diff options
Diffstat (limited to 'src/components/application_manager/include')
386 files changed, 10097 insertions, 5829 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 1197bbb813..612db6be03 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -43,6 +43,7 @@ #include "connection_handler/device.h" #include "application_manager/message.h" #include "application_manager/hmi_state.h" +#include "application_manager/application_state.h" #include "protocol_handler/protocol_handler.h" namespace NsSmartDeviceLink { @@ -57,6 +58,9 @@ namespace application_manager { namespace mobile_api = mobile_apis; namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; + +namespace custom_str = utils::custom_string; + typedef int32_t ErrorCode; class UsageStatistics; @@ -70,33 +74,28 @@ enum APIVersion { kAPIV4 = 4 }; -enum TLimitSource { - POLICY_TABLE = 0, - CONFIG_FILE -}; - +enum TLimitSource { POLICY_TABLE = 0, CONFIG_FILE }; struct Version { APIVersion min_supported_api_version; APIVersion max_supported_api_version; Version() - : min_supported_api_version(APIVersion::kUnknownAPI), - max_supported_api_version(APIVersion::kUnknownAPI) { - } + : min_supported_api_version(APIVersion::kUnknownAPI) + , max_supported_api_version(APIVersion::kUnknownAPI) {} }; struct AppFile { - // need to use in std::map; - AppFile() { - } - AppFile(const std::string& name, bool persistent, bool download_complete, + // need to use in std::map; + AppFile() {} + AppFile(const std::string& name, + bool persistent, + bool download_complete, mobile_apis::FileType::eType type) - : file_name(name), - is_persistent(persistent), - is_download_complete(download_complete), - file_type(type){ - } + : file_name(name) + , is_persistent(persistent) + , is_download_complete(download_complete) + , file_type(type) {} std::string file_name; bool is_persistent; bool is_download_complete; @@ -104,26 +103,26 @@ struct AppFile { }; typedef std::map<std::string, AppFile> AppFilesMap; class InitialApplicationData { - public: - virtual ~InitialApplicationData() { - } - - virtual const smart_objects::SmartObject* app_types() const = 0; - virtual const smart_objects::SmartObject* vr_synonyms() const = 0; - virtual std::string mobile_app_id() const = 0; - virtual const smart_objects::SmartObject* tts_name() const = 0; - virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0; - virtual const mobile_api::Language::eType& language() const = 0; - virtual const mobile_api::Language::eType& ui_language() const = 0; - virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0; - virtual void set_vr_synonyms( + public: + virtual ~InitialApplicationData() {} + + virtual const smart_objects::SmartObject* app_types() const = 0; + virtual const smart_objects::SmartObject* vr_synonyms() const = 0; + virtual const std::string& mac_address() const = 0; + virtual std::string policy_app_id() const = 0; + virtual const smart_objects::SmartObject* tts_name() const = 0; + virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0; + virtual const mobile_api::Language::eType& language() const = 0; + virtual const mobile_api::Language::eType& ui_language() const = 0; + virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0; + virtual void set_vr_synonyms( const smart_objects::SmartObject& vr_synonyms) = 0; - virtual void set_mobile_app_id(const std::string& mobile_app_id) = 0; - virtual void set_tts_name(const smart_objects::SmartObject& tts_name) = 0; - virtual void set_ngn_media_screen_name( + virtual void set_mobile_app_id(const std::string& policy_app_id) = 0; + virtual void set_tts_name(const smart_objects::SmartObject& tts_name) = 0; + virtual void set_ngn_media_screen_name( const smart_objects::SmartObject& ngn_name) = 0; - virtual void set_language(const mobile_api::Language::eType& language) = 0; - virtual void set_ui_language( + virtual void set_language(const mobile_api::Language::eType& language) = 0; + virtual void set_ui_language( const mobile_api::Language::eType& ui_language) = 0; }; @@ -161,554 +160,626 @@ typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap; */ typedef std::set<uint32_t> SoftButtonID; +/** + * @brief Defines set of vehicle info types + */ +typedef std::set<uint32_t> VehicleInfoSubscriptions; + +/** + * @brief Defines set of buttons subscription + */ +typedef std::set<mobile_apis::ButtonName::eType> ButtonSubscriptions; + class DynamicApplicationData { - public: - virtual ~DynamicApplicationData() { - } - virtual const smart_objects::SmartObject* help_prompt() const = 0; - virtual const smart_objects::SmartObject* timeout_prompt() const = 0; - virtual const smart_objects::SmartObject* vr_help_title() const = 0; - virtual const smart_objects::SmartObject* vr_help() const = 0; - virtual const mobile_api::TBTState::eType& tbt_state() const = 0; - virtual const smart_objects::SmartObject* show_command() const = 0; - virtual const smart_objects::SmartObject* tbt_show_command() const = 0; - virtual const std::set<mobile_apis::ButtonName::eType>& SubscribedButtons() const = 0; - virtual const std::set<uint32_t>& SubscribesIVI() const = 0; - virtual const smart_objects::SmartObject* keyboard_props() const = 0; - virtual const smart_objects::SmartObject* menu_title() const = 0; - virtual const smart_objects::SmartObject* menu_icon() const = 0; - - virtual void load_global_properties(const smart_objects::SmartObject& so) = 0; - virtual void set_help_prompt( + public: + virtual ~DynamicApplicationData() {} + virtual const smart_objects::SmartObject* help_prompt() const = 0; + virtual const smart_objects::SmartObject* timeout_prompt() const = 0; + virtual const smart_objects::SmartObject* vr_help_title() const = 0; + virtual const smart_objects::SmartObject* vr_help() const = 0; + virtual const mobile_api::TBTState::eType& tbt_state() const = 0; + virtual const smart_objects::SmartObject* show_command() const = 0; + virtual const smart_objects::SmartObject* tbt_show_command() const = 0; + virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const = 0; + virtual DataAccessor<VehicleInfoSubscriptions> SubscribedIVI() const = 0; + virtual const smart_objects::SmartObject* keyboard_props() const = 0; + virtual const smart_objects::SmartObject* menu_title() const = 0; + virtual const smart_objects::SmartObject* menu_icon() const = 0; + + virtual void load_global_properties(const smart_objects::SmartObject& so) = 0; + virtual void set_help_prompt( const smart_objects::SmartObject& help_prompt) = 0; - virtual void set_timeout_prompt( + virtual void set_timeout_prompt( const smart_objects::SmartObject& timeout_prompt) = 0; - virtual void set_vr_help_title( + virtual void set_vr_help_title( const smart_objects::SmartObject& vr_help_title) = 0; - virtual void reset_vr_help_title() = 0; - virtual void set_vr_help(const smart_objects::SmartObject& vr_help) = 0; - virtual void reset_vr_help() = 0; - virtual void set_tbt_state(const mobile_api::TBTState::eType& tbt_state) = 0; - virtual void set_show_command( + virtual void reset_vr_help_title() = 0; + virtual void set_vr_help(const smart_objects::SmartObject& vr_help) = 0; + virtual void reset_vr_help() = 0; + virtual void set_tbt_state(const mobile_api::TBTState::eType& tbt_state) = 0; + virtual void set_show_command( const smart_objects::SmartObject& show_command) = 0; - virtual void set_tbt_show_command( + virtual void set_tbt_show_command( const smart_objects::SmartObject& tbt_show) = 0; - virtual void set_keyboard_props( - const smart_objects::SmartObject& keyboard_props) = 0; - virtual void set_menu_title( - const smart_objects::SmartObject& menu_title) = 0; - virtual void set_menu_icon( - const smart_objects::SmartObject& menu_icon) = 0; - - virtual uint32_t audio_stream_retry_number() const = 0; - - virtual void set_audio_stream_retry_number( - const uint32_t& audio_stream_retry_number) = 0; - - virtual uint32_t video_stream_retry_number() const = 0; - - virtual void set_video_stream_retry_number( - const uint32_t& video_stream_retry_number) = 0; - - /* - * @brief Adds a command to the in application menu - */ - virtual void AddCommand(uint32_t cmd_id, - const smart_objects::SmartObject& command) = 0; - - /* - * @brief Deletes all commands from the application - * menu with the specified command id - */ - virtual void RemoveCommand(uint32_t cmd_id) = 0; - - /* - * @brief Finds command with the specified command id - */ - virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0; - - /* - * @brief Adds a menu to the application - */ - virtual void AddSubMenu(uint32_t menu_id, - const smart_objects::SmartObject& menu) = 0; - - /* - * @brief Deletes menu from the application menu - */ - virtual void RemoveSubMenu(uint32_t menu_id) = 0; - - /* - * @brief Finds menu with the specified id - */ - virtual smart_objects::SmartObject* FindSubMenu( - uint32_t menu_id) const = 0; - - /* - * @brief Returns true if sub menu with such name already exist - */ - virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0; - - /* - * @brief Adds a interaction choice set to the application - * - * @param choice_set_id Unique ID used for this interaction choice set - * @param choice_set SmartObject that represent choice set - */ - virtual void AddChoiceSet(uint32_t choice_set_id, - const smart_objects::SmartObject& choice_set) = 0; - - /* - * @brief Deletes choice set from the application - * - * @param choice_set_id Unique ID of the interaction choice set - */ - virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0; - - /* - * @brief Finds choice set with the specified choice_set_id id - * - * @param choice_set_id Unique ID of the interaction choice set - */ - virtual smart_objects::SmartObject* FindChoiceSet( - uint32_t choice_set_id) = 0; - - /* - * @brief Adds perform interaction choice set to the application - * - * @param correlation_id Unique ID of the request that added this choice set - * @param choice_set_id Unique ID used for this interaction choice set - * @param choice_set SmartObject that represents choice set - */ - virtual void AddPerformInteractionChoiceSet( - uint32_t correlation_id, uint32_t choice_set_id, + virtual void set_keyboard_props( + const smart_objects::SmartObject& keyboard_props) = 0; + virtual void set_menu_title(const smart_objects::SmartObject& menu_title) = 0; + virtual void set_menu_icon(const smart_objects::SmartObject& menu_icon) = 0; + + virtual uint32_t audio_stream_retry_number() const = 0; + + virtual void set_audio_stream_retry_number( + const uint32_t& audio_stream_retry_number) = 0; + + virtual uint32_t video_stream_retry_number() const = 0; + + virtual void set_video_stream_retry_number( + const uint32_t& video_stream_retry_number) = 0; + + /* + * @brief Adds a command to the in application menu + */ + virtual void AddCommand(uint32_t cmd_id, + const smart_objects::SmartObject& command) = 0; + + /* + * @brief Deletes all commands from the application + * menu with the specified command id + */ + virtual void RemoveCommand(uint32_t cmd_id) = 0; + + /* + * @brief Finds command with the specified command id + */ + virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0; + + /* + * @brief Adds a menu to the application + */ + virtual void AddSubMenu(uint32_t menu_id, + const smart_objects::SmartObject& menu) = 0; + + /* + * @brief Deletes menu from the application menu + */ + virtual void RemoveSubMenu(uint32_t menu_id) = 0; + + /* + * @brief Finds menu with the specified id + */ + virtual smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const = 0; + + /* + * @brief Returns true if sub menu with such name already exist + */ + virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0; + + /* + * @brief Adds a interaction choice set to the application + * + * @param choice_set_id Unique ID used for this interaction choice set + * @param choice_set SmartObject that represent choice set + */ + virtual void AddChoiceSet(uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set) = 0; + + /* + * @brief Deletes choice set from the application + * + * @param choice_set_id Unique ID of the interaction choice set + */ + virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0; + + /* + * @brief Finds choice set with the specified choice_set_id id + * + * @param choice_set_id Unique ID of the interaction choice set + */ + virtual smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id) = 0; + + /* + * @brief Adds perform interaction choice set to the application + * + * @param correlation_id Unique ID of the request that added this choice set + * @param choice_set_id Unique ID used for this interaction choice set + * @param choice_set SmartObject that represents choice set + */ + virtual void AddPerformInteractionChoiceSet( + uint32_t correlation_id, + uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) = 0; - /* - * @brief Deletes entirely perform interaction choice set for request - * @param correlation_id Unique ID of the request that added this choice set - * - */ - virtual void DeletePerformInteractionChoiceSet(uint32_t correlation_id) = 0; - - /* - * @brief Retrieves entirely ChoiceSet - VR commands map - * - * @return ChoiceSet map that is currently in use - */ - virtual DataAccessor<PerformChoiceSetMap> - performinteraction_choice_set_map() const = 0; - - /* - * @brief Retrieve application commands - */ - virtual DataAccessor<CommandsMap> commands_map() const = 0; - - /* - * @brief Retrieve application sub menus - */ - virtual DataAccessor<SubMenuMap> sub_menu_map() const = 0; - - /* - * @brief Retrieve application choice set map - */ - virtual DataAccessor<ChoiceSetMap> choice_set_map() const = 0; - - /* - * @brief Sets perform interaction state - * - * @param active Current state of the perform interaction - */ - virtual void set_perform_interaction_active(uint32_t active) = 0; - - /* - * @brief Retrieves perform interaction state - * - * @return TRUE if perform interaction active, otherwise FALSE - */ - virtual uint32_t is_perform_interaction_active() const = 0; - - /* + /* + * @brief Deletes entirely perform interaction choice set for request + * @param correlation_id Unique ID of the request that added this choice set + * + */ + virtual void DeletePerformInteractionChoiceSet(uint32_t correlation_id) = 0; + + /* + * @brief Retrieves entirely ChoiceSet - VR commands map + * + * @return ChoiceSet map that is currently in use + */ + virtual DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map() + const = 0; + + /* + * @brief Retrieve application commands + */ + virtual DataAccessor<CommandsMap> commands_map() const = 0; + + /* + * @brief Retrieve application sub menus + */ + virtual DataAccessor<SubMenuMap> sub_menu_map() const = 0; + + /* + * @brief Retrieve application choice set map + */ + virtual DataAccessor<ChoiceSetMap> choice_set_map() const = 0; + + /* + * @brief Sets perform interaction state + * + * @param active Current state of the perform interaction + */ + virtual void set_perform_interaction_active(uint32_t active) = 0; + + /* + * @brief Retrieves perform interaction state + * + * @return TRUE if perform interaction active, otherwise FALSE + */ + virtual uint32_t is_perform_interaction_active() const = 0; + + /* + * @brief Set perform interaction layout + * + * @param Current Interaction layout of the perform interaction + */ + virtual void set_perform_interaction_layout( + mobile_api::LayoutMode::eType layout) = 0; + + /* + * @brief Retrieve perform interaction layout + */ + virtual mobile_api::LayoutMode::eType perform_interaction_layout() const = 0; + + /* * @brief Sets the mode for perform interaction: UI/VR/BOTH * * @param mode Mode that was selected (MENU; VR; BOTH) */ - virtual void set_perform_interaction_mode(int32_t mode) = 0; - - /* - * @brief Retrieve the mode that was PerformInteraction sent in - * - * @return mode of PerformInteraction - */ - virtual int32_t perform_interaction_mode() const = 0; - - /* - * @brief Sets reset global properties state - * - * @param active Current state of the reset global properties - */ - virtual void set_reset_global_properties_active(bool active) = 0; - - /* - * @brief Retrieves reset global properties state - * - * @return TRUE if perform interaction active, otherwise FALSE - */ - virtual bool is_reset_global_properties_active() const = 0; + virtual void set_perform_interaction_mode(int32_t mode) = 0; + + /* + * @brief Retrieve the mode that was PerformInteraction sent in + * + * @return mode of PerformInteraction + */ + virtual int32_t perform_interaction_mode() const = 0; + + /* + * @brief Sets reset global properties state + * + * @param active Current state of the reset global properties + */ + virtual void set_reset_global_properties_active(bool active) = 0; + + /* + * @brief Retrieves reset global properties state + * + * @return TRUE if perform interaction active, otherwise FALSE + */ + virtual bool is_reset_global_properties_active() const = 0; }; class Application : public virtual InitialApplicationData, - public virtual DynamicApplicationData { - - public: - enum ApplicationState { - kRegistered = 0, - kWaitingForRegistration - }; - - public: - Application() : - is_greyed_out_(false) { - } - - virtual ~Application() { - } - - /** - * @brief Returns message belonging to the application - * that is currently executed (i.e. on HMI). - * @return smart_objects::SmartObject * Active message - */ - virtual const smart_objects::SmartObject* active_message() const = 0; - - /** - * @brief returns current hash value - * @return current hash value - */ - virtual const std::string& curHash() const = 0; - - /** - * @brief Change Hash for current application - * and send notification to mobile - * @return updated_hash - */ - virtual void UpdateHash() = 0; - - virtual void CloseActiveMessage() = 0; - virtual bool IsFullscreen() const = 0; - virtual void ChangeSupportingAppHMIType() = 0; - - virtual bool is_navi() const = 0; - virtual void set_is_navi(bool allow) = 0; - - virtual bool video_streaming_approved() const = 0; - virtual void set_video_streaming_approved(bool state) = 0; - virtual bool audio_streaming_approved() const = 0; - virtual void set_audio_streaming_approved(bool state) = 0; - - virtual bool video_streaming_allowed() const = 0; - virtual void set_video_streaming_allowed(bool state) = 0; - virtual bool audio_streaming_allowed() const = 0; - virtual void set_audio_streaming_allowed(bool state) = 0; - - /** - * @brief Starts streaming service for application - * @param service_type Type of streaming service - */ - virtual void StartStreaming( - protocol_handler::ServiceType service_type) = 0; - - /** - * @brief Stops streaming service for application - * @param service_type Type of streaming service - */ - virtual void StopStreaming( - protocol_handler::ServiceType service_type) = 0; - - /** - * @brief Suspends streaming process for application - * @param service_type Type of streaming service - */ - virtual void SuspendStreaming( - protocol_handler::ServiceType service_type) = 0; - - /** - * @brief Wakes up streaming process for application - * @param service_type Type of streaming service - */ - virtual void WakeUpStreaming( - protocol_handler::ServiceType service_type) = 0; - - virtual bool is_voice_communication_supported() const = 0; - virtual void set_voice_communication_supported( - bool is_voice_communication_supported) = 0; - virtual bool app_allowed() const = 0; - virtual bool has_been_activated() const = 0; - virtual bool set_activated(bool is_active) = 0; - - virtual const Version& version() const = 0; - virtual void set_hmi_application_id(uint32_t hmi_app_id) = 0; - virtual uint32_t hmi_app_id() const = 0; - virtual uint32_t app_id() const = 0; - virtual const std::string& name() const = 0; - virtual const std::string folder_name() const = 0; - virtual bool is_media_application() const = 0; - virtual bool is_foreground() const = 0; - virtual void set_foreground(bool is_foreground) = 0; - virtual const mobile_api::HMILevel::eType hmi_level() const = 0; - virtual const uint32_t put_file_in_none_count() const = 0; - virtual const uint32_t delete_file_in_none_count() const = 0; - virtual const uint32_t list_files_in_none_count() const = 0; - virtual const mobile_api::SystemContext::eType system_context() const = 0; - virtual const mobile_api::AudioStreamingState::eType - audio_streaming_state() const = 0; - virtual const std::string& app_icon_path() const = 0; - virtual connection_handler::DeviceHandle device() const = 0; - virtual bool tts_speak_state() = 0; - - /** - * @brief Active states of application - */ - DataAccessor<HmiStateList> GetHmiStateListAccessor() { - DataAccessor<HmiStateList> hmi_states_da = - DataAccessor<HmiStateList>(hmi_states_, hmi_states_lock_); - return hmi_states_da; - } - - /** - * @brief Current hmi state - */ - virtual const HmiStatePtr CurrentHmiState() const = 0; - - - /** - * @brief RegularHmiState of application without active events VR, TTS etc ... - * @return HmiState of application - */ - virtual const HmiStatePtr RegularHmiState() const = 0; - - /** - * @brief sets true if application has sent TTS GlobalProperties - * request with empty array help_prompt to HMI with level - * NONE BACKGROUND - * @param active contains state of sending TTS GlobalProperties - */ - virtual void set_tts_properties_in_none(bool active) = 0; - /** - * @brief returns true if application has sent TTS GlobalProperties - * otherwise return false - * @return flag tts_properties_in_none - */ - virtual bool tts_properties_in_none() = 0; - /** - * @brief sets true if application has sent TTS GlobalProperties - * request with default array help_prompt to HMI with level - * FULL LIMITED - * @param active contains state of sending TTS GlobalProperties - */ - virtual void set_tts_properties_in_full( - bool active) = 0; - /** - * @brief returns true if application has sent TTS GlobalProperties - * otherwise return false - * @return flag tts_properties_in_full - */ - virtual bool tts_properties_in_full() = 0; - virtual void set_version(const Version& version) = 0; - virtual void set_name(const std::string& name) = 0; - virtual void set_is_media_application(bool is_media) = 0; - virtual void increment_put_file_in_none_count() = 0; - virtual void increment_delete_file_in_none_count() = 0; - virtual void increment_list_files_in_none_count() = 0; - virtual bool set_app_icon_path(const std::string& file_name) = 0; - virtual void set_app_allowed(const bool& allowed) = 0; - virtual void set_device(connection_handler::DeviceHandle device) = 0; - virtual uint32_t get_grammar_id() const = 0 ; - virtual void set_grammar_id(uint32_t value) = 0; - - virtual void set_protocol_version( - const ProtocolVersion& protocol_version) = 0; - virtual ProtocolVersion protocol_version() const = 0; - - virtual bool AddFile(AppFile& file) = 0; - virtual const AppFilesMap& getAppFiles() const = 0; - - /** - * @brief Updates fields of existing file - * @param file_name File name, that need to update - * @param is_persistent Bollean describes is file persistent? - * @param is_download_complete Bollean describes is file downloaded fully on need to finish downloading? - * @return TRUE if file exist and updated sucsesfuly, othervise return false - */ - virtual bool UpdateFile(AppFile& file) = 0; - virtual bool DeleteFile(const std::string& file_name) = 0; - virtual const AppFile* GetFile(const std::string& file_name) = 0; - - virtual bool SubscribeToButton(mobile_apis::ButtonName::eType btn_name) = 0; - virtual bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name) = 0; - virtual bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name) = 0; - - virtual bool SubscribeToIVI(uint32_t vehicle_info_type_) = 0; - virtual bool IsSubscribedToIVI(uint32_t vehicle_info_type_) = 0; - virtual bool UnsubscribeFromIVI(uint32_t vehicle_info_type_) = 0; - - /** - * @brief ResetDataInNone reset data counters in NONE - */ - virtual void ResetDataInNone() = 0; - - /** - * @brief Check, if limits for command number per time is exceeded - * @param cmd_id Unique command id from mobile API - * @param source Limits source, e.g. policy table, config file etc. - * @return true, if - excedeed, otherwise - false - */ - virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id, - TLimitSource source) = 0; - - /** - * Returns object for recording statistics - * @return object for recording statistics - */ - virtual UsageStatistics& usage_report() = 0; - - /** - * @brief SetRegularState set permanent state of application - * @param state state to setup - */ - virtual void SetRegularState(HmiStatePtr state) = 0; - - /** - * @brief AddHMIState the function that will change application's - * hmi state. - * - * @param app_id id of the application whose hmi level should be changed. - * - * @param state new hmi state for certain application. - */ - virtual void AddHMIState(HmiStatePtr state) = 0; - - /** - * @brief RemoveHMIState the function that will turn back hmi_level after end - * of some event - * - * @param app_id id of the application whose hmi level should be changed. - * - * @param state_id that should be removed - */ - virtual void RemoveHMIState(HmiState::StateID state_id) = 0; - - /** - * @brief Keeps id of softbuttons which is created in commands: - * Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver, UpdateTurnList - * @param cmd_id Unique command id from mobile API - * @param list of softbuttons were created by command. - */ - virtual void SubscribeToSoftButtons(int32_t cmd_id, - const SoftButtonID& softbuttons_id) = 0; - - /** - * @brief Determine the existence of softbutton - * @param Softbutton_id contains id of softbutton - * @return Returns true if application contains softbutton id otherwise returns false. - */ - virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id) = 0; - - /** - * @brief Removes list of softbuttons which is created in commands - * @param cmd_id Unique command id from mobile API - */ - virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0; - - /** - * @brief Check's if it is media, voice communication or navigation application - * - * @return true if application is media, voice communication or navigation - */ - virtual bool IsAudioApplication() const = 0; - - /** - * @brief IsRegistered allows to distinguish if this - * application has been registered. - * - * @return true if registered, false otherwise. - */ - bool IsRegistered() const { return app_state_ == kRegistered;} - - /** - * @brief MarkRegistered allows to mark application as registered. - */ - void MarkRegistered() {app_state_ = kRegistered;} - - /** - * @brief MarkUnregistered allows to mark application as unregistered. - */ - void MarkUnregistered() {app_state_ = kWaitingForRegistration;} - - /** - * @brief schemaUrl contains application's url (for 4th protocol version) - * - * @return application's url. - */ - std::string SchemaUrl() const {return url_;} + public virtual DynamicApplicationData { + public: + enum ApplicationRegisterState { kRegistered = 0, kWaitingForRegistration }; + + public: + Application() : is_greyed_out_(false) {} + virtual ~Application() {} + + /** + * @brief Returns message belonging to the application + * that is currently executed (i.e. on HMI). + * @return smart_objects::SmartObject * Active message + */ + virtual const smart_objects::SmartObject* active_message() const = 0; + + /** + * @brief returns current hash value + * @return current hash value + */ + virtual const std::string& curHash() const = 0; + + /** + * @brief Change Hash for current application + * and send notification to mobile + * @return updated_hash + */ + virtual void UpdateHash() = 0; + + /** + * @brief method is called when SDL is saving application data for resumption + * @return TRUE if data of application need to save for resumption, otherwise + * return FALSE + */ + virtual bool is_application_data_changed() const = 0; + + /** + * @brief method is called after SDL saved application data for resumption + * @param state_application_data contains FALSE after saving data + */ + virtual void set_is_application_data_changed(bool state_application_data) = 0; + + virtual void CloseActiveMessage() = 0; + virtual bool IsFullscreen() const = 0; + virtual void ChangeSupportingAppHMIType() = 0; + + virtual bool is_navi() const = 0; + virtual void set_is_navi(bool allow) = 0; + + virtual bool video_streaming_approved() const = 0; + virtual void set_video_streaming_approved(bool state) = 0; + virtual bool audio_streaming_approved() const = 0; + virtual void set_audio_streaming_approved(bool state) = 0; + + virtual bool video_streaming_allowed() const = 0; + virtual void set_video_streaming_allowed(bool state) = 0; + virtual bool audio_streaming_allowed() const = 0; + virtual void set_audio_streaming_allowed(bool state) = 0; + + /** + * @brief Starts streaming service for application + * @param service_type Type of streaming service + */ + virtual void StartStreaming(protocol_handler::ServiceType service_type) = 0; + + /** + * @brief Stops streaming service for application + * @param service_type Type of streaming service + */ + virtual void StopStreaming(protocol_handler::ServiceType service_type) = 0; + + /** + * @brief Stops streaming for application whether it is allowed or not HMI + * @param service_type video or audio + */ + virtual void StopStreamingForce( + protocol_handler::ServiceType service_type) = 0; + + /** + * @brief Suspends streaming process for application + * @param service_type Type of streaming service + */ + virtual void SuspendStreaming(protocol_handler::ServiceType service_type) = 0; + + /** + * @brief Wakes up streaming process for application + * @param service_type Type of streaming service + */ + virtual void WakeUpStreaming(protocol_handler::ServiceType service_type) = 0; + + virtual bool is_voice_communication_supported() const = 0; + virtual void set_voice_communication_supported( + bool is_voice_communication_supported) = 0; + virtual bool app_allowed() const = 0; + virtual bool has_been_activated() const = 0; + virtual bool set_activated(bool is_active) = 0; + + virtual const Version& version() const = 0; + virtual void set_hmi_application_id(uint32_t hmi_app_id) = 0; + virtual uint32_t hmi_app_id() const = 0; + virtual uint32_t app_id() const = 0; + virtual const custom_str::CustomString& name() const = 0; + /** + * @brief Sets application folder name, which is used for storing of related + * files, e.g. icons + * @param folder_name Name of folder + */ + virtual void set_folder_name(const std::string& folder_name) = 0; + virtual const std::string folder_name() const = 0; + virtual bool is_media_application() const = 0; + virtual bool is_foreground() const = 0; + virtual void set_foreground(const bool is_foreground) = 0; + virtual const mobile_api::HMILevel::eType hmi_level() const = 0; + virtual const uint32_t put_file_in_none_count() const = 0; + virtual const uint32_t delete_file_in_none_count() const = 0; + virtual const uint32_t list_files_in_none_count() const = 0; + virtual const mobile_api::SystemContext::eType system_context() const = 0; + virtual const mobile_api::AudioStreamingState::eType audio_streaming_state() + const = 0; + virtual const std::string& app_icon_path() const = 0; + virtual connection_handler::DeviceHandle device() const = 0; + + /** + * @brief sets true if application has sent TTS GlobalProperties + * request with empty array help_prompt to HMI with level + * NONE BACKGROUND + * @param active contains state of sending TTS GlobalProperties + */ + virtual void set_tts_properties_in_none(bool active) = 0; + /** + * @brief returns true if application has sent TTS GlobalProperties + * otherwise return false + * @return flag tts_properties_in_none + */ + virtual bool tts_properties_in_none() = 0; + /** + * @brief sets true if application has sent TTS GlobalProperties + * request with default array help_prompt to HMI with level + * FULL LIMITED + * @param active contains state of sending TTS GlobalProperties + */ + virtual void set_tts_properties_in_full(bool active) = 0; + /** + * @brief returns true if application has sent TTS GlobalProperties + * otherwise return false + * @return flag tts_properties_in_full + */ + virtual bool tts_properties_in_full() = 0; + virtual void set_version(const Version& version) = 0; + virtual void set_name(const custom_str::CustomString& name) = 0; + virtual void set_is_media_application(bool is_media) = 0; + virtual void increment_put_file_in_none_count() = 0; + virtual void increment_delete_file_in_none_count() = 0; + virtual void increment_list_files_in_none_count() = 0; + virtual bool set_app_icon_path(const std::string& file_name) = 0; + virtual void set_app_allowed(const bool allowed) = 0; + virtual void set_device(connection_handler::DeviceHandle device) = 0; + virtual uint32_t get_grammar_id() const = 0; + virtual void set_grammar_id(uint32_t value) = 0; + + virtual void set_protocol_version( + const ProtocolVersion& protocol_version) = 0; + virtual ProtocolVersion protocol_version() const = 0; + + virtual void set_is_resuming(bool is_resuming) = 0; + virtual bool is_resuming() const = 0; + + virtual bool AddFile(const AppFile& file) = 0; + virtual const AppFilesMap& getAppFiles() const = 0; + + /** + * @brief Updates fields of existing file + * @param file_name File name, that need to update + * @param is_persistent Bollean describes is file persistent? + * @param is_download_complete Bollean describes is file downloaded fully on + * need to finish downloading? + * @return TRUE if file exist and updated sucsesfuly, othervise return false + */ + virtual bool UpdateFile(const AppFile& file) = 0; + virtual bool DeleteFile(const std::string& file_name) = 0; + virtual const AppFile* GetFile(const std::string& file_name) = 0; + + virtual bool SubscribeToButton(mobile_apis::ButtonName::eType btn_name) = 0; + virtual bool IsSubscribedToButton( + mobile_apis::ButtonName::eType btn_name) = 0; + virtual bool UnsubscribeFromButton( + mobile_apis::ButtonName::eType btn_name) = 0; + + virtual bool SubscribeToIVI(uint32_t vehicle_info_type) = 0; + virtual bool IsSubscribedToIVI(uint32_t vehicle_info_type) const = 0; + virtual bool UnsubscribeFromIVI(uint32_t vehicle_info_type) = 0; + + /** + * @brief ResetDataInNone reset data counters in NONE + */ + virtual void ResetDataInNone() = 0; + + /** + * @brief Check, if limits for command number per time is exceeded + * @param cmd_id Unique command id from mobile API + * @param source Limits source, e.g. policy table, config file etc. + * @return true, if - excedeed, otherwise - false + */ + virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id, + TLimitSource source) = 0; + + /** + * Returns object for recording statistics + * @return object for recording statistics + */ + virtual UsageStatistics& usage_report() = 0; + + /** + * @brief SetRegularState set permanent state of application + * + * @param state state to setup + */ + virtual void SetRegularState(HmiStatePtr state) = 0; + + /** + * @brief SetPostponedState sets postponed state to application. + * This state could be set as regular later + * + * @param state state to setup + */ + virtual void SetPostponedState(HmiStatePtr state) = 0; + + virtual void RemovePostponedState() = 0; + + /** + * @brief AddHMIState the function that will change application's + * hmi state. + * + * @param app_id id of the application whose hmi level should be changed. + * + * @param state new hmi state for certain application. + */ + virtual void AddHMIState(HmiStatePtr state) = 0; + + /** + * @brief RemoveHMIState the function that will turn back hmi_level after end + * of some event + * + * @param app_id id of the application whose hmi level should be changed. + * + * @param state_id that should be removed + */ + virtual void RemoveHMIState(HmiState::StateID state_id) = 0; + + /** + * @brief HmiState of application within active events PhoneCall, TTS< etc ... + * @return Active HmiState of application + */ + virtual const HmiStatePtr CurrentHmiState() const = 0; + + /** + * @brief RegularHmiState of application without active events VR, TTS etc ... + * @return HmiState of application + */ + virtual const HmiStatePtr RegularHmiState() const = 0; + + /** + * @brief PostponedHmiState returns postponed hmi state of application + * if it's present + * + * @return Postponed hmi state of application + */ + virtual const HmiStatePtr PostponedHmiState() const = 0; + + /** + * @brief Keeps id of softbuttons which is created in commands: + * Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver, + * UpdateTurnList + * @param cmd_id Unique command id from mobile API + * @param list of softbuttons were created by command. + */ + virtual void SubscribeToSoftButtons(int32_t cmd_id, + const SoftButtonID& softbuttons_id) = 0; + + /** + * @brief Determine the existence of softbutton + * @param Softbutton_id contains id of softbutton + * @return Returns true if application contains softbutton id otherwise + * returns false. + */ + virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id) = 0; + + /** + * @brief Removes list of softbuttons which is created in commands + * @param cmd_id Unique command id from mobile API + */ + virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0; + + /** + * @brief Check's if it is media, voice communication or navigation + * application + * + * @return true if application is media, voice communication or navigation + */ + virtual bool IsAudioApplication() const = 0; + + /** + * @brief IsRegistered allows to distinguish if this + * application has been registered. + * + * @return true if registered, false otherwise. + */ + virtual bool IsRegistered() const = 0; + /** + * @brief MarkRegistered allows to mark application as registered. + */ + void MarkRegistered() { + app_state_ = kRegistered; + } - /** - * @brief SetShemaUrl allows to store schema url for application. - * - * @param url url to store. - */ - void SetShemaUrl(const std::string& url) {url_ = url;} + /** + * @brief MarkUnregistered allows to mark application as unregistered. + */ + void MarkUnregistered() { + app_state_ = kWaitingForRegistration; + } - /** - * @brief packagName allows to obtain application's package name. - * - * @return pakage name. - */ - std::string PackageName() const {return package_name_;} + /** + * @brief schemaUrl contains application's url (for 4th protocol version) + * + * @return application's url. + */ + std::string SchemaUrl() const { + return url_; + } - /** - * @brief SetPackageName allows to store package name for application. - * - * @param packageName package name to store. - */ - void SetPackageName(const std::string& packageName) { - package_name_ = packageName; - } + /** + * @brief SetShemaUrl allows to store schema url for application. + * + * @param url url to store. + */ + void SetShemaUrl(const std::string& url) { + url_ = url; + } - /** - * @brief GetDeviceId allows to obtain device id which posseses - * by this application. - * - * @return device the device id. - */ - std::string GetDeviceId() const {return device_id_;} + /** + * @brief packagName allows to obtain application's package name. + * + * @return pakage name. + */ + std::string PackageName() const { + return package_name_; + } - /** - * @brief Returns is application should be greyed out on HMI - */ - bool is_greyed_out() const {return is_greyed_out_;} + /** + * @brief SetPackageName allows to store package name for application. + * + * @param packageName package name to store. + */ + void SetPackageName(const std::string& packageName) { + package_name_ = packageName; + } - /** - * @brief Sets application as should be greyed out on HMI - * @param is_greyed_out True, if should be greyed out on HMI, - * otherwise - false - */ - void set_greyed_out(bool is_greyed_out) {is_greyed_out_ = is_greyed_out;} + /** + * @brief GetDeviceId allows to obtain device id which posseses + * by this application. + * + * @return device the device id. + */ + std::string GetDeviceId() const { + return device_id_; + } - protected: + /** + * @brief Returns is application should be greyed out on HMI + */ + bool is_greyed_out() const { + return is_greyed_out_; + } - /** - * @brief Active states of application - */ - HmiStateList hmi_states_; - mutable sync_primitives::Lock hmi_states_lock_; - - ApplicationState app_state_; - std::string url_; - std::string package_name_; - std::string device_id_; - ssize_t connection_id_; - bool is_greyed_out_; + /** + * @brief Sets application as should be greyed out on HMI + * @param is_greyed_out True, if should be greyed out on HMI, + * otherwise - false + */ + void set_greyed_out(bool is_greyed_out) { + is_greyed_out_ = is_greyed_out; + } + /** + * @brief Load persistent files from application folder. + */ + virtual void LoadPersistentFiles() = 0; + + /** + * @brief Get available app space + * @param name of the app folder(make + mobile app id) + * @return free app space. + */ + virtual uint32_t GetAvailableDiskSpace() = 0; + + protected: + mutable sync_primitives::Lock hmi_states_lock_; + + ApplicationRegisterState app_state_; + ApplicationState state_; + std::string url_; + std::string package_name_; + std::string device_id_; + ssize_t connection_id_; + bool is_greyed_out_; }; typedef utils::SharedPtr<Application> ApplicationSharedPtr; diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h index 62d3d1c8c7..465e4e010a 100644 --- a/src/components/application_manager/include/application_manager/application_data_impl.h +++ b/src/components/application_manager/include/application_manager/application_data_impl.h @@ -44,235 +44,244 @@ namespace application_manager { namespace mobile_api = mobile_apis; class InitialApplicationDataImpl : public virtual Application { - public: - InitialApplicationDataImpl(); - ~InitialApplicationDataImpl(); - - const smart_objects::SmartObject* app_types() const; - const smart_objects::SmartObject* vr_synonyms() const; - virtual std::string mobile_app_id() const; - const smart_objects::SmartObject* tts_name() const; - const smart_objects::SmartObject* ngn_media_screen_name() const; - const mobile_api::Language::eType& language() const; - const mobile_api::Language::eType& ui_language() const; - void set_app_types(const smart_objects::SmartObject& app_types); - void set_vr_synonyms(const smart_objects::SmartObject& vr_synonyms); - void set_mobile_app_id(const std::string& mobile_app_id); - void set_tts_name(const smart_objects::SmartObject& tts_name); - void set_ngn_media_screen_name(const smart_objects::SmartObject& ngn_name); - void set_language(const mobile_api::Language::eType& language); - void set_ui_language(const mobile_api::Language::eType& ui_language); - - protected: - smart_objects::SmartObject* app_types_; - smart_objects::SmartObject* vr_synonyms_; - std::string mobile_app_id_; - smart_objects::SmartObject* tts_name_; - smart_objects::SmartObject* ngn_media_screen_name_; - mobile_api::Language::eType language_; - mobile_api::Language::eType ui_language_; - private: - DISALLOW_COPY_AND_ASSIGN(InitialApplicationDataImpl); + public: + InitialApplicationDataImpl(); + ~InitialApplicationDataImpl(); + + const smart_objects::SmartObject* app_types() const; + const smart_objects::SmartObject* vr_synonyms() const; + virtual std::string policy_app_id() const; + const smart_objects::SmartObject* tts_name() const; + const smart_objects::SmartObject* ngn_media_screen_name() const; + const mobile_api::Language::eType& language() const; + const mobile_api::Language::eType& ui_language() const; + void set_app_types(const smart_objects::SmartObject& app_types); + void set_vr_synonyms(const smart_objects::SmartObject& vr_synonyms); + void set_mobile_app_id(const std::string& policy_app_id); + void set_tts_name(const smart_objects::SmartObject& tts_name); + void set_ngn_media_screen_name(const smart_objects::SmartObject& ngn_name); + void set_language(const mobile_api::Language::eType& language); + void set_ui_language(const mobile_api::Language::eType& ui_language); + + void set_perform_interaction_layout( + mobile_api::LayoutMode::eType layout) OVERRIDE; + mobile_api::LayoutMode::eType perform_interaction_layout() const OVERRIDE; + + protected: + smart_objects::SmartObject* app_types_; + smart_objects::SmartObject* vr_synonyms_; + std::string mobile_app_id_; + smart_objects::SmartObject* tts_name_; + smart_objects::SmartObject* ngn_media_screen_name_; + mobile_api::Language::eType language_; + mobile_api::Language::eType ui_language_; + mobile_apis::LayoutMode::eType perform_interaction_layout_; + + private: + DISALLOW_COPY_AND_ASSIGN(InitialApplicationDataImpl); }; class DynamicApplicationDataImpl : public virtual Application { - public: - DynamicApplicationDataImpl(); - ~DynamicApplicationDataImpl(); - const smart_objects::SmartObject* help_prompt() const; - const smart_objects::SmartObject* timeout_prompt() const; - const smart_objects::SmartObject* vr_help_title() const; - const smart_objects::SmartObject* vr_help() const; - const mobile_api::TBTState::eType& tbt_state() const; - const smart_objects::SmartObject* show_command() const; - const smart_objects::SmartObject* tbt_show_command() const; - const smart_objects::SmartObject* keyboard_props() const; - const smart_objects::SmartObject* menu_title() const; - const smart_objects::SmartObject* menu_icon() const; - - void load_global_properties(const smart_objects::SmartObject& properties_so); - void set_help_prompt(const smart_objects::SmartObject& help_prompt); - void set_timeout_prompt(const smart_objects::SmartObject& timeout_prompt); - void set_vr_help_title(const smart_objects::SmartObject& vr_help_title); - void reset_vr_help_title(); - void set_vr_help(const smart_objects::SmartObject& vr_help); - void reset_vr_help(); - void set_tbt_state(const mobile_api::TBTState::eType& tbt_state); - void set_show_command(const smart_objects::SmartObject& show_command); - void set_tbt_show_command(const smart_objects::SmartObject& tbt_show); - void set_keyboard_props(const smart_objects::SmartObject& keyboard_props); - void set_menu_title(const smart_objects::SmartObject& menu_title); - void set_menu_icon(const smart_objects::SmartObject& menu_icon); - /* - * @brief Adds a command to the in application menu - */ - void AddCommand(uint32_t cmd_id, - const smart_objects::SmartObject& command); - - /* - * @brief Deletes all commands from the application menu with the specified command id - */ - void RemoveCommand(uint32_t cmd_id); - - /* - * @brief Finds command with the specified command id - */ - smart_objects::SmartObject* FindCommand(uint32_t cmd_id); - - /* - * @brief Adds a menu to the application - */ - void AddSubMenu(uint32_t menu_id, const smart_objects::SmartObject& menu); - - /* - * @brief Deletes menu from the application menu - */ - void RemoveSubMenu(uint32_t menu_id); - - /* - * @brief Finds menu with the specified id - */ - smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const; - - /* - * @brief Returns true if sub menu with such name already exist - */ - bool IsSubMenuNameAlreadyExist(const std::string& name); - - /* - * @brief Adds a interaction choice set to the application - * - * @param choice_set_id Unique ID used for this interaction choice set - * @param choice_set SmartObject that represent choice set - */ - void AddChoiceSet(uint32_t choice_set_id, - const smart_objects::SmartObject& choice_set); - - /* - * @brief Deletes choice set from the application - * - * @param choice_set_id Unique ID of the interaction choice set - */ - void RemoveChoiceSet(uint32_t choice_set_id); - - /* - * @brief Finds choice set with the specified choice_set_id id - * - * @param choice_set_id Unique ID of the interaction choice set - */ - smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id); - - /* - * @brief Adds perform interaction choice set to the application - * - * @param correlation_id Unique ID of the request that added this choice set - * @param choice_set_id Unique ID used for this interaction choice set - * @param choice_set SmartObject that represents choice set - */ - void AddPerformInteractionChoiceSet(uint32_t correlation_id, - uint32_t choice_set_id, const smart_objects::SmartObject& choice_set); - - /* - * @brief Deletes entirely perform interaction choice set map - * @param correlation_id Unique ID of the request that added this choice set - * - */ - void DeletePerformInteractionChoiceSet(uint32_t correlation_id); - - /* - * @brief Retrieves entirely ChoiceSet - VR commands map - * - * @return ChoiceSet map that is currently in use - */ - inline DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map() const; - - /* - * @brief Retrieve application commands - */ - inline DataAccessor<CommandsMap> commands_map() const; - - /* - * @brief Retrieve application sub menus - */ - inline DataAccessor<SubMenuMap> sub_menu_map() const; - - /* - * @brief Retrieve application choice set map - */ - inline DataAccessor<ChoiceSetMap> choice_set_map() const; - - /* - * @brief Sets perform interaction state - * - * @param active Current state of the perform interaction - */ - void set_perform_interaction_active(uint32_t active); - - /* - * @brief Retrieves perform interaction state - * - * @return TRUE if perform interaction active, otherwise FALSE - */ - inline uint32_t is_perform_interaction_active() const; - - /* - * @brief Sets the mode for perform interaction: UI/VR/BOTH - * - * @param mode Mode that was selected (MENU; VR; BOTH) - */ - void set_perform_interaction_mode(int32_t mode); - - /* - * @brief Retrieve the mode that was PerformInteraction sent in - * - * @return mode of PerformInteraction - */ - inline int32_t perform_interaction_mode() const; - - /* - * @brief Sets reset global properties state - * - * @param active Current state of the reset global properties - */ - void set_reset_global_properties_active(bool active); - - /* - * @brief Retrieves reset global properties state - * - * @return TRUE if perform interaction active, otherwise FALSE - */ - inline bool is_reset_global_properties_active() const; - -protected: - smart_objects::SmartObject* help_prompt_; - smart_objects::SmartObject* timeout_prompt_; - smart_objects::SmartObject* vr_help_title_; - smart_objects::SmartObject* vr_help_; - mobile_api::TBTState::eType tbt_state_; - smart_objects::SmartObject* show_command_; - smart_objects::SmartObject* keyboard_props_; - smart_objects::SmartObject* menu_title_; - smart_objects::SmartObject* menu_icon_; - smart_objects::SmartObject* tbt_show_command_; - - - CommandsMap commands_; - mutable sync_primitives::Lock commands_lock_; - SubMenuMap sub_menu_; - mutable sync_primitives::Lock sub_menu_lock_; - ChoiceSetMap choice_set_map_; - mutable sync_primitives::Lock choice_set_map_lock_; - PerformChoiceSetMap performinteraction_choice_set_map_; - mutable sync_primitives::Lock performinteraction_choice_set_lock_; - uint32_t is_perform_interaction_active_; - bool is_reset_global_properties_active_; - int32_t perform_interaction_mode_; - -private: - void SetGlobalProperties(const smart_objects::SmartObject& param, - void (DynamicApplicationData::*callback)( - const NsSmartDeviceLink::NsSmartObjects::SmartObject&)); - DISALLOW_COPY_AND_ASSIGN(DynamicApplicationDataImpl); + public: + DynamicApplicationDataImpl(); + ~DynamicApplicationDataImpl(); + const smart_objects::SmartObject* help_prompt() const; + const smart_objects::SmartObject* timeout_prompt() const; + const smart_objects::SmartObject* vr_help_title() const; + const smart_objects::SmartObject* vr_help() const; + const mobile_api::TBTState::eType& tbt_state() const; + const smart_objects::SmartObject* show_command() const; + const smart_objects::SmartObject* tbt_show_command() const; + const smart_objects::SmartObject* keyboard_props() const; + const smart_objects::SmartObject* menu_title() const; + const smart_objects::SmartObject* menu_icon() const; + + void load_global_properties(const smart_objects::SmartObject& properties_so); + void set_help_prompt(const smart_objects::SmartObject& help_prompt); + void set_timeout_prompt(const smart_objects::SmartObject& timeout_prompt); + void set_vr_help_title(const smart_objects::SmartObject& vr_help_title); + void reset_vr_help_title(); + void set_vr_help(const smart_objects::SmartObject& vr_help); + void reset_vr_help(); + void set_tbt_state(const mobile_api::TBTState::eType& tbt_state); + void set_show_command(const smart_objects::SmartObject& show_command); + void set_tbt_show_command(const smart_objects::SmartObject& tbt_show); + void set_keyboard_props(const smart_objects::SmartObject& keyboard_props); + void set_menu_title(const smart_objects::SmartObject& menu_title); + void set_menu_icon(const smart_objects::SmartObject& menu_icon); + /* + * @brief Adds a command to the in application menu + */ + void AddCommand(uint32_t cmd_id, const smart_objects::SmartObject& command); + + /* + * @brief Deletes all commands from the application menu with the specified + * command id + */ + void RemoveCommand(uint32_t cmd_id); + + /* + * @brief Finds command with the specified command id + */ + smart_objects::SmartObject* FindCommand(uint32_t cmd_id); + + /* + * @brief Adds a menu to the application + */ + void AddSubMenu(uint32_t menu_id, const smart_objects::SmartObject& menu); + + /* + * @brief Deletes menu from the application menu + */ + void RemoveSubMenu(uint32_t menu_id); + + /* + * @brief Finds menu with the specified id + */ + smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const; + + /* + * @brief Returns true if sub menu with such name already exist + */ + bool IsSubMenuNameAlreadyExist(const std::string& name); + + /* + * @brief Adds a interaction choice set to the application + * + * @param choice_set_id Unique ID used for this interaction choice set + * @param choice_set SmartObject that represent choice set + */ + void AddChoiceSet(uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set); + + /* + * @brief Deletes choice set from the application + * + * @param choice_set_id Unique ID of the interaction choice set + */ + void RemoveChoiceSet(uint32_t choice_set_id); + + /* + * @brief Finds choice set with the specified choice_set_id id + * + * @param choice_set_id Unique ID of the interaction choice set + */ + smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id); + + /* + * @brief Adds perform interaction choice set to the application + * + * @param correlation_id Unique ID of the request that added this choice set + * @param choice_set_id Unique ID used for this interaction choice set + * @param choice_set SmartObject that represents choice set + */ + void AddPerformInteractionChoiceSet( + uint32_t correlation_id, + uint32_t choice_set_id, + const smart_objects::SmartObject& choice_set); + + /* + * @brief Deletes entirely perform interaction choice set map + * @param correlation_id Unique ID of the request that added this choice set + * + */ + void DeletePerformInteractionChoiceSet(uint32_t correlation_id); + + /* + * @brief Retrieves entirely ChoiceSet - VR commands map + * + * @return ChoiceSet map that is currently in use + */ + inline DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map() + const; + + /* + * @brief Retrieve application commands + */ + inline DataAccessor<CommandsMap> commands_map() const; + + /* + * @brief Retrieve application sub menus + */ + inline DataAccessor<SubMenuMap> sub_menu_map() const; + + /* + * @brief Retrieve application choice set map + */ + inline DataAccessor<ChoiceSetMap> choice_set_map() const; + + /* + * @brief Sets perform interaction state + * + * @param active Current state of the perform interaction + */ + void set_perform_interaction_active(uint32_t active); + + /* + * @brief Retrieves perform interaction state + * + * @return TRUE if perform interaction active, otherwise FALSE + */ + inline uint32_t is_perform_interaction_active() const; + + /* + * @brief Sets the mode for perform interaction: UI/VR/BOTH + * + * @param mode Mode that was selected (MENU; VR; BOTH) + */ + void set_perform_interaction_mode(int32_t mode); + + /* + * @brief Retrieve the mode that was PerformInteraction sent in + * + * @return mode of PerformInteraction + */ + inline int32_t perform_interaction_mode() const; + + /* + * @brief Sets reset global properties state + * + * @param active Current state of the reset global properties + */ + void set_reset_global_properties_active(bool active); + + /* + * @brief Retrieves reset global properties state + * + * @return TRUE if perform interaction active, otherwise FALSE + */ + inline bool is_reset_global_properties_active() const; + + protected: + smart_objects::SmartObject* help_prompt_; + smart_objects::SmartObject* timeout_prompt_; + smart_objects::SmartObject* vr_help_title_; + smart_objects::SmartObject* vr_help_; + mobile_api::TBTState::eType tbt_state_; + smart_objects::SmartObject* show_command_; + smart_objects::SmartObject* keyboard_props_; + smart_objects::SmartObject* menu_title_; + smart_objects::SmartObject* menu_icon_; + smart_objects::SmartObject* tbt_show_command_; + + CommandsMap commands_; + mutable sync_primitives::Lock commands_lock_; + SubMenuMap sub_menu_; + mutable sync_primitives::Lock sub_menu_lock_; + ChoiceSetMap choice_set_map_; + mutable sync_primitives::Lock choice_set_map_lock_; + PerformChoiceSetMap performinteraction_choice_set_map_; + mutable sync_primitives::Lock performinteraction_choice_set_lock_; + uint32_t is_perform_interaction_active_; + bool is_reset_global_properties_active_; + int32_t perform_interaction_mode_; + + private: + void SetGlobalProperties( + const smart_objects::SmartObject& param, + void (DynamicApplicationData::*callback)( + const NsSmartDeviceLink::NsSmartObjects::SmartObject&)); + DISALLOW_COPY_AND_ASSIGN(DynamicApplicationDataImpl); }; DataAccessor<CommandsMap> DynamicApplicationDataImpl::commands_map() const { @@ -289,9 +298,8 @@ DataAccessor<ChoiceSetMap> DynamicApplicationDataImpl::choice_set_map() const { DataAccessor<PerformChoiceSetMap> DynamicApplicationDataImpl::performinteraction_choice_set_map() const { - return DataAccessor<PerformChoiceSetMap>( - performinteraction_choice_set_map_, - performinteraction_choice_set_lock_); + return DataAccessor<PerformChoiceSetMap>(performinteraction_choice_set_map_, + performinteraction_choice_set_lock_); } uint32_t DynamicApplicationDataImpl::is_perform_interaction_active() const { diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index f23b53632f..75496b2761 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -38,6 +38,7 @@ #include <vector> #include <utility> #include <list> +#include <stdint.h> #include "utils/date_time.h" #include "application_manager/application_data_impl.h" @@ -46,8 +47,10 @@ #include "protocol_handler/protocol_handler.h" #include "connection_handler/device.h" -#include "utils/timer_thread.h" #include "utils/lock.h" +#include "utils/atomic_object.h" +#include "utils/custom_string.h" +#include "utils/timer.h" namespace usage_statistics { @@ -59,14 +62,18 @@ using namespace utils; using namespace timer; namespace mobile_api = mobile_apis; +namespace custom_str = custom_string; class ApplicationImpl : public virtual InitialApplicationDataImpl, - public virtual DynamicApplicationDataImpl { + public virtual DynamicApplicationDataImpl { public: - ApplicationImpl(uint32_t application_id, - const std::string& mobile_app_id, - const std::string& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager); + ApplicationImpl( + uint32_t application_id, + const std::string& policy_app_id, + const std::string& mac_address, + const custom_str::CustomString& app_name, + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + ApplicationManager& application_manager); ~ApplicationImpl(); @@ -84,7 +91,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, */ virtual void ChangeSupportingAppHMIType(); - inline bool is_navi() const { return is_navi_; } + inline bool is_navi() const { + return is_navi_; + } void set_is_navi(bool allow); bool video_streaming_approved() const; @@ -97,15 +106,11 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, bool audio_streaming_allowed() const; void set_audio_streaming_allowed(bool state); - void StartStreaming( - protocol_handler::ServiceType service_type); - void StopStreaming( - protocol_handler::ServiceType service_type); - - void SuspendStreaming( - protocol_handler::ServiceType service_type); - void WakeUpStreaming( - protocol_handler::ServiceType service_type); + void StartStreaming(protocol_handler::ServiceType service_type); + void StopStreamingForce(protocol_handler::ServiceType service_type); + void StopStreaming(protocol_handler::ServiceType service_type); + void SuspendStreaming(protocol_handler::ServiceType service_type); + void WakeUpStreaming(protocol_handler::ServiceType service_type); virtual bool is_voice_communication_supported() const; virtual void set_voice_communication_supported( @@ -118,43 +123,46 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, void set_hmi_application_id(uint32_t hmi_app_id); inline uint32_t hmi_app_id() const; inline uint32_t app_id() const; - const std::string& name() const; + const custom_str::CustomString& name() const; + void set_folder_name(const std::string& folder_name) OVERRIDE; const std::string folder_name() const; bool is_media_application() const; - virtual bool is_foreground() const; - virtual void set_foreground(bool is_foreground); - virtual const mobile_api::HMILevel::eType hmi_level() const; + bool is_foreground() const OVERRIDE; + void set_foreground(const bool is_foreground) OVERRIDE; + const mobile_apis::HMILevel::eType hmi_level() const; const uint32_t put_file_in_none_count() const; const uint32_t delete_file_in_none_count() const; const uint32_t list_files_in_none_count() const; const mobile_api::SystemContext::eType system_context() const; - inline const mobile_apis::AudioStreamingState::eType audio_streaming_state() const; + inline const mobile_apis::AudioStreamingState::eType audio_streaming_state() + const; const std::string& app_icon_path() const; connection_handler::DeviceHandle device() const; - bool tts_speak_state(); + const std::string& mac_address() const OVERRIDE; void set_tts_properties_in_none(bool active); bool tts_properties_in_none(); void set_tts_properties_in_full(bool active); bool tts_properties_in_full(); void set_version(const Version& ver); - void set_name(const std::string& name); + void set_name(const custom_str::CustomString& name); void set_is_media_application(bool is_media); void increment_put_file_in_none_count(); void increment_delete_file_in_none_count(); void increment_list_files_in_none_count(); bool set_app_icon_path(const std::string& path); - void set_app_allowed(const bool& allowed); + void set_app_allowed(const bool allowed); void set_device(connection_handler::DeviceHandle device); virtual uint32_t get_grammar_id() const; virtual void set_grammar_id(uint32_t value); - virtual void set_protocol_version(const ProtocolVersion& protocol_version); virtual ProtocolVersion protocol_version() const; - bool AddFile(AppFile& file); - bool UpdateFile(AppFile& file); + virtual void set_is_resuming(bool is_resuming); + virtual bool is_resuming() const; + bool AddFile(const AppFile& file); + bool UpdateFile(const AppFile& file); bool DeleteFile(const std::string& file_name); virtual const AppFilesMap& getAppFiles() const; @@ -164,24 +172,29 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name); bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name); - bool SubscribeToIVI(uint32_t vehicle_info_type_); - bool IsSubscribedToIVI(uint32_t vehicle_info_type_); - bool UnsubscribeFromIVI(uint32_t vehicle_info_type_); + bool SubscribeToIVI(uint32_t vehicle_info_type) OVERRIDE; + bool IsSubscribedToIVI(uint32_t vehicle_info_type) const OVERRIDE; + bool UnsubscribeFromIVI(uint32_t vehicle_info_type) OVERRIDE; + DataAccessor<VehicleInfoSubscriptions> SubscribedIVI() const OVERRIDE; + inline bool IsRegistered() const OVERRIDE; /** * @brief ResetDataInNone reset data counters in NONE */ virtual void ResetDataInNone(); - virtual const std::set<mobile_apis::ButtonName::eType>& SubscribedButtons() const; - virtual const std::set<uint32_t>& SubscribesIVI() const; + virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE; virtual const std::string& curHash() const; - /** - * @brief Change Hash for current application - * and send notification to mobile - * @return updated_hash - */ +#ifdef CUSTOMER_PASA + virtual bool flag_sending_hash_change_after_awake() const; + virtual void set_flag_sending_hash_change_after_awake(bool flag); +#endif // CUSTOMER_PASA + /** + * @brief Change Hash for current application + * and send notification to mobile + * @return updated_hash + */ virtual void UpdateHash(); UsageStatistics& usage_report(); @@ -194,20 +207,36 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, virtual void UnsubscribeFromSoftButtons(int32_t cmd_id); + virtual bool is_application_data_changed() const; + + virtual void set_is_application_data_changed(bool state_application_data); + /** - * @brief Check's if it is media, voice communication or navigation application + * @brief Check's if it is media, voice communication or navigation + * application * * @return true if application is media, voice communication or navigation */ virtual bool IsAudioApplication() const; - /* + /** * @brief SetRegularState set permanent state of application + * * @param state state to setup */ virtual void SetRegularState(HmiStatePtr state); /** + * @brief SetPostponedState sets postponed state to application. + * This state could be set as regular later + * + * @param state state to setup + */ + virtual void SetPostponedState(HmiStatePtr state); + + virtual void RemovePostponedState(); + + /** * @brief AddHMIState the function that will change application's * hmi state. * @@ -239,6 +268,14 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, */ virtual const HmiStatePtr RegularHmiState() const; + /** + * @brief PostponedHmiState returns postponed hmi state of application + * if it's present + * + * @return Postponed hmi state of application + */ + virtual const HmiStatePtr PostponedHmiState() const; + uint32_t audio_stream_retry_number() const; void set_audio_stream_retry_number(const uint32_t& audio_stream_retry_number); @@ -247,21 +284,25 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, void set_video_stream_retry_number(const uint32_t& video_stream_retry_number); - protected: + /** + * @brief Load persistent files from application folder. + */ + void LoadPersistentFiles() OVERRIDE; /** - * @brief Clean up application folder. Persistent files will stay + * @brief Get available app space + * @param name of the app folder(make + mobile app id) + * @return free app space. */ - void CleanupFiles(); + uint32_t GetAvailableDiskSpace() OVERRIDE; + protected: /** - * @brief Load persistent files from application folder. + * @brief Clean up application folder. Persistent files will stay */ - void LoadPersistentFiles(); + void CleanupFiles(); private: - typedef SharedPtr<TimerThread<ApplicationImpl>> ApplicationTimerPtr; - /** * @brief Callback for video streaming suspend timer. * Suspends video streaming process for application @@ -269,55 +310,68 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, void OnVideoStreamSuspend(); /** + * @brief Stops video streaming for application + */ + inline void StopNaviStreaming(); + + /** + * @brief Stops audio streaming for application + */ + inline void StopAudioStreaming(); + + /** * @brief Callback for audio streaming suspend timer. * Suspends audio streaming process for application */ void OnAudioStreamSuspend(); - std::string hash_val_; - uint32_t grammar_id_; + std::string hash_val_; + uint32_t grammar_id_; Version version_; - std::string app_name_; - uint32_t hmi_app_id_; - uint32_t app_id_; - smart_objects::SmartObject* active_message_; - bool is_media_; - bool is_navi_; - - bool video_streaming_approved_; - bool audio_streaming_approved_; - bool video_streaming_allowed_; - bool audio_streaming_allowed_; - bool video_streaming_suspended_; - bool audio_streaming_suspended_; - sync_primitives::Lock video_streaming_suspended_lock_; - sync_primitives::Lock audio_streaming_suspended_lock_; - - bool is_app_allowed_; - bool has_been_activated_; - bool tts_properties_in_none_; - bool tts_properties_in_full_; - bool is_foreground_; - uint32_t put_file_in_none_count_; - uint32_t delete_file_in_none_count_; - uint32_t list_files_in_none_count_; - std::string app_icon_path_; - connection_handler::DeviceHandle device_; - - AppFilesMap app_files_; + custom_str::CustomString app_name_; + uint32_t hmi_app_id_; + uint32_t app_id_; + smart_objects::SmartObject* active_message_; + bool is_media_; + bool is_navi_; + + bool video_streaming_approved_; + bool audio_streaming_approved_; + bool video_streaming_allowed_; + bool audio_streaming_allowed_; + bool video_streaming_suspended_; + bool audio_streaming_suspended_; + sync_primitives::Lock video_streaming_suspended_lock_; + sync_primitives::Lock audio_streaming_suspended_lock_; + + bool is_app_allowed_; + bool has_been_activated_; + bool tts_properties_in_none_; + bool tts_properties_in_full_; + bool is_foreground_; + bool is_application_data_changed_; + uint32_t put_file_in_none_count_; + uint32_t delete_file_in_none_count_; + uint32_t list_files_in_none_count_; + std::string app_icon_path_; + connection_handler::DeviceHandle device_; + const std::string mac_address_; + + AppFilesMap app_files_; std::set<mobile_apis::ButtonName::eType> subscribed_buttons_; - std::set<uint32_t> subscribed_vehicle_info_; - UsageStatistics usage_report_; - ProtocolVersion protocol_version_; - bool is_voice_communication_application_; - - uint32_t video_stream_retry_number_; - uint32_t audio_stream_retry_number_; - uint32_t video_stream_suspend_timeout_; - uint32_t audio_stream_suspend_timeout_; - ApplicationTimerPtr video_stream_suspend_timer_; - ApplicationTimerPtr audio_stream_suspend_timer_; + VehicleInfoSubscriptions subscribed_vehicle_info_; + UsageStatistics usage_report_; + ProtocolVersion protocol_version_; + bool is_voice_communication_application_; + sync_primitives::atomic_bool is_resuming_; + + uint32_t video_stream_retry_number_; + uint32_t audio_stream_retry_number_; + uint32_t video_stream_suspend_timeout_; + uint32_t audio_stream_suspend_timeout_; + Timer video_stream_suspend_timer_; + Timer audio_stream_suspend_timer_; /** * @brief Defines number per time in seconds limits @@ -328,17 +382,20 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, * @brief Defines specific command number per time in seconds limits */ typedef std::map<mobile_apis::FunctionID::eType, TimeToNumberLimit> - CommandNumberTimeLimit; + CommandNumberTimeLimit; /** * @brief Defines id of SoftButton which is related from name of command */ - typedef std::map<int32_t, SoftButtonID> - CommandSoftButtonID; + typedef std::map<int32_t, SoftButtonID> CommandSoftButtonID; CommandNumberTimeLimit cmd_number_to_time_limits_; CommandSoftButtonID cmd_softbuttonid_; // Lock for command soft button id sync_primitives::Lock cmd_softbuttonid_lock_; + mutable sync_primitives::Lock vi_lock_; + sync_primitives::Lock button_lock_; + std::string folder_name_; + ApplicationManager& application_manager_; DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); }; @@ -354,14 +411,18 @@ const mobile_api::AudioStreamingState::eType ApplicationImpl::audio_streaming_state() const { using namespace mobile_apis; const HmiStatePtr hmi_state = CurrentHmiState(); - return hmi_state ? hmi_state->audio_streaming_state() : - AudioStreamingState::INVALID_ENUM; + return hmi_state ? hmi_state->audio_streaming_state() + : AudioStreamingState::INVALID_ENUM; } bool ApplicationImpl::app_allowed() const { return is_app_allowed_; } +bool ApplicationImpl::IsRegistered() const { + return app_state_ == kRegistered; +} + } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/application_manager.h b/src/components/application_manager/include/application_manager/application_manager.h index b535b5b63d..97c38cd134 100644 --- a/src/components/application_manager/include/application_manager/application_manager.h +++ b/src/components/application_manager/include/application_manager/application_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2015, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,28 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ +#include <string> +#include <vector> +#include <set> +#include "vehicle_info_data.h" #include "application_manager/application.h" +#include "application_manager/hmi_capabilities.h" +#include "application_manager/commands/command.h" +#include "connection_handler/connection_handler.h" +#include "utils/data_accessor.h" +#include "utils/shared_ptr.h" +#include "telemetry_monitor/telemetry_observable.h" +#include "application_manager/policies/policy_handler_interface.h" +#include "application_manager/application_manager_settings.h" +#include "application_manager/state_controller.h" + +namespace resumption { +class LastState; +} + +namespace media_manager { +class MediaManager; +} // Other compomnents class declaration namespace hmi_message_handler { @@ -45,19 +66,58 @@ class ProtocolHandler; namespace connection_handler { class ConnectionHandler; } +namespace resumption { +class ResumeCtrl; +} namespace application_manager { +namespace event_engine { +class EventDispatcher; +} + class Application; +class StateControllerImpl; +struct CommandParametersPermissions; +typedef std::vector<std::string> RPCParams; + +struct ApplicationsAppIdSorter { + bool operator()(const ApplicationSharedPtr lhs, + const ApplicationSharedPtr rhs) const { + return lhs->app_id() < rhs->app_id(); + } +}; + +struct ApplicationsPolicyAppIdSorter { + bool operator()(const ApplicationSharedPtr lhs, + const ApplicationSharedPtr rhs) { + if (lhs->policy_app_id() == rhs->policy_app_id()) { + return lhs->device() < rhs->device(); + } + return lhs->policy_app_id() < rhs->policy_app_id(); + } +}; + +typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplicationSet; + +typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter> + AppsWaitRegistrationSet; + +// typedef for Applications list iterator +typedef ApplicationSet::iterator ApplicationSetIt; + +// typedef for Applications list const iterator +typedef ApplicationSet::const_iterator ApplicationSetConstIt; class ApplicationManager { -public: + public: virtual ~ApplicationManager() {} /** * Inits application manager */ - virtual bool Init() = 0; + virtual bool Init(resumption::LastState& last_state, + media_manager::MediaManager* media_manager) = 0; /** * @brief Stop work. @@ -66,12 +126,164 @@ public: **/ virtual bool Stop() = 0; - virtual void - set_hmi_message_handler(hmi_message_handler::HMIMessageHandler *handler) = 0; - virtual void - set_protocol_handler(protocol_handler::ProtocolHandler *handler) = 0; - virtual void - set_connection_handler(connection_handler::ConnectionHandler *handler) = 0; + virtual void set_hmi_message_handler( + hmi_message_handler::HMIMessageHandler* handler) = 0; + virtual void set_protocol_handler( + protocol_handler::ProtocolHandler* handler) = 0; + virtual void set_connection_handler( + connection_handler::ConnectionHandler* handler) = 0; + + virtual DataAccessor<ApplicationSet> applications() const = 0; + + virtual ApplicationSharedPtr application(uint32_t app_id) const = 0; + virtual ApplicationSharedPtr active_application() const = 0; + + /** + * Function used only by HMI request/response/notification base classes + * to change HMI app id to Mobile app id and vice versa. + * Don't use it inside Core + */ + virtual ApplicationSharedPtr application_by_hmi_app( + uint32_t hmi_app_id) const = 0; + + virtual ApplicationSharedPtr application_by_policy_id( + const std::string& policy_app_id) const = 0; + + virtual std::vector<ApplicationSharedPtr> applications_by_button( + uint32_t button) = 0; + virtual std::vector<ApplicationSharedPtr> applications_with_navi() = 0; + + /** + * @brief Returns media application with LIMITED HMI Level if exists + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer. + */ + virtual ApplicationSharedPtr get_limited_media_application() const = 0; + + /** + * @brief Returns navigation application with LIMITED HMI Level if exists + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer + */ + virtual ApplicationSharedPtr get_limited_navi_application() const = 0; + + /** + * @brief Returns voice communication application with + * LIMITED HMI Level if exists + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer + */ + virtual ApplicationSharedPtr get_limited_voice_application() const = 0; + + /** + * @brief Retrieves application id associated with correlation id + * + * @param correlation_id Correlation ID of the HMI request + * + * @return application id associated with correlation id + */ + virtual uint32_t application_id(const int32_t correlation_id) = 0; + + /** + * @brief Sets application id correlation id + * + * @param correlation_id Correlation ID of the HMI request + * @param app_id Application ID + */ + virtual void set_application_id(const int32_t correlation_id, + const uint32_t app_id) = 0; + + /** + * @brief OnHMILevelChanged the callback that allows SDL to react when + * application's HMI level has been changed. + * + * @param app_id application identifier for which HMILevel has been chaned. + * + * @param from previous HMILevel. + * @param to current HMILevel. + */ + virtual void OnHMILevelChanged(uint32_t app_id, + mobile_apis::HMILevel::eType from, + mobile_apis::HMILevel::eType to) = 0; + + /** + * @brief Sends HMI status notification to mobile + * + * @param application_impl application with changed HMI status + * + **/ + virtual void SendHMIStatusNotification( + const utils::SharedPtr<Application> app) = 0; + + /** + * @brief Checks if Application is subscribed for way points + * @param Application AppID + * @return true if Application is subscribed for way points + * otherwise false + */ + virtual bool IsAppSubscribedForWayPoints(const uint32_t app_id) const = 0; + + /** + * @brief Subscribe Application for way points + * @param Application AppID + */ + virtual void SubscribeAppForWayPoints(const uint32_t app_id) = 0; + + /** + * @brief Unsubscribe Application for way points + * @param Application AppID + */ + virtual void UnsubscribeAppFromWayPoints(const uint32_t app_id) = 0; + + /** + * @brief Is Any Application is subscribed for way points + * @return true if some app is subscribed otherwise false + */ + virtual bool IsAnyAppSubscribedForWayPoints() const = 0; + + /** + * @brief Get subscribed for way points + * @return reference to set of subscribed apps for way points + */ + virtual const std::set<int32_t> GetAppsSubscribedForWayPoints() const = 0; + + virtual void SendMessageToMobile(const commands::MessageSharedPtr message, + bool final_message = false) = 0; + + virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0; + + virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0; + virtual bool ManageMobileCommand(const commands::MessageSharedPtr message, + commands::Command::CommandOrigin origin) = 0; + virtual mobile_api::HMILevel::eType GetDefaultHmiLevel( + ApplicationConstSharedPtr application) const = 0; + /** + * @brief hmi_capabilities return capabilities of hmi + * @return capabilities of hmi + */ + virtual HMICapabilities& hmi_capabilities() = 0; + + virtual const HMICapabilities& hmi_capabilities() const = 0; + + virtual void ProcessQueryApp(const smart_objects::SmartObject& sm_object, + const uint32_t connection_key) = 0; + + virtual bool is_attenuated_supported() const = 0; + + /** + * @brief Checks if application with the same HMI type + * (media, voice communication or navi) exists + * in HMI_FULL or HMI_LIMITED level. + * + * @param app Pointer to application to compare with + * + * @return true if exist otherwise false + */ + virtual bool IsAppTypeExistsInFullOrLimited( + ApplicationConstSharedPtr app) const = 0; /** * @brief Sets default HMI level and configure application after its @@ -79,8 +291,290 @@ public: * @param app Application */ virtual void OnApplicationRegistered(ApplicationSharedPtr app) = 0; + + virtual connection_handler::ConnectionHandler& connection_handler() const = 0; + virtual protocol_handler::ProtocolHandler& protocol_handler() const = 0; + virtual policy::PolicyHandlerInterface& GetPolicyHandler() = 0; + + virtual uint32_t GetNextHMICorrelationID() = 0; + virtual uint32_t GenerateNewHMIAppID() = 0; + + /** + * @brief Ends opened navi services (audio/video) for application + * @param app_id Application id + */ + virtual void EndNaviServices(uint32_t app_id) = 0; + + /* @brief Starts audio passthru process + * + * @return true on success, false if passthru is already in process + */ + virtual bool BeginAudioPassThrough() = 0; + + /* + * @brief Finishes already started audio passthru process + * + * @return true on success, false if passthru is not active + */ + virtual bool EndAudioPassThrough() = 0; + + virtual void ConnectToDevice(const std::string& device_mac) = 0; + + virtual void OnHMIStartedCooperation() = 0; + + virtual bool IsHMICooperating() const = 0; + /** + * @brief Notifies all components interested in Vehicle Data update + * i.e. new value of odometer etc and returns list of applications + * subscribed for event. + * @param vehicle_info Enum value of type of vehicle data + * @param new value (for integer values currently) of vehicle data + */ + virtual std::vector<ApplicationSharedPtr> IviInfoUpdated( + VehicleDataType vehicle_info, int value) = 0; + + virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr< + smart_objects::SmartObject>& request_for_registration) = 0; + + virtual void SendUpdateAppList() = 0; + + virtual void MarkAppsGreyOut(const connection_handler::DeviceHandle handle, + bool is_greyed_out) = 0; + + /** + * @brief Returns pointer to application-to-be-registered (from QUERY_APP + * list) + * @param hmi_id HMI application id + * @return Pointer to application or uninitialized shared pointer + */ + virtual ApplicationConstSharedPtr WaitingApplicationByID( + const uint32_t hmi_id) const = 0; + + /** + * @brief Returns list of applications-to-be-registered (QUERY_APP list) + * @return Locked list of applications + */ + virtual DataAccessor<AppsWaitRegistrationSet> AppsWaitingForRegistration() + const = 0; + + virtual bool IsAppsQueriedFrom( + const connection_handler::DeviceHandle handle) const = 0; + + virtual bool IsStopping() const = 0; + + virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0; + + virtual mobile_apis::Result::eType SaveBinary( + const std::vector<uint8_t>& binary_data, + const std::string& file_path, + const std::string& file_name, + const int64_t offset) = 0; + /* + * @brief Sets SDL access to all mobile apps + * + * @param allowed SDL access to all mobile apps + */ + virtual void SetAllAppsAllowed(const bool allowed) = 0; + + /* + * @brief Sets state for driver distraction + * + * @param state New state to be set + */ + virtual void set_driver_distraction(bool is_distracting) = 0; + + /* + * @brief Starts audio pass thru thread + * + * @param session_key Session key of connection for Mobile side + * @param correlation_id Correlation id for response for Mobile side + * @param max_duration Max duration of audio recording in milliseconds + * @param sampling_rate Value for rate(8, 16, 22, 44 kHz) + * @param bits_per_sample The quality the audio is recorded. + * @param audio_type Type of audio data + */ + virtual void StartAudioPassThruThread(int32_t session_key, + int32_t correlation_id, + int32_t max_duration, + int32_t sampling_rate, + int32_t bits_per_sample, + int32_t audio_type) = 0; + + virtual void StartDevicesDiscovery() = 0; + + virtual void StopAudioPassThru(int32_t application_key) = 0; + + /** + * @brief TerminateRequest forces termination of request + * @param connection_key - application id of request + * @param corr_id correlation id of request + */ + virtual void TerminateRequest(uint32_t connection_key, uint32_t corr_id) = 0; + + /* + * @brief Closes application by id + * + * @param app_id Application id + * @param reason reason of unregistering application + * @param is_resuming describes - is this unregister + * is normal or need to be resumed\ + * @param is_unexpected_disconnect + * Indicates if connection was unexpectedly lost(TM layer, HB) + */ + virtual void UnregisterApplication(const uint32_t& app_id, + mobile_apis::Result::eType reason, + bool is_resuming = false, + bool is_unexpected_disconnect = false) = 0; + + /** + * @ Updates request timeout + * + * @param connection_key Connection key of application + * @param mobile_correlation_id Correlation ID of the mobile request + * @param new_timeout_value New timeout in milliseconds to be set + */ + virtual void updateRequestTimeout(uint32_t connection_key, + uint32_t mobile_correlation_id, + uint32_t new_timeout_value) = 0; + + virtual StateController& state_controller() = 0; + + virtual void SetUnregisterAllApplicationsReason( + mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0; + + /* + * @brief Called on Master_reset or Factory_defaults + * when User chooses to reset HU. + * Resets Policy Table if applicable. + */ + virtual void HeadUnitReset( + mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0; + + /** + * @brief Checks HMI level and returns true if streaming is allowed + * @param app_id Application id + * @param service_type Service type to check + * @return True if streaming is allowed, false in other case + */ + virtual bool HMILevelAllowsStreaming( + uint32_t app_id, protocol_handler::ServiceType service_type) const = 0; + + /** + * @brief Checks, if given RPC is allowed at current HMI level for specific + * application in policy table + * @param policy_app_id Application id + * @param hmi_level Current HMI level of application + * @param function_id FunctionID of RPC + * @param params_permissions Permissions for RPC parameters (e.g. + * SubscribeVehicleData) defined in policy table + * @return SUCCESS, if allowed, otherwise result code of check + */ + virtual mobile_apis::Result::eType CheckPolicyPermissions( + const std::string& policy_app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::FunctionID::eType function_id, + const RPCParams& rpc_params, + CommandParametersPermissions* params_permissions = NULL) = 0; + + /** + * @brief IsApplicationForbidden allows to distinguish if application is + * not allowed to register, because of spamming. + * + * @param connection_key the connection key ofthe required application + * + * @param policy_app_id application's mobile(policy) identifier. + * + * @return true in case application is allowed to register, false otherwise. + */ + virtual bool IsApplicationForbidden( + uint32_t connection_key, const std::string& policy_app_id) const = 0; + + virtual resumption::ResumeCtrl& resume_controller() = 0; + /* + * @brief Converts connection string transport type representation + * to HMI Common_TransportType + * + * @param transport_type String representing connection type + * + * @return Corresponding HMI TransporType value + */ + virtual hmi_apis::Common_TransportType::eType GetDeviceTransportType( + const std::string& transport_type) = 0; + + /** + * @brief method adds application + * to tts_global_properties_app_list_ + * @param app_id contains application which will + * send TTS global properties after timeout + */ + virtual void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) = 0; + + /** + * Generate grammar ID + * + * @return New grammar ID + */ + virtual uint32_t GenerateGrammarID() = 0; + + virtual policy::DeviceConsent GetUserConsentForDevice( + const std::string& device_id) const = 0; + + /** + * @brief Handle sequence for unauthorized application + * @param app_id Application id + */ + virtual void OnAppUnauthorized(const uint32_t& app_id) = 0; + + virtual bool ActivateApplication(ApplicationSharedPtr app) = 0; + + /** + * @brief Callback calls when application starts/stops data streaming + * @param app_id Streaming application id + * @param service_type Streaming service type + * @param state Shows if streaming started or stopped + */ + virtual void OnAppStreaming(uint32_t app_id, + protocol_handler::ServiceType service_type, + bool state) = 0; + + /** + * @brief CreateRegularState create regular HMI state for application + * @param app_id + * @param hmi_level of returned state + * @param audio_state of returned state + * @param system_context of returned state + * @return new regular HMI state + */ + virtual HmiStatePtr CreateRegularState( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const = 0; + + virtual void SendAudioPassThroughNotification( + uint32_t session_key, std::vector<uint8_t>& binary_data) = 0; + + /** + * @brief Checks if application can stream (streaming service is started and + * streaming is enabled in application) + * @param app_id Application id + * @param service_type Service type to check + * @return True if streaming is allowed, false in other case + */ + virtual bool CanAppStream( + uint32_t app_id, protocol_handler::ServiceType service_type) const = 0; + + /** + * @brief ForbidStreaming forbid the stream over the certain application. + * @param app_id the application's id which should stop streaming. + */ + virtual void ForbidStreaming(uint32_t app_id) = 0; + + virtual const ApplicationManagerSettings& get_settings() const = 0; + + virtual event_engine::EventDispatcher& event_dispatcher() = 0; }; -} // namespace application_manager +} // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index a5b9833954..dda192f8b0 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,19 +46,22 @@ #include "application_manager/message.h" #include "application_manager/message_helper.h" #include "application_manager/request_controller.h" -#include "application_manager/resume_ctrl.h" +#include "application_manager/resumption/resume_ctrl.h" #include "application_manager/vehicle_info_data.h" -#include "application_manager/state_controller.h" +#include "application_manager/state_controller_impl.h" +#include "application_manager/application_manager_settings.h" +#include "application_manager/event_engine/event_dispatcher_impl.h" + #include "protocol_handler/protocol_observer.h" #include "protocol_handler/protocol_handler.h" #include "hmi_message_handler/hmi_message_observer.h" #include "hmi_message_handler/hmi_message_sender.h" #include "application_manager/policies/policy_handler_observer.h" -#include "media_manager/media_manager_impl.h" #include "connection_handler/connection_handler.h" #include "connection_handler/connection_handler_observer.h" #include "connection_handler/device.h" -#include "formatters/CSmartFactory.hpp" +#include "formatters/CSmartFactory.h" +#include "policies/policy_handler.h" #include "interfaces/HMI_API.h" #include "interfaces/HMI_API_schema.h" @@ -66,9 +69,15 @@ #include "interfaces/v4_protocol_v1_2_no_extra.h" #include "interfaces/v4_protocol_v1_2_no_extra_schema.h" -#ifdef TIME_TESTER -#include "time_metric_observer.h" -#endif // TIME_TESTER + +#ifdef ENABLE_SECURITY +#include "security_manager/security_manager_listener.h" +#include "security_manager/ssl_context.h" +#endif // ENABLE_SECURITY + +#ifdef TELEMETRY_MONITOR +#include "telemetry_observer.h" +#endif // TELEMETRY_MONITOR #include "utils/macro.h" #include "utils/shared_ptr.h" @@ -77,8 +86,8 @@ #include "utils/threads/thread.h" #include "utils/threads/message_loop_thread.h" #include "utils/lock.h" -#include "utils/singleton.h" #include "utils/data_accessor.h" +#include "utils/timer.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -96,12 +105,15 @@ namespace application_manager { namespace mobile_api = mobile_apis; using namespace utils; using namespace timer; +namespace custom_str = custom_string; class ApplicationManagerImpl; enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging }; struct CommandParametersPermissions; +typedef std::map<std::string, hmi_apis::Common_TransportType::eType> + DeviceTypes; namespace impl { using namespace threads; @@ -117,44 +129,56 @@ using namespace threads; * when we have them. */ struct MessageFromMobile : public utils::SharedPtr<Message> { - explicit MessageFromMobile(const utils::SharedPtr<Message> &message) + MessageFromMobile() {} + explicit MessageFromMobile(const utils::SharedPtr<Message>& message) : utils::SharedPtr<Message>(message) {} // PrioritizedQueue requres this method to decide which priority to assign - size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); } + size_t PriorityOrder() const { + return (*this)->Priority().OrderingValue(); + } }; struct MessageToMobile : public utils::SharedPtr<Message> { - explicit MessageToMobile(const utils::SharedPtr<Message> &message, + MessageToMobile() : is_final(false) {} + explicit MessageToMobile(const utils::SharedPtr<Message>& message, bool final_message) : utils::SharedPtr<Message>(message), is_final(final_message) {} // PrioritizedQueue requres this method to decide which priority to assign - size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); } + size_t PriorityOrder() const { + return (*this)->Priority().OrderingValue(); + } // Signals if connection to mobile must be closed after sending this message bool is_final; }; struct MessageFromHmi : public utils::SharedPtr<Message> { - explicit MessageFromHmi(const utils::SharedPtr<Message> &message) + MessageFromHmi() {} + explicit MessageFromHmi(const utils::SharedPtr<Message>& message) : utils::SharedPtr<Message>(message) {} // PrioritizedQueue requres this method to decide which priority to assign - size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); } + size_t PriorityOrder() const { + return (*this)->Priority().OrderingValue(); + } }; struct MessageToHmi : public utils::SharedPtr<Message> { - explicit MessageToHmi(const utils::SharedPtr<Message> &message) + MessageToHmi() {} + explicit MessageToHmi(const utils::SharedPtr<Message>& message) : utils::SharedPtr<Message>(message) {} // PrioritizedQueue requres this method to decide which priority to assign - size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); } + size_t PriorityOrder() const { + return (*this)->Priority().OrderingValue(); + } }; // Short type names for prioritized message queues -typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile>> +typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile> > FromMobileQueue; -typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile>> +typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> > ToMobileQueue; -typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi>> +typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> > FromHmiQueue; -typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi>> +typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> > ToHmiQueue; // AudioPassThru @@ -165,8 +189,9 @@ typedef struct { typedef std::queue<AudioData> RawAudioDataQueue; typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue; } - +CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") typedef std::vector<std::string> RPCParams; +typedef utils::SharedPtr<timer::Timer> TimerSPtr; class ApplicationManagerImpl : public ApplicationManager, @@ -174,66 +199,69 @@ class ApplicationManagerImpl public protocol_handler::ProtocolObserver, public connection_handler::ConnectionHandlerObserver, public policy::PolicyHandlerObserver, +#ifdef ENABLE_SECURITY + public security_manager::SecurityManagerListener, +#endif // ENABLE_SECURITY public impl::FromMobileQueue::Handler, public impl::ToMobileQueue::Handler, public impl::FromHmiQueue::Handler, public impl::ToHmiQueue::Handler, - public impl::AudioPassThruQueue::Handler, - public utils::Singleton<ApplicationManagerImpl> { + public impl::AudioPassThruQueue::Handler +#ifdef TELEMETRY_MONITOR + , + public telemetry_monitor::TelemetryObservable<AMTelemetryObserver> +#endif // TELEMETRY_MONITOR + { friend class ResumeCtrl; friend class CommandImpl; -public: + public: + ApplicationManagerImpl(const ApplicationManagerSettings& am_settings, + const policy::PolicySettings& policy_settings); ~ApplicationManagerImpl(); /** * Inits application manager */ - virtual bool Init(); + bool Init(resumption::LastState& last_state, + media_manager::MediaManager* media_manager) OVERRIDE; /** * @brief Stop work. * * @return TRUE on success otherwise FALSE. **/ - virtual bool Stop(); + bool Stop() OVERRIDE; - ///////////////////////////////////////////////////// + DataAccessor<ApplicationSet> applications() const OVERRIDE; + ApplicationSharedPtr application(uint32_t app_id) const OVERRIDE; - ApplicationSharedPtr application(uint32_t app_id) const; - ApplicationSharedPtr - application_by_policy_id(const std::string &policy_app_id) const; - ApplicationSharedPtr active_application() const; - std::vector<ApplicationSharedPtr> applications_by_button(uint32_t button); - std::vector<ApplicationSharedPtr> applications_by_ivi(uint32_t vehicle_info); - std::vector<ApplicationSharedPtr> applications_with_navi(); + ApplicationSharedPtr active_application() const OVERRIDE; - /** - * @brief Returns media application with LIMITED HMI Level if exist. - * - * @return Shared pointer to application if application does not - * exist returns empty shared pointer. - */ - ApplicationSharedPtr get_limited_media_application() const; + ApplicationSharedPtr application_by_hmi_app( + uint32_t hmi_app_id) const OVERRIDE; + ApplicationSharedPtr application_by_policy_id( + const std::string& policy_app_id) const OVERRIDE; - /** - * @brief Returns navigation application with LIMITED HMI Level if exist. - * - * @return Shared pointer to application if application does not - * exist returns empty shared pointer - */ - ApplicationSharedPtr get_limited_navi_application() const; + std::vector<ApplicationSharedPtr> applications_by_button( + uint32_t button) OVERRIDE; + std::vector<ApplicationSharedPtr> applications_with_navi() OVERRIDE; - /** - * @brief Returns voice communication application with LIMITED HMI Level if - *exist. - * - * @return Shared pointer to application if application does not - * exist returns empty shared pointer - */ - ApplicationSharedPtr get_limited_voice_application() const; + ApplicationSharedPtr get_limited_media_application() const OVERRIDE; + ApplicationSharedPtr get_limited_navi_application() const OVERRIDE; + ApplicationSharedPtr get_limited_voice_application() const OVERRIDE; + + uint32_t application_id(const int32_t correlation_id) OVERRIDE; + void set_application_id(const int32_t correlation_id, + const uint32_t app_id) OVERRIDE; + void OnHMILevelChanged(uint32_t app_id, + mobile_apis::HMILevel::eType from, + mobile_apis::HMILevel::eType to) OVERRIDE; + + void SendHMIStatusNotification( + const utils::SharedPtr<Application> app) OVERRIDE; /** * @brief Checks if application with the same HMI type * (media, voice communication or navi) exists @@ -243,7 +271,39 @@ public: * * @return true if exist otherwise false */ - bool IsAppTypeExistsInFullOrLimited(ApplicationSharedPtr app) const; + bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const; + + /** + * @brief Checks if Application is subscribed for way points + * @param Application AppID + * @return true if Application is subscribed for way points + * otherwise false + */ + bool IsAppSubscribedForWayPoints(const uint32_t app_id) const OVERRIDE; + + /** + * @brief Subscribe Application for way points + * @param Application AppID + */ + void SubscribeAppForWayPoints(const uint32_t app_id) OVERRIDE; + + /** + * @brief Unsubscribe Application for way points + * @param Application AppID + */ + void UnsubscribeAppFromWayPoints(const uint32_t app_id) OVERRIDE; + + /** + * @brief Is Any Application is subscribed for way points + * @return true if some app is subscribed otherwise false + */ + bool IsAnyAppSubscribedForWayPoints() const OVERRIDE; + + /** + * @brief Get subscribed for way points + * @return reference to set of subscribed apps for way points + */ + const std::set<int32_t> GetAppsSubscribedForWayPoints() const OVERRIDE; /** * @brief Notifies all components interested in Vehicle Data update @@ -253,13 +313,12 @@ public: * @param new value (for integer values currently) of vehicle data */ std::vector<ApplicationSharedPtr> IviInfoUpdated(VehicleDataType vehicle_info, - int value); + int value) OVERRIDE; void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE; - ///////////////////////////////////////////////////// - - HMICapabilities &hmi_capabilities(); + HMICapabilities& hmi_capabilities(); + const HMICapabilities& hmi_capabilities() const; /** * @brief ProcessQueryApp executes logic related to QUERY_APP system request. @@ -268,21 +327,22 @@ public: * system request. * @param connection_key connection key for app, which sent system request */ - void ProcessQueryApp(const smart_objects::SmartObject &sm_object, - const uint32_t connection_key); + void ProcessQueryApp(const smart_objects::SmartObject& sm_object, + const uint32_t connection_key) OVERRIDE; -#ifdef TIME_TESTER + bool is_attenuated_supported() const OVERRIDE; + +#ifdef TELEMETRY_MONITOR /** * @brief Setup observer for time metric. * * @param observer - pointer to observer */ - void SetTimeMetricObserver(AMMetricObserver *observer); -#endif // TIME_TESTER + void SetTelemetryObserver(AMTelemetryObserver* observer) OVERRIDE; +#endif // TELEMETRY_MONITOR - ApplicationSharedPtr - RegisterApplication(const utils::SharedPtr<smart_objects::SmartObject> & - request_for_registration); + ApplicationSharedPtr RegisterApplication(const utils::SharedPtr< + smart_objects::SmartObject>& request_for_registration) OVERRIDE; /* * @brief Closes application by id * @@ -293,16 +353,16 @@ public: * @param is_unexpected_disconnect * Indicates if connection was unexpectedly lost(TM layer, HB) */ - void UnregisterApplication(const uint32_t &app_id, + void UnregisterApplication(const uint32_t& app_id, mobile_apis::Result::eType reason, bool is_resuming = false, - bool is_unexpected_disconnect = false); + bool is_unexpected_disconnect = false) OVERRIDE; /** * @brief Handle sequence for unauthorized application * @param app_id Application id */ - void OnAppUnauthorized(const uint32_t &app_id); + void OnAppUnauthorized(const uint32_t& app_id) OVERRIDE; /* * @brief Sets unregister reason for closing all registered applications @@ -311,14 +371,15 @@ public: * @param reason Describes the reason for HU switching off */ void SetUnregisterAllApplicationsReason( - mobile_api::AppInterfaceUnregisteredReason::eType reason); + mobile_api::AppInterfaceUnregisteredReason::eType reason) OVERRIDE; /* * @brief Called on Master_reset or Factory_defaults * when User chooses to reset HU. * Resets Policy Table if applicable. */ - void HeadUnitReset(mobile_api::AppInterfaceUnregisteredReason::eType reason); + void HeadUnitReset( + mobile_api::AppInterfaceUnregisteredReason::eType reason) OVERRIDE; /* * @brief Closes all registered applications @@ -327,7 +388,7 @@ public: bool RemoveAppDataFromHMI(ApplicationSharedPtr app); bool LoadAppDataToHMI(ApplicationSharedPtr app); - bool ActivateApplication(ApplicationSharedPtr app); + bool ActivateApplication(ApplicationSharedPtr app) OVERRIDE; /** * @brief Put application in FULL HMI Level if possible, @@ -338,28 +399,28 @@ public: */ mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app); - void ConnectToDevice(const std::string &device_mac); - void OnHMIStartedCooperation(); + void ConnectToDevice(const std::string& device_mac) OVERRIDE; + void OnHMIStartedCooperation() OVERRIDE; /* * @brief Returns unique correlation ID for HMI request * * @return Unique correlation ID */ - uint32_t GetNextHMICorrelationID(); + uint32_t GetNextHMICorrelationID() OVERRIDE; /* @brief Starts audio passthru process * * @return true on success, false if passthru is already in process */ - bool begin_audio_pass_thru(); + bool BeginAudioPassThrough() OVERRIDE; /* * @brief Finishes already started audio passthru process * * @return true on success, false if passthru is not active */ - bool end_audio_pass_thru(); + bool EndAudioPassThrough() OVERRIDE; /* * @brief Retrieves driver distraction state @@ -373,7 +434,7 @@ public: * * @param state New state to be set */ - void set_driver_distraction(bool is_distracting); + void set_driver_distraction(const bool is_distracting) OVERRIDE; /* * @brief Retrieves if VR session has started @@ -387,7 +448,7 @@ public: * * @param state Current HMI VR session state */ - void set_vr_session_started(const bool &state); + void set_vr_session_started(const bool state); /* * @brief Retrieves SDL access to all mobile apps @@ -401,7 +462,7 @@ public: * * @param allowed SDL access to all mobile apps */ - void set_all_apps_allowed(const bool &allowed); + void SetAllAppsAllowed(const bool allowed) OVERRIDE; /** * @brief CreateRegularState create regular HMI state for application @@ -411,10 +472,11 @@ public: * @param system_context of returned state * @return new regular HMI state */ - HmiStatePtr - 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 CreateRegularState( + uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const OVERRIDE; /** * @brief SetState set regular audio state @@ -425,15 +487,15 @@ public: mobile_apis::AudioStreamingState::eType audio_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, audio_state); } /** - * @brief SetState setup regular hmi state, tha will appear if no + * @brief SetState setup regular hmi state, that will appear if no * specific events are active * @param app appication to setup regular State * @param state state of new regular state @@ -442,11 +504,11 @@ public: void SetState(uint32_t app_id, HmiStatePtr new_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } - state_ctrl_.SetRegularState<SendActivateApp>(app, new_state); + state_ctrl_.SetRegularState(app, new_state, SendActivateApp); } /** @@ -458,11 +520,11 @@ public: void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } - state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level); + state_ctrl_.SetRegularState(app, hmi_level, SendActivateApp); } /** @@ -473,15 +535,16 @@ public: * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ template <bool SendActivateApp> - void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level, + void SetState(uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } - state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state); + state_ctrl_.SetRegularState(app, hmi_level, audio_state, SendActivateApp); } /** @@ -492,17 +555,18 @@ public: * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ template <bool SendActivateApp> - void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level, + void SetState(uint32_t app_id, + mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } - state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state, - system_context); + state_ctrl_.SetRegularState( + app, hmi_level, audio_state, system_context, SendActivateApp); } /** @@ -514,14 +578,51 @@ public: mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with appID=" << app_id - << " does not exist"); + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, system_context); } /** + * @brief SetState Change regular hmi level + * @param app appication to setup regular State + * @param hmi_level hmi level of new regular state + */ + void SetHmiState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) { + ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); + return; + } + state_ctrl_.SetRegularState(app, hmi_level); + } + + /** + * @brief SetState Change regular hmi state + * @param app appication to setup regular State + * @param state new regular hmi state + */ + void SetState(uint32_t app_id, HmiStatePtr state) { + ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, + "Application with appID=" << app_id << " does not exist"); + return; + } + state_ctrl_.SetRegularState(app, state); + } + + /** + * @brief Checks, if particular state is active + * @param state_id State + * @return True, if state is active, otherwise - false + */ + bool IsStateActive(HmiState::StateID state_id) const; + + /** * @brief Notification from PolicyHandler about PTU. * Compares AppHMIType between saved in app and received from PTU. If they are * different method sends: @@ -533,8 +634,8 @@ public: * UI_ChangeRegistration with list new AppHMIType * for app with HMI level BACKGROUND. */ - virtual void OnUpdateHMIAppType( - std::map<std::string, std::vector<std::string>> app_hmi_types); + void OnUpdateHMIAppType( + std::map<std::string, std::vector<std::string> > app_hmi_types) OVERRIDE; /* * @brief Starts audio pass thru thread @@ -546,16 +647,19 @@ public: * @param bits_per_sample The quality the audio is recorded. * @param audio_type Type of audio data */ - void StartAudioPassThruThread(int32_t session_key, int32_t correlation_id, - int32_t max_duration, int32_t sampling_rate, - int32_t bits_per_sample, int32_t audio_type); + void StartAudioPassThruThread(int32_t session_key, + int32_t correlation_id, + int32_t max_duration, + int32_t sampling_rate, + int32_t bits_per_sample, + int32_t audio_type) OVERRIDE; /* * @brief Terminates audio pass thru thread * @param application_key Id of application for which * audio pass thru should be stopped */ - void StopAudioPassThru(int32_t application_key); + void StopAudioPassThru(int32_t application_key) OVERRIDE; /* * @brief Creates AudioPassThru data chunk and inserts it @@ -566,8 +670,8 @@ public: * * @param binary_data AudioPassThru data chunk */ - void SendAudioPassThroughNotification(uint32_t session_key, - std::vector<uint8_t> &binary_data); + void SendAudioPassThroughNotification( + uint32_t session_key, std::vector<uint8_t>& binary_data) OVERRIDE; std::string GetDeviceName(connection_handler::DeviceHandle handle); @@ -579,16 +683,12 @@ public: * * @return Corresponding HMI TransporType value */ - hmi_apis::Common_TransportType::eType - GetDeviceTransportType(const std::string &transport_type); - - ///////////////////////////////////////////////////// - - void set_hmi_message_handler(hmi_message_handler::HMIMessageHandler *handler); - void set_connection_handler(connection_handler::ConnectionHandler *handler); - void set_protocol_handler(protocol_handler::ProtocolHandler *handler); + hmi_apis::Common_TransportType::eType GetDeviceTransportType( + const std::string& transport_type); - /////////////////////////////////////////////////////// + void set_hmi_message_handler(hmi_message_handler::HMIMessageHandler* handler); + void set_connection_handler(connection_handler::ConnectionHandler* handler); + void set_protocol_handler(protocol_handler::ProtocolHandler* handler); void StartDevicesDiscovery(); @@ -596,48 +696,58 @@ public: // if |final_message| parameter is set connection to mobile will be closed // after processing this message void SendMessageToMobile(const commands::MessageSharedPtr message, - bool final_message = false); + bool final_message = false) OVERRIDE; + + void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE; + + bool ManageMobileCommand(const commands::MessageSharedPtr message, + commands::Command::CommandOrigin origin) OVERRIDE; + bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE; /** * @brief TerminateRequest forces termination of request * @param connection_key - application id of request * @param corr_id correlation id of request */ - void TerminateRequest(uint32_t connection_key, uint32_t corr_id); - - bool ManageMobileCommand( - const commands::MessageSharedPtr message, - commands::Command::CommandOrigin origin = commands::Command::ORIGIN_SDL); - void SendMessageToHMI(const commands::MessageSharedPtr message); - bool ManageHMICommand(const commands::MessageSharedPtr message); - - ///////////////////////////////////////////////////////// + void TerminateRequest(uint32_t connection_key, uint32_t corr_id) OVERRIDE; // Overriden ProtocolObserver method - virtual void - OnMessageReceived(const ::protocol_handler::RawMessagePtr message) OVERRIDE; - virtual void - OnMobileMessageSent(const ::protocol_handler::RawMessagePtr message) OVERRIDE; + void OnMessageReceived( + const ::protocol_handler::RawMessagePtr message) OVERRIDE; + void OnMobileMessageSent( + const ::protocol_handler::RawMessagePtr message) OVERRIDE; // Overriden HMIMessageObserver method - void - OnMessageReceived(hmi_message_handler::MessageSharedPointer message) OVERRIDE; - void - OnErrorSending(hmi_message_handler::MessageSharedPointer message) OVERRIDE; + void OnMessageReceived( + hmi_message_handler::MessageSharedPointer message) OVERRIDE; + void OnErrorSending( + hmi_message_handler::MessageSharedPointer message) OVERRIDE; // Overriden ConnectionHandlerObserver method void OnDeviceListUpdated( - const connection_handler::DeviceMap &device_list) OVERRIDE; - // TODO (EZamakhov): fix all indentations in this file + const connection_handler::DeviceMap& device_list) OVERRIDE; void OnFindNewApplicationsRequest() OVERRIDE; - void - RemoveDevice(const connection_handler::DeviceHandle &device_handle) OVERRIDE; + void RemoveDevice( + const connection_handler::DeviceHandle& device_handle) OVERRIDE; bool OnServiceStartedCallback( - const connection_handler::DeviceHandle &device_handle, - const int32_t &session_key, - const protocol_handler::ServiceType &type) OVERRIDE; + const connection_handler::DeviceHandle& device_handle, + const int32_t& session_key, + const protocol_handler::ServiceType& type) OVERRIDE; void OnServiceEndedCallback( - const int32_t &session_key, const protocol_handler::ServiceType &type, - const connection_handler::CloseSessionReason &close_reason) OVERRIDE; + const int32_t& session_key, + const protocol_handler::ServiceType& type, + const connection_handler::CloseSessionReason& close_reason) OVERRIDE; + +#ifdef ENABLE_SECURITY + // Overriden SecurityManagerListener method + bool OnHandshakeDone( + uint32_t connection_key, + security_manager::SSLContext::HandshakeResult result) OVERRIDE FINAL; + + void OnCertificateUpdateRequired() OVERRIDE FINAL; + + security_manager::SSLContext::HandshakeContext GetHandshakeContext( + uint32_t key) const OVERRIDE FINAL; +#endif // ENABLE_SECURITY /** * @ Add notification to collection @@ -651,7 +761,7 @@ public: * * @param ptr Reference to shared pointer that point on hmi notification */ - void removeNotification(const commands::Command *notification); + void removeNotification(const commands::Command* notification); /** * @ Updates request timeout @@ -662,24 +772,7 @@ public: */ void updateRequestTimeout(uint32_t connection_key, uint32_t mobile_correlation_id, - uint32_t new_timeout_value); - - /* - * @brief Retrieves application id associated whith correlation id - * - * @param correlation_id Correlation ID of the HMI request - * - * @return application id associated whith correlation id - */ - const uint32_t application_id(const int32_t correlation_id); - - /* - * @brief Sets application id correlation id - * - * @param correlation_id Correlation ID of the HMI request - * @param app_id Application ID - */ - void set_application_id(const int32_t correlation_id, const uint32_t app_id); + uint32_t new_timeout_value) OVERRIDE; /** * @brief AddPolicyObserver allows to subscribe needed component to events @@ -687,14 +780,14 @@ public: * * @param listener the component to subscribe. */ - void AddPolicyObserver(PolicyHandlerObserver *listener); + void AddPolicyObserver(PolicyHandlerObserver* listener); /** * @brief RemovePolicyObserver allows to remove observer from collection. * * @param listener observer to remove. */ - void RemovePolicyObserver(PolicyHandlerObserver *listener); + void RemovePolicyObserver(PolicyHandlerObserver* listener); /** * @brief Checks HMI level and returns true if streaming is allowed @@ -702,9 +795,9 @@ public: * @param service_type Service type to check * @return True if streaming is allowed, false in other case */ - bool - HMILevelAllowsStreaming(uint32_t app_id, - protocol_handler::ServiceType service_type) const; + bool HMILevelAllowsStreaming( + uint32_t app_id, + protocol_handler::ServiceType service_type) const OVERRIDE; /** * @brief Checks if application can stream (streaming service is started and @@ -714,19 +807,19 @@ public: * @return True if streaming is allowed, false in other case */ bool CanAppStream(uint32_t app_id, - protocol_handler::ServiceType service_type) const; + protocol_handler::ServiceType service_type) const OVERRIDE; /** * @brief Ends opened navi services (audio/video) for application * @param app_id Application id */ - void EndNaviServices(uint32_t app_id); + void EndNaviServices(uint32_t app_id) OVERRIDE; /** * @brief ForbidStreaming forbid the stream over the certain application. * @param app_id the application's id which should stop streaming. */ - void ForbidStreaming(uint32_t app_id); + void ForbidStreaming(uint32_t app_id) OVERRIDE; /** * @brief Callback calls when application starts/stops data streaming @@ -735,56 +828,47 @@ public: * @param state Shows if streaming started or stopped */ void OnAppStreaming(uint32_t app_id, - protocol_handler::ServiceType service_type, bool state); + protocol_handler::ServiceType service_type, + bool state) OVERRIDE; - /** - * @brief OnHMILevelChanged the callback that allows SDL to react when - * application's HMILeval has been changed. - * - * @param app_id application identifier for which HMILevel has been chaned. - * - * @param from previous HMILevel. - * @param to current HMILevel. - */ - void OnHMILevelChanged(uint32_t app_id, mobile_apis::HMILevel::eType from, - mobile_apis::HMILevel::eType to); - - mobile_api::HMILevel::eType - GetDefaultHmiLevel(ApplicationSharedPtr application) const; + mobile_api::HMILevel::eType GetDefaultHmiLevel( + ApplicationConstSharedPtr application) const; /** - * Getter for resume_controller - * @return Resume Controller - */ - ResumeCtrl &resume_controller() { return resume_ctrl_; } + * Getter for resume_controller + * @return Resume Controller + */ + resumption::ResumeCtrl& resume_controller() OVERRIDE { + return resume_ctrl_; + } /** * Generate grammar ID * * @return New grammar ID */ - uint32_t GenerateGrammarID(); + uint32_t GenerateGrammarID() OVERRIDE; /** * Generate new HMI application ID * * @return New HMI application ID */ - uint32_t GenerateNewHMIAppID(); + uint32_t GenerateNewHMIAppID() OVERRIDE; /** * @brief Parse smartObject and replace mobile app Id by HMI app ID * * @param message Smartobject to be parsed */ - void ReplaceMobileByHMIAppId(smart_objects::SmartObject &message); + void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** * @brief Parse smartObject and replace HMI app ID by mobile app Id * * @param message Smartobject to be parsed */ - void ReplaceHMIByMobileAppId(smart_objects::SmartObject &message); + void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); /* * @brief Save binary data to specified directory @@ -798,22 +882,22 @@ public: * * @return SUCCESS if file was saved, other code otherwise */ - mobile_apis::Result::eType SaveBinary(const std::vector<uint8_t> &binary_data, - const std::string &file_path, - const std::string &file_name, - const int64_t offset); + mobile_apis::Result::eType SaveBinary(const std::vector<uint8_t>& binary_data, + const std::string& file_path, + const std::string& file_name, + const int64_t offset) OVERRIDE; /** * @brief Get available app space * @param name of the app folder(make + mobile app id) * @return free app space. */ - uint32_t GetAvailableSpaceForApp(const std::string &folder_name); + uint32_t GetAvailableSpaceForApp(const std::string& folder_name); /* * @brief returns true if HMI is cooperating */ - bool IsHMICooperating() const; + bool IsHMICooperating() const OVERRIDE; /** * @brief Method used to send default app tts globalProperties @@ -827,7 +911,7 @@ public: * @param app_id contains application which will * send TTS global properties after timeout */ - void AddAppToTTSGlobalPropertiesList(const uint32_t app_id); + void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE; /** * @brief method removes application @@ -835,7 +919,7 @@ public: * @param app_id contains application which will * send TTS global properties after timeout */ - void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id); + void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE; /** * @brief method adds application in FULL and LIMITED state @@ -851,16 +935,13 @@ public: */ void ResetPhoneCallAppList(); - /** - * Function used only by HMI request/response/notification base classes - * to change HMI app id to Mobile app id and vice versa. - * Dot use it inside Core - */ - ApplicationSharedPtr application_by_hmi_app(uint32_t hmi_app_id) const; - // TODO(AOleynik): Temporary added, to fix build. Should be reworked. - connection_handler::ConnectionHandler *connection_handler(); + connection_handler::ConnectionHandler& connection_handler() const OVERRIDE; + protocol_handler::ProtocolHandler& protocol_handler() const OVERRIDE; + virtual policy::PolicyHandlerInterface& GetPolicyHandler() OVERRIDE { + return policy_handler_; + } /** * @brief Checks, if given RPC is allowed at current HMI level for specific * application in policy table @@ -872,9 +953,11 @@ public: * @return SUCCESS, if allowed, otherwise result code of check */ mobile_apis::Result::eType CheckPolicyPermissions( - const std::string &policy_app_id, mobile_apis::HMILevel::eType hmi_level, - mobile_apis::FunctionID::eType function_id, const RPCParams &rpc_params, - CommandParametersPermissions *params_permissions = NULL); + const std::string& policy_app_id, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::FunctionID::eType function_id, + const RPCParams& rpc_params, + CommandParametersPermissions* params_permissions = NULL) OVERRIDE; /* * @brief Function Should be called when Low Voltage is occured */ @@ -885,6 +968,22 @@ public: */ void OnWakeUp(); + /** + * @brief IsApplicationForbidden allows to distinguish if application is + * not allowed to register, because of spamming. + * + * @param connection_key the connection key ofthe required application + * + * @param policy_app_id application's mobile(policy) identifier. + * + * @return true in case application is allowed to register, false otherwise. + */ + bool IsApplicationForbidden(uint32_t connection_key, + const std::string& policy_app_id) const OVERRIDE; + + policy::DeviceConsent GetUserConsentForDevice( + const std::string& device_id) const OVERRIDE; + struct ApplicationsAppIdSorter { bool operator()(const ApplicationSharedPtr lhs, const ApplicationSharedPtr rhs) { @@ -892,95 +991,8 @@ public: } }; - struct ApplicationsMobileAppIdSorter { - bool operator()(const ApplicationSharedPtr lhs, - const ApplicationSharedPtr rhs) { - - if (lhs->mobile_app_id() == rhs->mobile_app_id()) { - return lhs->device() < rhs->device(); - } - return lhs->mobile_app_id() < rhs->mobile_app_id(); - } - }; - // typedef for Applications list - typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet; - - typedef std::multiset<ApplicationSharedPtr, ApplicationsMobileAppIdSorter> - AppsWaitRegistrationSet; - - // typedef for Applications list iterator - typedef ApplictionSet::iterator ApplictionSetIt; - - // typedef for Applications list const iterator - typedef ApplictionSet::const_iterator ApplictionSetConstIt; - - DataAccessor<AppsWaitRegistrationSet> apps_waiting_for_registration() const; - ApplicationConstSharedPtr waiting_app(const uint32_t hmi_id) const; - - /** - * Class for thread-safe access to applications list - */ - class ApplicationListAccessor : public DataAccessor<ApplictionSet> { - public: - /** - * @brief ApplicationListAccessor class constructor - */ - ApplicationListAccessor() - : DataAccessor<ApplictionSet>( - ApplicationManagerImpl::instance()->applications_, - ApplicationManagerImpl::instance()->applications_list_lock_) {} - - ~ApplicationListAccessor(); - - /** - * @brief thread-safe getter for applications - * @return applications list - */ - const ApplictionSet &applications() const { return GetData(); } - - ApplictionSetConstIt begin() { return applications().begin(); } - - ApplictionSetConstIt end() { return applications().end(); } - - template <class UnaryPredicate> - ApplicationSharedPtr Find(UnaryPredicate finder) { - ApplicationSharedPtr result; - ApplictionSetConstIt it = std::find_if(begin(), end(), finder); - if (it != end()) { - result = *it; - } - return result; - } - - template <class UnaryPredicate> - std::vector<ApplicationSharedPtr> FindAll(UnaryPredicate finder) { - std::vector<ApplicationSharedPtr> result; - ApplictionSetConstIt it = std::find_if(begin(), end(), finder); - while (it != end()) { - result.push_back(*it); - it = std::find_if(++it, end(), finder); - } - return result; - } - - void Erase(ApplicationSharedPtr app_to_remove) { - ApplicationManagerImpl::instance()->applications_.erase(app_to_remove); - } - - void Insert(ApplicationSharedPtr app_to_insert) { - ApplicationManagerImpl::instance()->applications_.insert(app_to_insert); - } - - bool Empty() { - return ApplicationManagerImpl::instance()->applications_.empty(); - } - - private: - DISALLOW_COPY_AND_ASSIGN(ApplicationListAccessor); - }; - - friend class ApplicationListAccessor; + typedef std::set<std::string> ForbiddenApps; struct AppIdPredicate { uint32_t app_id_; @@ -998,12 +1010,12 @@ public: } }; - struct MobileAppIdPredicate { + struct PolicyAppIdPredicate { std::string policy_app_id_; - MobileAppIdPredicate(const std::string &policy_app_id) + PolicyAppIdPredicate(const std::string& policy_app_id) : policy_app_id_(policy_app_id) {} bool operator()(const ApplicationSharedPtr app) const { - return app ? policy_app_id_ == app->mobile_app_id() : false; + return app ? policy_app_id_ == app->policy_app_id() : false; } }; @@ -1046,10 +1058,18 @@ public: } }; + struct GrammarIdPredicate { + uint32_t grammar_id_; + GrammarIdPredicate(uint32_t grammar_id) : grammar_id_(grammar_id) {} + bool operator()(const ApplicationSharedPtr app) const { + return app ? grammar_id_ == app->get_grammar_id() : false; + } + }; + /** * @brief Sends UpdateAppList notification to HMI */ - void SendUpdateAppList(); + void SendUpdateAppList() OVERRIDE; /** * @brief Marks applications received through QueryApps as should be @@ -1058,18 +1078,31 @@ public: * @param handle, device handle */ void MarkAppsGreyOut(const connection_handler::DeviceHandle handle, - bool is_greyed_out); + bool is_greyed_out) OVERRIDE; + + ApplicationConstSharedPtr WaitingApplicationByID( + const uint32_t hmi_id) const OVERRIDE; + + DataAccessor<AppsWaitRegistrationSet> AppsWaitingForRegistration() + const OVERRIDE; /** * @brief Checks, if apps list had been queried already from certain device * @param handle, Device handle * @return true, if list had been queried already, otherwise - false */ - bool IsAppsQueriedFrom(const connection_handler::DeviceHandle handle) const; + bool IsAppsQueriedFrom( + const connection_handler::DeviceHandle handle) const OVERRIDE; - bool IsStopping() const { return is_stopping_; } + bool IsStopping() const OVERRIDE { + return is_stopping_; + } + + StateController& state_controller() OVERRIDE; + const ApplicationManagerSettings& get_settings() const OVERRIDE; + virtual event_engine::EventDispatcher& event_dispatcher() OVERRIDE; -private: + private: /** * @brief PullLanguagesInfo allows to pull information about languages. * @@ -1078,11 +1111,9 @@ private: * @param ttsName tts name that should be filled. * @param vrSynonym vr synonymus that should be filled. */ - void PullLanguagesInfo(const smart_objects::SmartObject &app_data, - smart_objects::SmartObject &ttsName, - smart_objects::SmartObject &vrSynonym); - - ApplicationManagerImpl(); + void PullLanguagesInfo(const smart_objects::SmartObject& app_data, + smart_objects::SmartObject& ttsName, + smart_objects::SmartObject& vrSynonym); /** * @brief Method transforms string to AppHMIType @@ -1097,18 +1128,18 @@ private: * @param from_application contains app HMI type from application * @return return TRUE if arrays of appHMIType equal, otherwise return FALSE */ - bool CompareAppHMIType(const smart_objects::SmartObject &from_policy, - const smart_objects::SmartObject &from_application); + bool CompareAppHMIType(const smart_objects::SmartObject& from_policy, + const smart_objects::SmartObject& from_application); - hmi_apis::HMI_API &hmi_so_factory(); - mobile_apis::MOBILE_API &mobile_so_factory(); + hmi_apis::HMI_API& hmi_so_factory(); + mobile_apis::MOBILE_API& mobile_so_factory(); - bool ConvertMessageToSO(const Message &message, - smart_objects::SmartObject &output); - bool ConvertSOtoMessage(const smart_objects::SmartObject &message, - Message &output); - utils::SharedPtr<Message> - ConvertRawMsgToMessage(const ::protocol_handler::RawMessagePtr message); + bool ConvertMessageToSO(const Message& message, + smart_objects::SmartObject& output); + bool ConvertSOtoMessage(const smart_objects::SmartObject& message, + Message& output); + utils::SharedPtr<Message> ConvertRawMsgToMessage( + const ::protocol_handler::RawMessagePtr message); void ProcessMessageFromMobile(const utils::SharedPtr<Message> message); void ProcessMessageFromHMI(const utils::SharedPtr<Message> message); @@ -1119,26 +1150,27 @@ private: * of messages. Beware, each is called on different thread! */ // CALLED ON messages_from_mobile_ thread! - virtual void Handle(const impl::MessageFromMobile message) OVERRIDE; + void Handle(const impl::MessageFromMobile message) OVERRIDE; // CALLED ON messages_to_mobile_ thread! - virtual void Handle(const impl::MessageToMobile message) OVERRIDE; + void Handle(const impl::MessageToMobile message) OVERRIDE; // CALLED ON messages_from_hmi_ thread! - virtual void Handle(const impl::MessageFromHmi message) OVERRIDE; + void Handle(const impl::MessageFromHmi message) OVERRIDE; // CALLED ON messages_to_hmi_ thread! - virtual void Handle(const impl::MessageToHmi message) OVERRIDE; + void Handle(const impl::MessageToHmi message) OVERRIDE; // CALLED ON audio_pass_thru_messages_ thread! - virtual void Handle(const impl::AudioData message) OVERRIDE; + void Handle(const impl::AudioData message) OVERRIDE; template <typename ApplicationList> void PrepareApplicationListSO(ApplicationList app_list, - smart_objects::SmartObject &applications) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicatinManagerImpl"); + smart_objects::SmartObject& applications, + ApplicationManager& app_mngr) { + CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager"); - smart_objects::SmartArray *app_array = applications.asArray(); + smart_objects::SmartArray* app_array = applications.asArray(); uint32_t app_count = NULL == app_array ? 0 : app_array->size(); typename ApplicationList::const_iterator it; for (it = app_list.begin(); it != app_list.end(); ++it) { @@ -1148,8 +1180,13 @@ private: } smart_objects::SmartObject hmi_application(smart_objects::SmartType_Map); - ; - if (MessageHelper::CreateHMIApplicationStruct(*it, hmi_application)) { + const protocol_handler::SessionObserver& session_observer = + connection_handler().get_session_observer(); + if (MessageHelper::CreateHMIApplicationStruct(*it, + session_observer, + GetPolicyHandler(), + &hmi_application, + app_mngr)) { applications[app_count++] = hmi_application; } else { LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct "); @@ -1172,7 +1209,7 @@ private: * @param connection_key connection key of app, which provided app list to * be created */ - void CreateApplications(smart_objects::SmartArray &obj_array, + void CreateApplications(smart_objects::SmartArray& obj_array, const uint32_t connection_key); /* @@ -1186,17 +1223,28 @@ private: */ bool IsLowVoltage(); -private: + private: /* * NaviServiceStatusMap shows which navi service (audio/video) is opened * for specified application. Two bool values in std::pair mean: * 1st value - is video service opened or not * 2nd value - is audio service opened or not */ - typedef std::map<uint32_t, std::pair<bool, bool>> NaviServiceStatusMap; + typedef std::map<uint32_t, std::pair<bool, bool> > NaviServiceStatusMap; - typedef SharedPtr<TimerThread<ApplicationManagerImpl>> - ApplicationManagerTimerPtr; + /** + * @brief GetHashedAppID allows to obtain unique application id as a string. + * It concatenates device mac and application id to obtain unique id. + * + * @param connection_key connection key for which need to obtain device mac; + * + * @param policy_app_id mobile(policy) application id on particular device. + * This parameter will be concatenated with device id. + * + * @return unique aplication identifier. + */ + std::string GetHashedAppID(uint32_t connection_key, + const std::string& policy_app_id) const; /** * @brief Removes suspended and stopped timers from timer pool @@ -1275,7 +1323,7 @@ private: * @param type Directory type * @return true, if succedeed, otherwise - false */ - bool InitDirectory(const std::string &path, DirectoryType type) const; + bool InitDirectory(const std::string& path, DirectoryType type) const; /** * @brief Checks, whether r/w permissions are present for particular path @@ -1283,7 +1331,7 @@ private: * @param type Directory type * @return true, if allowed, otherwise - false */ - bool IsReadWriteAllowed(const std::string &path, DirectoryType type) const; + bool IsReadWriteAllowed(const std::string& path, DirectoryType type) const; /** * @brief Removes apps, waiting for registration related to @@ -1293,21 +1341,21 @@ private: void RemoveAppsWaitingForRegistration( const connection_handler::DeviceHandle handle); - /** - * @brief Clears TTS global properties list of apps - */ void ClearTTSGlobalPropertiesList(); -private: + private: + const ApplicationManagerSettings& settings_; /** * @brief List of applications */ - ApplictionSet applications_; + ApplicationSet applications_; AppsWaitRegistrationSet apps_to_register_; + ForbiddenApps forbidden_applications; // Lock for applications list mutable sync_primitives::Lock applications_list_lock_; mutable sync_primitives::Lock apps_to_register_list_lock_; + mutable sync_primitives::Lock subscribed_way_points_apps_lock_; /** * @brief Map of correlation id and associated application id. @@ -1315,6 +1363,11 @@ private: std::map<const int32_t, const uint32_t> appID_list_; /** + * @brief Set AppIDs of subscribed apps for way points + */ + std::set<int32_t> subscribed_way_points_apps_list_; + + /** * @brief Map contains applications which * will send TTS global properties to HMI after timeout */ @@ -1327,15 +1380,18 @@ private: bool is_vr_session_strated_; bool hmi_cooperating_; bool is_all_apps_allowed_; - media_manager::MediaManager *media_manager_; - hmi_message_handler::HMIMessageHandler *hmi_handler_; - connection_handler::ConnectionHandler *connection_handler_; - protocol_handler::ProtocolHandler *protocol_handler_; + event_engine::EventDispatcherImpl event_dispatcher_; + media_manager::MediaManager* media_manager_; + + hmi_message_handler::HMIMessageHandler* hmi_handler_; + connection_handler::ConnectionHandler* connection_handler_; + policy::PolicyHandler policy_handler_; + protocol_handler::ProtocolHandler* protocol_handler_; request_controller::RequestController request_ctrl_; - hmi_apis::HMI_API *hmi_so_factory_; - mobile_apis::MOBILE_API *mobile_so_factory_; + hmi_apis::HMI_API* hmi_so_factory_; + mobile_apis::MOBILE_API* mobile_so_factory_; static uint32_t corelation_id_; static const uint32_t max_corelation_id_; @@ -1362,7 +1418,7 @@ private: * about persistent application data on disk, and save session ID for resuming * application in case INGITION_OFF or MASTER_RESSET */ - ResumeCtrl resume_ctrl_; + resumption::ResumeCtrl resume_ctrl_; NaviServiceStatusMap navi_service_status_; std::deque<uint32_t> navi_app_to_stop_; @@ -1370,36 +1426,24 @@ private: uint32_t navi_close_app_timeout_; uint32_t navi_end_stream_timeout_; - std::vector<ApplicationManagerTimerPtr> timer_pool_; + std::vector<TimerSPtr> timer_pool_; sync_primitives::Lock timer_pool_lock_; - sync_primitives::Lock stopping_flag_lock_; + sync_primitives::Lock stopping_application_mng_lock_; + StateControllerImpl state_ctrl_; - StateController state_ctrl_; +#ifdef TELEMETRY_MONITOR + AMTelemetryObserver* metric_observer_; +#endif // TELEMETRY_MONITOR -#ifdef TIME_TESTER - AMMetricObserver *metric_observer_; -#endif // TIME_TESTER + Timer application_list_update_timer_; - class ApplicationListUpdateTimer - : public timer::TimerThread<ApplicationManagerImpl> { - public: - ApplicationListUpdateTimer(ApplicationManagerImpl *callee) - : timer::TimerThread<ApplicationManagerImpl>( - "AM ListUpdater", callee, - &ApplicationManagerImpl::OnApplicationListUpdateTimer) {} - }; - typedef utils::SharedPtr<ApplicationListUpdateTimer> - ApplicationListUpdateTimerSptr; - ApplicationListUpdateTimerSptr application_list_update_timer_; - - timer::TimerThread<ApplicationManagerImpl> tts_global_properties_timer_; + Timer tts_global_properties_timer_; bool is_low_voltage_; + volatile bool is_stopping_; DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl); - - FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl); }; bool ApplicationManagerImpl::vr_session_started() const { @@ -1413,6 +1457,7 @@ bool ApplicationManagerImpl::driver_distraction() const { inline bool ApplicationManagerImpl::all_apps_allowed() const { return is_all_apps_allowed_; } -} // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_ +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_ diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h new file mode 100644 index 0000000000..bf894eaf94 --- /dev/null +++ b/src/components/application_manager/include/application_manager/application_state.h @@ -0,0 +1,159 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_ +#include <vector> +#include "utils/lock.h" +#include "utils/macro.h" +#include "application_manager/hmi_state.h" + +namespace application_manager { + +typedef std::vector<HmiStatePtr> HmiStates; + +/* + * Class represents application state, i.e. current HMI level, audio streaming + * state and context + * Current implementation: + * - has regular state, which is default or base state + * - temporary states can be applied on top of regular state + * - on temporary state end it is being removed from states list + * - current state is the consolidated state of all the states, since different + * temporary state can affect one or more parameters (HMI state, audio, context) + * - can have postponed state (comes from resumption process), which is + * not applied on top, but is being added before base and can replace base later + * on + */ +class ApplicationState { + public: + /** + * @brief ApplicationState constructor + */ + ApplicationState(); + + /** + * @brief Init state + * @param state Initial state + */ + void InitState(HmiStatePtr state); + + /** + * @brief Adds state to states storage + * @param state State of application + */ + void AddState(HmiStatePtr state); + + /** + * @brief Removes state from states storage + * @param state State of application + */ + void RemoveState(HmiState::StateID state); + + /** + * @brief Gets state by state id + * @param state_id State id + * @return Pointer to application state + */ + HmiStatePtr GetState(HmiState::StateID state_id) const; + + private: + /** + * @brief AddHMIState the function that will change application's + * hmi state. + * + * @param app_id id of the application whose hmi level should be changed. + * + * @param state new hmi state for certain application. + */ + void AddHMIState(HmiStatePtr state); + + /** + * @brief RemoveHMIState the function that will turn back hmi_level after end + * of some event + * + * @param app_id id of the application whose hmi level should be changed. + * + * @param state_id that should be removed + */ + void RemoveHMIState(HmiState::StateID state_id); + + /** + * @brief Removes postponed state + */ + void RemovePostponedState(); + + /** + * @brief Sets regular state of application + * @param state State of application + */ + void SetRegularState(HmiStatePtr state); + + /** + * @brief Sets postponed state of application. + * This state could be set as regular later on + * + * @param state state to setup + */ + void SetPostponedState(HmiStatePtr state); + + /** + * @brief HmiState of application within active events PhoneCall, TTS< etc ... + * @return Active HmiState of application + */ + HmiStatePtr CurrentHmiState() const; + + /** + * @brief RegularHmiState of application without active events VR, TTS etc ... + * @return HmiState of application + */ + HmiStatePtr RegularHmiState() const; + + /** + * @brief PostponedHmiState returns postponed hmi state of application + * if it's present + * + * @return Postponed hmi state of application + */ + HmiStatePtr PostponedHmiState() const; + + /** + * @brief Active states of application + */ + HmiStates hmi_states_; + mutable sync_primitives::Lock hmi_states_lock_; + + DISALLOW_COPY_AND_ASSIGN(ApplicationState); +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index 238e0b71c7..fb2bc6d78f 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -32,17 +32,11 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_ - -#include "utils/shared_ptr.h" +#include <stdint.h> #include "smart_objects/smart_object.h" -#include "application_manager/event_engine/event_observer.h" -#include "application_manager/smart_object_keys.h" +#include "utils/shared_ptr.h" namespace application_manager { -/** - * @brief SmartObject type - **/ - namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; namespace commands { @@ -114,21 +108,16 @@ class Command { */ virtual bool AllowedToTerminate() = 0; - /** - * @brief SetAllowedToTerminate set up allowed to terminate flag. - * If true, request controller will terminate request on response - */ - virtual void SetAllowedToTerminate(bool allowed) = 0; - + /** + * @brief SetAllowedToTerminate set up allowed to terminate flag. + * If true, request controller will terminate request on response + */ + virtual void SetAllowedToTerminate(const bool allowed) = 0; - enum CommandOrigin { - ORIGIN_SDL, - ORIGIN_MOBILE - }; + enum CommandOrigin { ORIGIN_SDL, ORIGIN_MOBILE }; }; typedef smart_objects::SmartObjectSPtr MessageSharedPtr; - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 6cc8f82330..439b1756ef 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -34,6 +34,9 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_IMPL_H_ #include "application_manager/commands/command.h" +#include "application_manager/event_engine/event_observer.h" +#include "application_manager/application_manager.h" +#include "application_manager/smart_object_keys.h" #include "utils/logger.h" namespace application_manager { @@ -49,7 +52,6 @@ struct CommandParametersPermissions { }; namespace commands { - /** * @brief Class is intended to encapsulate RPC as an object **/ @@ -60,7 +62,8 @@ class CommandImpl : public Command { * * @param message Incoming SmartObject message **/ - explicit CommandImpl(const MessageSharedPtr& message); + CommandImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief CommandImpl class destructor @@ -71,52 +74,51 @@ class CommandImpl : public Command { /** * @brief Checks command permissions according to policy table */ - virtual bool CheckPermissions(); + bool CheckPermissions() OVERRIDE; /** * @brief Init required by command resources **/ - virtual bool Init(); + bool Init() OVERRIDE; /** * @brief Cleanup all resources used by command **/ - virtual bool CleanUp(); + bool CleanUp() OVERRIDE; /** * @brief Execute corresponding command by calling the action on reciever **/ - virtual void Run(); - + void Run() OVERRIDE; /** * @brief Retrieves request default timeout. * If request has a custom timeout, request_timeout_ should be reassign to it * * @return Request default timeout */ - virtual uint32_t default_timeout() const; + uint32_t default_timeout() const OVERRIDE; /* * @brief Retrieves correlation ID */ - virtual uint32_t correlation_id() const; + uint32_t correlation_id() const OVERRIDE; /* * @brief Retrieves connection key */ - virtual uint32_t connection_key() const; + uint32_t connection_key() const OVERRIDE; /* * @brief Retrieves request ID */ - virtual int32_t function_id() const; + int32_t function_id() const OVERRIDE; /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * */ - virtual void onTimeOut(); + void onTimeOut() OVERRIDE; /** * @brief AllowedToTerminate tells request Controller if it can terminate this @@ -125,30 +127,42 @@ class CommandImpl : public Command { * If request need to terminate itself, it should override this function false * @return allowed_to_terminate_ value */ - virtual bool AllowedToTerminate() { - return allowed_to_terminate_; - } + bool AllowedToTerminate() OVERRIDE; /** * @brief SetAllowedToTerminate set up allowed to terminate flag. * If true, request controller will terminate request on response */ - virtual void SetAllowedToTerminate(bool allowed) { - allowed_to_terminate_ = allowed; - } + void SetAllowedToTerminate(const bool allowed) OVERRIDE; // members static const int32_t hmi_protocol_type_; static const int32_t mobile_protocol_type_; - static const int32_t protocol_version_; + static const int32_t protocol_version_; protected: + /** + * @brief Parse smartObject and replace mobile app Id by HMI app ID + * + * @param message Smartobject to be parsed + */ + void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); + + /** + * @brief Parse smartObject and replace HMI app ID by mobile app Id + * + * @param message Smartobject to be parsed + */ + void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); + MessageSharedPtr message_; uint32_t default_timeout_; bool allowed_to_terminate_; + ApplicationManager& application_manager_; + #ifdef ENABLE_LOG static log4cxx::LoggerPtr logger_; -#endif // ENABLE_LOG +#endif // ENABLE_LOG private: DISALLOW_COPY_AND_ASSIGN(CommandImpl); diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h index 9f95a52850..2f3b809274 100644 --- a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h @@ -47,12 +47,14 @@ namespace commands { class CommandNotificationFromMobileImpl : public CommandImpl { public: - explicit CommandNotificationFromMobileImpl(const MessageSharedPtr& message); + CommandNotificationFromMobileImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~CommandNotificationFromMobileImpl(); virtual bool Init(); virtual bool CleanUp(); virtual void Run(); void SendNotification(); + private: DISALLOW_COPY_AND_ASSIGN(CommandNotificationFromMobileImpl); }; diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h index 7d0d11af89..25a2a18aca 100644 --- a/src/components/application_manager/include/application_manager/commands/command_notification_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_notification_impl.h @@ -47,12 +47,14 @@ namespace commands { class CommandNotificationImpl : public CommandImpl { public: - explicit CommandNotificationImpl(const MessageSharedPtr& message); + CommandNotificationImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~CommandNotificationImpl(); virtual bool Init(); virtual bool CleanUp(); virtual void Run(); void SendNotification(); + private: DISALLOW_COPY_AND_ASSIGN(CommandNotificationImpl); }; diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 0401a3bf46..c5f45e2095 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -50,19 +50,15 @@ namespace commands { namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; class CommandRequestImpl : public CommandImpl, - public event_engine::EventObserver { + public event_engine::EventObserver { public: + enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted }; - enum RequestState { - kAwaitingHMIResponse = 0, - kTimedOut, - kCompleted - }; - - explicit CommandRequestImpl(const MessageSharedPtr& message); + CommandRequestImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~CommandRequestImpl(); virtual bool CheckPermissions(); - virtual bool Init(); + virtual bool Init(); virtual bool CleanUp(); virtual void Run(); @@ -99,7 +95,7 @@ class CommandRequestImpl : public CommandImpl, * @param allow_empty_string if true methods allow empty sting * @return true if success otherwise return false */ - bool CheckSyntax(std::string str, bool allow_empty_line = false); + bool CheckSyntax(const std::string& str, bool allow_empty_line = false); /* * @brief Sends HMI request @@ -110,8 +106,8 @@ class CommandRequestImpl : public CommandImpl, * @return hmi correlation id */ uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params = NULL, - bool use_events = false); + const smart_objects::SmartObject* msg_params = NULL, + bool use_events = false); /* * @brief Creates HMI request @@ -131,8 +127,7 @@ class CommandRequestImpl : public CommandImpl, mobile_apis::Result::eType GetMobileResultCode( const hmi_apis::Common_Result::eType& hmi_code) const; -protected: - + protected: /** * @brief Checks message permissions and parameters according to policy table * permissions @@ -141,10 +136,8 @@ protected: /** * @brief Remove from current message parameters disallowed by policy table - * @param params_permissions Parameters permissions from policy table */ - void RemoveDisallowedParameters( - const CommandParametersPermissions& params_permissions); + void RemoveDisallowedParameters(); /** * @brief Adds disallowed parameters back to response with appropriate @@ -161,14 +154,20 @@ protected: bool HasDisallowedParams() const; protected: - RequestState current_state_; - sync_primitives::Lock state_lock_; - CommandParametersPermissions parameters_permissions_; + /** + * @brief Returns policy parameters permissions + * @return Parameters permissions struct reference + */ + const CommandParametersPermissions& parameters_permissions() const; + + RequestState current_state_; + sync_primitives::Lock state_lock_; + CommandParametersPermissions parameters_permissions_; + CommandParametersPermissions removed_parameters_permissions_; private: DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl); - /** * @brief Adds param to disallowed parameters enumeration * @param info string with disallowed params enumeration @@ -181,7 +180,8 @@ protected: * @brief Adds disallowed parameters to response info * @param response Response message, which info should be extended */ - void AddDisallowedParametersToInfo(smart_objects::SmartObject& response) const; + void AddDisallowedParametersToInfo( + smart_objects::SmartObject& response) const; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/command_response_impl.h b/src/components/application_manager/include/application_manager/commands/command_response_impl.h index 0c93bf54d4..2b52ea5a58 100644 --- a/src/components/application_manager/include/application_manager/commands/command_response_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_response_impl.h @@ -48,7 +48,8 @@ namespace commands { class CommandResponseImpl : public CommandImpl { public: - explicit CommandResponseImpl(const MessageSharedPtr& message); + CommandResponseImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~CommandResponseImpl(); virtual bool Init(); virtual bool CleanUp(); @@ -57,6 +58,7 @@ class CommandResponseImpl : public CommandImpl { const mobile_apis::Result::eType& result_code = mobile_apis::Result::INVALID_ENUM, bool final_message = false); + private: DISALLOW_COPY_AND_ASSIGN(CommandResponseImpl); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h index 5122a0856b..090a77b9ed 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief ActivateAppRequest command class **/ class ActivateAppRequest : public RequestToHMI { - public: - /** - * @brief ActivateAppRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit ActivateAppRequest(const MessageSharedPtr& message); + public: + /** + * @brief ActivateAppRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ActivateAppRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief ActivateAppRequest class destructor - **/ - virtual ~ActivateAppRequest(); + /** + * @brief ActivateAppRequest class destructor + **/ + virtual ~ActivateAppRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(ActivateAppRequest); + private: + DISALLOW_COPY_AND_ASSIGN(ActivateAppRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h index a15d317077..471de1135e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/activate_app_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief ActivateAppResponse command class **/ class ActivateAppResponse : public ResponseFromHMI { - public: - /** - * @brief ActivateAppResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit ActivateAppResponse(const MessageSharedPtr& message); + public: + /** + * @brief ActivateAppResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ActivateAppResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief ActivateAppResponse class destructor - **/ - virtual ~ActivateAppResponse(); + /** + * @brief ActivateAppResponse class destructor + **/ + virtual ~ActivateAppResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(ActivateAppResponse); + private: + DISALLOW_COPY_AND_ASSIGN(ActivateAppResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h index 1aa3b7a512..3e0f81f167 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/add_statistics_info_notification.h @@ -49,7 +49,8 @@ class AddStatisticsInfoNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit AddStatisticsInfoNotification(const MessageSharedPtr& message); + AddStatisticsInfoNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AddStatisticsInfoNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h index 3d42b6d5a6..c1c5b36e5b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_request.h @@ -49,7 +49,8 @@ class AllowAllAppsRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit AllowAllAppsRequest(const MessageSharedPtr& message); + AllowAllAppsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AllowAllAppsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h index ccc8d5ae7d..711825cfab 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_all_apps_response.h @@ -49,7 +49,8 @@ class AllowAllAppsResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit AllowAllAppsResponse(const MessageSharedPtr& message); + AllowAllAppsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AllowAllAppsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h index e90576a7df..10424a2661 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_request.h @@ -49,7 +49,8 @@ class AllowAppRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit AllowAppRequest(const MessageSharedPtr& message); + AllowAppRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AllowAppRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h index 6bedf30a38..4f2642f550 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/allow_app_response.h @@ -49,7 +49,8 @@ class AllowAppResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit AllowAppResponse(const MessageSharedPtr& message); + AllowAppResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AllowAppResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h index 867596f189..d9aaff7797 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief BasicCommunicationSystemRequest command class **/ class BasicCommunicationSystemRequest : public RequestToHMI { - public: - /** - * @brief BasicCommunicationSystemRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit BasicCommunicationSystemRequest(const MessageSharedPtr& message); + public: + /** + * @brief BasicCommunicationSystemRequest class constructor + * + * @param message Incoming SmartObject message + **/ + BasicCommunicationSystemRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief BasicCommunicationSystemRequest class destructor - **/ - virtual ~BasicCommunicationSystemRequest(); + /** + * @brief BasicCommunicationSystemRequest class destructor + **/ + virtual ~BasicCommunicationSystemRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemRequest); + private: + DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h index 5c174eac85..b7d4f8f689 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_system_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief BasicCommunicationSystemResponse command class **/ class BasicCommunicationSystemResponse : public ResponseFromHMI { - public: - /** - * @brief BasicCommunicationSystemResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit BasicCommunicationSystemResponse(const MessageSharedPtr& message); + public: + /** + * @brief BasicCommunicationSystemResponse class constructor + * + * @param message Incoming SmartObject message + **/ + BasicCommunicationSystemResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief BasicCommunicationSystemResponse class destructor - **/ - virtual ~BasicCommunicationSystemResponse(); + /** + * @brief BasicCommunicationSystemResponse class destructor + **/ + virtual ~BasicCommunicationSystemResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemResponse); + private: + DISALLOW_COPY_AND_ASSIGN(BasicCommunicationSystemResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h index 639800a047..45dc690c6c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_request.h @@ -49,7 +49,8 @@ class ButtonGetCapabilitiesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit ButtonGetCapabilitiesRequest(const MessageSharedPtr& message); + ButtonGetCapabilitiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ButtonGetCapabilitiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h index 7cd174477b..4efa576079 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/button_get_capabilities_response.h @@ -49,7 +49,8 @@ class ButtonGetCapabilitiesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit ButtonGetCapabilitiesResponse(const MessageSharedPtr& message); + ButtonGetCapabilitiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ButtonGetCapabilitiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h index 34722bc4f1..d7d4d18d97 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_request.h @@ -49,7 +49,8 @@ class ClosePopupRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit ClosePopupRequest(const MessageSharedPtr& message); + ClosePopupRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ClosePopupRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h index ce3a6d2936..6dccad7b57 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/close_popup_response.h @@ -49,7 +49,8 @@ class ClosePopupResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit ClosePopupResponse(const MessageSharedPtr& message); + ClosePopupResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ClosePopupResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h index 7d59abdadd..2b002c31dd 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Ford Motor Company + * Copyright (c) 2013, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,23 +50,24 @@ class DialNumberRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit DialNumberRequest(const MessageSharedPtr& message); + DialNumberRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DialNumberRequest class destructor **/ - ~DialNumberRequest() OVERRIDE; + virtual ~DialNumberRequest(); /** * @brief Execute command **/ - void Run() OVERRIDE; + virtual void Run(); private: DISALLOW_COPY_AND_ASSIGN(DialNumberRequest); }; -} // namespace hmi +} // namespace hmi } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h index 93a2e06c5f..1fbef15307 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Ford Motor Company + * Copyright (c) 2013, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,23 +51,24 @@ class DialNumberResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit DialNumberResponse(const MessageSharedPtr& message); + DialNumberResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DialNumberResponse class destructor **/ - ~DialNumberResponse() OVERRIDE; + virtual ~DialNumberResponse(); /** * @brief Execute command **/ - void Run() OVERRIDE; + virtual void Run(); private: DISALLOW_COPY_AND_ASSIGN(DialNumberResponse); }; -} // namespace hmi +} // namespace hmi } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h index 8262dbb6fa..f4e421473c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief GetSystemInfoRequest command class **/ class GetSystemInfoRequest : public RequestToHMI { - public: - /** - * @brief GetSystemInfoRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit GetSystemInfoRequest(const MessageSharedPtr& message); + public: + /** + * @brief GetSystemInfoRequest class constructor + * + * @param message Incoming SmartObject message + **/ + GetSystemInfoRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief GetSystemInfoRequest class destructor - **/ - virtual ~GetSystemInfoRequest(); + /** + * @brief GetSystemInfoRequest class destructor + **/ + virtual ~GetSystemInfoRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest); + private: + DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h index 70983d3ce3..766a2869d9 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/get_system_info_response.h @@ -34,35 +34,46 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_GET_SYSTEM_INFO_RESPONSE_H_ #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { +struct SystemInfo { + std::string ccpu_version; + std::string wers_country_code; + std::string language; +}; + /** * @brief GetSystemInfoResponse command class **/ class GetSystemInfoResponse : public ResponseFromHMI { - public: - /** - * @brief GetSystemInfoResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit GetSystemInfoResponse(const MessageSharedPtr& message); + public: + /** + * @brief GetSystemInfoResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetSystemInfoResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief GetSystemInfoResponse class destructor + **/ + virtual ~GetSystemInfoResponse(); - /** - * @brief GetSystemInfoResponse class destructor - **/ - virtual ~GetSystemInfoResponse(); + /** + * @brief Execute command + **/ + virtual void Run(); - /** - * @brief Execute command - **/ - virtual void Run(); + private: + const SystemInfo GetSystemInfo( + const hmi_apis::Common_Result::eType code) const; - private: - DISALLOW_COPY_AND_ASSIGN(GetSystemInfoResponse); + DISALLOW_COPY_AND_ASSIGN(GetSystemInfoResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h b/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h index ac7cf80ac2..5f75f42d5c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/get_urls.h @@ -38,51 +38,60 @@ namespace application_manager { namespace commands { - +namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; /** * @brief GetUrls command class **/ class GetUrls : public RequestFromHMI { - public: - /** - * @brief GetUrls class constructor - * - * @param message Incoming SmartObject message - **/ - explicit GetUrls(const MessageSharedPtr& message); + public: + /** + * @brief GetUrls class constructor + * + * @param message Incoming SmartObject message + **/ + GetUrls(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief GetUrls class destructor - **/ - virtual ~GetUrls(); + /** + * @brief GetUrls class destructor + **/ + virtual ~GetUrls(); - /** - * @brief Execute command - **/ - void Run() OVERRIDE; + /** + * @brief Execute command + **/ + void Run() OVERRIDE; - private: + private: #ifdef EXTENDED_POLICY - /** - * @brief Processes URLs collecting for policy service - * @param endpoints Endpoints section of policy table - */ - void ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints); + /** + * @brief Processes URLs collecting for policy service + * @param endpoints Endpoints section of policy table + */ + void ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints); #endif - /** - * @brief Process URLs collecting for service - * @param endpoints Endpoints section of policy table - */ - void ProcessServiceURLs(const policy::EndpointUrls& endpoints); + /** + * @brief Process URLs collecting for service + * @param endpoints Endpoints section of policy table + */ + void ProcessServiceURLs(const policy::EndpointUrls& endpoints); + + /** + * @brief Sends response to HMI + * @param result Result code + */ + void SendResponseToHMI(hmi_apis::Common_Result::eType result); - /** - * @brief Sends response to HMI - * @param result Result code - */ - void SendResponseToHMI(hmi_apis::Common_Result::eType result); + /** + * @brief fills structure for sending to HMI with default urls + * @param urls structure for filling + * @param endpoints Endpoints section of policy table + */ + void FillSODefaultUrls(smart_objects::SmartObject& urls, + const policy::EndpointUrls& endpoints); - DISALLOW_COPY_AND_ASSIGN(GetUrls); + DISALLOW_COPY_AND_ASSIGN(GetUrls); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h b/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h index 956e5a788e..1ca9ba93db 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/get_urls_response.h @@ -39,26 +39,27 @@ namespace application_manager { namespace commands { class GetUrlsResponse : public ResponseToHMI { - public: - /** - * @brief GetUrlsResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit GetUrlsResponse(const MessageSharedPtr& message); + public: + /** + * @brief GetUrlsResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetUrlsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief GetUrlsResponse class destructor - **/ - virtual ~GetUrlsResponse(); + /** + * @brief GetUrlsResponse class destructor + **/ + virtual ~GetUrlsResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(GetUrlsResponse); + private: + DISALLOW_COPY_AND_ASSIGN(GetUrlsResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h index 2957693c9e..4989208f7a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_request.h @@ -49,7 +49,8 @@ class MixingAudioSupportedRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit MixingAudioSupportedRequest(const MessageSharedPtr& message); + MixingAudioSupportedRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief MixingAudioSupportedRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h index e2b5affe34..a0cf89f558 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/mixing_audio_supported_response.h @@ -49,7 +49,8 @@ class MixingAudioSupportedResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit MixingAudioSupportedResponse(const MessageSharedPtr& message); + MixingAudioSupportedResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief MixingAudioSupportedResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h index 58f85f829a..123c0ab0d6 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_request.h @@ -49,7 +49,8 @@ class NaviAlertManeuverRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit NaviAlertManeuverRequest(const MessageSharedPtr& message); + NaviAlertManeuverRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviAlertManeuverRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h index 11f46d5da8..d4a57e9e2f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_alert_maneuver_response.h @@ -49,7 +49,8 @@ class NaviAlertManeuverResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviAlertManeuverResponse(const MessageSharedPtr& message); + NaviAlertManeuverResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviAlertManeuverResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h index 3e95c6b16b..d6f4fd36e2 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_request.h @@ -50,19 +50,19 @@ class AudioStartStreamRequest : public RequestToHMI, * * @param message Incoming SmartObject message **/ - explicit AudioStartStreamRequest(const MessageSharedPtr& message); + AudioStartStreamRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnNaviStartStreamRequest class destructor **/ virtual ~AudioStartStreamRequest(); - /** - * @brief onTimeOut from requrst Controller - */ + /** + * @brief onTimeOut from requrst Controller + */ virtual void onTimeOut(); - /** * @brief Execute command **/ @@ -73,13 +73,13 @@ class AudioStartStreamRequest : public RequestToHMI, **/ virtual void on_event(const event_engine::Event& event); - /** - * @brief RetryStartSession resend HMI startSession request if needed. - * If limit expired, set audio_stream_retry_number counter to 0 - */ + /** + * @brief RetryStartSession resend HMI startSession request if needed. + * If limit expired, set audio_stream_retry_number counter to 0 + */ void RetryStartSession(); - private: + private: uint32_t retry_number_; DISALLOW_COPY_AND_ASSIGN(AudioStartStreamRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h index 01992eb3b7..485b510bf2 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_start_stream_response.h @@ -48,7 +48,8 @@ class AudioStartStreamResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit AudioStartStreamResponse(const MessageSharedPtr& message); + AudioStartStreamResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AudioStartStreamResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h index 04bba8b752..3a21e3e827 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h @@ -48,7 +48,8 @@ class AudioStopStreamRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit AudioStopStreamRequest(const MessageSharedPtr& message); + AudioStopStreamRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviStopStreamRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h index 7275ac34d8..ce32d5b627 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h @@ -48,7 +48,8 @@ class AudioStopStreamResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit AudioStopStreamResponse(const MessageSharedPtr& message); + AudioStopStreamResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnNaviStopStreamResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h new file mode 100644 index 0000000000..33c5dfe2db --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviGetWayPointsRequest command class + **/ +class NaviGetWayPointsRequest : public RequestToHMI { + public: + /** + * @brief NaviGetWayPointsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + NaviGetWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + /** + * @brief NaviGetWayPointsRequest class destructor + **/ + virtual ~NaviGetWayPointsRequest(); + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviGetWayPointsRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h index ceba0528fa..633d927715 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,43 +30,44 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_ -#include "application_manager/commands/hmi/notification_to_hmi.h" +#include "application_manager/commands/hmi/response_from_hmi.h" namespace application_manager { namespace commands { /** - * @brief OnPlayToneNotification command class + * @brief NaviGetWaypoints command class **/ -class OnPlayToneNotification : public NotificationToHMI { +class NaviGetWayPointsResponse : public ResponseFromHMI { public: /** - * @brief OnPlayToneNotification class constructor + * @brief NaviGetWaypoints class constructor * * @param message Incoming SmartObject message **/ - explicit OnPlayToneNotification(const MessageSharedPtr& message); + NaviGetWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** - * @brief OnPlayToneNotification class destructor + * @brief NaviGetWaypoints class destructor **/ - virtual ~OnPlayToneNotification(); + virtual ~NaviGetWayPointsResponse(); /** * @brief Execute command **/ - virtual void Run(); + virtual void Run() OVERRIDE; private: - DISALLOW_COPY_AND_ASSIGN(OnPlayToneNotification); + DISALLOW_COPY_AND_ASSIGN(NaviGetWayPointsResponse); }; } // namespace commands } // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h index e779ecb699..9f1adaeee0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h @@ -49,7 +49,8 @@ class NaviIsReadyRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit NaviIsReadyRequest(const MessageSharedPtr& message); + NaviIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviIsReadyRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h index 3da6933bc3..72c001b863 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_response.h @@ -49,7 +49,8 @@ class NaviIsReadyResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviIsReadyResponse(const MessageSharedPtr& message); + NaviIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviIsReadyResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h index 45474b532a..56a9594c0b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_request.h @@ -49,7 +49,8 @@ class NaviSendLocationRequest : public RequestToHMI { * * @param message Incoming SmartObject message */ - explicit NaviSendLocationRequest(const MessageSharedPtr& message); + NaviSendLocationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviSendLocationRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h index ef9a605c36..ec3392642a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_send_location_response.h @@ -49,7 +49,8 @@ class NaviSendLocationResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message */ - explicit NaviSendLocationResponse(const MessageSharedPtr& message); + NaviSendLocationResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviSendLocationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h index b866ce3e1f..4cb8ddd7f7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h @@ -49,7 +49,8 @@ class NaviShowConstantTBTRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit NaviShowConstantTBTRequest(const MessageSharedPtr& message); + NaviShowConstantTBTRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviShowConstantTBTRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h index 3f212985f9..d9e7b1d234 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h @@ -49,7 +49,8 @@ class NaviShowConstantTBTResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviShowConstantTBTResponse(const MessageSharedPtr& message); + NaviShowConstantTBTResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviShowConstantTBTResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h index 0e8cd39cc9..6fcb3f3267 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_request.h @@ -44,44 +44,44 @@ namespace commands { **/ class NaviStartStreamRequest : public RequestToHMI, public event_engine::EventObserver { - public: - /** - * @brief NaviStartStreamRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit NaviStartStreamRequest(const MessageSharedPtr& message); - - /** - * @brief OnNaviStartStreamRequest class destructor - **/ - virtual ~NaviStartStreamRequest(); - - /** - * @brief Execute command - **/ - virtual void Run(); + public: + /** + * @brief NaviStartStreamRequest class constructor + * + * @param message Incoming SmartObject message + **/ + NaviStartStreamRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief On event callback - **/ - virtual void on_event(const event_engine::Event& event); + /** + * @brief OnNaviStartStreamRequest class destructor + **/ + virtual ~NaviStartStreamRequest(); - /** - * @brief onTimeOut from requrst Controller - */ - virtual void onTimeOut(); + /** + * @brief Execute command + **/ + virtual void Run(); + /** + * @brief On event callback + **/ + virtual void on_event(const event_engine::Event& event); - /** - * @brief RetryStartSession resend HMI startSession request if needed. - * If limit expired, set video_stream_retry_number counter to 0 + /** + * @brief onTimeOut from requrst Controller */ - void RetryStartSession(); + virtual void onTimeOut(); + + /** + * @brief RetryStartSession resend HMI startSession request if needed. + * If limit expired, set video_stream_retry_number counter to 0 + */ + void RetryStartSession(); - private: - uint32_t retry_number_; - DISALLOW_COPY_AND_ASSIGN(NaviStartStreamRequest); + private: + uint32_t retry_number_; + DISALLOW_COPY_AND_ASSIGN(NaviStartStreamRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h index c94b6f219c..3e18767194 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_start_stream_response.h @@ -48,7 +48,8 @@ class NaviStartStreamResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviStartStreamResponse(const MessageSharedPtr& message); + NaviStartStreamResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviStartStreamResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h index 86b0981c22..d6952d0305 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_request.h @@ -48,7 +48,8 @@ class NaviStopStreamRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit NaviStopStreamRequest(const MessageSharedPtr& message); + NaviStopStreamRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviStopStreamRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h index 6f4986e4c7..b3107b5e61 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_stop_stream_response.h @@ -48,7 +48,8 @@ class NaviStopStreamResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviStopStreamResponse(const MessageSharedPtr& message); + NaviStopStreamResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnNaviStopStreamResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h new file mode 100644 index 0000000000..33a2077918 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_request.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviSubscribeWayPointsRequest command class + **/ +class NaviSubscribeWayPointsRequest : public RequestToHMI { + public: + /** + * @brief NaviSubscribeWayPointsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + NaviSubscribeWayPointsRequest(const MessageSharedPtr& messag, + ApplicationManager& application_manager); + /** + * @brief NaviSubscribeWayPointsRequest class destructor + **/ + virtual ~NaviSubscribeWayPointsRequest(); + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h new file mode 100644 index 0000000000..eff2b281f2 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_subscribe_way_points_response.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviSubscribeWaypoints command class + **/ +class NaviSubscribeWayPointsResponse : public ResponseFromHMI { + public: + /** + * @brief NaviSubscribeWaypoints class constructor + * + * @param message Incoming SmartObject message + **/ + NaviSubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief NaviSubscribeWaypoints class destructor + **/ + virtual ~NaviSubscribeWayPointsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h new file mode 100644 index 0000000000..607bb1ef26 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_request.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviSubscribeWayPointsRequest command class + **/ +class NaviUnSubscribeWayPointsRequest : public RequestToHMI { + public: + /** + * @brief NaviUnSubscribeWayPointsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + NaviUnSubscribeWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + /** + * @brief NaviUnSubscribeWayPointsRequest class destructor + **/ + virtual ~NaviUnSubscribeWayPointsRequest(); + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviUnSubscribeWayPointsRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h new file mode 100644 index 0000000000..936814f2fe --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_unsubscribe_way_points_response.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief NaviUnSubscribeWaypoints command class + **/ +class NaviUnsubscribeWayPointsResponse : public ResponseFromHMI { + public: + /** + * @brief NaviUnSubscribeWaypoints class constructor + * + * @param message Incoming SmartObject message + **/ + NaviUnsubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief NaviUnSubscribeWaypoints class destructor + **/ + virtual ~NaviUnsubscribeWayPointsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(NaviUnsubscribeWayPointsResponse); +}; + +} // namespace commands + +} // namespace application_manager +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h index a5e2f8bf37..830e9358ec 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_request.h @@ -49,7 +49,8 @@ class NaviUpdateTurnListRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit NaviUpdateTurnListRequest(const MessageSharedPtr& message); + NaviUpdateTurnListRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviUpdateTurnListRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h index 0e15a9175c..93c714b4f4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_update_turn_list_response.h @@ -49,7 +49,8 @@ class NaviUpdateTurnListResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit NaviUpdateTurnListResponse(const MessageSharedPtr& message); + NaviUpdateTurnListResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief NaviUpdateTurnListResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h index 1dcae4366d..c74108ccf0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/notification_from_hmi.h @@ -50,14 +50,16 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; class NotificationFromHMI : public CommandImpl { public: - explicit NotificationFromHMI(const MessageSharedPtr& message); + NotificationFromHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~NotificationFromHMI(); virtual bool Init(); virtual bool CleanUp(); virtual void Run(); void SendNotificationToMobile(const MessageSharedPtr& message); void CreateHMIRequest(const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject& msg_params) const; + const smart_objects::SmartObject& msg_params) const; + private: DISALLOW_COPY_AND_ASSIGN(NotificationFromHMI); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h index 2372754b63..dd2db8804a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/notification_to_hmi.h @@ -41,12 +41,14 @@ namespace commands { class NotificationToHMI : public CommandImpl { public: - explicit NotificationToHMI(const MessageSharedPtr& message); + NotificationToHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~NotificationToHMI(); virtual bool Init(); virtual bool CleanUp(); virtual void Run(); void SendNotification(); + private: DISALLOW_COPY_AND_ASSIGN(NotificationToHMI); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h index 6ec14e35b0..ee7d22b859 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnAllowSDLFunctionalityNotification command class **/ class OnAllowSDLFunctionalityNotification : public NotificationFromHMI { - public: - /** - * @brief OnAllowSDLFunctionalityNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnAllowSDLFunctionalityNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnAllowSDLFunctionalityNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAllowSDLFunctionalityNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnAllowSDLFunctionalityNotification class destructor - **/ - virtual ~OnAllowSDLFunctionalityNotification(); + /** + * @brief OnAllowSDLFunctionalityNotification class destructor + **/ + virtual ~OnAllowSDLFunctionalityNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnAllowSDLFunctionalityNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnAllowSDLFunctionalityNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h index 011df3832c..a1de12b4d6 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_activated_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnAppActivatedNotification command class **/ class OnAppActivatedNotification : public NotificationFromHMI { - public: - /** - * @brief OnAppActivatedNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnAppActivatedNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnAppActivatedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppActivatedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnAppActivatedNotification class destructor - **/ - virtual ~OnAppActivatedNotification(); + /** + * @brief OnAppActivatedNotification class destructor + **/ + virtual ~OnAppActivatedNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnAppActivatedNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnAppActivatedNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h index 8731fc43f1..687d492a01 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_deactivated_notification.h @@ -49,7 +49,8 @@ class OnAppDeactivatedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnAppDeactivatedNotification(const MessageSharedPtr& message); + OnAppDeactivatedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnAppDeactivatedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h index c6ea82a15c..bdaf6d1119 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_changed_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnAppPermissionChangedNotification command class **/ class OnAppPermissionChangedNotification : public NotificationToHMI { - public: - /** - * @brief OnAppPermissionChangedNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnAppPermissionChangedNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnAppPermissionChangedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppPermissionChangedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnAppPermissionChangedNotification class destructor - **/ - virtual ~OnAppPermissionChangedNotification(); + /** + * @brief OnAppPermissionChangedNotification class destructor + **/ + virtual ~OnAppPermissionChangedNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnAppPermissionChangedNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnAppPermissionChangedNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h index ea36d55b39..5cafe0c1b5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_permission_consent_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnAppPermissionConsentNotification command class **/ class OnAppPermissionConsentNotification : public NotificationFromHMI { - public: - /** - * @brief OnAppPermissionConsentNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnAppPermissionConsentNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnAppPermissionConsentNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppPermissionConsentNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnAppPermissionConsentNotification class destructor - **/ - virtual ~OnAppPermissionConsentNotification(); + /** + * @brief OnAppPermissionConsentNotification class destructor + **/ + virtual ~OnAppPermissionConsentNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnAppPermissionConsentNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnAppPermissionConsentNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h index 1ebbfcd483..58e92a977a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_registered_notification.h @@ -49,7 +49,8 @@ class OnAppRegisteredNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnAppRegisteredNotification(const MessageSharedPtr& message); + OnAppRegisteredNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnAppRegisteredNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h index 96fd19e9bc..980e558d6f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h @@ -49,7 +49,8 @@ class OnAppUnregisteredNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnAppUnregisteredNotification(const MessageSharedPtr& message); + OnAppUnregisteredNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnAppUnregisteredNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h index 97a979065e..121367ed90 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_audio_data_streaming_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnAudioDataStreamingNotification command class **/ class OnAudioDataStreamingNotification : public NotificationToHMI { - public: - /** - * @brief OnAudioDataStreamingNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnAudioDataStreamingNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnAudioDataStreamingNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAudioDataStreamingNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnAudioDataStreamingNotification class destructor - **/ - virtual ~OnAudioDataStreamingNotification(); + /** + * @brief OnAudioDataStreamingNotification class destructor + **/ + virtual ~OnAudioDataStreamingNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnAudioDataStreamingNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnAudioDataStreamingNotification); }; } // namespace commands @@ -70,4 +71,3 @@ class OnAudioDataStreamingNotification : public NotificationToHMI { } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_AUDIO_DATA_STREAMING_NOTIFICATION_H_ - diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h index 0a56d7d924..f294bce2c8 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_event_notification.h @@ -53,7 +53,8 @@ class OnButtonEventNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnButtonEventNotification(const MessageSharedPtr& message); + OnButtonEventNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief Execute command @@ -64,7 +65,7 @@ class OnButtonEventNotification : public NotificationFromHMI { DISALLOW_COPY_AND_ASSIGN(OnButtonEventNotification); }; -} // namespace hmi +} // namespace hmi } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h index ce5f1de8f1..8936ed8a0f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_press_notification.h @@ -53,7 +53,8 @@ class OnButtonPressNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnButtonPressNotification(const MessageSharedPtr& message); + OnButtonPressNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h index c046380cd7..d98ba3a90b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_button_subscription_notification.h @@ -51,7 +51,8 @@ class OnButtonSubscriptionNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnButtonSubscriptionNotification(const MessageSharedPtr& message); + OnButtonSubscriptionNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnButtonSubscriptionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h index 17ba26b7f7..5345135583 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_device_chosen_notification.h @@ -49,7 +49,8 @@ class OnDeviceChosenNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnDeviceChosenNotification(const MessageSharedPtr& message); + OnDeviceChosenNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnDeviceChosenNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h index b87a6e2d9f..62a87f4599 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_device_state_changed_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnDeviceStateChangedNotification command class **/ class OnDeviceStateChangedNotification : public NotificationFromHMI { - public: - /** - * @brief OnDeviceStateChangedNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnDeviceStateChangedNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnDeviceStateChangedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnDeviceStateChangedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnDeviceStateChangedNotification class destructor - **/ - virtual ~OnDeviceStateChangedNotification(); + /** + * @brief OnDeviceStateChangedNotification class destructor + **/ + virtual ~OnDeviceStateChangedNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnDeviceStateChangedNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnDeviceStateChangedNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h index 01a87aae05..69d1707bf7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_driver_distraction_notification.h @@ -53,7 +53,8 @@ class OnDriverDistractionNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnDriverDistractionNotification(const MessageSharedPtr& message); + OnDriverDistractionNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnDriverDistractionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_event_changed_notification.h index 45d831eb03..e066332d4c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_event_changed_notification.h @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" @@ -39,25 +39,23 @@ namespace application_manager { namespace commands { -namespace hmi { - - /** - * @brief OnPhoneCallNotification command class + * @brief OnEventChangedNotification command class **/ -class OnPhoneCallNotification : public NotificationFromHMI { +class OnEventChangedNotification : public NotificationFromHMI { public: /** - * @brief OnPhoneCallNotification class constructor + * @brief OnEventChangedNotification class constructor * * @param message Incoming SmartObject message **/ - explicit OnPhoneCallNotification(const MessageSharedPtr& message); + OnEventChangedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** - * @brief OnPhoneCallNotification class destructor + * @brief OnEventChangedNotification class destructor **/ - virtual ~OnPhoneCallNotification(); + virtual ~OnEventChangedNotification(); /** * @brief Execute command @@ -65,13 +63,11 @@ class OnPhoneCallNotification : public NotificationFromHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification); + DISALLOW_COPY_AND_ASSIGN(OnEventChangedNotification); }; -} // namespace hmi - } // namespace commands } // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h index 65d78f60c6..ad10a58bff 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h @@ -49,7 +49,8 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnExitAllApplicationsNotification(const MessageSharedPtr& message); + OnExitAllApplicationsNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnExitAllApplicationsNotification class destructor @@ -62,7 +63,6 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI { virtual void Run(); private: - /** * @brief Notify's HMI that SDL stored all data required for resumption **/ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h index 479dd3a09c..275b266b98 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_application_notification.h @@ -49,7 +49,8 @@ class OnExitApplicationNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnExitApplicationNotification(const MessageSharedPtr& message); + OnExitApplicationNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnExitApplicationNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h index cc47705c82..3f1ac17fc4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_file_removed_notification.h @@ -49,7 +49,8 @@ class OnFileRemovedNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnFileRemovedNotification(const MessageSharedPtr& message); + OnFileRemovedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnFileRemovedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h b/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h index f9fb9cdb21..32db73c2f5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_find_applications.h @@ -49,7 +49,8 @@ class OnFindApplications : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnFindApplications(const MessageSharedPtr& message); + OnFindApplications(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnFindApplications class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h index f8fccdc382..acb1ff31ac 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h @@ -50,7 +50,8 @@ class OnIgnitionCycleOverNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnIgnitionCycleOverNotification(const MessageSharedPtr& message); + OnIgnitionCycleOverNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnIgnitionCycleOverNotification class destructor @@ -63,7 +64,6 @@ class OnIgnitionCycleOverNotification : public NotificationFromHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnIgnitionCycleOverNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h index a657ffcc68..0150853546 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_TBT_CLIENT_STATE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnNaviTBTClientStateNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnNaviTBTClientStateNotification(const MessageSharedPtr& message); + OnNaviTBTClientStateNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnNaviTBTClientStateNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h new file mode 100644 index 0000000000..d304685008 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_navi_way_point_change_notification.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_ + +#include "application_manager/commands/hmi/notification_from_hmi.h" +#include "application_manager/application_manager.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief OnNaviWayPointChangeNotification command class + **/ +class OnNaviWayPointChangeNotification : public NotificationFromHMI { + public: + /** + * @brief OnNaviWayPointChangeNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnNaviWayPointChangeNotification(const MessageSharedPtr& message, + ApplicationManager& app_man); + + /** + * @brief OnNaviWayPointChangeNotification class destructor + **/ + virtual ~OnNaviWayPointChangeNotification(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(OnNaviWayPointChangeNotification); +}; + +} // namespace commands + +} // namespace application_manager +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h index 81278fb75a..d4380048ee 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_policy_update.h @@ -39,26 +39,27 @@ namespace application_manager { namespace commands { class OnPolicyUpdate : public NotificationFromHMI { - public: - /** - * @brief OnPolicyUpdate class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnPolicyUpdate(const MessageSharedPtr& message); + public: + /** + * @brief OnPolicyUpdate class constructor + * + * @param message Incoming SmartObject message + **/ + OnPolicyUpdate(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnPolicyUpdate class destructor - **/ - virtual ~OnPolicyUpdate(); + /** + * @brief OnPolicyUpdate class destructor + **/ + virtual ~OnPolicyUpdate(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnPolicyUpdate); + private: + DISALLOW_COPY_AND_ASSIGN(OnPolicyUpdate); }; } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h index bc60284309..809623fda0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_put_file_notification.h @@ -50,7 +50,8 @@ class OnPutFileNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnPutFileNotification(const MessageSharedPtr& message); + OnPutFileNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnPutFileNotification class destructor @@ -63,7 +64,6 @@ class OnPutFileNotification : public NotificationToHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnPutFileNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h index 24fc52deac..7df1bf5ac0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ready_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_READY_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnReadyNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnReadyNotification(const MessageSharedPtr& message); + OnReadyNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnReadyNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h index 4b61deef4f..4c2eacdae3 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h @@ -46,7 +46,8 @@ class OnReceivedPolicyUpdate : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnReceivedPolicyUpdate(const MessageSharedPtr& message); + OnReceivedPolicyUpdate(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnReceivedPolicyUpdate class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h index 67cccdd816..fbb8a0522a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_record_start_notification.h @@ -49,7 +49,8 @@ class OnRecordStartdNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnRecordStartdNotification(const MessageSharedPtr& message); + OnRecordStartdNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnRecordStartdNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h index 03f84d0907..764ee6d180 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_resume_audio_source_notification.h @@ -50,7 +50,8 @@ class OnResumeAudioSourceNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnResumeAudioSourceNotification(const MessageSharedPtr& message); + OnResumeAudioSourceNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnResumeAudioSourceNotification class destructor @@ -63,7 +64,6 @@ class OnResumeAudioSourceNotification : public NotificationToHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnResumeAudioSourceNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h index 5b9ac04e8f..ef1d289ca7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_close_notification.h @@ -49,7 +49,8 @@ class OnSDLCloseNotification : public NotificationToHMI { * * @param message Incoming SmartObject message **/ - explicit OnSDLCloseNotification(const MessageSharedPtr& message); + OnSDLCloseNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnSdlCloseNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h index 4f30873e4e..e54daab96f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnSDLConsentNeededNotification command class **/ class OnSDLConsentNeededNotification : public NotificationToHMI { - public: - /** - * @brief OnSDLConsentNeededNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnSDLConsentNeededNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnSDLConsentNeededNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnSDLConsentNeededNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnSDLConsentNeededNotification class destructor - **/ - virtual ~OnSDLConsentNeededNotification(); + /** + * @brief OnSDLConsentNeededNotification class destructor + **/ + virtual ~OnSDLConsentNeededNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnSDLConsentNeededNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnSDLConsentNeededNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h index 6f8f3a6e1a..6ac04b488b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnSDLPersistenceCompleteNotification command class **/ class OnSDLPersistenceCompleteNotification : public NotificationToHMI { - public: - /** - * @brief OnSDLPersistenceCompleteNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnSDLPersistenceCompleteNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnSDLPersistenceCompleteNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnSDLPersistenceCompleteNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnSDLPersistenceCompleteNotification class destructor - **/ - virtual ~OnSDLPersistenceCompleteNotification(); + /** + * @brief OnSDLPersistenceCompleteNotification class destructor + **/ + virtual ~OnSDLPersistenceCompleteNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnSDLPersistenceCompleteNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnSDLPersistenceCompleteNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h b/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h index bfa14f67fc..dc40c1a614 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_start_device_discovery.h @@ -49,7 +49,8 @@ class OnStartDeviceDiscovery : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnStartDeviceDiscovery(const MessageSharedPtr& message); + OnStartDeviceDiscovery(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnStartDeviceDiscovery class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h index c123826886..62ee38c473 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_status_update_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnGetStatusUpdateNotification command class **/ class OnStatusUpdateNotification : public NotificationToHMI { - public: - /** - * @brief OnGetStatusUpdateNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnStatusUpdateNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnGetStatusUpdateNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnStatusUpdateNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnGetStatusUpdateNotification class destructor - **/ - virtual ~OnStatusUpdateNotification(); + /** + * @brief OnGetStatusUpdateNotification class destructor + **/ + virtual ~OnStatusUpdateNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnStatusUpdateNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnStatusUpdateNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h index 35d6f49daa..9008a20cc9 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h @@ -51,7 +51,8 @@ class OnSystemContextNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnSystemContextNotification(const MessageSharedPtr& message); + OnSystemContextNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnSystemContextNotification class destructor @@ -64,9 +65,6 @@ class OnSystemContextNotification : public NotificationFromHMI { virtual void Run(); private: - void SendSystemContextNotification(ApplicationSharedPtr app, - mobile_api::SystemContext::eType system_context); - DISALLOW_COPY_AND_ASSIGN(OnSystemContextNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h index ee7df7acd6..1e65b15c20 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_error_notification.h @@ -49,7 +49,8 @@ class OnSystemErrorNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnSystemErrorNotification(const MessageSharedPtr& message); + OnSystemErrorNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnSystemErrorNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h index 9b6c62782c..d709a5267c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_info_changed_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnSystemInfoChangedNotification command class **/ class OnSystemInfoChangedNotification : public NotificationFromHMI { - public: - /** - * @brief OnSystemInfoChangedNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnSystemInfoChangedNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnSystemInfoChangedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnSystemInfoChangedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnSystemInfoChangedNotification class destructor - **/ - virtual ~OnSystemInfoChangedNotification(); + /** + * @brief OnSystemInfoChangedNotification class destructor + **/ + virtual ~OnSystemInfoChangedNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnSystemInfoChangedNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnSystemInfoChangedNotification); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h index f1d25e24a4..8e4db24822 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_request_notification.h @@ -50,7 +50,8 @@ class OnSystemRequestNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnSystemRequestNotification(const MessageSharedPtr& message); + OnSystemRequestNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnSystemRequestNotification class destructor @@ -63,7 +64,6 @@ class OnSystemRequestNotification : public NotificationFromHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnSystemRequestNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h index 79ae9b496e..245dc32386 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_language_change_notification.h @@ -49,7 +49,8 @@ class OnTTSLanguageChangeNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnTTSLanguageChangeNotification(const MessageSharedPtr& message); + OnTTSLanguageChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTTSLanguageChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h index 11cb755544..be84a93215 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h @@ -51,7 +51,8 @@ class OnTTSResetTimeoutNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnTTSResetTimeoutNotification(const MessageSharedPtr& message); + OnTTSResetTimeoutNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTTSResetTimeoutNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h index c7e88ac558..234d8036eb 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_started_notification.h @@ -49,7 +49,8 @@ class OnTTSStartedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnTTSStartedNotification(const MessageSharedPtr& message); + OnTTSStartedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTTSStartedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h index bf5dc7fb9e..4e058fde64 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_tts_stopped_notification.h @@ -49,7 +49,8 @@ class OnTTSStoppedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject OnTTSStartedNotificationmessage **/ - explicit OnTTSStoppedNotification(const MessageSharedPtr& message); + OnTTSStoppedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTTSStoppedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h index b4a0228c78..618bc13017 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_command_notification.h @@ -49,7 +49,8 @@ class OnUICommandNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUICommandNotification(const MessageSharedPtr& message); + OnUICommandNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUICommandNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h index 77b771065b..6e881dc94a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_UI_KEYBOARD_INPUT_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -52,7 +52,8 @@ class OnUIKeyBoardInputNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUIKeyBoardInputNotification(const MessageSharedPtr& message); + OnUIKeyBoardInputNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUIKeyBoardInputNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h index bcb661c89d..cc8cd1eb0e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_language_change_notification.h @@ -49,7 +49,8 @@ class OnUILanguageChangeNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUILanguageChangeNotification(const MessageSharedPtr& message); + OnUILanguageChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUILanguageChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h index f97c8768b5..f5dd173998 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h @@ -51,7 +51,8 @@ class OnUIResetTimeoutNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUIResetTimeoutNotification(const MessageSharedPtr& message); + OnUIResetTimeoutNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUIResetTimeoutNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h index 6d8005e12f..9e9384fffe 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_ui_touch_event_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_UI_TOUCH_EVENT_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -52,7 +52,8 @@ class OnUITouchEventNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUITouchEventNotification(const MessageSharedPtr& message); + OnUITouchEventNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUITouchEventNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h b/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h index f56d01a5cc..ee53445606 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_update_device_list.h @@ -49,7 +49,8 @@ class OnUpdateDeviceList : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnUpdateDeviceList(const MessageSharedPtr& message); + OnUpdateDeviceList(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnUpdateDeviceList class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h index d591ab2be6..9c5a8cd955 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIAccPedalPositionNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIAccPedalPositionNotification(const MessageSharedPtr& message); + OnVIAccPedalPositionNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIAccPedalPositionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h index f901462fdf..c4f92269bb 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_belt_status_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIBeltStatusNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIBeltStatusNotification(const MessageSharedPtr& message); + OnVIBeltStatusNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIBeltStatusNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h index a0bc31778a..9d9854c50b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_body_information_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIBodyInformationNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIBodyInformationNotification(const MessageSharedPtr& message); + OnVIBodyInformationNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIBodyInformationNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h index 0e24616f3e..c31ee1f209 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_device_status_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIDeviceStatusNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIDeviceStatusNotification(const MessageSharedPtr& message); + OnVIDeviceStatusNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIDeviceStatusNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h index 0290388756..108f02b5a4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIDriverBrakingNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIDriverBrakingNotification(const MessageSharedPtr& message); + OnVIDriverBrakingNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIDriverBrakingNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h index 8307e5359e..bbd13963aa 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIEngineTorqueNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIEngineTorqueNotification(const MessageSharedPtr& message); + OnVIEngineTorqueNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIEngineTorqueNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h index be5b086853..b996febacf 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIExternalTemperatureNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIExternalTemperatureNotification(const MessageSharedPtr& message); + OnVIExternalTemperatureNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIExternalTemperatureNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h index 83e6f845e0..9c30b6c32c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIFuelLevelNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIFuelLevelNotification(const MessageSharedPtr& message); + OnVIFuelLevelNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIFuelLevelNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h index 42a6b8e0d9..53b6ea209f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIFuelLevelStateNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIFuelLevelStateNotification(const MessageSharedPtr& message); + OnVIFuelLevelStateNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIFuelLevelStateNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h index 01c2cf60b6..579344b538 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_gps_data_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIGpsDataNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIGpsDataNotification(const MessageSharedPtr& message); + OnVIGpsDataNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIGpsDataNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h index dc80b33ddd..5fd3be85a4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIHeadLampStatusNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIHeadLampStatusNotification(const MessageSharedPtr& message); + OnVIHeadLampStatusNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIHeadLampStatusNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h index c4e5accead..ee82b1397f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIInstantFuelConsumptionNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIInstantFuelConsumptionNotification(const MessageSharedPtr& message); + OnVIInstantFuelConsumptionNotification( + const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnVIInstantFuelConsumptionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h index e2d9d91ae1..364e42081c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_my_key_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIMyKeyNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIMyKeyNotification(const MessageSharedPtr& message); + OnVIMyKeyNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIMyKeyNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h index 7c1c691ac5..7d93530f04 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_odometer_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIOdometerNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIOdometerNotification(const MessageSharedPtr& message); + OnVIOdometerNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIOdometerNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h index bf2ca83f8f..c09220d2a6 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_prndl_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIPrndlNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIPrndlNotification(const MessageSharedPtr& message); + OnVIPrndlNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIPrndlNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h index ebcfe3a86c..d05e1221df 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_rpm_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIRpmNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIRpmNotification(const MessageSharedPtr& message); + OnVIRpmNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIRpmNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h index 37bf66e4d0..b1908cde28 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_speed_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVISpeedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVISpeedNotification(const MessageSharedPtr& message); + OnVISpeedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVISpeedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h index bf01b2bf76..28f78ac4d5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVISteeringWheelAngleNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVISteeringWheelAngleNotification(const MessageSharedPtr& message); + OnVISteeringWheelAngleNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVISteeringWheelAngleNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h index 1c1e00d893..eef4f0e4a4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVITirePressureNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVITirePressureNotification(const MessageSharedPtr& message); + OnVITirePressureNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVITirePressureNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h index 59da271a04..2422c47813 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_VEHICLE_DATA_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -51,7 +51,8 @@ class OnVIVehicleDataNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIVehicleDataNotification(const MessageSharedPtr& message); + OnVIVehicleDataNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIVehicleDataNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h index 06b73c508d..4ea04fbb0d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_vin_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIVinNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIVinNotification(const MessageSharedPtr& message); + OnVIVinNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIVinNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h index 399b38112e..2b57ef1dd3 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_ #include "application_manager/commands/hmi/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -50,7 +50,8 @@ class OnVIWiperStatusNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVIWiperStatusNotification(const MessageSharedPtr& message); + OnVIWiperStatusNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVIWiperStatusNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h index 38749ba8f8..02c65df4e9 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_video_data_streaming_notification.h @@ -43,26 +43,27 @@ namespace commands { * @brief OnVideoDataStreamingNotification command class **/ class OnVideoDataStreamingNotification : public NotificationToHMI { - public: - /** - * @brief OnVideoDataStreamingNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnVideoDataStreamingNotification(const MessageSharedPtr& message); + public: + /** + * @brief OnVideoDataStreamingNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnVideoDataStreamingNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnVideoDataStreamingNotification class destructor - **/ - virtual ~OnVideoDataStreamingNotification(); + /** + * @brief OnVideoDataStreamingNotification class destructor + **/ + virtual ~OnVideoDataStreamingNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(OnVideoDataStreamingNotification); + private: + DISALLOW_COPY_AND_ASSIGN(OnVideoDataStreamingNotification); }; } // namespace commands @@ -70,4 +71,3 @@ class OnVideoDataStreamingNotification : public NotificationToHMI { } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_VIDEO_DATA_STREAMING_NOTIFICATION_H_ - diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h index 37bc2556f8..fa85ba8468 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_command_notification.h @@ -50,7 +50,8 @@ class OnVRCommandNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVRCommandNotification(const MessageSharedPtr& message); + OnVRCommandNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVRCommandNotification class destructor @@ -63,7 +64,6 @@ class OnVRCommandNotification : public NotificationFromHMI { virtual void Run(); private: - DISALLOW_COPY_AND_ASSIGN(OnVRCommandNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h index be408f0aa0..d0f86e5f83 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_language_change_notification.h @@ -49,7 +49,8 @@ class OnVRLanguageChangeNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVRLanguageChangeNotification(const MessageSharedPtr& message); + OnVRLanguageChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVRLanguageChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h index 5ae5ace27b..f142fcc25c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_started_notification.h @@ -49,7 +49,8 @@ class OnVRStartedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVRStartedNotification(const MessageSharedPtr& message); + OnVRStartedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVRStartedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h index 311ee8acde..d1dbcc91cd 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_vr_stopped_notification.h @@ -49,7 +49,8 @@ class OnVRStoppedNotification : public NotificationFromHMI { * * @param message Incoming SmartObject message **/ - explicit OnVRStoppedNotification(const MessageSharedPtr& message); + OnVRStoppedNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVRStoppedNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h index 9cb5a9f99d..c435c41c47 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h @@ -1,75 +1,82 @@ - /* - 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. +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ + +#include "application_manager/commands/command_impl.h" +#include "interfaces/HMI_API.h" + +namespace NsSmartDeviceLink { +namespace NsSmartObjects { +class SmartObject; +} +} + +namespace application_manager { + +namespace commands { + +namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; + +class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { + public: + RequestFromHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); + virtual ~RequestFromHMI(); + virtual bool Init(); + virtual bool CleanUp(); + virtual void Run(); + virtual void on_event(const event_engine::Event& event); + /** + * @brief SendResponse allows to send response to hmi + * @param correlation_id the correlation id for the rfesponse. + * @param function_id the function id for which response will be sent + * @param result_code the result code. */ + void SendResponse(const bool success, + const uint32_t correlation_id, + const hmi_apis::FunctionID::eType function_id, + const hmi_apis::Common_Result::eType result_code); + + void FillCommonParametersOfSO(smart_objects::SmartObject* message, + uint32_t correlation_id, + hmi_apis::FunctionID::eType function_id); + + private: + DISALLOW_COPY_AND_ASSIGN(RequestFromHMI); +}; + +} // namespace commands +} // namespace application_manager - #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ - #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ - - #include "application_manager/commands/command_impl.h" - #include "interfaces/HMI_API.h" - - namespace NsSmartDeviceLink { - namespace NsSmartObjects { - class SmartObject; - } - } - - namespace application_manager { - - namespace commands { - - namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; - - class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { - public: - explicit RequestFromHMI(const MessageSharedPtr& message); - virtual ~RequestFromHMI(); - virtual bool Init(); - virtual bool CleanUp(); - virtual void Run(); - virtual void on_event(const event_engine::Event& event); - /** - * @brief SendResponse allows to send response to hmi - * @param correlation_id the correlation id for the rfesponse. - * @param function_id the function id for which response will be sent - * @param result_code the result code. - */ - void SendResponse(uint32_t correlation_id, - hmi_apis::FunctionID::eType function_id, - hmi_apis::Common_Result::eType result_code); - private: - DISALLOW_COPY_AND_ASSIGN(RequestFromHMI); - }; - - } // namespace commands - } // namespace application_manager - - #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_FROM_HMI_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h index fe359182dd..e512279e79 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h @@ -34,15 +34,16 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_REQUEST_TO_HMI_H_ #include "application_manager/commands/command_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { - class RequestToHMI : public CommandImpl { public: - explicit RequestToHMI(const MessageSharedPtr& message); + RequestToHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~RequestToHMI(); virtual bool Init(); virtual bool CleanUp(); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h index 7769caa0a7..a5d41252f5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/response_from_hmi.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_RESPONSE_FROM_HMI_H_ #include "application_manager/commands/command_impl.h" +#include "application_manager/application_manager.h" #include "interfaces/HMI_API.h" namespace NsSmartDeviceLink { @@ -50,12 +51,14 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; class ResponseFromHMI : public CommandImpl { public: - explicit ResponseFromHMI(const MessageSharedPtr& message); + ResponseFromHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~ResponseFromHMI(); virtual bool Init(); virtual bool CleanUp(); virtual void Run(); - void SendResponseToMobile(const MessageSharedPtr& message); + void SendResponseToMobile(const MessageSharedPtr& message, + ApplicationManager& application_manager); /* * @brief Creates HMI request diff --git a/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h index ce9e9469d0..f00e57ff3a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/response_to_hmi.h @@ -51,7 +51,8 @@ namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; class ResponseToHMI : public CommandImpl { public: - explicit ResponseToHMI(const MessageSharedPtr& message); + ResponseToHMI(const MessageSharedPtr& message, + ApplicationManager& application_manager); virtual ~ResponseToHMI(); virtual bool Init(); virtual bool CleanUp(); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h index 58a7e9ecda..0dff904955 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_request.h @@ -34,54 +34,74 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_SDL_ACTIVATE_APP_REQUEST_H_ #include "application_manager/commands/hmi/request_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { - typedef std::pair<ApplicationSharedPtr, std::vector<ApplicationSharedPtr> > DevicesApps; /** * @brief SDLActivateAppRequest command class **/ class SDLActivateAppRequest : public RequestFromHMI { - public: - /** - * @brief SDLActivateAppRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLActivateAppRequest(const MessageSharedPtr& message); - - /** - * @brief SDLActivateAppRequest class destructor - **/ - virtual ~SDLActivateAppRequest(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - /** - * @brief onTimeOut allows to process case when timeout has appeared - * during request execution. - */ - virtual void onTimeOut(); - - /** - * @brief on_event allows to handle events - * - * @param event event type that current request subscribed on. - */ - virtual void on_event(const event_engine::Event& event); - private: - uint32_t app_id() const; - uint32_t hmi_app_id(const smart_objects::SmartObject& so) const; - - DevicesApps FindAllAppOnParticularDevice( - const connection_handler::DeviceHandle handle); - DISALLOW_COPY_AND_ASSIGN(SDLActivateAppRequest); + public: + /** + * @brief Applications registered over protocol v4 + */ + typedef std::vector<application_manager::ApplicationSharedPtr> V4ProtoApps; + + /** + * @brief SDLActivateAppRequest class constructor + * + * @param message Incoming SmartObject message + **/ + SDLActivateAppRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief SDLActivateAppRequest class destructor + **/ + ~SDLActivateAppRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief onTimeOut allows to process case when timeout has appeared + * during request execution. + */ + void onTimeOut() OVERRIDE; + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const event_engine::Event& event) OVERRIDE; + + private: + uint32_t app_id() const; + uint32_t hmi_app_id(const smart_objects::SmartObject& so) const; + + /** + * @brief Retrieves all v4 protocol applications for particular device + * @param handle Device handle + * @return List of applications registered over v4 protocol + */ + V4ProtoApps get_v4_proto_apps( + const connection_handler::DeviceHandle handle) const; + + /** + * @brief Get v4 protocol application reported as forgrounded on device + * @param handle Device + * @return Pointer to application or empty pointer + */ + ApplicationSharedPtr get_foreground_app( + const connection_handler::DeviceHandle handle) const; + + DISALLOW_COPY_AND_ASSIGN(SDLActivateAppRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h index bf0789e60e..f35a295581 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_activate_app_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLActivateAppResponse command class **/ class SDLActivateAppResponse : public ResponseToHMI { - public: - /** - * @brief SDLActivateAppResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLActivateAppResponse(const MessageSharedPtr& message); + public: + /** + * @brief SDLActivateAppResponse class constructor + * + * @param message Incoming SmartObject message + **/ + SDLActivateAppResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLActivateAppResponse class destructor - **/ - virtual ~SDLActivateAppResponse(); + /** + * @brief SDLActivateAppResponse class destructor + **/ + virtual ~SDLActivateAppResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLActivateAppResponse); + private: + DISALLOW_COPY_AND_ASSIGN(SDLActivateAppResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h index 7c8f10529b..4f8d598322 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLGetListOfPermissionsRequest command class **/ class SDLGetListOfPermissionsRequest : public RequestFromHMI { - public: - /** - * @brief SDLGetListOfPermissionsRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetListOfPermissionsRequest(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetListOfPermissionsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetListOfPermissionsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetListOfPermissionsRequest class destructor - **/ - virtual ~SDLGetListOfPermissionsRequest(); + /** + * @brief SDLGetListOfPermissionsRequest class destructor + **/ + virtual ~SDLGetListOfPermissionsRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsRequest); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h index 452784d92c..e00e613e70 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLGetListOfPermissionsResponse command class **/ class SDLGetListOfPermissionsResponse : public ResponseToHMI { - public: - /** - * @brief SDLGetListOfPermissionsResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetListOfPermissionsResponse(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetListOfPermissionsResponse class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetListOfPermissionsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetListOfPermissionsResponse class destructor - **/ - virtual ~SDLGetListOfPermissionsResponse(); + /** + * @brief SDLGetListOfPermissionsResponse class destructor + **/ + virtual ~SDLGetListOfPermissionsResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsResponse); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetListOfPermissionsResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h index cb7d37d336..cfc0d55b54 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLGetStatusUpdateRequest command class **/ class SDLGetStatusUpdateRequest : public RequestFromHMI { - public: - /** - * @brief SDLGetStatusUpdateRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetStatusUpdateRequest(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetStatusUpdateRequest class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetStatusUpdateRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetStatusUpdateRequest class destructor - **/ - virtual ~SDLGetStatusUpdateRequest(); + /** + * @brief SDLGetStatusUpdateRequest class destructor + **/ + virtual ~SDLGetStatusUpdateRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateRequest); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h index a3fc0862b5..c25008bd90 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_status_update_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLGetStatusUpdateResponse command class **/ class SDLGetStatusUpdateResponse : public ResponseToHMI { - public: - /** - * @brief SDLGetStatusUpdateResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetStatusUpdateResponse(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetStatusUpdateResponse class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetStatusUpdateResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetStatusUpdateResponse class destructor - **/ - virtual ~SDLGetStatusUpdateResponse(); + /** + * @brief SDLGetStatusUpdateResponse class destructor + **/ + virtual ~SDLGetStatusUpdateResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateResponse); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetStatusUpdateResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h index 96f46cfa3d..7d9fec337c 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_GET_USER_FRIENDLY_MESSAGE_REQUEST_H_ #include "application_manager/commands/hmi/request_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -43,26 +44,27 @@ namespace commands { * @brief SDLGetUserFriendlyMessageRequest command class **/ class SDLGetUserFriendlyMessageRequest : public RequestFromHMI { - public: - /** - * @brief SDLGetUserFriendlyMessageRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetUserFriendlyMessageRequest(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetUserFriendlyMessageRequest class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetUserFriendlyMessageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetUserFriendlyMessageRequest class destructor - **/ - virtual ~SDLGetUserFriendlyMessageRequest(); + /** + * @brief SDLGetUserFriendlyMessageRequest class destructor + **/ + virtual ~SDLGetUserFriendlyMessageRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageRequest); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h index 4cf7be56c9..43c440c277 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief SDLGetUserFriendlyMessageResponse command class **/ class SDLGetUserFriendlyMessageResponse : public ResponseToHMI { - public: - /** - * @brief SDLGetUserFriendlyMessageResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLGetUserFriendlyMessageResponse(const MessageSharedPtr& message); + public: + /** + * @brief SDLGetUserFriendlyMessageResponse class constructor + * + * @param message Incoming SmartObject message + **/ + SDLGetUserFriendlyMessageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLGetUserFriendlyMessageResponse class destructor - **/ - virtual ~SDLGetUserFriendlyMessageResponse(); + /** + * @brief SDLGetUserFriendlyMessageResponse class destructor + **/ + virtual ~SDLGetUserFriendlyMessageResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageResponse); + private: + DISALLOW_COPY_AND_ASSIGN(SDLGetUserFriendlyMessageResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h index 9cffc8644d..6cf4646163 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h @@ -46,7 +46,8 @@ class SDLPolicyUpdate : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit SDLPolicyUpdate(const MessageSharedPtr& message); + SDLPolicyUpdate(const MessageSharedPtr& message, + ApplicationManager& application_manager); ~SDLPolicyUpdate() OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h index d3f7105523..53e9e796bf 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update_response.h @@ -40,26 +40,27 @@ namespace application_manager { namespace commands { class SDLPolicyUpdateResponse : public ResponseFromHMI { - public: - /** - * @brief SDLPolicyUpdateResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit SDLPolicyUpdateResponse(const MessageSharedPtr& message); + public: + /** + * @brief SDLPolicyUpdateResponse class constructor + * + * @param message Incoming SmartObject message + **/ + SDLPolicyUpdateResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief SDLPolicyUpdateResponse class destructor - **/ - virtual ~SDLPolicyUpdateResponse(); + /** + * @brief SDLPolicyUpdateResponse class destructor + **/ + virtual ~SDLPolicyUpdateResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdateResponse); + private: + DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdateResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h index a25309e5d5..0f36e82b44 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_request.h @@ -49,7 +49,8 @@ class TTSChangeRegistrationRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSChangeRegistrationRequest(const MessageSharedPtr& message); + TTSChangeRegistrationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSChangeRegistrationRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h index 73ad180286..ca9c114156 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_change_registration_response.h @@ -49,7 +49,8 @@ class TTSChangeRegistratioResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSChangeRegistratioResponse(const MessageSharedPtr& message); + TTSChangeRegistratioResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSChangeRegistratioResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h index 543945e8ef..bea41b7371 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_request.h @@ -49,7 +49,8 @@ class TTSGetCapabilitiesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetCapabilitiesRequest(const MessageSharedPtr& message); + TTSGetCapabilitiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetCapabilitiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h index 2fc16d1a40..a70ee2b33b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_capabilities_response.h @@ -49,7 +49,8 @@ class TTSGetCapabilitiesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetCapabilitiesResponse(const MessageSharedPtr& message); + TTSGetCapabilitiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetCapabilitiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h index e0ae0da0c4..627cf3da06 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_request.h @@ -49,7 +49,8 @@ class TTSGetLanguageRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetLanguageRequest(const MessageSharedPtr& message); + TTSGetLanguageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetLanguageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h index 0d9df07ae6..f44492a6ed 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_language_response.h @@ -49,7 +49,8 @@ class TTSGetLanguageResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetLanguageResponse(const MessageSharedPtr& message); + TTSGetLanguageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetLanguageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h index 136edbb5f4..9500d54eea 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_request.h @@ -49,7 +49,8 @@ class TTSGetSupportedLanguagesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetSupportedLanguagesRequest(const MessageSharedPtr& message); + TTSGetSupportedLanguagesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetSupportedLanguagesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h index 38e3c673bb..1bc569ebb8 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_get_supported_languages_response.h @@ -49,7 +49,8 @@ class TTSGetSupportedLanguagesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSGetSupportedLanguagesResponse(const MessageSharedPtr& message); + TTSGetSupportedLanguagesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSGetSupportedLanguagesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h index 676faabc01..81bd8eb27b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h @@ -49,7 +49,8 @@ class TTSIsReadyRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSIsReadyRequest(const MessageSharedPtr& message); + TTSIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSIsReadyRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h index 12bb3bb870..833d3d0a82 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_response.h @@ -49,7 +49,8 @@ class TTSIsReadyResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSIsReadyResponse(const MessageSharedPtr& message); + TTSIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSIsReadyResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h index 92a260d77f..b18e372b3e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_request.h @@ -49,7 +49,8 @@ class TTSSetGlobalPropertiesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSSetGlobalPropertiesRequest(const MessageSharedPtr& message); + TTSSetGlobalPropertiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSSetGlobalPropertiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h index 0766decf9f..aa7c85eece 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_set_global_properties_response.h @@ -49,7 +49,8 @@ class TTSSetGlobalPropertiesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSSetGlobalPropertiesResponse(const MessageSharedPtr& message); + TTSSetGlobalPropertiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSSetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h index f5555f6495..87384beedf 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_request.h @@ -42,15 +42,15 @@ namespace commands { /** * @brief TTSSpeakRequest command class **/ -class TTSSpeakRequest - : public RequestToHMI { +class TTSSpeakRequest : public RequestToHMI { public: /** * @brief TTSSpeakRequest class constructor * * @param message Incoming SmartObject message **/ - explicit TTSSpeakRequest(const MessageSharedPtr& message); + TTSSpeakRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSSpeakRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h index 541ea0d2ab..9f15afb33b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_speak_response.h @@ -42,15 +42,15 @@ namespace commands { /** * @brief TTSSpeakResponse command class **/ -class TTSSpeakResponse - : public ResponseFromHMI { +class TTSSpeakResponse : public ResponseFromHMI { public: /** * @brief TTSSpeakResponse class constructor * * @param message Incoming SmartObject message **/ - explicit TTSSpeakResponse(const MessageSharedPtr& message); + TTSSpeakResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSSpeakResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h index 46c464425d..c51daee84d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_request.h @@ -49,7 +49,8 @@ class TTSStopSpeakingRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit TTSStopSpeakingRequest(const MessageSharedPtr& message); + TTSStopSpeakingRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSStopSpeakingRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h index aab8ca8c5b..a23889a733 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_stop_speaking_response.h @@ -49,7 +49,8 @@ class TTSStopSpeakingResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit TTSStopSpeakingResponse(const MessageSharedPtr& message); + TTSStopSpeakingResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSStopSpeakingResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h index 6b857818e7..294fd11912 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_request.h @@ -49,7 +49,8 @@ class UIAddCommandRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIAddCommandRequest(const MessageSharedPtr& message); + UIAddCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAddCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h index c6a02fdd03..ed48e13322 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_command_response.h @@ -49,7 +49,8 @@ class UIAddCommandResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIAddCommandResponse(const MessageSharedPtr& message); + UIAddCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAddCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h index bba9a4c47e..96fa0557ae 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_request.h @@ -49,7 +49,8 @@ class UIAddSubmenuRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIAddSubmenuRequest(const MessageSharedPtr& message); + UIAddSubmenuRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAddSubmenuRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h index 0c4afc2fa3..62abf10b60 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_add_submenu_response.h @@ -49,7 +49,8 @@ class UIAddSubmenuResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIAddSubmenuResponse(const MessageSharedPtr& message); + UIAddSubmenuResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAddSubmenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h index 72cd733eb5..123246e596 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_request.h @@ -49,7 +49,8 @@ class UIAlertRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIAlertRequest(const MessageSharedPtr& message); + UIAlertRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAlertRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h index 97eb2ba94b..db48699a23 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_alert_response.h @@ -49,7 +49,8 @@ class UIAlertResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIAlertResponse(const MessageSharedPtr& message); + UIAlertResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIAlertResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h index 8e68dee2ec..744ed82cad 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_request.h @@ -49,7 +49,8 @@ class UIChangeRegistrationRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIChangeRegistrationRequest(const MessageSharedPtr& message); + UIChangeRegistrationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIChangeRegistrationRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h index 50b092639b..57814b9acf 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_change_registration_response.h @@ -49,7 +49,8 @@ class UIChangeRegistratioResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIChangeRegistratioResponse(const MessageSharedPtr& message); + UIChangeRegistratioResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIChangeRegistratioResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h index 9eceb2eb6f..21a4c6dd42 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_request.h @@ -49,7 +49,8 @@ class UIDeleteCommandRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIDeleteCommandRequest(const MessageSharedPtr& message); + UIDeleteCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIDeleteCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h index c4d7ab6cac..c9baba728f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_command_response.h @@ -49,7 +49,8 @@ class UIDeleteCommandResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIDeleteCommandResponse(const MessageSharedPtr& message); + UIDeleteCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIDeleteCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h index 24bf5878ff..d238e39a10 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_request.h @@ -49,7 +49,8 @@ class UIDeleteSubmenuRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIDeleteSubmenuRequest(const MessageSharedPtr& message); + UIDeleteSubmenuRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIDeleteSubmenuRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h index 05d77c82d7..36d7bee528 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_delete_submenu_response.h @@ -49,7 +49,8 @@ class UIDeleteSubmenuResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIDeleteSubmenuResponse(const MessageSharedPtr& message); + UIDeleteSubmenuResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIDeleteSubmenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h index 06637fc8d4..d8bd10a9ca 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h @@ -50,7 +50,8 @@ class UIEndAudioPassThruRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIEndAudioPassThruRequest(const MessageSharedPtr& message); + UIEndAudioPassThruRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIEndAudioPassThruRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h index 6d5594f69f..c2a373d8c0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h @@ -49,7 +49,8 @@ class UIEndAudioPassThruResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIEndAudioPassThruResponse(const MessageSharedPtr& message); + UIEndAudioPassThruResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIEndAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h index ad9a566078..cffba5ca42 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_request.h @@ -49,7 +49,8 @@ class UIGetCapabilitiesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetCapabilitiesRequest(const MessageSharedPtr& message); + UIGetCapabilitiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetCapabilitiesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h index ce6ad6f7ef..525dd7ad9d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_capabilities_response.h @@ -49,7 +49,8 @@ class UIGetCapabilitiesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetCapabilitiesResponse(const MessageSharedPtr& message); + UIGetCapabilitiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetCapabilitiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h index 7371cd1031..4bf8e11d7e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_request.h @@ -49,7 +49,8 @@ class UIGetLanguageRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetLanguageRequest(const MessageSharedPtr& message); + UIGetLanguageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetLanguageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h index f6536452ce..29bbba85ff 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_language_response.h @@ -49,7 +49,8 @@ class UIGetLanguageResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetLanguageResponse(const MessageSharedPtr& message); + UIGetLanguageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetLanguageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h index d0975e68da..94c197b7bc 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_request.h @@ -49,7 +49,8 @@ class UIGetSupportedLanguagesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetSupportedLanguagesRequest(const MessageSharedPtr& message); + UIGetSupportedLanguagesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetSupportedLanguagesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h index c888c7b208..8962b77833 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_get_supported_languages_response.h @@ -49,7 +49,8 @@ class UIGetSupportedLanguagesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIGetSupportedLanguagesResponse(const MessageSharedPtr& message); + UIGetSupportedLanguagesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIGetSupportedLanguagesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h index 7cb4287244..a505df6de4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h @@ -49,7 +49,8 @@ class UIIsReadyRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIIsReadyRequest(const MessageSharedPtr& message); + UIIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIIsReadyRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h index 64106654e9..93b2d9a569 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_response.h @@ -49,7 +49,8 @@ class UIIsReadyResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIIsReadyResponse(const MessageSharedPtr& message); + UIIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIIsReadyResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h index 69566324f2..4cec5a5600 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h @@ -49,7 +49,8 @@ class UIPerformAudioPassThruRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIPerformAudioPassThruRequest(const MessageSharedPtr& message); + UIPerformAudioPassThruRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIPerformAudioPassThruRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h index c3283101f9..9fb502233f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h @@ -49,7 +49,8 @@ class UIPerformAudioPassThruResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIPerformAudioPassThruResponse(const MessageSharedPtr& message); + UIPerformAudioPassThruResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIPerformAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h index d8e2f6c682..d9ae72a319 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_request.h @@ -49,7 +49,8 @@ class UIPerformInteractionRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIPerformInteractionRequest(const MessageSharedPtr& message); + UIPerformInteractionRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIPerformInteractionRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h index 04286897a3..4db471bbae 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_perform_interaction_response.h @@ -49,7 +49,8 @@ class UIPerformInteractionResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIPerformInteractionResponse(const MessageSharedPtr& message); + UIPerformInteractionResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIPerformInteractionResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h index 06bfadbae7..8ba828a25e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_request.h @@ -49,7 +49,8 @@ class UIScrollableMessageRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIScrollableMessageRequest(const MessageSharedPtr& message); + UIScrollableMessageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIScrollableMessageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h index 6d6d09c313..4ae432d658 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_scrollable_message_response.h @@ -49,7 +49,8 @@ class UIScrollableMessageResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIScrollableMessageResponse(const MessageSharedPtr& message); + UIScrollableMessageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIScrollableMessageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h index 96f91d0f82..c016cf7cda 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_request.h @@ -49,7 +49,8 @@ class UISetAppIconRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UISetAppIconRequest(const MessageSharedPtr& message); + UISetAppIconRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISetIconRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h index b323a91c36..640e43c9f4 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_app_icon_response.h @@ -49,7 +49,8 @@ class UISetAppIconResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UISetAppIconResponse(const MessageSharedPtr& message); + UISetAppIconResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h index 7e67912f53..573e9351b1 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_request.h @@ -42,26 +42,27 @@ namespace commands { * @brief UiSetDisplayLayoutRequest command class **/ class UiSetDisplayLayoutRequest : public RequestToHMI { - public: - /** - * @brief UiSetDisplayLayoutRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit UiSetDisplayLayoutRequest(const MessageSharedPtr& message); + public: + /** + * @brief UiSetDisplayLayoutRequest class constructor + * + * @param message Incoming SmartObject message + **/ + UiSetDisplayLayoutRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief UiSetDisplayLayoutRequest class destructor - **/ - virtual ~UiSetDisplayLayoutRequest(); + /** + * @brief UiSetDisplayLayoutRequest class destructor + **/ + virtual ~UiSetDisplayLayoutRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutRequest); + private: + DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h index 3e7a898af0..7b8098fdf5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_display_layout_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief UiSetDisplayLayoutResponse command class **/ class UiSetDisplayLayoutResponse : public ResponseFromHMI { - public: - /** - * @brief UiSetDisplayLayoutResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit UiSetDisplayLayoutResponse(const MessageSharedPtr& message); + public: + /** + * @brief UiSetDisplayLayoutResponse class constructor + * + * @param message Incoming SmartObject message + **/ + UiSetDisplayLayoutResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief UiSetDisplayLayoutResponse class destructor - **/ - virtual ~UiSetDisplayLayoutResponse(); + /** + * @brief UiSetDisplayLayoutResponse class destructor + **/ + virtual ~UiSetDisplayLayoutResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutResponse); + private: + DISALLOW_COPY_AND_ASSIGN(UiSetDisplayLayoutResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h index 8b54e85332..83bf11e2e1 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_request.h @@ -49,7 +49,8 @@ class UISetGlobalPropertiesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UISetGlobalPropertiesRequest(const MessageSharedPtr& message); + UISetGlobalPropertiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIShowRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h index b3cb38d49f..91de5e6df7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_global_properties_response.h @@ -49,7 +49,8 @@ class UISetGlobalPropertiesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UISetGlobalPropertiesResponse(const MessageSharedPtr& message); + UISetGlobalPropertiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h index 1541aada6b..34bef8a989 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_request.h @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2013, Ford Motor Company +/* + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ class UISetIconRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UISetIconRequest(const MessageSharedPtr& message); + UISetIconRequest(const MessageSharedPtr& message); /** * @brief UISetIconRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h index f125f64282..a9739bc802 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_icon_response.h @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2013, Ford Motor Company +/* + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ class UISetIconResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UISetIconResponse(const MessageSharedPtr& message); + UISetIconResponse(const MessageSharedPtr& message); /** * @brief UISetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h index 443fc8d1a7..92565e6f02 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h @@ -49,7 +49,8 @@ class UISetMediaClockTimerRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UISetMediaClockTimerRequest(const MessageSharedPtr& message); + UISetMediaClockTimerRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISetMediaClockTimerRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h index 9358707117..0d71ff00f0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h @@ -49,7 +49,8 @@ class UISetMediaClockTimerResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UISetMediaClockTimerResponse(const MessageSharedPtr& message); + UISetMediaClockTimerResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISetMediaClockTimerResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h index 136a99622b..80348de63b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_request.h @@ -49,7 +49,8 @@ class UIShowRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UIShowRequest(const MessageSharedPtr& message); + UIShowRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIShowRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h index 4a9b49253e..d696d2b9f8 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_show_response.h @@ -49,7 +49,8 @@ class UIShowResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UIShowResponse(const MessageSharedPtr& message); + UIShowResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UIShowResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h index 8a3b37bfef..583f52084d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_request.h @@ -49,7 +49,8 @@ class UISliderRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UISliderRequest(const MessageSharedPtr& message); + UISliderRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISliderRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h index 2384f248aa..cabb54f6cb 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_slider_response.h @@ -49,7 +49,8 @@ class UISliderResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UISliderResponse(const MessageSharedPtr& message); + UISliderResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UISliderResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h index b606134409..61be04d04f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_request.h @@ -49,7 +49,8 @@ class UpdateAppListRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UpdateAppListRequest(const MessageSharedPtr& message); + UpdateAppListRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateAppListRequest class destructor @@ -70,4 +71,3 @@ class UpdateAppListRequest : public RequestToHMI { } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_ - diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h index 135481cb0b..5ff8948393 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_app_list_response.h @@ -49,7 +49,8 @@ class UpdateAppListResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UpdateAppListResponse(const MessageSharedPtr& message); + UpdateAppListResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateAppListResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h index f645d312c5..c52ec96075 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_request.h @@ -53,7 +53,8 @@ class UpdateDeviceListRequest : public RequestToHMI, * * @param message Incoming SmartObject message **/ - explicit UpdateDeviceListRequest(const MessageSharedPtr& message); + UpdateDeviceListRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateDeviceListRequest class destructor @@ -73,14 +74,14 @@ class UpdateDeviceListRequest : public RequestToHMI, */ virtual void on_event(const event_engine::Event& event); - /** - * @brief Need to stop execution StopMethod if HMI did not started - */ + /** + * @brief Need to stop execution StopMethod if HMI did not started + */ virtual bool CleanUp(); private: - sync_primitives::Lock wait_hmi_lock; - sync_primitives::ConditionalVariable termination_condition_; + sync_primitives::Lock wait_hmi_lock; + sync_primitives::ConditionalVariable termination_condition_; DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h index 6ea2c1e528..1928b81207 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_device_list_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief UpdateDeviceListResponse command class **/ class UpdateDeviceListResponse : public ResponseFromHMI { - public: - /** - * @brief UpdateDeviceListResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit UpdateDeviceListResponse(const MessageSharedPtr& message); + public: + /** + * @brief UpdateDeviceListResponse class constructor + * + * @param message Incoming SmartObject message + **/ + UpdateDeviceListResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief UpdateDeviceListResponse class destructor - **/ - virtual ~UpdateDeviceListResponse(); + /** + * @brief UpdateDeviceListResponse class destructor + **/ + virtual ~UpdateDeviceListResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListResponse); + private: + DISALLOW_COPY_AND_ASSIGN(UpdateDeviceListResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h index f84f93f2ed..d8be10da2e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_request.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UPDATE_SDL_REQUEST_H_ #include "application_manager/commands/hmi/request_to_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -49,7 +50,8 @@ class UpdateSDLRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit UpdateSDLRequest(const MessageSharedPtr& message); + UpdateSDLRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateSDLRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h index b0d370ecfd..bc0375d5fa 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/update_sdl_response.h @@ -49,7 +49,8 @@ class UpdateSDLResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit UpdateSDLResponse(const MessageSharedPtr& message); + UpdateSDLResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateSDLResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h index c60533d2ea..099f27b734 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_request.h @@ -49,7 +49,8 @@ class VIDiagnosticMessageRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIDiagnosticMessageRequest(const MessageSharedPtr& message); + VIDiagnosticMessageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIDiagnosticMessageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h index 027e007e42..f0ae76ccb7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_diagnostic_message_response.h @@ -49,7 +49,8 @@ class VIDiagnosticMessageResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIDiagnosticMessageResponse(const MessageSharedPtr& message); + VIDiagnosticMessageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIDiagnosticMessageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h index 170eb895fd..3b7e502a57 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_request.h @@ -49,7 +49,8 @@ class VIGetDTCsRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetDTCsRequest(const MessageSharedPtr& message); + VIGetDTCsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetDTCsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h index 3ba4656d5b..7b7dab567b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_dtcs_response.h @@ -49,7 +49,8 @@ class VIGetDTCsResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetDTCsResponse(const MessageSharedPtr& message); + VIGetDTCsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetDTCsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h index 7413b6bf3b..006f18e864 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h @@ -49,7 +49,8 @@ class VIGetVehicleDataRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleDataRequest(const MessageSharedPtr& message); + VIGetVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetVehicleDataRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h index af991186fd..a11c763021 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h @@ -44,7 +44,7 @@ namespace commands { * * Template class for sending 1 subscribe thin request **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VIGetVehicleDataRequestTemplate : public RequestToHMI { public: /** @@ -52,15 +52,15 @@ class VIGetVehicleDataRequestTemplate : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleDataRequestTemplate(const MessageSharedPtr& message) - : RequestToHMI(message) { - } + VIGetVehicleDataRequestTemplate(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} /** * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VIGetVehicleDataRequestTemplate::Run"); + LOG4CXX_AUTO_TRACE(logger_); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h index 1f9736b56a..ef19072bb0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_H_ #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -49,7 +50,8 @@ class VIGetVehicleDataResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleDataResponse(const MessageSharedPtr& message); + VIGetVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h index 156664cac3..a1c143baed 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h @@ -35,6 +35,7 @@ #include "application_manager/event_engine/event.h" #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { @@ -42,7 +43,7 @@ namespace commands { /** * @brief VIGetVehicleDataResponseTemplate command class **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VIGetVehicleDataResponseTemplate : public ResponseFromHMI { public: /** @@ -50,18 +51,18 @@ class VIGetVehicleDataResponseTemplate : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleDataResponseTemplate(const MessageSharedPtr& message) - : ResponseFromHMI(message) { - } + VIGetVehicleDataResponseTemplate(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} /** * @brief Execute command **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VIGetVehicleDataResponseTemplate::Run"); + LOG4CXX_AUTO_TRACE(logger_); event_engine::Event event(eventID); event.set_smart_object(*message_); - event.raise(); + event.raise(application_manager_.event_dispatcher()); } private: diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h index 67d8ae046c..cd70c3349b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h @@ -49,7 +49,8 @@ class VIGetVehicleTypeRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleTypeRequest(const MessageSharedPtr& message); + VIGetVehicleTypeRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetVehicleTypeRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h index b36b193418..0ef35dd7fc 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h @@ -49,7 +49,8 @@ class VIGetVehicleTypeResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIGetVehicleTypeResponse(const MessageSharedPtr& message); + VIGetVehicleTypeResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIGetVehicleTypeResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h index 061681029a..9049db4d24 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h @@ -49,7 +49,8 @@ class VIIsReadyRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIIsReadyRequest(const MessageSharedPtr& message); + VIIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIIsReadyRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h index 52e00f85da..a7866a1e73 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_response.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_VI_IS_READY_RESPONSE_H_ #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -49,7 +50,8 @@ class VIIsReadyResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIIsReadyResponse(const MessageSharedPtr& message); + VIIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIIsReadyResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h index 6520db5e7d..cdbdb45a8b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_request.h @@ -49,7 +49,8 @@ class VIReadDIDRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIReadDIDRequest(const MessageSharedPtr& message); + VIReadDIDRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIReadDIDRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h index 0855be454b..acb8760c5b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_read_did_response.h @@ -49,7 +49,8 @@ class VIReadDIDResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIReadDIDResponse(const MessageSharedPtr& message); + VIReadDIDResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIReadDIDResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h index 1eb06c6217..58d4984f8d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h @@ -49,7 +49,8 @@ class VISubscribeVehicleDataRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VISubscribeVehicleDataRequest(const MessageSharedPtr& message); + VISubscribeVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VISubscribeVehicleDataRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h index fc9b7dd2ea..7fefe0dbe2 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h @@ -44,7 +44,7 @@ namespace commands { * * Template class for sending 1 subscribe thin request **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VISubscribeVehicleDataRequestTemplate : public RequestToHMI { public: /** @@ -52,16 +52,15 @@ class VISubscribeVehicleDataRequestTemplate : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VISubscribeVehicleDataRequestTemplate( - const MessageSharedPtr& message) - : RequestToHMI(message) { - } + VISubscribeVehicleDataRequestTemplate(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} /** * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VISubscriveVehicleDataRequestTemplate::Run"); + LOG4CXX_AUTO_TRACE(logger_); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h index b5e2788f32..8f038bf941 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h @@ -49,7 +49,8 @@ class VISubscribeVehicleDataResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VISubscribeVehicleDataResponse(const MessageSharedPtr& message); + VISubscribeVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VISubscribeVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h index 64f3c51cbc..7790c57092 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h @@ -35,13 +35,14 @@ #include "application_manager/event_engine/event.h" #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { /** * @brief VISubscriveVehicleDataResponseTemplate command class **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI { public: /** @@ -49,20 +50,20 @@ class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VISubscribeVehicleDataResponseTemplate( - const MessageSharedPtr& message) - : ResponseFromHMI(message) { - } + VISubscribeVehicleDataResponseTemplate( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} /** * @brief Execute command **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VISubscribeVehicleDataResponse::Run"); + LOG4CXX_AUTO_TRACE(logger_); event_engine::Event event(eventID); event.set_smart_object(*message_); - event.raise(); + event.raise(application_manager_.event_dispatcher()); } + private: DISALLOW_COPY_AND_ASSIGN(VISubscribeVehicleDataResponseTemplate<eventID>); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h index 1320ae477a..b99eee47e7 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h @@ -49,7 +49,8 @@ class VIUnsubscribeVehicleDataRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIUnsubscribeVehicleDataRequest(const MessageSharedPtr& message); + VIUnsubscribeVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIUnsubscribeVehicleDataRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h index 9aa529d407..b9367a372e 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h @@ -44,7 +44,7 @@ namespace commands { * * Template class for sending 1 unsubscribe thin request **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI { public: /** @@ -52,16 +52,15 @@ class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VIUnsubscribeVehicleDataRequestTemplate( - const MessageSharedPtr& message) - : RequestToHMI(message) { - } + VIUnsubscribeVehicleDataRequestTemplate( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} /** * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VIUnsubscriveVehicleDataRequestTemplate::Run"); + LOG4CXX_AUTO_TRACE(logger_); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h index 8818709afe..3f930b5a5b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h @@ -49,7 +49,8 @@ class VIUnsubscribeVehicleDataResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIUnsubscribeVehicleDataResponse(const MessageSharedPtr& message); + VIUnsubscribeVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VIUnsubscribeVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h index 3dfcc763cb..9d943b838d 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h @@ -35,6 +35,7 @@ #include "application_manager/event_engine/event.h" #include "application_manager/commands/hmi/response_from_hmi.h" +#include "application_manager/application_manager.h" namespace application_manager { namespace commands { @@ -42,7 +43,7 @@ namespace commands { /** * @brief VIUnsubscriveVehicleDataResponseTemplate command class **/ -template<event_engine::Event::EventID eventID> +template <event_engine::Event::EventID eventID> class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI { public: /** @@ -50,20 +51,20 @@ class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VIUnsubscribeVehicleDataResponseTemplate( - const MessageSharedPtr& message) - : ResponseFromHMI(message) { - } + VIUnsubscribeVehicleDataResponseTemplate( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} /** * @brief Execute command **/ virtual void Run() { - LOG4CXX_INFO(logger_, "VIUnsubscriveVehicleDataResponseTemplate::Run"); + LOG4CXX_AUTO_TRACE(logger_); event_engine::Event event(eventID); event.set_smart_object(*message_); - event.raise(); + event.raise(application_manager_.event_dispatcher()); } + private: DISALLOW_COPY_AND_ASSIGN(VIUnsubscribeVehicleDataResponseTemplate<eventID>); }; diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h index 9fdc3f776f..1ef4125c89 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_request.h @@ -49,7 +49,8 @@ class VRAddCommandRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRAddCommandRequest(const MessageSharedPtr& message); + VRAddCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRAddCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h index 7418ed5865..1b419ed6ec 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_add_command_response.h @@ -49,7 +49,8 @@ class VRAddCommandResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRAddCommandResponse(const MessageSharedPtr& message); + VRAddCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRAddCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h index 53584ee970..642319e8d6 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_request.h @@ -49,7 +49,8 @@ class VRChangeRegistrationRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRChangeRegistrationRequest(const MessageSharedPtr& message); + VRChangeRegistrationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRChangeRegistrationRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h index d71a14da34..8dc5e96729 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_change_registration_response.h @@ -49,7 +49,8 @@ class VRChangeRegistrationResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRChangeRegistrationResponse(const MessageSharedPtr& message); + VRChangeRegistrationResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRChangeRegistrationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h index 91a5dc7d99..bc5c24a350 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_request.h @@ -49,7 +49,8 @@ class VRDeleteCommandRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRDeleteCommandRequest(const MessageSharedPtr& message); + VRDeleteCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRDeleteCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h index ad8c82e38c..526c296321 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_delete_command_response.h @@ -49,7 +49,8 @@ class VRDeleteCommandResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRDeleteCommandResponse(const MessageSharedPtr& message); + VRDeleteCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRDeleteCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h index 676967083f..8dcc240e9b 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief VRGetCapabilitiesRequest command class **/ class VRGetCapabilitiesRequest : public RequestToHMI { - public: - /** - * @brief VRGetCapabilitiesRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit VRGetCapabilitiesRequest(const MessageSharedPtr& message); + public: + /** + * @brief VRGetCapabilitiesRequest class constructor + * + * @param message Incoming SmartObject message + **/ + VRGetCapabilitiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief VRGetCapabilitiesRequest class destructor - **/ - virtual ~VRGetCapabilitiesRequest(); + /** + * @brief VRGetCapabilitiesRequest class destructor + **/ + virtual ~VRGetCapabilitiesRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest); + private: + DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h index 8b88eb4e3b..b6c8e081f5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_capabilities_response.h @@ -43,26 +43,27 @@ namespace commands { * @brief VRGetCapabilitiesResponse command class **/ class VRGetCapabilitiesResponse : public ResponseFromHMI { - public: - /** - * @brief VRGetCapabilitiesResponse class constructor - * - * @param message Incoming SmartObject message - **/ - explicit VRGetCapabilitiesResponse(const MessageSharedPtr& message); + public: + /** + * @brief VRGetCapabilitiesResponse class constructor + * + * @param message Incoming SmartObject message + **/ + VRGetCapabilitiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief VRGetCapabilitiesResponse class destructor - **/ - virtual ~VRGetCapabilitiesResponse(); + /** + * @brief VRGetCapabilitiesResponse class destructor + **/ + virtual ~VRGetCapabilitiesResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesResponse); + private: + DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesResponse); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h index 9dd9133ffd..05373784f3 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_request.h @@ -49,7 +49,8 @@ class VRGetLanguageRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRGetLanguageRequest(const MessageSharedPtr& message); + VRGetLanguageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRGetLanguageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h index d9c4fc2126..fad2f219df 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_language_response.h @@ -49,7 +49,8 @@ class VRGetLanguageResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRGetLanguageResponse(const MessageSharedPtr& message); + VRGetLanguageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRGetLanguageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h index 0a010cdfec..6ed56ebd32 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_request.h @@ -49,7 +49,8 @@ class VRGetSupportedLanguagesRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRGetSupportedLanguagesRequest(const MessageSharedPtr& message); + VRGetSupportedLanguagesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRGetSupportedLanguagesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h index dbbe57ba36..c4e742ecd0 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_get_supported_languages_response.h @@ -49,7 +49,8 @@ class VRGetSupportedLanguagesResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRGetSupportedLanguagesResponse(const MessageSharedPtr& message); + VRGetSupportedLanguagesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRGetSupportedLanguagesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h index e66c9c36a5..9fc4ccd2f3 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h @@ -49,7 +49,8 @@ class VRIsReadyRequest : public RequestToHMI { * * @param message Incoming SmartObject message **/ - explicit VRIsReadyRequest(const MessageSharedPtr& message); + VRIsReadyRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRIsReadyRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h index a9b1a68455..474b3373a3 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_response.h @@ -49,7 +49,8 @@ class VRIsReadyResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRIsReadyResponse(const MessageSharedPtr& message); + VRIsReadyResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief VRIsReadyResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h index b819fdb927..35a7e80b06 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_request.h @@ -43,26 +43,27 @@ namespace commands { * @brief VRPerformInteractionRequest command class **/ class VRPerformInteractionRequest : public RequestToHMI { - public: - /** - * @brief VRPerformInteractionRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit VRPerformInteractionRequest(const MessageSharedPtr& message); + public: + /** + * @brief VRPerformInteractionRequest class constructor + * + * @param message Incoming SmartObject message + **/ + VRPerformInteractionRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief VRPerformInteractionRequest class destructor - **/ - virtual ~VRPerformInteractionRequest(); + /** + * @brief VRPerformInteractionRequest class destructor + **/ + virtual ~VRPerformInteractionRequest(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run(); - private: - DISALLOW_COPY_AND_ASSIGN(VRPerformInteractionRequest); + private: + DISALLOW_COPY_AND_ASSIGN(VRPerformInteractionRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h index ffbbd613e2..7c445416ce 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_perform_interaction_response.h @@ -49,7 +49,8 @@ class VRPerformInteractionResponse : public ResponseFromHMI { * * @param message Incoming SmartObject message **/ - explicit VRPerformInteractionResponse(const MessageSharedPtr& message); + VRPerformInteractionResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief TTSPerformInteractionResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h index 2c36d8425e..22a0c7e85f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h @@ -52,7 +52,8 @@ class AddCommandRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AddCommandRequest(const MessageSharedPtr& message); + AddCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AddCommandRequest class destructor @@ -72,7 +73,6 @@ class AddCommandRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); private: - /* * @brief Check if command name doesn't exist in application * Please see SDLAQ-CRS-407 for more information diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h index 67a49a8e17..84bcdebc31 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_response.h @@ -51,7 +51,8 @@ class AddCommandResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AddCommandResponse(const MessageSharedPtr& message); + AddCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AddCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h index befeb76d9f..1f12523953 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h @@ -51,7 +51,8 @@ class AddSubMenuRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AddSubMenuRequest(const MessageSharedPtr& message); + AddSubMenuRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AddSubMenuRequest class destructor @@ -71,7 +72,6 @@ class AddSubMenuRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); private: - /* * @brief Check if submenu name is valid * diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h index 62c404951a..4d71e5f017 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_response.h @@ -51,7 +51,8 @@ class AddSubMenuResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AddSubMenuResponse(const MessageSharedPtr& message); + AddSubMenuResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AddSubMenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h index 02423f0630..472ff45551 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h @@ -53,7 +53,8 @@ class AlertManeuverRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AlertManeuverRequest(const MessageSharedPtr& message); + AlertManeuverRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AlertManeuverRequest class destructor @@ -81,8 +82,10 @@ class AlertManeuverRequest : public CommandRequestImpl { */ bool IsWhiteSpaceExist(); - mobile_apis::Result::eType tts_speak_result_code_; - mobile_apis::Result::eType navi_alert_maneuver_result_code_; + mobile_apis::Result::eType tts_speak_result_code_; + mobile_apis::Result::eType navi_alert_maneuver_result_code_; + std::string info_navi_; + std::string info_tts_; Pending pending_requests_; DISALLOW_COPY_AND_ASSIGN(AlertManeuverRequest); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h index 5f0827699b..c02322e298 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_response.h @@ -51,7 +51,8 @@ class AlertManeuverResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AlertManeuverResponse(const MessageSharedPtr& message); + AlertManeuverResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AlertManeuverResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h index 705a1d1454..bc99665d82 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h @@ -52,7 +52,8 @@ class AlertRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit AlertRequest(const MessageSharedPtr& message); + AlertRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AlertRequest class destructor @@ -71,7 +72,8 @@ class AlertRequest : public CommandRequestImpl { /* * @brief Will caled by request controller, when default will be expired. - * If Alert request has soft buttons, timeout response should not be sent to mobile + * If Alert request has soft buttons, timeout response should not be sent to + * mobile */ virtual void onTimeOut(); @@ -83,7 +85,6 @@ class AlertRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); protected: - private: /* * @brief Checks if request parameters are valid @@ -102,15 +103,16 @@ class AlertRequest : public CommandRequestImpl { * @brief Sends TTS Speak request * * @param app_id Id of application requested this RPC - */ - void SendSpeakRequest(int32_t app_id); - - /* - * @brief Sends Basic communication playtone notification * - * @param app_id Id of application requested this RPC + * @param tts_chunks_exists if tts chunks exists in + * message contains true, otherwise contains false + * + * @param length_tts_chunks contains length of array + * tts chunks. */ - void SendPlayToneNotification(int32_t app_id); + void SendSpeakRequest(int32_t app_id, + bool tts_chunks_exists, + size_t length_tts_chunks); /* * @brief Tells if there are sent requests without responses @@ -124,14 +126,14 @@ class AlertRequest : public CommandRequestImpl { */ bool CheckStringsOfAlertRequest(); - bool awaiting_ui_alert_response_; - bool awaiting_tts_speak_response_; - bool awaiting_tts_stop_speaking_response_; - bool response_success_; - bool flag_other_component_sent_; - mobile_apis::Result::eType response_result_; - smart_objects::SmartObject response_params_; - mobile_apis::Result::eType tts_speak_response_; + bool awaiting_ui_alert_response_; + bool awaiting_tts_speak_response_; + bool awaiting_tts_stop_speaking_response_; + bool is_alert_succeeded_; + bool is_ui_alert_sent_; + mobile_apis::Result::eType alert_result_; + smart_objects::SmartObject alert_response_params_; + mobile_apis::Result::eType tts_speak_result_; DISALLOW_COPY_AND_ASSIGN(AlertRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h index 59b38933a7..acac21d738 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_response.h @@ -51,7 +51,8 @@ class AlertResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit AlertResponse(const MessageSharedPtr& message); + AlertResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief AlertResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h index d36f16a976..c81ed0b5d3 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h @@ -39,22 +39,26 @@ #include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/pending.h" #include "utils/macro.h" +#include "utils/custom_string.h" namespace application_manager { namespace commands { +namespace custom_str = utils::custom_string; + /** * @brief ChangeRegistrationRequest command class **/ -class ChangeRegistrationRequest : public CommandRequestImpl { +class ChangeRegistrationRequest : public CommandRequestImpl { public: /** * @brief ChangeRegistrationRequest class constructor * * @param message Incoming SmartObject message **/ - explicit ChangeRegistrationRequest(const MessageSharedPtr& message); + ChangeRegistrationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ChangeRegistrationRequest class destructor @@ -107,9 +111,9 @@ class ChangeRegistrationRequest : public CommandRequestImpl { * * @return true if all of result codes is success */ - bool AllHmiResponsesSuccess(const hmi_apis::Common_Result::eType ui, - const hmi_apis::Common_Result::eType vr, - const hmi_apis::Common_Result::eType tts); + bool AllHmiResponsesSuccess(const hmi_apis::Common_Result::eType ui, + const hmi_apis::Common_Result::eType vr, + const hmi_apis::Common_Result::eType tts); /** * @brief Checks change_registration params(ttsName, appname, @@ -118,42 +122,49 @@ class ChangeRegistrationRequest : public CommandRequestImpl { * @return true if command contains \t\n \\t \\n of whitespace otherwise * returns false. */ - bool IsWhiteSpaceExist(); - - /** - * @brief Check parameters (name, vr) for - * coincidence with already known parameters of registered applications - * - * @return SUCCESS if there is no coincidence of app.name/VR synonyms, - * otherwise appropriate error code returns - */ - mobile_apis::Result::eType CheckCoincidence(); - - /** - * @brief Predicate for using with CheckCoincidence method to compare with VR synonym SO - * - * @return TRUE if there is coincidence of VR, otherwise FALSE - */ - struct CoincidencePredicateVR { - explicit CoincidencePredicateVR(const std::string &newItem) - :newItem_(newItem) - {}; - - bool operator()(smart_objects::SmartObject obj) { - const std::string vr_synonym = obj.asString(); - return !(strcasecmp(vr_synonym.c_str(), newItem_.c_str())); - }; - - const std::string &newItem_; - }; - - Pending pending_requests_; - - hmi_apis::Common_Result::eType ui_result_; - hmi_apis::Common_Result::eType vr_result_; - hmi_apis::Common_Result::eType tts_result_; - - DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest); + bool IsWhiteSpaceExist(); + + /** + * @brief Check parameters (name, vr) for + * coincidence with already known parameters of registered applications + * + * @return SUCCESS if there is no coincidence of app.name/VR synonyms, + * otherwise appropriate error code returns + */ + mobile_apis::Result::eType CheckCoincidence(); + + /** + * @brief Checks if requested name is allowed by policy + * @param app_name Application name + * @return true, if allowed, otherwise - false + */ + bool IsNicknameAllowed(const custom_str::CustomString& app_name) const; + + /** + * @brief Predicate for using with CheckCoincidence method to compare with VR + * synonym SO + * + * @return TRUE if there is coincidence of VR, otherwise FALSE + */ + struct CoincidencePredicateVR { + CoincidencePredicateVR(const custom_str::CustomString& newItem) + : newItem_(newItem){}; + + bool operator()(const smart_objects::SmartObject& obj) const { + const custom_str::CustomString& vr_synonym = obj.asCustomString(); + return newItem_.CompareIgnoreCase(vr_synonym); + }; + + const custom_str::CustomString& newItem_; + }; + + Pending pending_requests_; + + hmi_apis::Common_Result::eType ui_result_; + hmi_apis::Common_Result::eType vr_result_; + hmi_apis::Common_Result::eType tts_result_; + + DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h index 2cac5f2d58..6ff3fd9a4a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_response.h @@ -51,7 +51,8 @@ class ChangeRegistrationResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ChangeRegistrationResponse(const MessageSharedPtr& message); + ChangeRegistrationResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ChangeRegistrationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h index 615416fac5..2a6e55f312 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h @@ -53,186 +53,185 @@ namespace commands { **/ class CreateInteractionChoiceSetRequest : public CommandRequestImpl { public: - /** - * @brief CreateInteractionChoiceSetRequest class constructor - * - * @param message Incoming SmartObject message - **/ - explicit CreateInteractionChoiceSetRequest(const MessageSharedPtr& message); - - /** - * @brief CreateInteractionChoiceSetRequest class destructor - **/ - virtual ~CreateInteractionChoiceSetRequest(); - - /** - * @brief Execute command - **/ - virtual void Run(); - + /** + * @brief CreateInteractionChoiceSetRequest class constructor + * + * @param message Incoming SmartObject message + **/ + CreateInteractionChoiceSetRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief CreateInteractionChoiceSetRequest class destructor + **/ + virtual ~CreateInteractionChoiceSetRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); private: - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const event_engine::Event& event); - - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - virtual void onTimeOut(); - /** - * @brief DeleteChoices allows to walk through the sent commands collection - * in order to sent appropriate DeleteCommand request. - */ - void DeleteChoices(); - - /** - * @brief Calls after all responses from HMI were received. - * Terminates request and sends successful response to mobile - * if all responses were SUCCESS or calls DeleteChoices in other case. - */ - void OnAllHMIResponsesReceived(); - - /** - * @brief The VRCommand struct - * Collect minimum information about sent VR commands, for correctly - * processing deleting sent commands if error from HMI received - */ - struct VRCommandInfo { - VRCommandInfo() {} - explicit VRCommandInfo(uint32_t cmd_id): - cmd_id_(cmd_id), - succesful_response_received_(false) {} - uint32_t cmd_id_; - bool succesful_response_received_; - }; - - typedef std::map<uint32_t, VRCommandInfo> SentCommandsMap; - SentCommandsMap sent_commands_map_; - - int32_t choice_set_id_; - size_t expected_chs_count_; - size_t received_chs_count_; - - /** - * @brief Flag for stop sending VR commands to HMI, in case one of responses - * failed - */ - volatile bool error_from_hmi_; - sync_primitives::Lock error_from_hmi_lock_; - - /** - * @brief Flag shows if request already was expired by timeout - */ - volatile bool is_timed_out_; - sync_primitives::Lock is_timed_out_lock_; - - sync_primitives::Lock vr_commands_lock_; - /* - * @brief Sends VR AddCommand request to HMI - * - * @param app_id Application ID - * - */ - void SendVRAddCommandRequests(ApplicationSharedPtr const app); - - /* - * @brief Checks incoming choiseSet params. - * @param app Registred mobile application - * - * @return Mobile result code - */ - mobile_apis::Result::eType CheckChoiceSet(ApplicationConstSharedPtr app); - - /* - * @brief Predicate for using with CheckChoiceSet method to compare choice ID param - * - * return TRUE if there is coincidence of choice ID, otherwise FALSE - */ - struct CoincidencePredicateChoiceID { - explicit CoincidencePredicateChoiceID(const uint32_t newItem) - : newItem_(newItem) - {} - - bool operator()(smart_objects::SmartObject obj) { - return obj[strings::choice_id].asUInt() == newItem_; - } - - const uint32_t newItem_; - }; - - /* - * @brief Predicate for using with CheckChoiceSet method to compare menu name param - * - * return TRUE if there is coincidence of menu name, otherwise FALSE - */ - struct CoincidencePredicateMenuName { - explicit CoincidencePredicateMenuName(const std::string& newItem) - : newItem_(newItem) - {}; - - bool operator()(smart_objects::SmartObject obj) { - return obj[strings::menu_name].asString() == newItem_; - } - - const std::string& newItem_; - }; - - /* - * @brief Predicate for using with CheckChoiceSet method to compare VR commands param - * - * return TRUE if there is coincidence of VR commands, otherwise FALSE - */ - struct CoincidencePredicateVRCommands { - explicit CoincidencePredicateVRCommands( - const smart_objects::SmartObject& newItem): newItem_(newItem) {} - - bool operator()(smart_objects::SmartObject obj) { - return compareStr(obj, newItem_); - } - - const smart_objects::SmartObject& newItem_; - }; - - /* - * @brief Checks if incoming choice set doesn't has similar VR synonyms. - * - * @param choice1 Choice to compare - * @param choice2 Choice to compare - * - * return Return TRUE if there are similar VR synonyms in choice set, - * otherwise FALSE - */ - bool compareSynonyms( + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const event_engine::Event& event); + + /** + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + */ + virtual void onTimeOut(); + /** + * @brief DeleteChoices allows to walk through the sent commands collection + * in order to sent appropriate DeleteCommand request. + */ + void DeleteChoices(); + + /** + * @brief Calls after all responses from HMI were received. + * Terminates request and sends successful response to mobile + * if all responses were SUCCESS or calls DeleteChoices in other case. + */ + void OnAllHMIResponsesReceived(); + + /** + * @brief The VRCommand struct + * Collect minimum information about sent VR commands, for correctly + * processing deleting sent commands if error from HMI received + */ + struct VRCommandInfo { + VRCommandInfo() {} + VRCommandInfo(uint32_t cmd_id) + : cmd_id_(cmd_id), succesful_response_received_(false) {} + uint32_t cmd_id_; + bool succesful_response_received_; + }; + + typedef std::map<uint32_t, VRCommandInfo> SentCommandsMap; + SentCommandsMap sent_commands_map_; + + int32_t choice_set_id_; + size_t expected_chs_count_; + size_t received_chs_count_; + + /** + * @brief Flag for stop sending VR commands to HMI, in case one of responses + * failed + */ + volatile bool error_from_hmi_; + sync_primitives::Lock error_from_hmi_lock_; + + /** + * @brief Flag shows if request already was expired by timeout + */ + volatile bool is_timed_out_; + sync_primitives::Lock is_timed_out_lock_; + + sync_primitives::Lock vr_commands_lock_; + /* + * @brief Sends VR AddCommand request to HMI + * + * @param app_id Application ID + * + */ + void SendVRAddCommandRequests(ApplicationSharedPtr const app); + + /* + * @brief Checks incoming choiseSet params. + * @param app Registred mobile application + * + * @return Mobile result code + */ + mobile_apis::Result::eType CheckChoiceSet(ApplicationConstSharedPtr app); + + /* + * @brief Predicate for using with CheckChoiceSet method to compare choice ID + *param + * + * return TRUE if there is coincidence of choice ID, otherwise FALSE + */ + struct CoincidencePredicateChoiceID { + CoincidencePredicateChoiceID(const uint32_t newItem) : newItem_(newItem) {} + + bool operator()(smart_objects::SmartObject obj) { + return obj[strings::choice_id].asUInt() == newItem_; + } + + const uint32_t newItem_; + }; + + /* + * @brief Predicate for using with CheckChoiceSet method to compare menu name + *param + * + * return TRUE if there is coincidence of menu name, otherwise FALSE + */ + struct CoincidencePredicateMenuName { + CoincidencePredicateMenuName(const std::string& newItem) + : newItem_(newItem){}; + + bool operator()(smart_objects::SmartObject obj) { + return obj[strings::menu_name].asString() == newItem_; + } + + const std::string& newItem_; + }; + + /* + * @brief Predicate for using with CheckChoiceSet method to compare VR commands + *param + * + * return TRUE if there is coincidence of VR commands, otherwise FALSE + */ + struct CoincidencePredicateVRCommands { + CoincidencePredicateVRCommands(const smart_objects::SmartObject& newItem) + : newItem_(newItem) {} + + bool operator()(smart_objects::SmartObject obj) { + return compareStr(obj, newItem_); + } + + const smart_objects::SmartObject& newItem_; + }; + + /* + * @brief Checks if incoming choice set doesn't has similar VR synonyms. + * + * @param choice1 Choice to compare + * @param choice2 Choice to compare + * + * return Return TRUE if there are similar VR synonyms in choice set, + * otherwise FALSE + */ + bool compareSynonyms( const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1, const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2); - /* - * @brief Checks VR synonyms ignoring differences in case. - * - * @param str1 VR synonym to compare - * @param str2 VR synonym to compare - * - * return Return TRUE if there are similar VR synonyms in choice set, - * otherwise FALSE - */ - static bool compareStr( + /* + * @brief Checks VR synonyms ignoring differences in case. + * + * @param str1 VR synonym to compare + * @param str2 VR synonym to compare + * + * return Return TRUE if there are similar VR synonyms in choice set, + * otherwise FALSE + */ + static bool compareStr( const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1, const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2); - /** - * @brief Checks choice set params(menuName, tertiaryText, ...) - * When type is String there is a check on the contents \t\n \\t \\n - * @param choice_set which must check - * @return if choice_set contains \t\n \\t \\n return TRUE, FALSE otherwise - */ - bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set); + /** + * @brief Checks choice set params(menuName, tertiaryText, ...) + * When type is String there is a check on the contents \t\n \\t \\n + * @param choice_set which must check + * @return if choice_set contains \t\n \\t \\n return TRUE, FALSE otherwise + */ + bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set); - DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest); + DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h index 965573f4a4..6a7faf705c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_response.h @@ -51,7 +51,8 @@ class CreateInteractionChoiceSetResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit CreateInteractionChoiceSetResponse(const MessageSharedPtr& message); + CreateInteractionChoiceSetResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief CreateInteractionChoiceSetResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h index bae0fedd54..6a19014c96 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h @@ -51,7 +51,8 @@ class DeleteCommandRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteCommandRequest(const MessageSharedPtr& message); + DeleteCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteCommandRequest class destructor @@ -71,7 +72,6 @@ class DeleteCommandRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); private: - DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest); /* diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h index 0fe0f0959b..b61035ca1b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_response.h @@ -51,7 +51,8 @@ class DeleteCommandResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteCommandResponse(const MessageSharedPtr& message); + DeleteCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteCommandResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h index 4927227465..adaf2686bc 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_request.h @@ -53,7 +53,8 @@ class DeleteFileRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteFileRequest(const MessageSharedPtr& message); + DeleteFileRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteFileRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h index cfe6aaa4fa..e001e46a22 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_file_response.h @@ -51,7 +51,8 @@ class DeleteFileResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteFileResponse(const MessageSharedPtr& message); + DeleteFileResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteFileResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h index 283b882fad..716a1d82de 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h @@ -52,7 +52,8 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message); + DeleteInteractionChoiceSetRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteInteractionChoiceSetRequest class destructor @@ -65,7 +66,6 @@ class DeleteInteractionChoiceSetRequest : public CommandRequestImpl { virtual void Run(); private: - /* * @brief Check if requested choice set ID in use by perform interaction * diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h index 1f641e15b3..86e20bc6d4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h @@ -51,7 +51,8 @@ class DeleteInteractionChoiceSetResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message); + DeleteInteractionChoiceSetResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteInteractionChoiceSetResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h index 6687218051..7c48de5d8e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_request.h @@ -52,7 +52,8 @@ class DeleteSubMenuRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteSubMenuRequest(const MessageSharedPtr& message); + DeleteSubMenuRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteSubMenuRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h index 0bb080e93e..76232aee4b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_sub_menu_response.h @@ -51,7 +51,8 @@ class DeleteSubMenuResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DeleteSubMenuResponse(const MessageSharedPtr& message); + DeleteSubMenuResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DeleteSubMenuResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h index 4cda040b42..34c8b0e872 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_request.h @@ -51,7 +51,8 @@ class DiagnosticMessageRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit DiagnosticMessageRequest(const MessageSharedPtr& message); + DiagnosticMessageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DiagnosticMessageRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h index 1b6a6024f4..439f11a57e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/diagnostic_message_response.h @@ -51,7 +51,8 @@ class DiagnosticMessageResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DiagnosticMessageResponse(const MessageSharedPtr& message); + DiagnosticMessageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DiagnosticMessageResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h index ea8556f6e0..1b945fc5fb 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h @@ -48,7 +48,8 @@ class DialNumberRequest : public CommandRequestImpl { /** * \brief DialNumberRequest class constructor **/ - explicit DialNumberRequest(const MessageSharedPtr& message); + DialNumberRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief DialNumberRequest class destructor @@ -58,11 +59,11 @@ class DialNumberRequest : public CommandRequestImpl { /** * @brief Initialize request params **/ - bool Init() OVERRIDE; + bool Init() OVERRIDE; /** - * @brief Execute command - **/ + * @brief Execute command + **/ void Run() OVERRIDE; /** @@ -73,13 +74,12 @@ class DialNumberRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); private: - /** * @brief Removes from number param all characters * except the + character and digits. * */ - void StripNumberParam(std::string &number); + void StripNumberParam(std::string& number); DISALLOW_COPY_AND_ASSIGN(DialNumberRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h index 0cdeb9eb90..4a6980bd04 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h @@ -1,5 +1,6 @@ /* - Copyright (c) 2016, Ford Motor Company + + Copyright (c) 2013, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -50,17 +51,18 @@ class DialNumberResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit DialNumberResponse(const MessageSharedPtr& message); + DialNumberResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief DialNumberResponse class destructor **/ - ~DialNumberResponse() OVERRIDE; + virtual ~DialNumberResponse(); /** * @brief Execute command **/ - void Run() OVERRIDE; + virtual void Run(); private: DISALLOW_COPY_AND_ASSIGN(DialNumberResponse); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h index f291f7a748..add6d2497e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_request.h @@ -51,7 +51,8 @@ class EndAudioPassThruRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit EndAudioPassThruRequest(const MessageSharedPtr& message); + EndAudioPassThruRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief EndAudioPassThruRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h index 5ad5f85e6e..381a397fbd 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/end_audio_pass_thru_response.h @@ -51,7 +51,8 @@ class EndAudioPassThruResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit EndAudioPassThruResponse(const MessageSharedPtr& message); + EndAudioPassThruResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief EndAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h index 1fb931d508..9ccef12152 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/generic_response.h @@ -45,15 +45,14 @@ class GenericResponse : public CommandResponseImpl { /** * \brief GenericResponse class constructor **/ - explicit GenericResponse(const MessageSharedPtr& message) - : CommandResponseImpl(message) { - } + GenericResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} /** * \brief GenericResponse class destructor **/ - virtual ~GenericResponse() { - } + virtual ~GenericResponse() {} /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h index d76ac253bc..d962937e39 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_request.h @@ -51,7 +51,8 @@ class GetDTCsRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit GetDTCsRequest(const MessageSharedPtr& message); + GetDTCsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief GetDTCsRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h index 69ff1fca59..abe970d60f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_dtcs_response.h @@ -51,7 +51,8 @@ class GetDTCsResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit GetDTCsResponse(const MessageSharedPtr& message); + GetDTCsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief GetDTCsResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h index db9db7b0a7..eda77e59b0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_request.h @@ -53,7 +53,8 @@ class GetVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit GetVehicleDataRequest(const MessageSharedPtr& message); + GetVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief GetVehicleDataRequest class destructor @@ -65,7 +66,6 @@ class GetVehicleDataRequest : public CommandRequestImpl { **/ virtual void Run(); - protected: virtual void on_event(const event_engine::Event& event); @@ -83,7 +83,7 @@ class GetVehicleDataRequest : public CommandRequestImpl { typedef std::vector<HmiRequest> HmiRequests; HmiRequests hmi_requests_; -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API DISALLOW_COPY_AND_ASSIGN(GetVehicleDataRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h index f0306df6aa..4fadaf2b01 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_vehicle_data_response.h @@ -51,7 +51,8 @@ class GetVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit GetVehicleDataResponse(const MessageSharedPtr& message); + GetVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief GetVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h new file mode 100644 index 0000000000..bf23121177 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief GetWayPointsRequest command class + **/ +class GetWayPointsRequest : public CommandRequestImpl { + public: + /** + * \brief GetWayPointsRequest class constructor + **/ + GetWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * \brief GetWayPointsRequest class destructor + **/ + virtual ~GetWayPointsRequest(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h index aa82de4d89..cb4f840763 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,43 +30,43 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_ -#include "application_manager/commands/hmi/notification_from_hmi.h" +#include "application_manager/commands/command_response_impl.h" +#include "utils/macro.h" namespace application_manager { namespace commands { /** - * @brief OnEmergencyEventNotification command class + * @brief GetWayPointsResponse command class **/ -class OnEmergencyEventNotification : public NotificationFromHMI { - public: - /** - * @brief OnEmergencyEventNotification class constructor - * - * @param message Incoming SmartObject message - **/ - explicit OnEmergencyEventNotification(const MessageSharedPtr& message); +class GetWayPointsResponse : public CommandResponseImpl { + public: + /** + * \brief GetWayPointsResponse class constructor + **/ + GetWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); - /** - * @brief OnEmergencyEventNotification class destructor - **/ - virtual ~OnEmergencyEventNotification(); + /** + * \brief GetWayPointsResponse class destructor + **/ + virtual ~GetWayPointsResponse(); - /** - * @brief Execute command - **/ - virtual void Run(); + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; - private: - DISALLOW_COPY_AND_ASSIGN(OnEmergencyEventNotification); + private: + DISALLOW_COPY_AND_ASSIGN(GetWayPointsResponse); }; } // namespace commands } // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h index 86171f1ff8..d8d28b7e9d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_request.h @@ -51,7 +51,8 @@ class ListFilesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ListFilesRequest(const MessageSharedPtr& message); + ListFilesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ListFilesRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h index 6f8e80bae2..a211ee5968 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/list_files_response.h @@ -51,7 +51,8 @@ class ListFilesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ListFilesResponse(const MessageSharedPtr& message); + ListFilesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ListFilesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h index 8753660470..7ef2e7e5d2 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h @@ -51,8 +51,8 @@ class OnAppInterfaceUnregisteredNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnAppInterfaceUnregisteredNotification( - const MessageSharedPtr& message); + OnAppInterfaceUnregisteredNotification( + const MessageSharedPtr& message, ApplicationManager& application_manager); /** * @brief OnAppInterfaceUnregisteredNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h index 67bc319771..b74d8fbe41 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h @@ -42,7 +42,8 @@ namespace application_manager { namespace commands { /** - * @brief OnAudioPassThruNotification class used to send notification with binary data written from + * @brief OnAudioPassThruNotification class used to send notification with + *binary data written from * microphone to mobile device while PerformAudioPassThru is active. **/ class OnAudioPassThruNotification : public CommandNotificationImpl { @@ -52,7 +53,8 @@ class OnAudioPassThruNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnAudioPassThruNotification(const MessageSharedPtr& message); + OnAudioPassThruNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnAudioPassThruNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h index d1297ba980..80355993e1 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_event_notification.h @@ -55,7 +55,8 @@ class OnButtonEventNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnButtonEventNotification(const MessageSharedPtr& message); + OnButtonEventNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnButtonEventNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h index 0ebdb6d7c6..1443e58a70 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_button_press_notification.h @@ -55,7 +55,8 @@ class OnButtonPressNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnButtonPressNotification(const MessageSharedPtr& message); + OnButtonPressNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnButtonEventCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h index 751b1e7dd2..3f9a0ad6c2 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_command_notification.h @@ -54,7 +54,8 @@ class OnCommandNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnCommandNotification(const MessageSharedPtr& message); + OnCommandNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnCommandNotification class destructor @@ -65,6 +66,7 @@ class OnCommandNotification : public CommandNotificationImpl { * @brief Execute command **/ virtual void Run(); + private: DISALLOW_COPY_AND_ASSIGN(OnCommandNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h index 2f2a3c81fc..ee3c19c707 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_driver_distraction_notification.h @@ -53,7 +53,8 @@ class OnDriverDistractionNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnDriverDistractionNotification(const MessageSharedPtr& message); + OnDriverDistractionNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnDriverDistractionNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h index be83047863..9f9fad16d4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hash_change_notification.h @@ -52,7 +52,8 @@ class OnHashChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnHashChangeNotification(const MessageSharedPtr& message); + OnHashChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnHashChangeNotification class destructor @@ -68,7 +69,7 @@ class OnHashChangeNotification : public CommandNotificationImpl { DISALLOW_COPY_AND_ASSIGN(OnHashChangeNotification); }; -} // namespace mobile +} // namespace mobile } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h index 11d82925ec..a82182eea0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification.h @@ -51,7 +51,8 @@ class OnHMIStatusNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnHMIStatusNotification(const MessageSharedPtr& message); + OnHMIStatusNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnHMIStatusNotification class destructor @@ -63,7 +64,7 @@ class OnHMIStatusNotification : public CommandNotificationImpl { **/ virtual void Run(); -private: + private: DISALLOW_COPY_AND_ASSIGN(OnHMIStatusNotification); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h index 70a8bf745b..878f4fa720 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_ #include "application_manager/commands/command_notification_from_mobile_impl.h" +#include "application_manager/application_manager.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -45,15 +46,16 @@ namespace commands { /** * @brief OnHMIStatusNotificationFromMobile class **/ -class OnHMIStatusNotificationFromMobile : - public CommandNotificationFromMobileImpl { +class OnHMIStatusNotificationFromMobile + : public CommandNotificationFromMobileImpl { public: /** * @brief OnHMIStatusNotificationFromMobile class constructor * * @param message Incoming SmartObject message **/ - explicit OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message); + OnHMIStatusNotificationFromMobile(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnHMIStatusNotificationFromMobile class destructor @@ -65,7 +67,7 @@ class OnHMIStatusNotificationFromMobile : **/ virtual void Run(); -private: + private: DISALLOW_COPY_AND_ASSIGN(OnHMIStatusNotificationFromMobile); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h index e0d6a258e9..911ca70cdf 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_keyboard_input_notification.h @@ -53,7 +53,8 @@ class OnKeyBoardInputNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnKeyBoardInputNotification(const MessageSharedPtr& message); + OnKeyBoardInputNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnKeyBoardInputNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h index d163114890..c62652ff67 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_language_change_notification.h @@ -51,7 +51,8 @@ class OnLanguageChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnLanguageChangeNotification(const MessageSharedPtr& message); + OnLanguageChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnLanguageChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h index 3cffe8ff49..d5f7aa96b8 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_permissions_change_notification.h @@ -51,7 +51,8 @@ class OnPermissionsChangeNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnPermissionsChangeNotification(const MessageSharedPtr& message); + OnPermissionsChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnPermissionsChangeNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h index cba6c4ed99..143b076033 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h @@ -53,7 +53,8 @@ class OnSystemRequestNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnSystemRequestNotification(const MessageSharedPtr& message); + OnSystemRequestNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnSystemRequestNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h index 5c34caba36..e7b895dceb 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_tbt_client_state_notification.h @@ -51,7 +51,8 @@ class OnTBTClientStateNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnTBTClientStateNotification(const MessageSharedPtr& message); + OnTBTClientStateNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTBTClientStateNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h index 1aba3087dd..abbf6787db 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_touch_event_notification.h @@ -53,7 +53,8 @@ class OnTouchEventNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnTouchEventNotification(const MessageSharedPtr& message); + OnTouchEventNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnTouchEventNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h index 7e64f19639..de6172de64 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_vehicle_data_notification.h @@ -53,7 +53,8 @@ class OnVehicleDataNotification : public CommandNotificationImpl { * * @param message Incoming SmartObject message **/ - explicit OnVehicleDataNotification(const MessageSharedPtr& message); + OnVehicleDataNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief OnVehicleDataNotification class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h new file mode 100644 index 0000000000..c204e1669c --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/on_way_point_change_notification.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_H_ + +#include "application_manager/commands/command_notification_impl.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +class OnWayPointChangeNotification : public CommandNotificationImpl { + public: + /** + * @brief OnWayPointChangeNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnWayPointChangeNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief OnWayPointChangeNotification class destructor + **/ + virtual ~OnWayPointChangeNotification(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(OnWayPointChangeNotification); +}; + +} // namespace commands +} // namespace application_manager +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ON_WAY_POINT_CHANGE_NOTIFICATION_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h index 62ca1257bb..b69cb969e1 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h @@ -52,7 +52,8 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit PerformAudioPassThruRequest(const MessageSharedPtr& message); + PerformAudioPassThruRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PerformAudioPassThruRequest class destructor @@ -114,12 +115,19 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { bool IsWhiteSpaceExist(); /** + * @brief Waiting for TTS.Speak response, after default timeout send + * GENERIC_ERROR response + * @return if receive TTS.Speak return TRUE, FALSE otherwise + */ + bool WaitTTSSpeak(); + + /** * @brief If is_active_tts_speak_ TRUE - set up to FALSE and send request * TTS_StopSpeaking to HMI */ void FinishTTSSpeak(); - //flag display state of speak during perform audio pass thru + // flag display state of speak during perform audio pass thru bool is_active_tts_speak_; mobile_apis::Result::eType result_tts_speak_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h index d659e59be0..d227c4fef3 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h @@ -51,7 +51,8 @@ class PerformAudioPassThruResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PerformAudioPassThruResponse(const MessageSharedPtr& message); + PerformAudioPassThruResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PerformAudioPassThruResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h index 02575c1126..f64b2ab334 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h @@ -36,7 +36,6 @@ #include "application_manager/commands/command_request_impl.h" #include "application_manager/application.h" -#include "utils/timer_thread.h" #include "utils/macro.h" namespace application_manager { @@ -48,15 +47,15 @@ namespace commands { /** * @brief PerformInteractionRequest command class **/ -class PerformInteractionRequest : public CommandRequestImpl { - +class PerformInteractionRequest : public CommandRequestImpl { public: /** * @brief PerformInteractionRequest class constructor * * @param message Incoming SmartObject message **/ - explicit PerformInteractionRequest(const MessageSharedPtr& message); + PerformInteractionRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PerformInteractionRequest class destructor @@ -86,7 +85,7 @@ class PerformInteractionRequest : public CommandRequestImpl { * has exceed it's limit * */ - virtual void onTimeOut(); + virtual void onTimeOut(); /* * @brief Function will be called when VR_OnCommand event @@ -95,7 +94,8 @@ class PerformInteractionRequest : public CommandRequestImpl { * @param message which should send to mobile side * */ - void ProcessVRResponse(const smart_objects::SmartObject& message); + void ProcessVRResponse(const smart_objects::SmartObject& message, + smart_objects::SmartObject& msg_params); /* * @brief Sends PerformInteraction response to mobile side @@ -103,9 +103,9 @@ class PerformInteractionRequest : public CommandRequestImpl { * @param message which should send to mobile side * */ - void ProcessPerformInteractionResponse - (const smart_objects::SmartObject& message); - + void ProcessPerformInteractionResponse( + const smart_objects::SmartObject& message, + smart_objects::SmartObject& msg_params); /* * @brief Sends UI PerformInteraction request to HMI @@ -132,12 +132,6 @@ class PerformInteractionRequest : public CommandRequestImpl { */ void SendUIShowVRHelpRequest(ApplicationSharedPtr const app); - /** - * @brief Creates and Sends Perform interaction to UI. - */ - void CreateUIPerformInteraction(const smart_objects::SmartObject& msg_params, - application_manager::ApplicationSharedPtr const app); - /* * @brief Checks if incoming choice set doesn't has similar menu names. * @@ -146,7 +140,8 @@ class PerformInteractionRequest : public CommandRequestImpl { * return Return TRUE if there are no similar menu names in choice set, * otherwise FALSE */ - bool CheckChoiceSetMenuNames(application_manager::ApplicationSharedPtr const app); + bool CheckChoiceSetMenuNames( + application_manager::ApplicationSharedPtr const app); /* * @brief Checks if incoming choice set doesn't has similar VR synonyms. @@ -156,7 +151,8 @@ class PerformInteractionRequest : public CommandRequestImpl { * return Return TRUE if there are no similar VR synonyms in choice set, * otherwise FALSE */ - bool CheckChoiceSetVRSynonyms(application_manager::ApplicationSharedPtr const app); + bool CheckChoiceSetVRSynonyms( + application_manager::ApplicationSharedPtr const app); /* * @brief Checks if request with non-sequential positions of vrHelpItems @@ -167,7 +163,8 @@ class PerformInteractionRequest : public CommandRequestImpl { * @return TRUE if vrHelpItems positions are sequential, * otherwise FALSE */ - bool CheckVrHelpItemPositions(application_manager::ApplicationSharedPtr const app); + bool CheckVrHelpItemPositions( + application_manager::ApplicationSharedPtr const app); /* * @brief Disable PerformInteraction state in application and @@ -197,13 +194,50 @@ class PerformInteractionRequest : public CommandRequestImpl { */ bool CheckChoiceIDFromResponse(ApplicationSharedPtr app, int32_t choice_id); - // members - mobile_apis::Result::eType vr_perform_interaction_code_; + /** + * @brief Checks for a match of choice ID, in + * choice sets. + * @param app contains pointer to application. + * @param choice_set_id_list_length contains amount + * of choice set ids. + * @param choice_set_id_list array of choice set ids + * @return If request contains several choice sets with + * same choice id returns false, otherwise returns + * true. + */ + bool CheckChoiceIDFromRequest( + ApplicationSharedPtr app, + const size_t choice_set_id_list_length, + const smart_objects::SmartObject& choice_set_id_list) const; + + /** + * @brief Tells if there are sent requests without responses + * @return If there is request without response method returns TRUE + * otherwise returns FALSE + */ + const bool HasHMIResponsesToWait() const; + + /** + * @brief Check VR response result code, in case GENERIC_ERROR, REJECTED, + * send resultCode FALSE, in case WARNINGS send resultCode TRUE + */ + void CheckResponseResultCode(); + + /** + * @brief Check UI & VR result codes, send response to mobile + * @param msg_param Message params to send + */ + void SendBothModeResponse(const smart_objects::SmartObject& msg_param); + mobile_apis::InteractionMode::eType interaction_mode_; - bool ui_response_recived_; - bool vr_response_recived_; - bool app_pi_was_active_before_; - static uint32_t pi_requests_count_; + bool ui_response_recived_; + bool vr_response_recived_; + bool ui_result_; + bool vr_result_; + bool app_pi_was_active_before_; + static uint32_t pi_requests_count_; + mobile_apis::Result::eType vr_resultCode_; + mobile_apis::Result::eType ui_resultCode_; DISALLOW_COPY_AND_ASSIGN(PerformInteractionRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h index 4ecc149fb4..1274996747 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_response.h @@ -51,7 +51,8 @@ class PerformInteractionResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PerformInteractionResponse(const MessageSharedPtr& message); + PerformInteractionResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PerformInteractionResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h index 8a94a708a1..e3af8ac69b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_request.h @@ -36,7 +36,7 @@ #include "application_manager/commands/command_request_impl.h" #include "utils/macro.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace application_manager { @@ -52,7 +52,8 @@ class PutFileRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit PutFileRequest(const MessageSharedPtr& message); + PutFileRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PutFileRequest class destructor @@ -65,13 +66,13 @@ class PutFileRequest : public CommandRequestImpl { virtual void Run(); private: - int64_t offset_; - std::string sync_file_name_; - int64_t length_; - mobile_apis::FileType::eType file_type_; - bool is_persistent_file_; + int64_t offset_; + std::string sync_file_name_; + int64_t length_; + mobile_apis::FileType::eType file_type_; + bool is_persistent_file_; - void SendOnPutFileNotification(); + void SendOnPutFileNotification(); DISALLOW_COPY_AND_ASSIGN(PutFileRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h index 89ff6ad08f..f561f9fdbc 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/put_file_response.h @@ -51,7 +51,8 @@ class PutFileResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit PutFileResponse(const MessageSharedPtr& message); + PutFileResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief PutFileResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h index e2e5dbf3da..c88f16dab0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_request.h @@ -51,7 +51,8 @@ class ReadDIDRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ReadDIDRequest(const MessageSharedPtr& message); + ReadDIDRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ReadDIDRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h index 80b9b5ea48..2e493fa0ec 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/read_did_response.h @@ -51,7 +51,8 @@ class ReadDIDResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ReadDIDResponse(const MessageSharedPtr& message); + ReadDIDResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ReadDIDResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index e5bcf40da9..dc7f9fb755 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -34,9 +34,10 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ -#include <string.h> #include "application_manager/commands/command_request_impl.h" +#include "application_manager/policies/policy_handler_interface.h" #include "utils/macro.h" +#include "utils/custom_string.h" namespace policy { struct DeviceInfo; @@ -48,6 +49,8 @@ class Application; namespace commands { +namespace custom_str = utils::custom_string; + /** * @brief Register app interface request command class **/ @@ -56,7 +59,8 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { /** * \brief RegisterAppInterfaceRequest class constructor **/ - explicit RegisterAppInterfaceRequest(const MessageSharedPtr& message); + RegisterAppInterfaceRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief RegisterAppInterfaceRequest class destructor @@ -79,10 +83,21 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { *@param application_impl application * **/ - void SendRegisterAppInterfaceResponseToMobile( - mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS); + void SendRegisterAppInterfaceResponseToMobile(); private: + smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification( + const uint32_t connection_key, ApplicationSharedPtr app); + + /** + * @brief Sends OnAppRegistered notification to HMI + * + *@param application_impl application with changed HMI status + * + **/ + void SendOnAppRegisteredNotificationToHMI(const Application& application_impl, + bool resumption = false, + bool need_restore_vr = false); /* * @brief Check new ID along with known mobile application ID * @@ -100,22 +115,21 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { mobile_apis::Result::eType CheckCoincidence(); /* - * @brief Predicate for using with CheckCoincidence method to compare with VR synonym SO + * @brief Predicate for using with CheckCoincidence method to compare with VR + * synonym SO * * return TRUE if there is coincidence of VR, otherwise FALSE */ struct CoincidencePredicateVR { - explicit CoincidencePredicateVR(const std::string &newItem) - :newItem_(newItem) - {}; - - bool operator()(smart_objects::SmartObject obj) { - const std::string vr_synonym = obj.asString(); - return !(strcasecmp(vr_synonym.c_str(), newItem_.c_str())); - }; + CoincidencePredicateVR(const custom_str::CustomString& newItem) + : newItem_(newItem) {} - const std::string &newItem_; - }; + bool operator()(const smart_objects::SmartObject& obj) { + const custom_str::CustomString& vr_synonym = obj.asCustomString(); + return newItem_.CompareIgnoreCase(vr_synonym); + } + const custom_str::CustomString& newItem_; + }; /** * @brief Check request parameters against policy table data @@ -153,11 +167,11 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { */ void SendSubscribeCustomButtonNotification(); -private: + private: std::string response_info_; mobile_apis::Result::eType result_checking_app_hmi_type_; - + policy::PolicyHandlerInterface& GetPolicyHandler(); DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h index 1244cb65f8..b125cc7c55 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_response.h @@ -47,15 +47,14 @@ class RegisterAppInterfaceResponse : public CommandResponseImpl { /** * \brief RegisterAppInterfaceResponse class constructor **/ - explicit RegisterAppInterfaceResponse(const MessageSharedPtr& response) - : CommandResponseImpl(response) { - } + RegisterAppInterfaceResponse(const MessageSharedPtr& response, + ApplicationManager& application_manager) + : CommandResponseImpl(response, application_manager) {} /** * \brief RegisterAppInterfaceResponse class destructor **/ - virtual ~RegisterAppInterfaceResponse() { - } + virtual ~RegisterAppInterfaceResponse() {} /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h index d7abe38c11..0053c14f3c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h @@ -52,7 +52,8 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ResetGlobalPropertiesRequest(const MessageSharedPtr& message); + ResetGlobalPropertiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ResetGlobalPropertiesRequest class destructor @@ -103,7 +104,8 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl { * * @return TRUE on success, otherwise FALSE */ - bool ResetVrHelpTitleItems(application_manager::ApplicationSharedPtr const app); + bool ResetVrHelpTitleItems( + application_manager::ApplicationSharedPtr const app); /* * @brief Check if there some not delivered hmi responses exist diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h index 7c0b8eb00b..39e28486d4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_response.h @@ -51,7 +51,8 @@ class ResetGlobalPropertiesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ResetGlobalPropertiesResponse(const MessageSharedPtr& message); + ResetGlobalPropertiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ResetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h index a810f4eb2d..b3058c9a26 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h @@ -50,7 +50,8 @@ class ScrollableMessageRequest : public CommandRequestImpl { /** * @brief ScrollableMessageRequest class constructor **/ - explicit ScrollableMessageRequest(const MessageSharedPtr& message); + ScrollableMessageRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SliderCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h index f0c0ea8f7a..aa0ac01e9d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_response.h @@ -45,13 +45,13 @@ class ScrollableMessageResponse : public CommandResponseImpl { /** * \brief ScrollableMessageResponse class constructor **/ - explicit ScrollableMessageResponse(const MessageSharedPtr& message); + ScrollableMessageResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SpeakResponseCommand class destructor **/ - virtual ~ScrollableMessageResponse() { - } + virtual ~ScrollableMessageResponse() {} /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h index 581c779aa5..570e70d007 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_request.h @@ -34,6 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_ +#include <list> #include "application_manager/commands/command_request_impl.h" namespace application_manager { @@ -48,7 +49,8 @@ class SendLocationRequest : public CommandRequestImpl { /** * @brief SendLocationRquest class constructor */ - explicit SendLocationRequest(const MessageSharedPtr& message); + SendLocationRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SendLocationRquest class destructor @@ -67,8 +69,13 @@ class SendLocationRequest : public CommandRequestImpl { */ virtual void on_event(const event_engine::Event& event); - private: + /** + * @brief CheckFieldsCompatibility checks if fields are compatible with each + * other. + * @return true if compatible, otherwise return false + */ + bool CheckFieldsCompatibility(); /** * @brief Checks sendlocation params(locationName, locationDescription, ...). @@ -77,7 +84,8 @@ class SendLocationRequest : public CommandRequestImpl { */ bool IsWhiteSpaceExist(); - bool CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names); + bool CheckHMICapabilities( + std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names); DISALLOW_COPY_AND_ASSIGN(SendLocationRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h index fe88a2af29..0be0be8ca3 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_location_response.h @@ -36,7 +36,6 @@ #include "application_manager/commands/command_response_impl.h" #include "application_manager/message.h" - namespace application_manager { namespace commands { @@ -45,7 +44,8 @@ class SendLocationResponse : public CommandResponseImpl { /** * @brief SendLocationResponse class constructor */ - explicit SendLocationResponse(const MessageSharedPtr& message); + SendLocationResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SendLocationResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h index da21decd81..42eedad19b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_request.h @@ -49,17 +49,15 @@ class SetAppIconRequest : public CommandRequestImpl { /** * @brief Contains information about the type of image */ - typedef enum { - STATIC = 0, - DYNAMIC - } ImageType; + typedef enum { STATIC = 0, DYNAMIC } ImageType; /** * @brief SetIconRequest class constructor * * @param message Incoming SmartObject message **/ - explicit SetAppIconRequest(const MessageSharedPtr& message); + SetAppIconRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetIconRequest class destructor @@ -101,11 +99,11 @@ class SetAppIconRequest : public CommandRequestImpl { bool IsEnoughSpaceForIcon(const uint64_t icon_size) const; DISALLOW_COPY_AND_ASSIGN(SetAppIconRequest); -private: + private: /** * @brief Checks, if icons saving to configured folder is enabled */ - static int8_t is_icons_saving_enabled_; + bool is_icons_saving_enabled_; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h index 02be7fe37e..6061cf5702 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_app_icon_response.h @@ -51,7 +51,8 @@ class SetAppIconResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetAppIconResponse(const MessageSharedPtr& message); + SetAppIconResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h index 925a1cd67f..06e8d70f79 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_request.h @@ -51,7 +51,8 @@ class SetDisplayLayoutRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetDisplayLayoutRequest(const MessageSharedPtr& message); + SetDisplayLayoutRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetDisplayLayoutRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h index dbf3de8d88..a2040307b0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_display_layout_response.h @@ -51,7 +51,8 @@ class SetDisplayLayoutResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetDisplayLayoutResponse(const MessageSharedPtr& message); + SetDisplayLayoutResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetDisplayLayoutResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h index d9e18dd76f..aa26a70393 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h @@ -1,6 +1,5 @@ /* - - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2015, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -36,6 +35,7 @@ #include "application_manager/commands/command_request_impl.h" #include "utils/macro.h" +#include "application_manager/application.h" namespace application_manager { @@ -51,7 +51,8 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SetGlobalPropertiesRequest(const MessageSharedPtr& message); + SetGlobalPropertiesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetGlobalPropertiesRequest class destructor @@ -71,21 +72,42 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { void on_event(const event_engine::Event& event); private: - /* - * @brief Chec if HelpItems order is correct - * - * @return TRUE on success, otherwise FALSE - */ - bool CheckVrHelpItemsOrder(); + // Verify correctness VrHelptitle value + static bool ValidateVRHelpTitle( + const smart_objects::SmartObject* const vr_help_so_ptr); + + // prepare UI sending data (VrHelps, Menus, Keyboard) to SmartObject + static void PrepareUIRequestVRHelpData( + const ApplicationSharedPtr app, + const smart_objects::SmartObject& msg_params, + smart_objects::SmartObject& out_params); + + static bool PrepareUIRequestDefaultVRHelpData( + const ApplicationSharedPtr app, smart_objects::SmartObject& out_params); + + static void PrepareUIRequestMenuAndKeyboardData( + const ApplicationSharedPtr app, + const smart_objects::SmartObject& msg_params, + smart_objects::SmartObject& out_params); + + // Send TTS request to HMI + void SendTTSRequest(const smart_objects::SmartObject& params, + bool use_events); + + // Send UI request to HMI + void SendUIRequest(const smart_objects::SmartObject& params, bool use_events); - /* + // VRHelp shall contain sequential positions and start from 1 + static bool CheckVrHelpItemsOrder(const smart_objects::SmartObject& vr_help); + + /** * @brief Check if there some not delivered hmi responses exist * * @return true if all responses received */ bool IsPendingResponseExist(); - /* + /** * @brief Checks if request has at least one parameter * * @param params request parameters @@ -103,8 +125,6 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { */ bool IsWhiteSpaceExist(); - DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest); - bool is_ui_send_; bool is_tts_send_; @@ -113,6 +133,8 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType tts_result_; + + DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest); }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h index dd80e738e3..c5beda084d 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_response.h @@ -51,7 +51,8 @@ class SetGlobalPropertiesResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetGlobalPropertiesResponse(const MessageSharedPtr& message); + SetGlobalPropertiesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetGlobalPropertiesResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h index d46094032a..96d4ac6f1e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_request.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_REQUEST_H_ #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" #include "utils/macro.h" namespace application_manager { @@ -49,17 +50,15 @@ class SetIconRequest : public CommandRequestImpl { /** * @brief Contains information about the type of image */ - typedef enum { - STATIC = 0, - DYNAMIC - } ImageType; + typedef enum { STATIC = 0, DYNAMIC } ImageType; /** * @brief SetIconRequest class constructor * * @param message Incoming SmartObject message **/ - explicit SetIconRequest(const MessageSharedPtr& message); + SetIconRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SetIconRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h index 88dceaf5a2..83be0d4a4b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_icon_response.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_ #include "application_manager/commands/command_response_impl.h" +#include "application_manager/application_manager.h" #include "utils/macro.h" namespace application_manager { @@ -51,7 +52,7 @@ class SetIconResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SetIconResponse(const MessageSharedPtr& message); + SetIconResponse(const MessageSharedPtr& message, ApplicationManager& app_man); /** * @brief SetIconResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h index e4fae5c0b3..283dd41622 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_request.h @@ -49,7 +49,8 @@ class SetMediaClockRequest : public CommandRequestImpl { /** * \brief SetMediaClockRequest class constructor **/ - explicit SetMediaClockRequest(const MessageSharedPtr& message); + SetMediaClockRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief ShowCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h index 46844bd2f3..3f41ae2dab 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_media_clock_timer_response.h @@ -45,7 +45,8 @@ class SetMediaClockTimerResponse : public CommandResponseImpl { /** * \brief SetMediaClockTimerResponse class constructor **/ - explicit SetMediaClockTimerResponse(const MessageSharedPtr& message); + SetMediaClockTimerResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SetMediaClockTimerResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h index a22ee9852a..f015d740df 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h @@ -52,7 +52,8 @@ class ShowConstantTBTRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit ShowConstantTBTRequest(const MessageSharedPtr& message); + ShowConstantTBTRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ShowConstantTBTRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h index 6a102b1984..73aad5de89 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_response.h @@ -51,7 +51,8 @@ class ShowConstantTBTResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit ShowConstantTBTResponse(const MessageSharedPtr& message); + ShowConstantTBTResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief ShowConstantTBTResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h index 091cab3bfd..cbe2ca396a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_request.h @@ -50,7 +50,8 @@ class ShowRequest : public CommandRequestImpl { /** * \brief ShowRequest class constructor **/ - explicit ShowRequest(const MessageSharedPtr& message); + ShowRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief ShowRequest class destructor @@ -70,7 +71,6 @@ class ShowRequest : public CommandRequestImpl { virtual void on_event(const event_engine::Event& event); private: - /* * @brief Check if all strings have valid syntax in request * diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h index c327bc3b3a..0a54fb9cde 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_response.h @@ -45,7 +45,8 @@ class ShowResponse : public CommandResponseImpl { /** * \brief ShowResponse class constructor **/ - explicit ShowResponse(const MessageSharedPtr& message); + ShowResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief ShowResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h index de24438ddd..2446c9ff20 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_request.h @@ -49,7 +49,8 @@ class SliderRequest : public CommandRequestImpl { /** * \brief SliderRequest class constructor **/ - explicit SliderRequest(const MessageSharedPtr& message); + SliderRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SliderRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h index 1888388e7c..bc0efaadd0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/slider_response.h @@ -45,7 +45,8 @@ class SliderResponse : public CommandResponseImpl { /** * \brief SliderResponse class constructor **/ - explicit SliderResponse(const MessageSharedPtr& message); + SliderResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SpeakResponseCommand class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h index 7d3b2096af..dc22652b27 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h @@ -49,7 +49,8 @@ class SpeakRequest : public CommandRequestImpl { /** * \brief SpeakRequest class constructor **/ - explicit SpeakRequest(const MessageSharedPtr& message); + SpeakRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SpeakRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h index cbf1ec40de..2808526603 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_response.h @@ -45,7 +45,8 @@ class SpeakResponse : public CommandResponseImpl { /** * \brief SpeakResponse class constructor **/ - explicit SpeakResponse(const MessageSharedPtr& message); + SpeakResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * \brief SpeakResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h index 12168e2473..b5a22d40a9 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_request.h @@ -52,7 +52,8 @@ class SubscribeButtonRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeButtonRequest(const MessageSharedPtr& message); + SubscribeButtonRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SubscribeButtonRequest class destructor @@ -65,7 +66,6 @@ class SubscribeButtonRequest : public CommandRequestImpl { virtual void Run(); private: - /** * @brief Checks if button subscription allowed. In case non-media * application trying to subscribe on buttons(tune, seek) negative result will diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h index 8366884540..38e0dd2dc6 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_button_response.h @@ -51,7 +51,8 @@ class SubscribeButtonResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeButtonResponse(const MessageSharedPtr& message); + SubscribeButtonResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SubscribeButtonResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h index 288500e7e8..6b2c2bb616 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_ #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application.h" #include "utils/macro.h" namespace application_manager { @@ -51,7 +52,8 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeVehicleDataRequest(const MessageSharedPtr& message); + SubscribeVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SubscribeButtonCommandRequest class destructor @@ -82,12 +84,45 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl { typedef std::vector<HmiRequest> HmiRequests; HmiRequests hmi_requests_; -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API private: - bool IsAnythingAlreadySubscribed( + /** + * @brief Checks, if any app is subscribed for particular VI parameter + * @param param_id VI parameter id + * @return true, if there are registered apps subscribed for VI parameter, + * otherwise - false + */ + bool IsSomeoneSubscribedFor(const uint32_t param_id) const; + + /** + * @brief Adds VI parameters being subscribed by another or the same app to + * response with appropriate results + * @param msg_params 'message_params' response section reference + */ + void AddAlreadySubscribedVI(smart_objects::SmartObject& msg_params) const; + + /** + * @brief Removes subscription for VI parameters which subsription attempt + * returned an error + * @param app Pointer to application sent subscribe request + * @param msg_params 'message_parameters' response section reference + */ + void UnsubscribeFailedSubscriptions( + ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) const; + /** + * @brief VI parameters which had been already subscribed by another apps + * befor particular app subscribed for these parameters + */ + VehicleInfoSubscriptions vi_already_subscribed_by_another_apps_; + + /** + * @brief VI parameters which had been subscribed already by particular app + */ + VehicleInfoSubscriptions vi_already_subscribed_by_this_app_; + DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h index d2771c0712..7e3cffc387 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h @@ -51,7 +51,8 @@ class SubscribeVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SubscribeVehicleDataResponse(const MessageSharedPtr& message); + SubscribeVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataCommandRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h new file mode 100644 index 0000000000..50b3a6f2cb --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_request.h @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SubsribeWayPointsRequest command class + **/ +class SubscribeWayPointsRequest : public CommandRequestImpl { + public: + /** + * \brief SubscribeWayPointsRequest class constructor + **/ + SubscribeWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * \brief SubscribeWayPointsRequest class destructor + **/ + virtual ~SubscribeWayPointsRequest(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest); +}; + +} // commands + +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h new file mode 100644 index 0000000000..cfdc0eede7 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_way_points_response.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SubscribeWayPointsResponse command class + **/ +class SubscribeWayPointsResponse : public CommandResponseImpl { + public: + /** + * \brief SubscribeWayPointsResponse class constructor + **/ + SubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * \brief SubscribeWayPointsResponse class destructor + **/ + virtual ~SubscribeWayPointsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsResponse); +}; + +} // commands + +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h index 25accb1db2..de87512e92 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/system_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/system_request.h @@ -36,6 +36,9 @@ #include <string> #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event.h" +#include "smart_objects/smart_object.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -57,7 +60,8 @@ class SystemRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit SystemRequest(const MessageSharedPtr& message); + SystemRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SystemRequest class destructor @@ -76,17 +80,17 @@ class SystemRequest : public CommandRequestImpl { */ virtual void on_event(const event_engine::Event& event); -private: + private: /** * @brief Validates data coming within QueryApps response * @param data Data * @return true, if data is valid, otherwise - false */ - bool ValidateQueryAppData(const smart_objects::SmartObject& data) const; + bool ValidateQueryAppData(smart_objects::SmartObject& data) const; private: static uint32_t index; - std::string processing_file_; + std::string processing_file_; DISALLOW_COPY_AND_ASSIGN(SystemRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h index ca2fb99970..3f48db7f0e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/system_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/system_response.h @@ -36,7 +36,6 @@ #include "application_manager/commands/command_response_impl.h" - namespace application_manager { namespace commands { @@ -51,7 +50,8 @@ class SystemResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit SystemResponse(const MessageSharedPtr& message); + SystemResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief SystemResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h index a5a53736e2..acc7374e18 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_request.h @@ -49,15 +49,14 @@ class UnregisterAppInterfaceRequest : public CommandRequestImpl { /** * \brief UnregisterAppInterfaceRequest class constructor **/ - explicit UnregisterAppInterfaceRequest(const MessageSharedPtr& message) - : CommandRequestImpl(message) { - } + UnregisterAppInterfaceRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} /** * \brief UnregisterAppInterfaceRequest class destructor **/ - virtual ~UnregisterAppInterfaceRequest() { - } + virtual ~UnregisterAppInterfaceRequest() {} /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h index 5c8928a6c8..1a459e109c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unregister_app_interface_response.h @@ -47,15 +47,14 @@ class UnregisterAppInterfaceResponse : public CommandResponseImpl { /** * \brief UnregisterAppInterfaceResponse class constructor **/ - explicit UnregisterAppInterfaceResponse(const MessageSharedPtr& response) - : CommandResponseImpl(response) { - } + UnregisterAppInterfaceResponse(const MessageSharedPtr& response, + ApplicationManager& application_manager) + : CommandResponseImpl(response, application_manager) {} /** * \brief UnregisterAppInterfaceResponse class destructor **/ - virtual ~UnregisterAppInterfaceResponse() { - } + virtual ~UnregisterAppInterfaceResponse() {} /** * @brief Execute command diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h index 58c9dc8de9..62600d51d7 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_request.h @@ -51,7 +51,8 @@ class UnsubscribeButtonRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeButtonRequest(const MessageSharedPtr& message); + UnsubscribeButtonRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UnsubscribeButtonRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h index 972da48065..06dbe84578 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_button_response.h @@ -51,7 +51,8 @@ class UnsubscribeButtonResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeButtonResponse(const MessageSharedPtr& message); + UnsubscribeButtonResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UnsubscribeButtonResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h index dd52a77224..a6bade2fd6 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_ #include "application_manager/commands/command_request_impl.h" +#include "application_manager/application.h" #include "utils/macro.h" namespace application_manager { @@ -51,7 +52,8 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeVehicleDataRequest(const MessageSharedPtr& message); + UnsubscribeVehicleDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataRequest class destructor @@ -82,11 +84,40 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl { typedef std::vector<HmiRequest> HmiRequests; HmiRequests hmi_requests_; -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API private: - bool IsAnythingAlreadyUnsubscribed( - const smart_objects::SmartObject& msg_params) const; + /** + * @brief Checks, if any app is subscribed for particular VI parameter + * @param param_id VI parameter id + * @return true, if there are registered apps subscribed for VI parameter, + * otherwise - false + */ + bool IsSomeoneSubscribedFor(const uint32_t param_id) const; + + /** + * @brief Adds VI parameters being unsubscribed by another or the same app to + * response with appropriate results + * @param msg_params 'message_params' response section reference + */ + void AddAlreadyUnsubscribedVI(smart_objects::SmartObject& response) const; + + /** + * @brief Allows to update hash after sending response to mobile. + */ + void UpdateHash() const; + + /** + * @brief VI parameters which still being subscribed by another apps after + * particular app had been unsubscribed from these parameters + */ + VehicleInfoSubscriptions vi_still_subscribed_by_another_apps_; + + /** + * @brief VI parameters which had been unsubscribed already by particular app + */ + VehicleInfoSubscriptions vi_already_unsubscribed_by_this_app_; + DISALLOW_COPY_AND_ASSIGN(UnsubscribeVehicleDataRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h index 3fb932ecf3..a34a36688c 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h @@ -51,7 +51,8 @@ class UnsubscribeVehicleDataResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UnsubscribeVehicleDataResponse(const MessageSharedPtr& message); + UnsubscribeVehicleDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UnsubscribeVehicleDataResponse class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h new file mode 100644 index 0000000000..2831551667 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_request.h @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace application_manager { + +namespace commands { + +class UnSubscribeWayPointsRequest : public CommandRequestImpl { + public: + /** + * \brief UnSubscribeWayPointsRequest class constructor + **/ + UnSubscribeWayPointsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * \brief UnSubscribeWayPointsRequest class destructor + **/ + virtual ~UnSubscribeWayPointsRequest(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(UnSubscribeWayPointsRequest); +}; + +} // commands + +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h new file mode 100644 index 0000000000..70211330a9 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_way_points_response.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief UnsubscribeWayPointsResponse command class + **/ +class UnsubscribeWayPointsResponse : public CommandResponseImpl { + public: + /** + * \brief UnsubscribeWayPointsResponse class constructor + **/ + UnsubscribeWayPointsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * \brief UnsubscribeWayPointsResponse class destructor + **/ + virtual ~UnsubscribeWayPointsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsResponse); +}; + +} // commands + +} // application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h index c65c2bc534..e15e81caf5 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h @@ -52,7 +52,8 @@ class UpdateTurnListRequest : public CommandRequestImpl { * * @param message Incoming SmartObject message **/ - explicit UpdateTurnListRequest(const MessageSharedPtr& message); + UpdateTurnListRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateTurnListRequest class destructor diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h index fdbf64826c..481ad9f219 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_response.h @@ -51,7 +51,8 @@ class UpdateTurnListResponse : public CommandResponseImpl { * * @param message Incoming SmartObject message **/ - explicit UpdateTurnListResponse(const MessageSharedPtr& message); + UpdateTurnListResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief UpdateTurnListResponse class destructor diff --git a/src/components/application_manager/include/application_manager/event_engine/event.h b/src/components/application_manager/include/application_manager/event_engine/event.h index 55f5cd1320..4b8a4088bf 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event.h +++ b/src/components/application_manager/include/application_manager/event_engine/event.h @@ -41,11 +41,12 @@ namespace application_manager { namespace event_engine { +class EventDispatcher; + namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; class Event { public: - // Typedef for possible Event ID's from mobile_apis functionID enum typedef hmi_apis::FunctionID::eType EventID; @@ -65,7 +66,7 @@ class Event { * @brief Sends synchronously event to all subscribers. * */ - void raise(); + void raise(EventDispatcher& event_dispatcher); /* * @brief Provides event ID @@ -102,11 +103,9 @@ class Event { inline int32_t smart_object_type() const; protected: - private: - - EventID id_; - smart_objects::SmartObject response_so_; + EventID id_; + smart_objects::SmartObject response_so_; /* * @brief Default constructor @@ -127,21 +126,24 @@ const smart_objects::SmartObject& Event::smart_object() const { } int32_t Event::smart_object_function_id() const { - return response_so_.getElement( - strings::params).getElement(strings::function_id).asInt(); + return response_so_.getElement(strings::params) + .getElement(strings::function_id) + .asInt(); } int32_t Event::smart_object_correlation_id() const { - return response_so_.getElement( - strings::params).getElement(strings::correlation_id).asInt(); + return response_so_.getElement(strings::params) + .getElement(strings::correlation_id) + .asInt(); } int32_t Event::smart_object_type() const { - return response_so_.getElement( - strings::params).getElement(strings::message_type).asInt(); + return response_so_.getElement(strings::params) + .getElement(strings::message_type) + .asInt(); } -} -} +} // namespace event_engine +} // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_H_ diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h index ff21b01c58..3d236b9c0f 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -34,11 +34,6 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_H_ #include <list> -#include <map> - -#include "utils/lock.h" -#include "utils/singleton.h" - #include "application_manager/event_engine/event.h" namespace application_manager { @@ -46,15 +41,14 @@ namespace event_engine { class EventObserver; -class EventDispatcher : public utils::Singleton<EventDispatcher> { +class EventDispatcher { public: - /* * @brief Delivers the event to all subscribers * * @param event Received event */ - void raise_event(const Event& event); + virtual void raise_event(const Event& event) = 0; /* * @brief Subscribe the observer to event @@ -63,9 +57,9 @@ class EventDispatcher : public utils::Singleton<EventDispatcher> { * @param hmi_correlation_id The event HMI correlation ID * @param observer The observer to subscribe for event */ - void add_observer(const Event::EventID& event_id, - int32_t hmi_correlation_id, - EventObserver* const observer); + virtual void add_observer(const Event::EventID& event_id, + int32_t hmi_correlation_id, + EventObserver& observer) = 0; /* * @brief Unsubscribes the observer from specific event @@ -73,55 +67,23 @@ class EventDispatcher : public utils::Singleton<EventDispatcher> { * @param event_id The event ID to unsubscribe from * @param observer The observer to be unsubscribed */ - void remove_observer(const Event::EventID& event_id, - EventObserver* const observer); + virtual void remove_observer(const Event::EventID& event_id, + EventObserver& observer) = 0; /* * @brief Unsubscribes the observer from all events * * @param observer The observer to be unsubscribed */ - void remove_observer(EventObserver* const observer); - - protected: - - private: - - /* - * @brief Default constructor - */ - EventDispatcher(); + virtual void remove_observer(EventObserver& observer) = 0; /* * @brief Destructor */ - virtual ~EventDispatcher(); - - /* - * @brief removes observer - * when occurs unsubscribe from event - * @param observer to be removed - */ - void remove_observer_from_list(EventObserver* const observer); - - DISALLOW_COPY_AND_ASSIGN(EventDispatcher); - - FRIEND_BASE_SINGLETON_CLASS(EventDispatcher); - - // Data types section - typedef std::list<EventObserver*> ObserverList; - typedef std::map<int32_t, ObserverList> ObserversMap; - typedef std::map<Event::EventID, ObserversMap> EventObserverMap; - - // Members section - sync_primitives::Lock state_lock_; - sync_primitives::Lock observer_list_lock_; - EventObserverMap observers_; - ObserverList observers_list_; - + virtual ~EventDispatcher(){}; }; -} -} +} // namespace event_engine +} // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_H_ diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h new file mode 100644 index 0000000000..9a13ad608b --- /dev/null +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h @@ -0,0 +1,129 @@ +/* + 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_ + +#include <vector> +#include <map> + +#include "utils/lock.h" + +#include "application_manager/event_engine/event.h" +#include "application_manager/event_engine/event_dispatcher.h" + +namespace application_manager { +namespace event_engine { + +class EventObserver; + +class EventDispatcherImpl : public EventDispatcher { + public: + // Data types section + typedef std::vector<EventObserver*> ObserverVector; + typedef std::map<int32_t, ObserverVector> ObserversMap; + typedef std::map<Event::EventID, ObserversMap> EventObserverMap; + /* + * @brief Destructor + */ + virtual ~EventDispatcherImpl(); + + /* + * @brief Default constructor + */ + EventDispatcherImpl(); + +#ifdef BUILD_TESTS + EventObserverMap get_observers() const { + return observers_event_; + } + ObserverVector get_observers_list() const { + return observers_; + } +#endif // BUILD_TESTS + + /* + * @brief Delivers the event to all subscribers + * + * @param event Received event + */ + void raise_event(const Event& event) OVERRIDE; + + /* + * @brief Subscribe the observer to event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + * @param observer The observer to subscribe for event + */ + void add_observer(const Event::EventID& event_id, + int32_t hmi_correlation_id, + EventObserver& observer) OVERRIDE; + + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to unsubscribe from + * @param observer The observer to be unsubscribed + */ + void remove_observer(const Event::EventID& event_id, + EventObserver& observer) OVERRIDE; + + /* + * @brief Unsubscribes the observer from all events + * + * @param observer The observer to be unsubscribed + */ + void remove_observer(EventObserver& observer) OVERRIDE; + + private: + /* + * @brief removes observer + * when occurs unsubscribe from event + * @param observer to be removed + */ + void remove_observer_from_vector(EventObserver& observer); + + DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl); + + private: + // Members section + sync_primitives::Lock state_lock_; + sync_primitives::Lock observer_lock_; + EventObserverMap observers_event_; + ObserverVector observers_; +}; + +} // namespace event_engine +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h index 8631203290..3e910edfa9 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,15 +35,13 @@ #include <string> #include "application_manager/event_engine/event.h" -#include "application_manager/event_engine/event_dispatcher.h" namespace application_manager { namespace event_engine { -class EventObserver -{ +class EventDispatcher; +class EventObserver { public: - friend class EventDispatcher; // Typedef for possible Observer ID's from mobile_apis functionID enum @@ -53,7 +51,7 @@ class EventObserver * @brief Constructor * */ - EventObserver(); + EventObserver(EventDispatcher& event_dispatcher); /* * @brief Destructor @@ -75,7 +73,6 @@ class EventObserver virtual void on_event(const Event& event) = 0; protected: - /* * @brief Subscribe to an event * @@ -83,8 +80,8 @@ class EventObserver * @param hmi_correlation_id The event HMI correlation ID. * If param is omitted, it means subscription for HMI notification */ - void subscribe_on_event( - const Event::EventID& event_id, int32_t hmi_correlation_id = 0); + void subscribe_on_event(const Event::EventID& event_id, + int32_t hmi_correlation_id = 0); /* * @brief Unsubscribes the observer from specific event @@ -100,8 +97,8 @@ class EventObserver void unsubscribe_from_all_events(); private: - ObserverID id_; + EventDispatcher& event_dispatcher_; DISALLOW_COPY_AND_ASSIGN(EventObserver); }; @@ -110,7 +107,7 @@ const EventObserver::ObserverID& EventObserver::id() const { return id_; } -} -} +} // namespace event_engine +} // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_OBSERVER_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_OBSERVER_H_ diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities.h b/src/components/application_manager/include/application_manager/hmi_capabilities.h index 277455ff4e..f94c8125c8 100644 --- a/src/components/application_manager/include/application_manager/hmi_capabilities.h +++ b/src/components/application_manager/include/application_manager/hmi_capabilities.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */ +*/ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_ @@ -37,28 +37,30 @@ #include "interfaces/MOBILE_API.h" #include "json/json.h" #include "utils/macro.h" +#include "application_manager/hmi_language_handler.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { class SmartObject; } } +namespace resumption { +class LastState; +} namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; namespace application_manager { -class ApplicationManagerImpl; +class ApplicationManager; class HMICapabilities { - public: - /* * @ Class constructor * * @param app_mngr Application manager pointer */ - explicit HMICapabilities(ApplicationManagerImpl* const app_mngr); + explicit HMICapabilities(ApplicationManager& app_mngr); /* * @brief Class destructor @@ -121,8 +123,7 @@ class HMICapabilities { * * @return Currently active UI language */ - inline const hmi_apis::Common_Language::eType& - active_ui_language() const; + const hmi_apis::Common_Language::eType active_ui_language() const; /* * @brief Sets currently active UI language @@ -136,8 +137,7 @@ class HMICapabilities { * * @return Currently supported UI languages */ - inline const smart_objects::SmartObject* - ui_supported_languages() const; + inline const smart_objects::SmartObject* ui_supported_languages() const; /* * @brief Sets supported UI languages @@ -152,8 +152,7 @@ class HMICapabilities { * * @return Currently active VR language */ - inline const hmi_apis::Common_Language::eType& - active_vr_language() const; + const hmi_apis::Common_Language::eType active_vr_language() const; /* * @brief Sets currently active VR language @@ -167,8 +166,7 @@ class HMICapabilities { * * @return Currently supported VR languages */ - inline const smart_objects::SmartObject* - vr_supported_languages() const; + inline const smart_objects::SmartObject* vr_supported_languages() const; /* * @brief Sets supported VR languages @@ -183,8 +181,7 @@ class HMICapabilities { * * @return Currently active TTS language */ - inline const hmi_apis::Common_Language::eType& - active_tts_language() const; + const hmi_apis::Common_Language::eType active_tts_language() const; /* * @brief Sets currently active TTS language @@ -192,15 +189,14 @@ class HMICapabilities { * @param language Currently active TTS language */ void set_active_tts_language( - const hmi_apis::Common_Language::eType& language); + const hmi_apis::Common_Language::eType& language); /* * @brief Retrieves TTS supported languages * * @return Currently supported TTS languages */ - inline const smart_objects::SmartObject* - tts_supported_languages() const; + inline const smart_objects::SmartObject* tts_supported_languages() const; /* * @brief Sets supported TTS languages @@ -215,8 +211,7 @@ class HMICapabilities { * * @return Currently supported display capabilities */ - inline const smart_objects::SmartObject* - display_capabilities() const; + inline const smart_objects::SmartObject* display_capabilities() const; /* * @brief Sets supported display capabilities @@ -231,8 +226,7 @@ class HMICapabilities { * * @return Currently supported HMI zone capabilities */ - inline const smart_objects::SmartObject* - hmi_zone_capabilities() const; + inline const smart_objects::SmartObject* hmi_zone_capabilities() const; /* * @brief Sets supported HMI zone capabilities @@ -247,8 +241,7 @@ class HMICapabilities { * * @return Currently supported SoftButton's capabilities */ - inline const smart_objects::SmartObject* - soft_button_capabilities() const; + inline const smart_objects::SmartObject* soft_button_capabilities() const; /* * @brief Sets supported SoftButton's capabilities @@ -311,12 +304,26 @@ class HMICapabilities { const smart_objects::SmartObject& audio_pass_thru_capabilities); /* + * @brief Sets supported pcm_stream capabilities + * + * @param supported pcm stream capabilities + */ + void set_pcm_stream_capabilities( + const smart_objects::SmartObject& pcm_stream_capabilities); + + /* * @brief Retrieves information about the audio_pass_thru capabilities * * @return Currently supported audio_pass_thru capabilities */ - inline const smart_objects::SmartObject* - audio_pass_thru_capabilities() const; + inline const smart_objects::SmartObject* audio_pass_thru_capabilities() const; + + /* + * @brief Retrieves information about the pcm_stream capabilities + * + * @return Currently supported pcm_streaming capabilities + */ + inline const smart_objects::SmartObject* pcm_stream_capabilities() const; /* * @brief Retrieves information about the preset bank capabilities @@ -360,7 +367,7 @@ class HMICapabilities { * @param prerecorded_speech supported prerecorded speech */ void set_prerecorded_speech( - const smart_objects::SmartObject& prerecorded_speech); + const smart_objects::SmartObject& prerecorded_speech); /* * @brief Interface used to store information if navigation @@ -393,7 +400,8 @@ class HMICapabilities { inline bool phone_call_supported() const; /* - * @brief Interface used to store information about software version of the target + * @brief Interface used to store information about software version of the + *target * * @param ccpu_version Received system/hmi software version */ @@ -406,8 +414,18 @@ class HMICapabilities { */ inline const std::string& ccpu_version() const; - protected: + void Init(resumption::LastState* last_state); + /** + * @brief return component which follows for correctness of + * languages + * @return HMI language handler + */ + HMILanguageHandler& get_hmi_language_handler() { + return hmi_language_handler_; + } + + protected: /* * @brief Loads capabilities from local file in case SDL was launched * without HMI @@ -426,8 +444,8 @@ class HMICapabilities { * @returns TRUE if member exists and returns FALSE if * member does not exist. */ - bool check_existing_json_member( - const Json::Value& json_member, const char* name_of_member); + bool check_existing_json_member(const Json::Value& json_member, + const char* name_of_member); /* * @brief function converts json object "languages" to smart object @@ -440,41 +458,43 @@ class HMICapabilities { smart_objects::SmartObject& languages); private: - bool is_vr_cooperating_; - bool is_tts_cooperating_; - bool is_ui_cooperating_; - bool is_navi_cooperating_; - bool is_ivi_cooperating_; + bool is_vr_cooperating_; + bool is_tts_cooperating_; + bool is_ui_cooperating_; + bool is_navi_cooperating_; + bool is_ivi_cooperating_; // to check if IsReady response for corresponding interface received - bool is_vr_ready_response_recieved_; - bool is_tts_ready_response_recieved_; - bool is_ui_ready_response_recieved_; - bool is_navi_ready_response_recieved_; - bool is_ivi_ready_response_recieved_; + bool is_vr_ready_response_recieved_; + bool is_tts_ready_response_recieved_; + bool is_ui_ready_response_recieved_; + bool is_navi_ready_response_recieved_; + bool is_ivi_ready_response_recieved_; - bool attenuated_supported_; + bool attenuated_supported_; hmi_apis::Common_Language::eType ui_language_; hmi_apis::Common_Language::eType vr_language_; hmi_apis::Common_Language::eType tts_language_; - smart_objects::SmartObject* vehicle_type_; - smart_objects::SmartObject* ui_supported_languages_; - smart_objects::SmartObject* tts_supported_languages_; - smart_objects::SmartObject* vr_supported_languages_; - smart_objects::SmartObject* display_capabilities_; - smart_objects::SmartObject* hmi_zone_capabilities_; - smart_objects::SmartObject* soft_buttons_capabilities_; - smart_objects::SmartObject* button_capabilities_; - smart_objects::SmartObject* preset_bank_capabilities_; - smart_objects::SmartObject* vr_capabilities_; - smart_objects::SmartObject* speech_capabilities_; - smart_objects::SmartObject* audio_pass_thru_capabilities_; - smart_objects::SmartObject* prerecorded_speech_; - bool is_navigation_supported_; - bool is_phone_call_supported_; - std::string ccpu_version_; - - ApplicationManagerImpl* app_mngr_; + smart_objects::SmartObject* vehicle_type_; + smart_objects::SmartObject* ui_supported_languages_; + smart_objects::SmartObject* tts_supported_languages_; + smart_objects::SmartObject* vr_supported_languages_; + smart_objects::SmartObject* display_capabilities_; + smart_objects::SmartObject* hmi_zone_capabilities_; + smart_objects::SmartObject* soft_buttons_capabilities_; + smart_objects::SmartObject* button_capabilities_; + smart_objects::SmartObject* preset_bank_capabilities_; + smart_objects::SmartObject* vr_capabilities_; + smart_objects::SmartObject* speech_capabilities_; + smart_objects::SmartObject* audio_pass_thru_capabilities_; + smart_objects::SmartObject* pcm_stream_capabilities_; + smart_objects::SmartObject* prerecorded_speech_; + std::string ccpu_version_; + bool is_navigation_supported_; + bool is_phone_call_supported_; + + ApplicationManager& app_mngr_; + HMILanguageHandler hmi_language_handler_; DISALLOW_COPY_AND_ASSIGN(HMICapabilities); }; @@ -499,48 +519,33 @@ bool HMICapabilities::is_ivi_cooperating() const { return is_ivi_cooperating_; } -const hmi_apis::Common_Language::eType& -HMICapabilities::active_ui_language() const { - return ui_language_; -} - -const smart_objects::SmartObject* -HMICapabilities::ui_supported_languages() const { +const smart_objects::SmartObject* HMICapabilities::ui_supported_languages() + const { return ui_supported_languages_; } -const hmi_apis::Common_Language::eType& -HMICapabilities::active_vr_language() const { - return vr_language_; -} - -const smart_objects::SmartObject* -HMICapabilities::vr_supported_languages() const { +const smart_objects::SmartObject* HMICapabilities::vr_supported_languages() + const { return vr_supported_languages_; } -const hmi_apis::Common_Language::eType& -HMICapabilities::active_tts_language() const { - return tts_language_; -} - -const smart_objects::SmartObject* -HMICapabilities::tts_supported_languages() const { +const smart_objects::SmartObject* HMICapabilities::tts_supported_languages() + const { return tts_supported_languages_; } -const smart_objects::SmartObject* -HMICapabilities::display_capabilities() const { +const smart_objects::SmartObject* HMICapabilities::display_capabilities() + const { return display_capabilities_; } -const smart_objects::SmartObject* -HMICapabilities::hmi_zone_capabilities() const { +const smart_objects::SmartObject* HMICapabilities::hmi_zone_capabilities() + const { return hmi_zone_capabilities_; } -const smart_objects::SmartObject* -HMICapabilities::soft_button_capabilities() const { +const smart_objects::SmartObject* HMICapabilities::soft_button_capabilities() + const { return soft_buttons_capabilities_; } @@ -548,8 +553,7 @@ const smart_objects::SmartObject* HMICapabilities::button_capabilities() const { return button_capabilities_; } -const smart_objects::SmartObject* -HMICapabilities::speech_capabilities() const { +const smart_objects::SmartObject* HMICapabilities::speech_capabilities() const { return speech_capabilities_; } @@ -562,8 +566,13 @@ HMICapabilities::audio_pass_thru_capabilities() const { return audio_pass_thru_capabilities_; } -const smart_objects::SmartObject* -HMICapabilities::preset_bank_capabilities() const { +const smart_objects::SmartObject* HMICapabilities::pcm_stream_capabilities() + const { + return pcm_stream_capabilities_; +} + +const smart_objects::SmartObject* HMICapabilities::preset_bank_capabilities() + const { return preset_bank_capabilities_; } @@ -575,11 +584,14 @@ const smart_objects::SmartObject* HMICapabilities::vehicle_type() const { return vehicle_type_; } -const smart_objects::SmartObject* -HMICapabilities::prerecorded_speech() const { +const smart_objects::SmartObject* HMICapabilities::prerecorded_speech() const { return prerecorded_speech_; } +const std::string& HMICapabilities::ccpu_version() const { + return ccpu_version_; +} + bool HMICapabilities::navigation_supported() const { return is_navigation_supported_; } @@ -588,10 +600,6 @@ bool HMICapabilities::phone_call_supported() const { return is_phone_call_supported_; } -const std::string& HMICapabilities::ccpu_version() const { - return ccpu_version_; -} - } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_ diff --git a/src/components/application_manager/include/application_manager/hmi_command_factory.h b/src/components/application_manager/include/application_manager/hmi_command_factory.h index 89936e4ca6..6603563c6d 100644 --- a/src/components/application_manager/include/application_manager/hmi_command_factory.h +++ b/src/components/application_manager/include/application_manager/hmi_command_factory.h @@ -37,9 +37,8 @@ #include "utils/macro.h" namespace application_manager { - typedef utils::SharedPtr<commands::Command> CommandSharedPtr; - +class ApplicationManager; /** * @brief Factory class for command creation **/ @@ -51,7 +50,9 @@ class HMICommandFactory { * @param smartObject SmartObject shared pointer. * @return Pointer to created command object. **/ - static CommandSharedPtr CreateCommand(const commands::MessageSharedPtr& message); + static CommandSharedPtr CreateCommand( + const commands::MessageSharedPtr& message, + ApplicationManager& application_manager); private: HMICommandFactory(); diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h new file mode 100644 index 0000000000..e8af02c189 --- /dev/null +++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h @@ -0,0 +1,187 @@ +/* + * 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. +*/ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_ + +#include "application_manager/event_engine/event_observer.h" +#include "utils/lock.h" +#include "interfaces/HMI_API.h" +namespace resumption { +class LastState; +} +namespace application_manager { + +class ApplicationManager; +/** + * Class is used to handle edge case with slow HMI responses for current + * languages. Main idea is to cache values within some persistent storage and + * respond to applications with these values. In case app registered before + * responses are gotten and after responses were received their language(s) + * mismatch to current on HMI - apps have to be unregistered. + **/ +class HMILanguageHandler : public event_engine::EventObserver { + public: + typedef std::map<uint32_t, bool> Apps; + + /** + * @brief System interfaces + */ + enum Interface { INTERFACE_UI, INTERFACE_VR, INTERFACE_TTS }; + + /** + * @brief Class constructor + */ + HMILanguageHandler(ApplicationManager& application_manager); + + /** + * @brief Sets language for interface + * @param interface Interface + * @param language Language + */ + void set_language_for(Interface interface, + hmi_apis::Common_Language::eType language); + + /** + * @brief Gets language for interface + * @param interface Interface + * @return Language + */ + hmi_apis::Common_Language::eType get_language_for(Interface interface) const; + + void on_event(const event_engine::Event& event) OVERRIDE; + + /** + * @brief Trigger waiting for response + * @param request Request object + */ + void set_handle_response_for( + const event_engine::smart_objects::SmartObject& request); + + /** + * @brief Sets default languages from HMI capabilities + * @param ui UI language + * @param vr VR language + * @param tts TTS language + */ + void set_default_capabilities_languages(hmi_apis::Common_Language::eType ui, + hmi_apis::Common_Language::eType vr, + hmi_apis::Common_Language::eType tts); + void Init(resumption::LastState* value); + + /** + * @brief Removes application from container after + * removing application from core + * @param app_id id application for removing + */ + void OnUnregisterApplication(uint32_t app_id); + + private: + void SendOnLanguageChangeToMobile(uint32_t connection_key); + + /** + * @brief Verifies languages gotten from HMI with persisted languages + */ + void VerifyWithPersistedLanguages(); + + /** + * @brief Handles applications registered before actual HMI languages + * have been received + * @param app_id Application id + */ + void HandleWrongLanguageApp(const Apps::value_type& app_id); + + /** + * @brief Checks if application needs to be handled because of language(s) + * mismatch + * @param app Application + */ + void CheckApplication(const Apps::value_type app); + + sync_primitives::Lock apps_lock_; + + /** + * @brief Applications, which needs to be handled + */ + Apps apps_; + + /** + * @brief UI language persisted from previous ignition cycle + */ + hmi_apis::Common_Language::eType persisted_ui_language_; + + /** + * @brief VR language persisted from previous ignition cycle + */ + hmi_apis::Common_Language::eType persisted_vr_language_; + + /** + * @brief TTS language persisted from previous ignition cycle + */ + hmi_apis::Common_Language::eType persisted_tts_language_; + + /** + * @brief Default UI language from HMI capabilitites + */ + hmi_apis::Common_Language::eType capabilities_ui_language_; + + /** + * @brief Default VR language from HMI capabilitites + */ + hmi_apis::Common_Language::eType capabilities_vr_language_; + + /** + * @brief Default TTS language from HMI capabilitites + */ + hmi_apis::Common_Language::eType capabilities_tts_language_; + + /** + * @brief Indicates if current UI language has been received from HMI + */ + bool is_ui_language_received_; + + /** + * @brief Indicates if current VR language has been received from HMI + */ + bool is_vr_language_received_; + + /** + * @brief Indicates if current TTS language has been received from HMI + */ + bool is_tts_language_received_; + resumption::LastState* last_state_; + ApplicationManager& application_manager_; +}; + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_ diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 4451fb6857..31da7647fa 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -1,186 +1,304 @@ +/* + * 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. + */ + #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H #include <list> #include "interfaces/MOBILE_API.h" #include "utils/shared_ptr.h" -#include "application_manager/state_context.h" namespace application_manager { class HmiState; +class ApplicationManager; + typedef utils::SharedPtr<HmiState> HmiStatePtr; -typedef std::list<HmiStatePtr> HmiStateList; - /** - * @brief The HmiState class - * Handle Hmi state of application (hmi level, - * audio streaming state, system context) - * - */ +/** +* @brief The HmiState class +* Handle Hmi state of application (hmi level, +* audio streaming state, system context) +* +*/ class HmiState { + public: + /** + * @brief The StateID enum describes state of application + * If no events occured STATE_ID_DEFAULT shuld be presented + */ + enum StateID { + STATE_ID_CURRENT, + STATE_ID_REGULAR, + STATE_ID_POSTPONED, + STATE_ID_PHONE_CALL, + STATE_ID_SAFETY_MODE, + STATE_ID_VR_SESSION, + STATE_ID_TTS_SESSION, + STATE_ID_NAVI_STREAMING, + STATE_ID_DEACTIVATE_HMI, + STATE_ID_AUDIO_SOURCE, + STATE_ID_EMBEDDED_NAVI + }; - public: - /** - * @brief The StateID enum describes state of application - * If no events occured STATE_ID_DEFAULT shuld be presented - */ - enum StateID { - STATE_ID_REGULAR, - STATE_ID_PHONE_CALL, - STATE_ID_SAFETY_MODE, - STATE_ID_VR_SESSION, - STATE_ID_TTS_SESSION, - STATE_ID_NAVI_STREAMING, - }; - - HmiState(uint32_t app_id, const StateContext& state_context_); - HmiState(uint32_t app_id, const StateContext& state_context_, - StateID state_id); - - - virtual ~HmiState() {} - - /** - * @brief setParent setup parent state - * @param parent state to setup - */ - void set_parent(HmiStatePtr parent); - - /** - * @brief parent get parent state - * @return parent state - */ - const HmiStatePtr parent() const { - return parent_; - } + HmiState(uint32_t app_id, const ApplicationManager& app_mngr); + HmiState(uint32_t app_id, + const ApplicationManager& app_mngr, + StateID state_id); - /** - * @brief hmi_level - * @return return hmi level member - */ - virtual mobile_apis::HMILevel::eType hmi_level() const { - if (parent_) { - return parent_->hmi_level(); - } - return hmi_level_; - } - /** - * @brief set_hmi_level set hmi_level member - * @param hmi_level hmi level to setup - */ - void set_hmi_level(mobile_apis::HMILevel::eType hmi_level) { - hmi_level_ = hmi_level; - } + virtual ~HmiState() {} - /** - * @brief audio_streaming_state - * @return return audio streaming state member - */ - virtual mobile_apis::AudioStreamingState::eType - audio_streaming_state() const { - if (parent_) { - return parent_->audio_streaming_state(); - } - return audio_streaming_state_; - } - /** - * @brief set_audio_streaming_state set audio_streaming_state member - * @param audio_state audio_state to setup - */ - virtual void set_audio_streaming_state( - mobile_apis::AudioStreamingState::eType audio_state) { - audio_streaming_state_ = audio_state; - } + /** + * @brief setParent setup parent state + * @param parent state to setup + */ + void set_parent(HmiStatePtr parent); + + /** + * @brief parent get parent state + * @return parent state + */ + const HmiStatePtr parent() const { + return parent_; + } - /** - * @brief system_context - * @return return system context member - */ - virtual mobile_apis::SystemContext::eType system_context() const { - if (parent_) { - return parent_->system_context(); - } - return system_context_; + /** + * @brief hmi_level + * @return return hmi level member + */ + virtual mobile_apis::HMILevel::eType hmi_level() const { + if (parent_) { + return parent_->hmi_level(); } + return hmi_level_; + } + /** + * @brief set_hmi_level set hmi_level member + * @param hmi_level hmi level to setup + */ + void set_hmi_level(mobile_apis::HMILevel::eType hmi_level) { + hmi_level_ = hmi_level; + } - /** - * @brief set_system_context set system_context member - * @param system_context system_context to setup - */ - virtual void set_system_context( - mobile_apis::SystemContext::eType system_context){ - system_context_ = system_context; + /** + * @brief audio_streaming_state + * @return return audio streaming state member + */ + virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() + const { + if (parent_) { + return parent_->audio_streaming_state(); } + return audio_streaming_state_; + } + /** + * @brief set_audio_streaming_state set audio_streaming_state member + * @param audio_state audio_state to setup + */ + virtual void set_audio_streaming_state( + mobile_apis::AudioStreamingState::eType audio_state) { + audio_streaming_state_ = audio_state; + } - /** - * @brief state_id state type - * @return reutrn state type - */ - StateID state_id() const { - return state_id_; + /** + * @brief system_context + * @return return system context member + */ + virtual mobile_apis::SystemContext::eType system_context() const { + if (parent_) { + return parent_->system_context(); } - protected: - uint32_t app_id_; - StateID state_id_; - const StateContext& state_context_; - HmiStatePtr parent_; - mobile_apis::HMILevel::eType hmi_level_; - mobile_apis::AudioStreamingState::eType audio_streaming_state_; - mobile_apis::SystemContext::eType system_context_; - private: - void operator=(const HmiState&); + return system_context_; + } + + /** + * @brief set_system_context set system_context member + * @param system_context system_context to setup + */ + virtual void set_system_context( + mobile_apis::SystemContext::eType system_context) { + system_context_ = system_context; + } + + /** + * @brief state_id state type + * @return return state type + */ + StateID state_id() const { + return state_id_; + } + + /** + * @brief set_state_id sets state id + * @param state_id state id to setup + */ + virtual void set_state_id(StateID state_id) { + state_id_ = state_id; + } + + protected: + uint32_t app_id_; + StateID state_id_; + const ApplicationManager& app_mngr_; + HmiStatePtr parent_; + mobile_apis::HMILevel::eType hmi_level_; + mobile_apis::AudioStreamingState::eType audio_streaming_state_; + mobile_apis::SystemContext::eType system_context_; + + protected: + /** + * @brief is_navi_app check if app is navi + * @param app_id application id + * @return true if app is navi, otherwise return false + */ + bool is_navi_app(const uint32_t app_id) const; + + /** + * @brief is_media_app check if app is media + * @param app_id application id + * @return true if media_app, otherwise return false + */ + bool is_media_app(const uint32_t app_id) const; + + /** + * @brief is_voice_communicationn_app check if app is voice comunication + * @param app_id application id + * @return true if voice_communicationn_app, otherwise return false + */ + bool is_voice_communication_app(const uint32_t app_id) const; + + private: + void operator=(const HmiState&); }; /** - * @brief The VRHmiState class impement logic of VR temporary state + * @brief The VRHmiState class implements logic of VR temporary state */ class VRHmiState : public HmiState { - public: - virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const; - VRHmiState(uint32_t app_id, StateContext& state_context); + public: + virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE; + VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr); }; /** - * @brief The TTSHmiState class impement logic of TTS temporary state + * @brief The TTSHmiState class implements logic of TTS temporary state */ class TTSHmiState : public HmiState { - public: - TTSHmiState(uint32_t app_id, StateContext& state_context); - virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const; + public: + TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE; }; /** - * @brief The NaviStreamingState class impement logic of NaviStreaming temporary state + * @brief The NaviStreamingState class implements logic of NaviStreaming + * temporary state */ class NaviStreamingHmiState : public HmiState { - public: - NaviStreamingHmiState(uint32_t app_id, StateContext& state_context); - virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const; + public: + NaviStreamingHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE; }; /** - * @brief The PhoneCallHmiState class impement logic of PhoneCall temporary state + * @brief The PhoneCallHmiState class implements logic of PhoneCall temporary + * state */ class PhoneCallHmiState : public HmiState { - public: - PhoneCallHmiState(uint32_t app_id, StateContext& state_context); - virtual mobile_apis::HMILevel::eType hmi_level() const; - virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const { - return mobile_apis::AudioStreamingState::NOT_AUDIBLE; - } + public: + PhoneCallHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE { + return mobile_apis::AudioStreamingState::NOT_AUDIBLE; + } }; /** - * @brief The SafetyModeHmiState class impement logic of SafetyMode temporary state + * @brief The SafetyModeHmiState class implements logic of SafetyMode temporary + * state */ class SafetyModeHmiState : public HmiState { - public: - SafetyModeHmiState(uint32_t app_id, StateContext& state_context); - virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const { - return mobile_apis::AudioStreamingState::NOT_AUDIBLE; - } + public: + SafetyModeHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE { + return mobile_apis::AudioStreamingState::NOT_AUDIBLE; + } }; +/** + * @brief The DeactivateHMI class implements logic of DeactivateHMI temporary + * state + */ +class DeactivateHMI : public HmiState { + public: + DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE { + return mobile_apis::AudioStreamingState::NOT_AUDIBLE; + } +}; + +/** + * @brief The AudioSource class implements logic of OnEventChanged(AUDIO_SOURCE) + * temporary state + */ +class AudioSource : public HmiState { + public: + AudioSource(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE { + return mobile_apis::AudioStreamingState::NOT_AUDIBLE; + } +}; + +/** + * @brief The EmbeddedNavi class implements logic of + * OnEventChanged(EMBEDDED_NAVI) + * temporary state + */ +class EmbeddedNavi : public HmiState { + public: + EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; + mobile_apis::AudioStreamingState::eType audio_streaming_state() + const OVERRIDE { + return mobile_apis::AudioStreamingState::NOT_AUDIBLE; + } +}; } -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h index 5a2c8bdc18..521e0baca5 100644 --- a/src/components/application_manager/include/application_manager/message.h +++ b/src/components/application_manager/include/application_manager/message.h @@ -53,7 +53,7 @@ enum MessageType { kRequest = 0, kResponse = 1, kNotification = 2, - kErrorResponse = 3 // Error Response HMI ONLY + kErrorResponse = 3 // Error Response HMI ONLY }; // Map PrcType to corresponding MessageType @@ -103,12 +103,14 @@ class Message { void set_data_size(size_t data_size); void set_payload_size(size_t payload_size); - protocol_handler::MessagePriority Priority() const { return priority_; } + protocol_handler::MessagePriority Priority() const { + return priority_; + } private: - int32_t function_id_; // @remark protocol V2. + int32_t function_id_; // @remark protocol V2. int32_t correlation_id_; // @remark protocol V2. - MessageType type_; // @remark protocol V2. + MessageType type_; // @remark protocol V2. // Pre-calculated message priority, higher priority messages are // Processed first diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index cfd3d4c72f..ab89883ad2 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2015, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -34,8 +34,9 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_HELPER_H_ #include <map> +#include <vector> #include <string> -#include <string.h> + #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "utils/macro.h" @@ -43,6 +44,8 @@ #include "application_manager/application.h" #include "application_manager/vehicle_info_data.h" #include "policy/policy_types.h" +#include "protocol_handler/session_observer.h" +#include "application_manager/policies/policy_handler_interface.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -50,6 +53,10 @@ class SmartObject; } } +namespace policy { +class PolicyHandlerInterface; +} + namespace application_manager { namespace mobile_api = mobile_apis; namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; @@ -66,508 +73,629 @@ typedef std::map<std::string, VehicleDataType> VehicleData; * @brief MessageHelper class **/ class MessageHelper { - public: - /** - * @brief Creates request for different interfaces(JSON, DBUS) - * @param correlation_id unique ID - * @param params Vector of arguments that we need in GetVehicleData request (e.g. gps, odometer, fuel_level) - */ - static void CreateGetVehicleDataRequest(uint32_t correlation_id, const std::vector<std::string>& params); - - /** - * @brief Sends HMI status notification to mobile - * - *@param application_impl application with changed HMI status - * - **/ - static void SendHMIStatusNotification(const Application& application_impl); - - /** - * @brief Sends OnAppRegistered notification to HMI - * - *@param application_impl application with changed HMI status - * - **/ - static void SendOnAppRegisteredNotificationToHMI( - const Application& application_impl, - bool resumption = false, - bool need_restore_vr = false); - - /** - * @brief Create mobile HashUpdateNotification - */ - static smart_objects::SmartObjectSPtr GetHashUpdateNotification(const uint32_t app_id); - - /** - * @brief Create OnSystemRequest notification for lock screen icon url - */ - static smart_objects::SmartObject* GetLockScreenIconUrlNotification(const uint32_t connection_key); - - /** - * @brief Send the OnSystemRequest notification for lock screen icon url to the mobile device - */ - static void SendLockScreenIconUrlNotification(const uint32_t connection_key); - - /** - * @brief Sends to mobile HashUpdateNotification - */ - static void SendHashUpdateNotification(const uint32_t app_id); - - /** - * @brief Sends OnAppInterfaceUnregistered notification to mobile - * - *@param connection_key Connection key - *@param reason Reason - * - **/ - static void SendOnAppInterfaceUnregisteredNotificationToMobile( - int32_t connection_key, - mobile_apis::AppInterfaceUnregisteredReason::eType reason); - - /* - * @brief Retrieve vehicle data map for param name in mobile request - * to VehicleDataType - * - * @return VehicleData reference - */ - static const VehicleData& vehicle_data(); - - /** - * @brief Convert string to HMI level, if possible - * @param hmi_level Stringified HMI level - * @return Appropriate enum from HMI level, or INVALID_ENUM, if conversiion - * is not possible - */ - static mobile_api::HMILevel::eType StringToHMILevel( + public: + /** + * @brief Creates request for different interfaces(JSON, DBUS) + * @param correlation_id unique ID + * @param params Vector of arguments that we need in GetVehicleData request + * (e.g. gps, odometer, fuel_level) + */ + static void CreateGetVehicleDataRequest( + const uint32_t correlation_id, + const std::vector<std::string>& params, + ApplicationManager& app_mngr); + + /** + * @brief Create mobile HashUpdateNotification + */ + static smart_objects::SmartObjectSPtr CreateHashUpdateNotification( + const uint32_t app_id); + + /** + * @brief Sends to mobile HashUpdateNotification + */ + static void SendHashUpdateNotification(const uint32_t app_id, + ApplicationManager& app_mngr); + + /** + * @brief Sends OnLanguageChange notification to application + * @param connection_key Connection key of application + */ + static void SendOnLanguageChangeToMobile(uint32_t connection_key); + + /* + * @brief Retrieve vehicle data map for param name in mobile request + * to VehicleDataType + * + * @return VehicleData reference + */ + static const VehicleData& vehicle_data(); + + /** + * @brief Converts HMI Result enum value to string + * @param hmi_result HMI Result enum value + * @return stringified value for enum if succedeed, otherwise - empty string + */ + static std::string HMIResultToString( + hmi_apis::Common_Result::eType hmi_result); + + /** + * @brief Converts string to HMI Result enum value + * @param hmi_result stringified value + * @return HMI Result enum value if succedeed, otherwise - INVALID_ENUM + * value + */ + static hmi_apis::Common_Result::eType HMIResultFromString( + const std::string& hmi_result); + + /** + * @brief Converts mobile Result enum value to string + * @param mobile_result mobile Result enum value + * @return stringified value for enum if succedeed, otherwise - empty string + */ + static std::string MobileResultToString( + mobile_apis::Result::eType mobile_result); + + /** + * @brief Converts string to mobile Result enum value + * @param mobile_result stringified value + * @return mobile Result enum value if succedeed, otherwise - INVALID_ENUM + * value + */ + static mobile_api::Result::eType MobileResultFromString( + const std::string& mobile_result); + + /** + * @brief Converts HMI Result enum value to mobile Result enum value + * @param hmi_result HMI Result enum value + * @return mobile Result enum value if succedeed, otherwise - INVALID_ENUM + * value + */ + static mobile_api::Result::eType HMIToMobileResult( + const hmi_apis::Common_Result::eType hmi_result); + + /** + * @brief Converts mobile Result enum value to HMI Result enum value + * @param mobile_result mobile Result enum value + * @return HMI Result enum value + */ + static hmi_apis::Common_Result::eType MobileToHMIResult( + const mobile_api::Result::eType mobile_result); + + /** + * @brief Convert string to HMI level, if possible + * @param hmi_level Stringified HMI level + * @return Appropriate enum from HMI level, or INVALID_ENUM, if conversiion + * is not possible + */ + static mobile_api::HMILevel::eType StringToHMILevel( const std::string& hmi_level); - /* - * @brief Used to obtain string representation of app's - * HMI Level. - * @param hmi_level Desired HMI Level - */ - static std::string StringifiedHMILevel( + /* + * @brief Used to obtain string representation of app's + * HMI Level. + * @param hmi_level Desired HMI Level + */ + static std::string StringifiedHMILevel( mobile_apis::HMILevel::eType hmi_level); - /* - * @brief Used to obtain function name by its id - * @param function_id Function ID - */ - static std::string StringifiedFunctionID( + /* + * @brief Used to obtain function name by its id + * @param function_id Function ID + */ + static std::string StringifiedFunctionID( mobile_apis::FunctionID::eType function_id); - static smart_objects::SmartObjectSPtr CreateBlockedByPoliciesResponse( + static smart_objects::SmartObjectSPtr CreateBlockedByPoliciesResponse( mobile_apis::FunctionID::eType function_id, - mobile_apis::Result::eType result, uint32_t correlation_id, + mobile_apis::Result::eType result, + const uint32_t correlation_id, uint32_t connection_key); - /* - * @brief Prepare GetDeviceListResponse - * - * - * @param devices Devices list - * - */ - static smart_objects::SmartObjectSPtr CreateDeviceListSO( - const connection_handler::DeviceMap& devices); - - static smart_objects::SmartObjectSPtr CreateModuleInfoSO( - uint32_t function_id); - - static smart_objects::SmartObjectSPtr CreateSetAppIcon( - const std::string& path_to_icon, uint32_t app_id); - - /** - * @brief Sends IVI subscription requests - */ - static bool SendIVISubscribtions(const uint32_t app_id); - - /** - * @brief Returns IVI subscription requests - */ - static smart_objects::SmartObjectList GetIVISubscriptionRequests(ApplicationSharedPtr app); - - /** - * @brief Sends button subscription notification - */ - static void SendOnButtonSubscriptionNotification( - uint32_t app_id, hmi_apis::Common_ButtonName::eType button, bool is_subscribed); - - /** - * @brief Sends button subscription notifications for all buttons - * that application is subscribed on - */ - static void SendAllOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app); - - static void SendAppDataToHMI(ApplicationConstSharedPtr app); - static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app); - static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(ApplicationConstSharedPtr app); - - static smart_objects::SmartObjectSPtr CreateAppVrHelp( - ApplicationConstSharedPtr app); - - static smart_objects::SmartObjectList CreateShowRequestToHMI(ApplicationConstSharedPtr app); - static void SendShowRequestToHMI(ApplicationConstSharedPtr app); - static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app); - static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app); - static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(ApplicationConstSharedPtr app); - - /** - * @brief Sends UI_ChangeRegistration to HMI with list of AppHMIType - * @param app applicaton instace - */ - static void SendUIChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app); - static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app); - static void SendAddVRCommandToHMI( - uint32_t cmd_id, const smart_objects::SmartObject& vr_commands, - uint32_t app_id); - - static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI( - uint32_t cmd_id, const smart_objects::SmartObject& vr_commands, - uint32_t app_id); - - /* - * @brief Create Common.HMIApplication struct application instance - * @param app : applicaton instace - * @param output smart object to store Common.HMIApplication struct - * @return true on succes, otherwise return false; - */ - static bool CreateHMIApplicationStruct(ApplicationConstSharedPtr app, - smart_objects::SmartObject& output); - - static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app); - static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI(ApplicationConstSharedPtr app); - - /* - * @brief Creates BasicCommunication.OnAppUnregistered notification - * @param app Application instance - * @param is_unexpected_disconnect - * Indicates if connection was unexpectedly lost by TM or HB - */ - static void SendOnAppUnregNotificationToHMI(ApplicationConstSharedPtr app, - bool is_unexpected_disconnect = false); - static uint32_t SendActivateAppToHMI( - uint32_t const app_id, - hmi_apis::Common_HMILevel::eType level = hmi_apis::Common_HMILevel::FULL, - bool send_policy_priority = true); - - static void SendOnResumeAudioSourceToHMI(const uint32_t app_id); - - static std::string GetDeviceMacAddressForHandle( - const uint32_t device_handle); - - static void GetDeviceInfoForHandle(const uint32_t device_handle, - policy::DeviceParams* device_info); - static void GetDeviceInfoForApp(uint32_t connection_key, - policy::DeviceParams* device_info); - - /** - * @brief Send SDL_ActivateApp response to HMI - * @param permissions response parameters - */ - static void SendSDLActivateAppResponse(policy::AppPermissions& permissions, - uint32_t correlation_id); + /* + * @brief Prepare GetDeviceListResponse + * + * + * @param devices Devices list + * + */ + static smart_objects::SmartObjectSPtr CreateDeviceListSO( + const connection_handler::DeviceMap& devices, + const policy::PolicyHandlerInterface& policy_handler, + ApplicationManager& app_mngr); + + static smart_objects::SmartObjectSPtr CreateModuleInfoSO( + uint32_t function_id, ApplicationManager& app_mngr); + + static smart_objects::SmartObjectSPtr CreateSetAppIcon( + const std::string& path_to_icon, uint32_t app_id); + + /** + * @brief Sends IVI subscription requests + */ + static bool SendIVISubscribtions(const uint32_t app_id, + ApplicationManager& app_mngr); + + /** + * @brief Returns IVI subscription requests + */ + static smart_objects::SmartObjectList GetIVISubscriptionRequests( + ApplicationSharedPtr app, ApplicationManager& app_mngr); + + /** + * @brief Sends button subscription notification + */ + static void SendOnButtonSubscriptionNotification( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button, + const bool is_subscribed, + ApplicationManager& app_mngr); + + /** + * @brief Sends button subscription notifications for all buttons + * that application is subscribed on + */ + static void SendAllOnButtonSubscriptionNotificationsForApp( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + + static void SendAppDataToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_man); + static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI( + ApplicationConstSharedPtr app, const uint32_t correlation_id); + + static smart_objects::SmartObjectSPtr CreateAppVrHelp( + ApplicationConstSharedPtr app); - /** - * @brief Send OnSDLConsentNeeded to HMI for device data consent by user - * @param device_info Device info, e.g. mac, handle, name + static smart_objects::SmartObjectList CreateShowRequestToHMI( + ApplicationConstSharedPtr app, const uint32_t correlation_id); + static void SendShowRequestToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_man); + static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_man); + static smart_objects::SmartObjectList CreateAddCommandRequestToHMI( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + + static smart_objects::SmartObjectList + CreateAddVRCommandRequestFromChoiceToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + /** + * @brief Sends UI_ChangeRegistration to HMI with list of AppHMIType + * @param app applicaton instace + */ + static void SendUIChangeRegistrationRequestToHMI( + ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + static void SendAddVRCommandToHMI( + uint32_t cmd_id, + const smart_objects::SmartObject& vr_commands, + const uint32_t app_id, + ApplicationManager& app_mngr); + + static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI( + uint32_t cmd_id, + const smart_objects::SmartObject& vr_commands, + const uint32_t app_id, + ApplicationManager& app_mngr); + + /* + * @brief Create Common.HMIApplication struct application instance + * @param app : applicaton instace + * @param output smart object to store Common.HMIApplication struct + * @return true on succes, otherwise return false; + */ + static bool CreateHMIApplicationStruct( + ApplicationConstSharedPtr app, + const protocol_handler::SessionObserver& session_observer, + const policy::PolicyHandlerInterface& policy_handler, + smart_objects::SmartObject* output, + ApplicationManager& app_mngr); + + static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI( + ApplicationConstSharedPtr app, const uint32_t correlation_id); + + /* + * @brief Creates BasicCommunication.OnAppUnregistered notification + * @param app Application instance + * @param is_unexpected_disconnect + * Indicates if connection was unexpectedly lost by TM or HB + */ + static void SendOnAppUnregNotificationToHMI(ApplicationConstSharedPtr app, + bool is_unexpected_disconnect, + ApplicationManager& app_mngr); + + static NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr + GetBCActivateAppRequestToHMI( + ApplicationConstSharedPtr app, + const protocol_handler::SessionObserver& session_observer, + const policy::PolicyHandlerInterface& policy_handler, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority, + ApplicationManager& app_mngr); + + static void SendOnResumeAudioSourceToHMI(const uint32_t app_id, + ApplicationManager& app_mngr); + + /** + * @brief Send SDL_ActivateApp response to HMI + * @param permissions response parameters + */ + static void SendSDLActivateAppResponse(policy::AppPermissions& permissions, + uint32_t correlation_id, + ApplicationManager& app_mngr); + + /** + * @brief Send OnSDLConsentNeeded to HMI for device data consent by user + * @param device_info Device info, e.g. mac, handle, name + */ + static void SendOnSDLConsentNeeded(const policy::DeviceParams& device_info, + ApplicationManager& app_man); + + /** + * @brief Send request to SyncP process to read file and send + * Policy Table Snapshot using Retry Strategy + * @param file_path Path to file with PTS + * @param timeout Timeout to wait for PTU + * @param retries Seconds between retries */ - static void SendOnSDLConsentNeeded(const policy::DeviceParams& device_info); - - /** - * @brief Send request to SyncP process to read file and send - * Policy Table Snapshot using Retry Strategy - * @param file_path Path to file with PTS - * @param timeout Timeout to wait for PTU - * @param retries Seconds between retries - */ - static void SendPolicyUpdate(const std::string& file_path, - int timeout, - const std::vector<int>& retries); - - /** - * @brief Send GetUserFriendlyMessage response to HMI - * @param msg Appopriate messages params - * @param correlation_id Correlation id of request - */ - static void SendGetUserFriendlyMessageResponse( + static void SendPolicyUpdate(const std::string& file_path, + int timeout, + const std::vector<int>& retries, + ApplicationManager& app_mngr); + + /** + * @brief Send GetUserFriendlyMessage response to HMI + * @param msg Appopriate messages params + * @param correlation_id Correlation id of request + */ + static void SendGetUserFriendlyMessageResponse( const std::vector<policy::UserFriendlyMessage>& msg, - uint32_t correlation_id); - - /** - * @brief Send GetListOfPermissions response to HMI - * @param permissions Array of groups permissions - * @param correlation_id Correlation id of request - */ - static void SendGetListOfPermissionsResponse( + uint32_t correlation_id, + ApplicationManager& app_mngr); + + /** + * @brief Send GetListOfPermissions response to HMI + * @param permissions Array of groups permissions + * @param correlation_id Correlation id of request + */ + static void SendGetListOfPermissionsResponse( const std::vector<policy::FunctionalGroupPermission>& permissions, - uint32_t correlation_id); - - /* - * @brief Sends notification to HMI to start video streaming - * - * @param connection_key Application connection key - * - */ - static void SendNaviStartStream(int32_t connection_key); - - /* - * @brief Sends notification to HMI to stop video streaming - * - * @param connection_key Application connection key - * - */ - static void SendNaviStopStream(int32_t connection_key); - - /* - * @brief Send notification for Update of Policy Table - * with PT Snapshot. - * @param connection_key Id of application to send message to - * @param policy_data PT Snapshot - * @param url If empty string, no URL is provided - * @param timeout If -1 no timeout is provdied - */ - static void SendPolicySnapshotNotification( - unsigned int connection_key, const std::vector<uint8_t>& policy_data, - const std::string& url = "", int timeout = -1); - - static void SendSystemRequestNotification( - uint32_t connection_key, - NsSmartDeviceLink::NsSmartObjects::SmartObject& content); - - /** - * @brief SendLaunchApp allows to send OnSystemRequest with LAUNCH_UP. - * - * @param connection_key application id. - * - * @param urlSchema application's url schema. - * - * @param packageName application's package name. - */ - static void SendLaunchApp(uint32_t connection_key, - const std::string& urlSchema, - const std::string& packageName); - - /** - * @brief Sends OnSystemRequest which queries remote apps list - * @param connection_key application id, which is used for sending out - */ - static void SendQueryApps(uint32_t connection_key); - - /* - * @brief Send notification to mobile on application permissions update - * @param connection_key Id of application to send message to - * @param permissions updated permissions for application - */ - static void SendOnPermissionsChangeNotification( - uint32_t connection_key, const policy::Permissions& permissions); - - /* - * @brief Send notification to HMI on application permissions update - * @param connection_key Id of application to send message to - * @param permissions updated permissions for application - */ - static void SendOnAppPermissionsChangedNotification( - uint32_t connection_key, const policy::AppPermissions& permissions); - - /** - * @brief Send GetStatusUpdate response to HMI with current policy update - * status - * @param status Update status - * @param correlation_id Correlation id from request - */ - static void SendGetStatusUpdateResponse(const std::string& status, - uint32_t correlation_id); - - /** - * @brief Send UpdateSDL response to HMI with policy update result - * @param result Update result - * @param correlation_id Correlation id from request - */ - static void SendUpdateSDLResponse(const std::string& result, - uint32_t correlation_id); - - /** - * @brief Send OnStatusUpdate to HMI on policy update status change - * @param status Policy table update status - */ - static void SendOnStatusUpdate(const std::string& status); - - /** - * @brief Send GetSystemInfo request to HMI - */ - static void SendGetSystemInfoRequest(); - - /* - * @brief Sends notification to HMI to start audio streaming - * - * @param connection_key Application connection key - * - */ - static void SendAudioStartStream(int32_t connection_key); - - /* - * @brief Sends notification to HMI to stop audio streaming - * - * @param connection_key Application connection key - * - */ - static void SendAudioStopStream(int32_t connection_key); - - static void SendOnDataStreaming(protocol_handler::ServiceType service, - bool available); - - /* - * @brief Sends notification to HMI to stop audioPathThru - * - * @param connection_key Application connection key - * - * @return TRUE on SUCCES otherwise return FALSE - */ - static bool SendStopAudioPathThru(); - - static smart_objects::SmartObjectSPtr CreateNegativeResponse( - uint32_t connection_key, int32_t function_id, uint32_t correlation_id, - int32_t result_code); - - /* - * @brief Verify image and add image file full path - * - * @param SmartObject with image - * - * @param app current application - * - * @return verification result - * - */ - static mobile_apis::Result::eType VerifyImage(smart_objects::SmartObject& image, - ApplicationConstSharedPtr app); - - /* - * @brief Finds "Image" structure in request and verify image file presence - * in Core. - * - * @param message SmartObject with request - * - * @param app current application - * - * @return verification result - * - */ - static mobile_apis::Result::eType VerifyImageFiles( - smart_objects::SmartObject& message, ApplicationConstSharedPtr app); - - static mobile_apis::Result::eType VerifyImageVrHelpItems( - smart_objects::SmartObject& message, ApplicationConstSharedPtr app); - - /** - * @brief Checks string if it contains incorrect character \t\n \\t \\n - * or string contains only whitespace - * @param parameter str contains string which must be checked - * @return returns FALSE if string contains incorrect character or - * string is empty otherwise returns TRUE - */ - static bool VerifySoftButtonString(const std::string& str); - - static mobile_apis::Result::eType ProcessSoftButtons( + uint32_t correlation_id, + ApplicationManager& app_mngr); + + /* + * @brief Sends notification to HMI to start video streaming + * + * @param connection_key Application connection key + * + */ + static void SendNaviStartStream(int32_t app_id, ApplicationManager& app_mngr); + + /* + * @brief Sends notification to HMI to stop video streaming + * + * @param connection_key Application connection key + * + */ + static void SendNaviStopStream(int32_t app_id, ApplicationManager& app_mngr); + + /* + * @brief Send notification for Update of Policy Table + * with PT Snapshot. + * @param connection_key Id of application to send message to + * @param policy_data PT Snapshot + * @param url If empty string, no URL is provided + * @param timeout If -1 no timeout is provdied + */ + static void SendPolicySnapshotNotification( + uint32_t connection_key, + const std::vector<uint8_t>& policy_data, + const std::string& url, + ApplicationManager& app_mngr); + + static void SendSystemRequestNotification( + uint32_t connection_key, + NsSmartDeviceLink::NsSmartObjects::SmartObject& content, + ApplicationManager& app_mngr); + + /** + * @brief SendLaunchApp allows to send OnSystemRequest with LAUNCH_UP. + * + * @param connection_key application id. + * + * @param urlSchema application's url schema. + * + * @param packageName application's package name. + */ + static void SendLaunchApp(const uint32_t connection_key, + const std::string& urlSchema, + const std::string& packageName, + ApplicationManager& app_man); + + /** + * @brief Sends OnSystemRequest which queries remote apps list + * @param connection_key application id, which is used for sending out + */ + static void SendQueryApps(const uint32_t connection_key, + ApplicationManager& app_man); + + /* + * @brief Send notification to mobile on application permissions update + * @param connection_key Id of application to send message to + * @param permissions updated permissions for application + */ + static void SendOnPermissionsChangeNotification( + uint32_t connection_key, + const policy::Permissions& permissions, + ApplicationManager& app_mngr); + + /* + * @brief Send notification to HMI on application permissions update + * @param connection_key Id of application to send message to + * @param permissions updated permissions for application + */ + static void SendOnAppPermissionsChangedNotification( + uint32_t connection_key, + const policy::AppPermissions& permissions, + ApplicationManager& app_mngr); + + /** + * @brief Send GetStatusUpdate response to HMI with current policy update + * status + * @param status Update status + * @param correlation_id Correlation id from request + */ + static void SendGetStatusUpdateResponse(const std::string& status, + const uint32_t correlation_id, + ApplicationManager& app_mngr); + + /** + * @brief Send UpdateSDL response to HMI with policy update result + * @param result Update result + * @param correlation_id Correlation id from request + */ + static void SendUpdateSDLResponse(const std::string& result, + const uint32_t correlation_id, + ApplicationManager& app_mngr); + + /** + * @brief Send OnStatusUpdate to HMI on policy update status change + * @param status Policy table update status + */ + static void SendOnStatusUpdate(const std::string& status, + ApplicationManager& app_mngr); + + /** + * @brief Send GetSystemInfo request to HMI + */ + static void SendGetSystemInfoRequest(ApplicationManager& app_mngr); + + /* + * @brief Sends notification to HMI to start audio streaming + * + * @param connection_key Application connection key + * + */ + static void SendAudioStartStream(int32_t app_id, + ApplicationManager& app_mngr); + + /* + * @brief Sends notification to HMI to stop audio streaming + * + * @param connection_key Application connection key + * + */ + static void SendAudioStopStream(int32_t connection_key, + ApplicationManager& app_mngr); + + static void SendOnDataStreaming(protocol_handler::ServiceType service, + bool available, + ApplicationManager& app_mngr); + + /* + * @brief Sends notification to HMI to stop audioPathThru + * + * @param connection_key Application connection key + * + * @return TRUE on SUCCES otherwise return FALSE + */ + static bool SendStopAudioPathThru(ApplicationManager& app_mngr); + + /** + * @brief Sends UnsubscribeWayPoints request + * @return true if UnSubscribedWayPoints is send otherwise false + */ + static bool SendUnsubscribedWayPoints(ApplicationManager& app_mngr); + + static smart_objects::SmartObjectSPtr CreateNegativeResponse( + uint32_t connection_key, + int32_t function_id, + const uint32_t correlation_id, + int32_t result_code); + + /* + * @brief Verify image and add image file full path + * + * @param SmartObject with image + * + * @param app current application + * + * @return verification result + * + */ + static mobile_apis::Result::eType VerifyImage( + smart_objects::SmartObject& image, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + /* + * @brief Finds "Image" structure in request and verify image file presence + * in Core. + * + * @param message SmartObject with request + * + * @param app current application + * + * @return verification result + * + */ + static mobile_apis::Result::eType VerifyImageFiles( + smart_objects::SmartObject& message, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + static mobile_apis::Result::eType VerifyImageVrHelpItems( + smart_objects::SmartObject& message, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + /** + * @brief Checks string if it contains incorrect character \t\n \\t \\n + * or string contains only whitespace + * @param parameter str contains string which must be checked + * @return returns FALSE if string contains incorrect character or + * string is empty otherwise returns TRUE + */ + static bool VerifySoftButtonString(const std::string& str); + + static mobile_apis::Result::eType ProcessSoftButtons( smart_objects::SmartObject& message_params, - ApplicationConstSharedPtr app); - - /** - * @brief checkWithPolicy allows to check soft button's parameters - * according to the current policy - * @param system_action system action - * @param app_mobile_id policy application id - * @return - */ - static bool CheckWithPolicy(mobile_apis::SystemAction::eType system_action, - const std::string& app_mobile_id); - - /* - * @brief subscribe application to softbutton - * - * @param message_params contains data of request - * - * @param app current application - * - * @param function_id Unique command id from mobile API - */ - static void SubscribeApplicationToSoftButton( - smart_objects::SmartObject& message_params, - ApplicationSharedPtr app, - int32_t function_id); - - static bool PrintSmartObject(const smart_objects::SmartObject& object); - - template<typename From, typename To> - static To ConvertEnumAPINoCheck(const From& input) { - return static_cast<To>(input); - } - - /** - * @brief Convert common language to string representation - * @param language Common language - * @return Common language string representation - */ - static std::string CommonLanguageToString( + ApplicationConstSharedPtr app, + const policy::PolicyHandlerInterface& policy_handler, + ApplicationManager& app_mngr); + + /* + * @brief subscribe application to softbutton + * + * @param message_params contains data of request + * + * @param app current application + * + * @param function_id Unique command id from mobile API + */ + static void SubscribeApplicationToSoftButton( + smart_objects::SmartObject& message_params, + ApplicationSharedPtr app, + int32_t function_id); + + static bool PrintSmartObject(const smart_objects::SmartObject& object); + + template <typename From, typename To> + static To ConvertEnumAPINoCheck(const From& input) { + return static_cast<To>(input); + } + + static const uint32_t GetPriorityCode(const std::string& priority); + /** + * @brief Convert common language to string representation + * @param language Common language + * @return Common language string representation + */ + static std::string CommonLanguageToString( hmi_apis::Common_Language::eType language); - /** - * @brief Converts string to common language enum value - * @param language language as string - * @return Common language enum value - */ - static hmi_apis::Common_Language::eType CommonLanguageFromString( - const std::string& language); - - /** - * @brief Gets command limit number per minute for specific application - * @param policy_app_id Unique application id - * @return Limit for number of command per minute - */ - static uint32_t GetAppCommandLimit(const std::string& policy_app_id); - - /** - * @brief Creates TTS.SetGlobalProperties request and sends - * to HMI for VCA module. - * @param app contains application which sends TTS GlobalProperties to HMI - * after timeout or first time when application register with level NONE or - * BACKGROUND - * @param default_help_prompt - * if default_help_prompt=TRUE->TTSGlobalProperties request will be created with - * default helpPrompt array, otherwise TTSGlobalProperties request will be created - * with empty helpPrompt array. - */ - static void SendTTSGlobalProperties( - ApplicationSharedPtr app, bool default_help_prompt); - - /** - * @brief SendSetAppIcon allows to send SetAppIcon request. - * - * @param app_id application for which icon request should be sent. - * - * @param icon_path path to the icon. - */ - static void SendSetAppIcon(uint32_t app_id, - const std::string& icon_path); - private: - /** - * @brief Allows to fill SO according to the current permissions. - * @param permissions application permissions. - * @param message which should be filled. - */ - static void FillAppRevokedPermissions(const policy::AppPermissions& permissions, - smart_objects::SmartObject& message); - - static smart_objects::SmartObjectSPtr CreateChangeRegistration( - int32_t function_id, int32_t language, uint32_t app_id, - const smart_objects::SmartObject* app_types = NULL); - - MessageHelper(); - - static const VehicleData vehicle_data_; - DISALLOW_COPY_AND_ASSIGN(MessageHelper); + /** + * @brief Converts string to mobile language enum value + * @param language language as string + * @return Mobile language enum value + */ + static mobile_apis::Language::eType MobileLanguageFromString( + const std::string& language); + + /** + * @brief Converts mobile language enum to HMI language enum + * @param language Mobile language enum + * @return HMI language enum + */ + static hmi_apis::Common_Language::eType MobileToCommonLanguage( + const mobile_apis::Language::eType language); + + /** + * @brief Converts HMI language enum to mobile language enum + * @param language HMI language enum + * @return Mobile language enum + */ + static mobile_apis::Language::eType CommonToMobileLanguage( + const hmi_apis::Common_Language::eType language); + + /** + * @brief Gets command limit number per minute for specific application + * @param policy_app_id Unique application id + * @return Limit for number of command per minute + */ + static uint32_t GetAppCommandLimit(const std::string& policy_app_id); + + /** + * @brief Creates TTS.SetGlobalProperties request and sends + * to HMI for VCA module. + * @param app contains application which sends TTS GlobalProperties to HMI + * after timeout or first time when application register with level NONE or + * BACKGROUND + * @param default_help_prompt + * if default_help_prompt=TRUE->TTSGlobalProperties request will be created + * with + * default helpPrompt array, otherwise TTSGlobalProperties request will be + * created + * with empty helpPrompt array. + */ + static void SendTTSGlobalProperties(ApplicationSharedPtr app, + const bool default_help_prompt, + ApplicationManager& app_man); + + /** + * @brief SendSetAppIcon allows to send SetAppIcon request. + * + * @param app_id application for which icon request should be sent. + * + * @param icon_path path to the icon. + */ + static void SendSetAppIcon(const uint32_t app_id, + const std::string& icon_path, + ApplicationManager& application_manager); + + static hmi_apis::Common_Language::eType CommonLanguageFromString( + const std::string& language); + + static smart_objects::SmartObjectSPtr + GetOnAppInterfaceUnregisteredNotificationToMobile( + int32_t connection_key, + mobile_api::AppInterfaceUnregisteredReason::eType reason); + + private: + /** + * @brief Creates new request object and fill its header + * @return New request object + */ + static smart_objects::SmartObjectSPtr CreateRequestObject( + const uint32_t correlation_id); + + /** + * @brief Allows to fill SO according to the current permissions. + * @param permissions application permissions. + * @param message which should be filled. + */ + static void FillAppRevokedPermissions( + const policy::AppPermissions& permissions, + smart_objects::SmartObject& message); + + static smart_objects::SmartObjectSPtr CreateChangeRegistration( + const int32_t function_id, + const int32_t language, + const uint32_t app_id, + const smart_objects::SmartObject* app_types, + ApplicationManager& app_mngr); + + MessageHelper(); + + static const VehicleData vehicle_data_; + DISALLOW_COPY_AND_ASSIGN(MessageHelper); }; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/mobile_command_factory.h b/src/components/application_manager/include/application_manager/mobile_command_factory.h index b28e0abb34..1f270b28db 100644 --- a/src/components/application_manager/include/application_manager/mobile_command_factory.h +++ b/src/components/application_manager/include/application_manager/mobile_command_factory.h @@ -39,6 +39,7 @@ namespace application_manager { typedef utils::SharedPtr<commands::Command> CommandSharedPtr; +class ApplicationManager; /** * @brief Factory class for command creation @@ -51,9 +52,10 @@ class MobileCommandFactory { * @param smartObject SmartObject shared pointer. * @return Pointer to created command object. **/ - static commands::Command* CreateCommand( - const commands::MessageSharedPtr& message, - commands::Command::CommandOrigin origin); + static CommandSharedPtr CreateCommand( + const commands::MessageSharedPtr& message, + commands::Command::CommandOrigin origin, + ApplicationManager& application_manager); private: MobileCommandFactory(); diff --git a/src/components/application_manager/include/application_manager/mobile_message_handler.h b/src/components/application_manager/include/application_manager/mobile_message_handler.h index 5e8d551aee..6b62258b23 100644 --- a/src/components/application_manager/include/application_manager/mobile_message_handler.h +++ b/src/components/application_manager/include/application_manager/mobile_message_handler.h @@ -40,29 +40,29 @@ namespace application_manager { typedef utils::SharedPtr<application_manager::Message> MobileMessage; class MobileMessageHandler { - public: - static application_manager::Message* HandleIncomingMessageProtocol( + public: + static application_manager::Message* HandleIncomingMessageProtocol( const protocol_handler::RawMessagePtr message); - static protocol_handler::RawMessage* HandleOutgoingMessageProtocol( + static protocol_handler::RawMessage* HandleOutgoingMessageProtocol( const MobileMessage& message); - //! ------------------------------------------------------------- - private: - static application_manager::Message* HandleIncomingMessageProtocolV1( + //! ------------------------------------------------------------- + private: + static application_manager::Message* HandleIncomingMessageProtocolV1( const protocol_handler::RawMessagePtr message); - static application_manager::Message* HandleIncomingMessageProtocolV2( + static application_manager::Message* HandleIncomingMessageProtocolV2( const protocol_handler::RawMessagePtr message); - //! ------------------------------------------------------------- + //! ------------------------------------------------------------- - static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV1( + static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV1( const MobileMessage& message); - static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV2( + static protocol_handler::RawMessage* HandleOutgoingMessageProtocolV2( const MobileMessage& message); - DISALLOW_COPY_AND_ASSIGN(MobileMessageHandler); + DISALLOW_COPY_AND_ASSIGN(MobileMessageHandler); }; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h b/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h index 55a4f146c2..6913f5038e 100644 --- a/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h +++ b/src/components/application_manager/include/application_manager/policies/delegates/app_permission_delegate.h @@ -33,49 +33,50 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_ - #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" #include "utils/conditional_variable.h" #include "policy/policy_types.h" +#include "application_manager/policies/policy_handler_interface.h" namespace policy { - +/** +*@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent +*in async way. +*/ +class AppPermissionDelegate : public threads::ThreadDelegate { + public: /** - * @brief The AppPermissionDelegate class allows to call OnAppPermissionConsent - * in async way. - */ -class AppPermissionDelegate: public threads::ThreadDelegate { - public: - /** - * @brief AppPermissionDelegate constructor, contains parameters - * which will be pass to the called function. - * - * @param connection_key connection key. - * - * @param permissions new permissions - */ - AppPermissionDelegate(const uint32_t connection_key, - const PermissionConsent &permissions); + * @brief AppPermissionDelegate constructor, contains parameters + * which will be pass to the called function. + * + * @param connection_key connection key. + * + * @param permissions new permissions + */ + AppPermissionDelegate(const uint32_t connection_key, + const PermissionConsent& permissions, + policy::PolicyHandlerInterface& policy_handler); - /** - * @brief threadMain run the needed function. - */ - virtual void threadMain(); - - /** - * @brief exitThreadMain do some stuff before exit from thread - * - * @return true in case when thread has been finished properly - */ - virtual void exitThreadMain(); + /** + * @brief threadMain run the needed function. + */ + virtual void threadMain(); - private: - uint32_t connection_key_; - PermissionConsent permissions_; + /** + * @brief exitThreadMain do some stuff before exit from thread + * + * @return true in case when thread has been finished properly + */ + virtual void exitThreadMain(); + + private: + uint32_t connection_key_; + PermissionConsent permissions_; + policy::PolicyHandlerInterface& policy_handler_; }; -} // namespace policy +} // namespace policy -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_ diff --git a/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h b/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h index 9044a3fd33..3dc9ad925c 100644 --- a/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h +++ b/src/components/application_manager/include/application_manager/policies/delegates/statistics_delegate.h @@ -42,41 +42,45 @@ namespace policy { - class StatisticsDelegate: public threads::ThreadDelegate { - enum StatisticType{ - INCREMENT_GLOBAL, - INCREMENT_APP, - SET, - ADD - }; - public: - explicit StatisticsDelegate(usage_statistics::GlobalCounterId type); - - StatisticsDelegate(const std::string& app_id, - usage_statistics::AppCounterId type); - - StatisticsDelegate(const std::string& app_id, - usage_statistics::AppInfoId type, - const std::string& value); - - StatisticsDelegate(const std::string& app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds); - - virtual void threadMain(); - - virtual void exitThreadMain(); - private: - StatisticType type_; - usage_statistics::GlobalCounterId global_counter_; - usage_statistics::AppCounterId app_counter_; - usage_statistics::AppInfoId app_info_; - usage_statistics::AppStopwatchId stop_watch_; - - std::string app_id_; - std::string value_; - int32_t timespan_seconds_; - }; -} // namespace policy - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_STATISTICS_DELEGATE_H_ +class PolicyHandler; + +class StatisticsDelegate : public threads::ThreadDelegate { + enum StatisticType { INCREMENT_GLOBAL, INCREMENT_APP, SET, ADD }; + + public: + StatisticsDelegate(PolicyHandler& policy_handler, + usage_statistics::GlobalCounterId type); + + StatisticsDelegate(PolicyHandler& policy_handler, + const std::string& app_id, + usage_statistics::AppCounterId type); + + StatisticsDelegate(PolicyHandler& policy_handler, + const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value); + + StatisticsDelegate(PolicyHandler& policy_handler, + const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds); + + virtual void threadMain(); + + virtual void exitThreadMain(); + + private: + StatisticType type_; + usage_statistics::GlobalCounterId global_counter_; + usage_statistics::AppCounterId app_counter_; + usage_statistics::AppInfoId app_info_; + usage_statistics::AppStopwatchId stop_watch_; + + std::string app_id_; + std::string value_; + int32_t timespan_seconds_; + PolicyHandler& policy_handler_; +}; +} // namespace policy + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_STATISTICS_DELEGATE_H_ diff --git a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h index e251170fec..13f070a1ec 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h +++ b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h @@ -30,30 +30,34 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_ #include "application_manager/event_engine/event_observer.h" +#include "utils/lock.h" namespace policy { namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; -class PolicyHandler; +class PolicyHandlerInterface; -class PolicyEventObserver : - public application_manager::event_engine::EventObserver { +class PolicyEventObserver + : public application_manager::event_engine::EventObserver { public: - explicit PolicyEventObserver(policy::PolicyHandler* const policy_handler); - void set_policy_handler(policy::PolicyHandler* const policy_handler); + PolicyEventObserver( + policy::PolicyHandlerInterface* const policy_handler, + application_manager::event_engine::EventDispatcher& event_dispatcher); + void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler); void on_event(const application_manager::event_engine::Event& event); void subscribe_on_event( const application_manager::event_engine::Event::EventID& event_id, int32_t hmi_correlation_id = 0); + private: sync_primitives::Lock policy_handler_lock_; - PolicyHandler* policy_handler_; + PolicyHandlerInterface* policy_handler_; void ProcessOdometerEvent(const smart_objects::SmartObject& message); }; } // namespace policy -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_EVENT_OBSERVER_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_ diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 1fb7d68d25..6f36408444 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -37,80 +37,93 @@ #include <map> #include <set> #include <vector> -#include <cstdint> +#include <list> +#include <stdint.h> + #include "policy/policy_manager.h" +#include "application_manager/policies/policy_handler_interface.h" #include "application_manager/policies/policy_event_observer.h" #include "application_manager/policies/delegates/statistics_delegate.h" +#include "application_manager/policies/policy_handler_observer.h" #include "utils/logger.h" -#include "utils/singleton.h" #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" #include "utils/conditional_variable.h" #include "utils/rwlock.h" -#include "usage_statistics/statistics_manager.h" -#include "application_manager/policies/policy_handler_observer.h" +#include "utils/custom_string.h" +#include "policy/usage_statistics/statistics_manager.h" #include "utils/threads/async_runner.h" -#include "application_manager/application_manager_impl.h" +#include "policy/policy_settings.h" namespace Json { class Value; } +namespace application_manager { +class ApplicationManager; +} + namespace policy { typedef std::vector<uint32_t> AppIds; typedef std::vector<uint32_t> DeviceHandles; - -class PolicyHandler - : public utils::Singleton<PolicyHandler, - utils::deleters::Deleter<PolicyHandler>>, - public PolicyListener, - public threads::AsyncRunner { -public: +namespace custom_str = utils::custom_string; + +class PolicyHandler : public PolicyHandlerInterface, + public PolicyListener, + public threads::AsyncRunner { + public: + PolicyHandler(const policy::PolicySettings& get_settings, + application_manager::ApplicationManager& application_manager); virtual ~PolicyHandler(); - bool LoadPolicyLibrary(); - bool PolicyEnabled(); - bool InitPolicyTable(); - bool ResetPolicyTable(); - bool ClearUserConsent(); - bool SendMessageToSDK(const BinaryMessage &pt_string, const std::string &url); - bool ReceiveMessageFromSDK(const std::string &file, - const BinaryMessage &pt_string); - bool UnloadPolicyLibrary(); - virtual void OnPermissionsUpdated(const std::string &policy_app_id, - const Permissions &permissions, - const HMILevel &default_hmi); - - virtual void OnPermissionsUpdated(const std::string &policy_app_id, - const Permissions &permissions); - - void OnSnapshotCreated(const BinaryMessage &pt_string) OVERRIDE; - - bool GetPriority(const std::string &policy_app_id, std::string *priority); - void CheckPermissions(const PTString &app_id, const PTString &hmi_level, - const PTString &rpc, const RPCParams &rpc_params, - CheckPermissionResult &result); - - uint32_t GetNotificationsNumber(const std::string &priority); - DeviceConsent GetUserConsentForDevice(const std::string &device_id); - bool GetDefaultHmi(const std::string &policy_app_id, - std::string *default_hmi); - bool GetInitialAppData(const std::string &application_id, - StringArray *nicknames = NULL, - StringArray *app_hmi_types = NULL); - void GetServiceUrls(const std::string &service_type, - EndpointUrls &end_points); - - std::string GetLockScreenIconUrl() const; - void ResetRetrySequence(); - uint32_t NextRetryTimeout(); - int TimeoutExchange(); - void OnExceededTimeout(); - void OnSystemReady(); - void PTUpdatedAt(int kilometers, int days_after_epoch); - void add_listener(PolicyHandlerObserver *listener); - void remove_listener(PolicyHandlerObserver *listener); - - utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager(); + bool LoadPolicyLibrary() OVERRIDE; + bool PolicyEnabled() const OVERRIDE; + bool InitPolicyTable() OVERRIDE; + bool ResetPolicyTable() OVERRIDE; + bool ClearUserConsent() OVERRIDE; + bool SendMessageToSDK(const BinaryMessage& pt_string, + const std::string& url) OVERRIDE; + bool ReceiveMessageFromSDK(const std::string& file, + const BinaryMessage& pt_string) OVERRIDE; + bool UnloadPolicyLibrary() OVERRIDE; + virtual void OnPermissionsUpdated(const std::string& policy_app_id, + const Permissions& permissions, + const HMILevel& default_hmi) OVERRIDE; + + virtual void OnPermissionsUpdated(const std::string& policy_app_id, + const Permissions& permissions) OVERRIDE; + + virtual void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE; + + virtual bool GetPriority(const std::string& policy_app_id, + std::string* priority) const OVERRIDE; + void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result) OVERRIDE; + + uint32_t GetNotificationsNumber(const std::string& priority) const OVERRIDE; + virtual DeviceConsent GetUserConsentForDevice( + const std::string& device_id) const OVERRIDE; + bool GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi) const OVERRIDE; + bool GetInitialAppData(const std::string& application_id, + StringArray* nicknames = NULL, + StringArray* app_hmi_types = NULL) OVERRIDE; + void GetServiceUrls(const std::string& service_type, + EndpointUrls& end_points) OVERRIDE; + virtual std::string GetLockScreenIconUrl() const OVERRIDE; + void ResetRetrySequence() OVERRIDE; + uint32_t NextRetryTimeout() OVERRIDE; + int TimeoutExchange() OVERRIDE; + void OnExceededTimeout() OVERRIDE; + void OnSystemReady() OVERRIDE; + void PTUpdatedAt(Counters counter, int value) OVERRIDE; + void add_listener(PolicyHandlerObserver* listener) OVERRIDE; + void remove_listener(PolicyHandlerObserver* listener) OVERRIDE; + + utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager() + const OVERRIDE; /** * @brief CheckSystemAction allows to check whether certain system @@ -121,47 +134,56 @@ public: * @return true if specified system action is enabled, false otherwise. */ bool CheckSystemAction(mobile_apis::SystemAction::eType system_action, - const std::string &policy_app_id); + const std::string& policy_app_id) const OVERRIDE; /** * Lets client to notify PolicyHandler that more kilometers expired * @param kms New value of odometer */ - void KmsChanged(int kms); + void KmsChanged(int kms) OVERRIDE; /** * @brief Gather information for application and sends it to HMI * @param connection_key Connection key for application */ - void OnActivateApp(uint32_t connection_key, uint32_t correlation_id); + void OnActivateApp(uint32_t connection_key, uint32_t correlation_id) OVERRIDE; /** * @brief Process user consent on mobile data connection access - * @param Device id or 0, if concern to all SDL functionality + * @param Device id or empty string, if concern to all SDL functionality * @param User consent from response */ - void OnAllowSDLFunctionalityNotification(bool is_allowed, - uint32_t device_id = 0); + void OnAllowSDLFunctionalityNotification( + bool is_allowed, const std::string& device_id) OVERRIDE; /** * @brief Increment counter for ignition cycles */ - void OnIgnitionCycleOver(); + void OnIgnitionCycleOver() OVERRIDE; - void OnPendingPermissionChange(const std::string &policy_app_id); + void OnPendingPermissionChange(const std::string& policy_app_id) OVERRIDE; /** * Initializes PT exchange at user request * @param correlation_id correlation id of request */ - void PTExchangeAtUserRequest(uint32_t correlation_id); + void PTExchangeAtUserRequest(uint32_t correlation_id) OVERRIDE; + + /** + * @brief Add's device to policy table + * @param device_id Device mac address + * @param connection_type Device connection type + */ + void AddDevice(const std::string& device_id, + const std::string& connection_type) OVERRIDE; /** * @brief Save device info for specific device to policy table * @param device_id Device mac address * @param device_info Device params */ - void SetDeviceInfo(std::string &device_id, const DeviceInfo &device_info); + void SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info) OVERRIDE; /** * @brief Store user-changed permissions consent to DB @@ -170,7 +192,7 @@ public: * @param permissions User-changed group permissions consent */ void OnAppPermissionConsent(const uint32_t connection_key, - const PermissionConsent &permissions); + const PermissionConsent& permissions) OVERRIDE; /** * @brief Get appropriate message parameters and send them with response @@ -179,9 +201,9 @@ public: * @param language Language * @param correlation_id correlation id of request */ - void OnGetUserFriendlyMessage(const std::vector<std::string> &message_codes, - const std::string &language, - uint32_t correlation_id); + void OnGetUserFriendlyMessage(const std::vector<std::string>& message_codes, + const std::string& language, + uint32_t correlation_id) OVERRIDE; /** * @brief Get list of permissions for application/device binded to @@ -191,32 +213,33 @@ public: * @param correlation_id Correlation id from request */ void OnGetListOfPermissions(const uint32_t connection_key, - const uint32_t correlation_id); + const uint32_t correlation_id) OVERRIDE; /** * @brief Get current policy table update state and send response * @param correlation_id Correlation id from request */ - void OnGetStatusUpdate(const uint32_t correlation_id); + void OnGetStatusUpdate(const uint32_t correlation_id) OVERRIDE; /** * @brief Send notification to HMI with changed policy update status * @param status Current policy update state */ - void OnUpdateStatusChanged(const std::string &status); + void OnUpdateStatusChanged(const std::string& status) OVERRIDE; /** * @brief Update currently used device id in policies manager for given * application * @param policy_app_id Application id */ - std::string OnCurrentDeviceIdUpdateRequired(const std::string &policy_app_id); + std::string OnCurrentDeviceIdUpdateRequired( + const std::string& policy_app_id) OVERRIDE; /** * @brief Set parameters from OnSystemInfoChanged to policy table * @param language System language */ - void OnSystemInfoChanged(const std::string &language); + void OnSystemInfoChanged(const std::string& language) OVERRIDE; /** * @brief Save data from GetSystemInfo request to policy table @@ -224,116 +247,114 @@ public: * @param wers_country_code WERS country code * @param language System language */ - void OnGetSystemInfo(const std::string &ccpu_version, - const std::string &wers_country_code, - const std::string &language); + void OnGetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) OVERRIDE; /** * @brief Send request to HMI to get update on system parameters */ - void OnSystemInfoUpdateRequired() OVERRIDE; + virtual void OnSystemInfoUpdateRequired() OVERRIDE; /** * @brief Sends GetVehicleData request in case when Vechicle info is ready. */ - virtual void OnVIIsReady(); + virtual void OnVIIsReady() OVERRIDE; /** * @brief Allows to update vechicle data info. * @param SmartObject which contains all needed information. */ - virtual void OnVehicleDataUpdated(const smart_objects::SmartObject &message); + virtual void OnVehicleDataUpdated( + const smart_objects::SmartObject& message) OVERRIDE; /** * Removes device * @param device_id id of device */ - void RemoveDevice(const std::string &device_id); + void RemoveDevice(const std::string& device_id) OVERRIDE; /** * Adds statistics info * @param type type of info */ - void AddStatisticsInfo(int type); + void AddStatisticsInfo(int type) OVERRIDE; /** * Handles system error * @param code code of error */ - void OnSystemError(int code); + void OnSystemError(int code) OVERRIDE; /** * @brief Choose application id to be used for snapshot sending * @return Application id or 0, if there are no applications registered */ - uint32_t GetAppIdForSending(); + uint32_t GetAppIdForSending() const OVERRIDE; - std::string GetAppName(const std::string &policy_app_id); + custom_str::CustomString GetAppName( + const std::string& policy_app_id) OVERRIDE; - void - OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types) OVERRIDE; + virtual void OnUpdateHMIAppType( + std::map<std::string, StringArray> app_hmi_types) OVERRIDE; - void OnCertificateUpdated(const std::string &certificate_data) OVERRIDE; + virtual void OnCertificateUpdated( + const std::string& certificate_data) OVERRIDE; - bool CanUpdate() OVERRIDE; + virtual bool CanUpdate() OVERRIDE; - void OnDeviceConsentChanged(const std::string &device_id, - bool is_allowed) OVERRIDE; + virtual void OnDeviceConsentChanged(const std::string& device_id, + const bool is_allowed) OVERRIDE; - virtual void OnPTExchangeNeeded(); + virtual void SendOnAppPermissionsChanged( + const AppPermissions& permissions, + const std::string& policy_app_id) const OVERRIDE; - void GetAvailableApps(std::queue<std::string> &apps) OVERRIDE; + virtual void OnPTExchangeNeeded() OVERRIDE; + + virtual void GetAvailableApps(std::queue<std::string>& apps) OVERRIDE; /** * @brief Allows to add new or update existed application during * registration process * @param application_id The policy aplication id. */ - void AddApplication(const std::string &application_id); + void AddApplication(const std::string& application_id) OVERRIDE; /** * Checks whether application is revoked * @param app_id id application * @return true if application is revoked */ - bool IsApplicationRevoked(const std::string &app_id); + bool IsApplicationRevoked(const std::string& app_id) OVERRIDE; /** * @brief Notifies policy manager, that PTS was sent out */ - void OnUpdateRequestSentToMobile(); + void OnUpdateRequestSentToMobile() OVERRIDE; /** * Returns heart beat timeout * @param app_id application id - * @return if timeout was set then value in seconds greater zero + * @return if timeout was set then value in milliseconds greater zero * otherwise heart beat for specific application isn't set */ - uint16_t HeartBeatTimeout(const std::string &app_id) const; + uint32_t HeartBeatTimeout(const std::string& app_id) const OVERRIDE; /** * @brief Returns URL for querying list of remote apps */ - const std::string RemoteAppsUrl() const; + const std::string RemoteAppsUrl() const OVERRIDE; /** * @brief Handler on applications search started */ - void OnAppsSearchStarted(); + void OnAppsSearchStarted() OVERRIDE; /** * @brief Handler on applications search completed */ - void OnAppsSearchCompleted(); - - /** - * @brief OnAppRegisteredOnMobile alows to handle event when application were - * succesfully registered on mobile device. - * It will send OnAppPermissionSend notification and will try to start PTU. - * - * @param application_id registered application. - */ - void OnAppRegisteredOnMobile(const std::string &application_id); + void OnAppsSearchCompleted() OVERRIDE; /** * @brief Checks if certain request type is allowed for application @@ -341,34 +362,63 @@ public: * @param type Request type * @return true, if allowed, otherwise - false */ - bool IsRequestTypeAllowed(const std::string &policy_app_id, - mobile_apis::RequestType::eType type) const; + bool IsRequestTypeAllowed( + const std::string& policy_app_id, + mobile_apis::RequestType::eType type) const OVERRIDE; /** * @brief Gets application request types * @param policy_app_id Unique application id * @return request types */ - const std::vector<std::string> - GetAppRequestTypes(const std::string &policy_app_id) const; + const std::vector<std::string> GetAppRequestTypes( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Gets vehicle information + * @return Structure with vehicle information + */ + const VehicleInfo GetVehicleInfo() const OVERRIDE; + + /** + * @brief OnAppRegisteredOnMobile allows to handle event when application were + * succesfully registered on mobile device. + * It will send OnAppPermissionSend notification and will try to start PTU. + * + * @param application_id registered application. + */ + void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; // TODO(AKutsan) REMOVE THIS UGLY HOTFIX - virtual void Increment(usage_statistics::GlobalCounterId type); - virtual void Increment(const std::string &app_id, - usage_statistics::AppCounterId type); - virtual void Set(const std::string &app_id, usage_statistics::AppInfoId type, - const std::string &value); - virtual void Add(const std::string &app_id, + virtual void Increment(usage_statistics::GlobalCounterId type) OVERRIDE; + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) OVERRIDE; + virtual void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) OVERRIDE; + virtual void Add(const std::string& app_id, usage_statistics::AppStopwatchId type, - int32_t timespan_seconds); + int32_t timespan_seconds) OVERRIDE; + +#ifdef BUILD_TESTS + void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) { + policy_manager_ = pm; + } +#endif // BUILD_TESTS + +#ifdef ENABLE_SECURITY + std::string RetrieveCertificate() const OVERRIDE; +#endif // ENABLE_SECURITY -protected: + const PolicySettings& get_settings() const OVERRIDE; + + protected: /** * Starts next retry exchange policy table */ void StartNextRetry(); -private: + private: /** * Checks system action of application for permission of keep context * @param system_action system action (see mobile api) @@ -377,7 +427,7 @@ private: * policy * otherwise true */ - bool CheckKeepContext(const std::string &policy_app_id); + bool CheckKeepContext(const std::string& policy_app_id) const; /** * Checks system action of application for permission of steal focus @@ -387,7 +437,7 @@ private: * policy * otherwise true */ - bool CheckStealFocus(const std::string &policy_app_id); + bool CheckStealFocus(const std::string& policy_app_id) const; /** * @brief OnAppPermissionConsentInternal reacts on permission changing @@ -397,47 +447,54 @@ private: * @param permissions new permissions. */ void OnAppPermissionConsentInternal(const uint32_t connection_key, - PermissionConsent &permissions); + PermissionConsent& permissions) OVERRIDE; + + /** + * @brief Sets days after epoch on successful policy update + */ + void SetDaysAfterEpoch(); -private: + private: class StatisticManagerImpl : public usage_statistics::StatisticsManager { + public: + StatisticManagerImpl(PolicyHandler* policy_handler) + : policy_handler_(policy_handler) { + DCHECK(policy_handler_); + } // TODO(AKutsan) REMOVE THIS UGLY HOTFIX virtual void Increment(usage_statistics::GlobalCounterId type) { - - PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(type)); + policy_handler_->AsyncRun(new StatisticsDelegate(*policy_handler_, type)); } - virtual void Increment(const std::string &app_id, - usage_statistics::AppCounterId type) { - - PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(app_id, type)); + void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) { + policy_handler_->AsyncRun( + new StatisticsDelegate(*policy_handler_, app_id, type)); } - virtual void Set(const std::string &app_id, - usage_statistics::AppInfoId type, - const std::string &value) { - - PolicyHandler::instance()->AsyncRun( - new StatisticsDelegate(app_id, type, value)); + void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) { + policy_handler_->AsyncRun( + new StatisticsDelegate(*policy_handler_, app_id, type, value)); } - virtual void Add(const std::string &app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds) { - - PolicyHandler::instance()->AsyncRun( - new StatisticsDelegate(app_id, type, timespan_seconds)); + void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) { + policy_handler_->AsyncRun(new StatisticsDelegate( + *policy_handler_, app_id, type, timespan_seconds)); } + + private: + PolicyHandler* policy_handler_; }; - // TODO(AKutsan) REMOVE THIS UGLY HOTFIX - PolicyHandler(); - bool SaveSnapshot(const BinaryMessage &pt_string, std::string &snap_path); - static PolicyHandler *instance_; + bool SaveSnapshot(const BinaryMessage& pt_string, std::string& snap_path); static const std::string kLibrary; mutable sync_primitives::RWLock policy_manager_lock_; utils::SharedPtr<PolicyManager> policy_manager_; - void *dl_handle_; + void* dl_handle_; AppIds last_used_app_ids_; utils::SharedPtr<PolicyEventObserver> event_observer_; uint32_t last_activated_app_id_; @@ -449,7 +506,7 @@ private: inline bool CreateManager(); - typedef std::list<PolicyHandlerObserver *> HandlersCollection; + typedef std::list<PolicyHandlerObserver*> HandlersCollection; HandlersCollection listeners_; sync_primitives::Lock listeners_lock_; @@ -463,15 +520,13 @@ private: sync_primitives::Lock app_to_device_link_lock_; utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_; - + const PolicySettings& settings_; + application_manager::ApplicationManager& application_manager_; friend class AppPermissionDelegate; DISALLOW_COPY_AND_ASSIGN(PolicyHandler); - FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER( - PolicyHandler, utils::deleters::Deleter<PolicyHandler>); - FRIEND_DELETER_DESTRUCTOR(PolicyHandler); }; -} // namespace policy +} // namespace policy -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_H_ diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h index c9b32b7e17..794da0cdfb 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h @@ -33,12 +33,19 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_ +#include <vector> +#include <string> +#include <map> + namespace policy { -class PolicyHandlerObserver{ - public: - virtual void OnUpdateHMIAppType(std::map<std::string, std::vector<std::string> > app_hmi_types) = 0; - virtual void OnCertificateUpdated(const std::string& certificate_data) {} +class PolicyHandlerObserver { + public: + virtual void OnUpdateHMIAppType( + std::map<std::string, std::vector<std::string> > app_hmi_types) {} + virtual bool OnCertificateUpdated(const std::string& certificate_data) { + return false; + } virtual ~PolicyHandlerObserver() {} }; } // namespace policy diff --git a/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h index 31f7ded507..4e543eae96 100644 --- a/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h +++ b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler.h @@ -37,10 +37,10 @@ namespace policy { class PTExchangeHandler { - public: - virtual ~PTExchangeHandler() {}; - virtual void Start() = 0; - virtual void Stop() = 0; + public: + virtual ~PTExchangeHandler(){}; + virtual void Start() = 0; + virtual void Stop() = 0; }; } // namespace policy diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h index cddcd72337..237d9f5d8a 100644 --- a/src/components/application_manager/include/application_manager/request_controller.h +++ b/src/components/application_manager/include/application_manager/request_controller.h @@ -42,13 +42,13 @@ #include "utils/threads/thread.h" #include "utils/conditional_variable.h" #include "utils/threads/thread_delegate.h" +#include "utils/timer.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "application_manager/request_info.h" -#include "utils/timer_thread.h" - +#include "application_manager/request_controller_settings.h" namespace application_manager { @@ -59,233 +59,231 @@ namespace request_controller { * requests. */ class RequestController { - public: - /** - * @brief Result code for addRequest - */ - enum TResult { - SUCCESS = 0, - TOO_MANY_REQUESTS, - TOO_MANY_PENDING_REQUESTS, - NONE_HMI_LEVEL_MANY_REQUESTS, - INVALID_DATA - }; - - /** - * @brief Thread pool state - */ - enum TPoolState { - UNDEFINED = 0, - STARTED, - STOPPED, - }; - - // Methods - - /** - * @brief Class constructor - * - */ - RequestController(); - - /** - * @brief Class destructor - * - */ - virtual ~RequestController(); - - /** - * @brief Initialize thread pool - * - */ - void InitializeThreadpool(); - - /** - * @brief Destroy thread pool - * - */ - void DestroyThreadpool(); - - /** - * @brief Check if max request amount wasn't exceed and adds request to queue. - * - * @param request Active mobile request - * @param hmi_level Current application hmi_level - * - * @return Result code - * - */ - TResult addMobileRequest(const RequestPtr request, - const mobile_apis::HMILevel::eType& hmi_level); - - - /** - * @brief Store HMI request until response or timeout won't remove it - * - * @param request Active hmi request - * @return Result code - * - */ - TResult addHMIRequest(const RequestPtr request); - - /** - * @ Add notification to collection - * - * @param ptr Reference to shared pointer that point on hmi notification - */ - void addNotification(const RequestPtr ptr); - - - /** - * @brief Removes request from queue - * - * @param correlation_id Active request correlation ID, - * @param connection_key Active request connection key (0 for HMI requersts) - * @param force_terminate if true, request controller will terminate - * even if not allowed by request - */ - void terminateRequest(const uint32_t& correlation_id, - const uint32_t& connection_key, - bool force_terminate = false); - - /** - * @brief Removes request from queue - * - * @param mobile_correlation_id Active mobile request correlation ID - * - */ - void OnMobileResponse(const uint32_t& mobile_correlation_id, - const uint32_t& connection_key); - - - /** - * @brief Removes request from queue - * - * @param mobile_correlation_id Active mobile request correlation ID - * - */ - void OnHMIResponse(const uint32_t& correlation_id); - - /** - * @ Add notification to collection - * - * @param ptr Reference to shared pointer that point on hmi notification - */ - void removeNotification(const commands::Command* notification); - - /** - * @brief Removes all requests from queue for specified application - * - * @param app_id Mobile application ID (app_id) - * - */ - void terminateAppRequests(const uint32_t& app_id); - - /** - * @brief Terminates all requests from HMI - */ - void terminateAllHMIRequests(); - - - /** - * @brief Terminates all requests from Mobile - */ - void terminateAllMobileRequests(); - - /** - * @brief Updates request timeout - * - * @param app_id Connection key of application - * @param mobile_correlation_id Correlation ID of the mobile request - * @param new_timeout_value New timeout to be set in milliseconds - */ - void updateRequestTimeout(const uint32_t& app_id, - const uint32_t& mobile_correlation_id, - const uint32_t& new_timeout); - - /* - * @brief Function Should be called when Low Voltage is occured - */ - void OnLowVoltage(); - - /* - * @brief Function Should be called when Low Voltage is occured - */ - void OnWakeUp(); - - bool IsLowVoltage(); - - protected: - /** - * @brief Timer Callback - */ - void onTimer(); - - /** - * @brief Update timout for next OnTimer - * Not thread safe - */ - void UpdateTimer(); - - void terminateWaitingForExecutionAppRequests(const uint32_t& app_id); - void terminateWaitingForResponseAppRequests(const uint32_t& app_id); - - /** - * @brief Check Posibility to add new requests, or limits was exceeded - * @param request - request to check possipility to Add - * @return True if new request could be added, false otherwise - */ - TResult CheckPosibilitytoAdd(const RequestPtr request); - - /** - * @brief Check Posibility to add new requests, or limits was exceeded - * @param pending_requests_amount - maximum count of request that should be allowed for all applications - * @return True if new request could be added, false otherwise - */ - bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount); - - private: - class Worker : public threads::ThreadDelegate { - public: - explicit Worker(RequestController* requestController); - virtual ~Worker(); - virtual void threadMain(); - virtual void exitThreadMain(); - protected: - private: - RequestController* request_controller_; - sync_primitives::Lock thread_lock_; - volatile bool stop_flag_; - }; - - std::vector<threads::Thread*> pool_; - volatile TPoolState pool_state_; - uint32_t pool_size_; - sync_primitives::ConditionalVariable cond_var_; - - std::list<RequestInfoPtr> mobile_request_info_list_; - sync_primitives::Lock mobile_request_info_list_lock_; - - /* - * Requests, that are waiting for responses - * RequestInfoSet provides correct processing of requests with thre same - * app_id and corr_id - */ - RequestInfoSet waiting_for_response_; - - /** - * @brief Set of HMI notifications with timeout. - */ - std::list<RequestPtr> notification_list_; - - /* - * timer for checking requests timeout - */ - timer::TimerThread<RequestController> timer_; - static const uint32_t dafault_sleep_time_ = UINT_MAX; - - bool is_low_voltage_; - DISALLOW_COPY_AND_ASSIGN(RequestController); + public: + /** + * @brief Result code for addRequest + */ + enum TResult { + SUCCESS = 0, + TOO_MANY_REQUESTS, + TOO_MANY_PENDING_REQUESTS, + NONE_HMI_LEVEL_MANY_REQUESTS, + INVALID_DATA + }; + + /** + * @brief Thread pool state + */ + enum TPoolState { + UNDEFINED = 0, + STARTED, + STOPPED, + }; + + // Methods + + /** + * @brief Class constructor + * + */ + RequestController(const RequestControlerSettings& settings); + + /** + * @brief Class destructor + * + */ + virtual ~RequestController(); + + /** + * @brief Initialize thread pool + * + */ + void InitializeThreadpool(); + + /** + * @brief Destroy thread pool + * + */ + void DestroyThreadpool(); + + /** + * @brief Check if max request amount wasn't exceed and adds request to queue. + * + * @param request Active mobile request + * @param hmi_level Current application hmi_level + * + * @return Result code + * + */ + TResult addMobileRequest(const RequestPtr request, + const mobile_apis::HMILevel::eType& hmi_level); + + /** + * @brief Store HMI request until response or timeout won't remove it + * + * @param request Active hmi request + * @return Result code + * + */ + TResult addHMIRequest(const RequestPtr request); + + /** + * @ Add notification to collection + * + * @param ptr Reference to shared pointer that point on hmi notification + */ + void addNotification(const RequestPtr ptr); + + /** + * @brief Removes request from queue + * + * @param correlation_id Active request correlation ID, + * @param connection_key Active request connection key (0 for HMI requersts) + * @param force_terminate if true, request controller will terminate + * even if not allowed by request + */ + void terminateRequest(const uint32_t& correlation_id, + const uint32_t& connection_key, + bool force_terminate = false); + + /** + * @brief Removes request from queue + * + * @param mobile_correlation_id Active mobile request correlation ID + * + */ + void OnMobileResponse(const uint32_t& mobile_correlation_id, + const uint32_t& connection_key); + + /** + * @brief Removes request from queue + * + * @param mobile_correlation_id Active mobile request correlation ID + * + */ + void OnHMIResponse(const uint32_t& correlation_id); + + /** + * @ Add notification to collection + * + * @param ptr Reference to shared pointer that point on hmi notification + */ + void removeNotification(const commands::Command* notification); + + /** + * @brief Removes all requests from queue for specified application + * + * @param app_id Mobile application ID (app_id) + * + */ + void terminateAppRequests(const uint32_t& app_id); + + /** + * @brief Terminates all requests from HMI + */ + void terminateAllHMIRequests(); + + /** + * @brief Terminates all requests from Mobile + */ + void terminateAllMobileRequests(); + + /** + * @brief Updates request timeout + * + * @param app_id Connection key of application + * @param mobile_correlation_id Correlation ID of the mobile request + * @param new_timeout_value New timeout to be set in milliseconds + */ + void updateRequestTimeout(const uint32_t& app_id, + const uint32_t& mobile_correlation_id, + const uint32_t& new_timeout); + + /* + * @brief Function Should be called when Low Voltage is occured + */ + void OnLowVoltage(); + + /* + * @brief Function Should be called when Low Voltage is occured + */ + void OnWakeUp(); + + bool IsLowVoltage(); + + protected: + /** + * @brief Timer Callback + */ + void onTimer(); + + /** + * @brief Update timout for next OnTimer + * Not thread safe + */ + void UpdateTimer(); + + void terminateWaitingForExecutionAppRequests(const uint32_t& app_id); + void terminateWaitingForResponseAppRequests(const uint32_t& app_id); + + /** + * @brief Check Posibility to add new requests, or limits was exceeded + * @param request - request to check possipility to Add + * @return True if new request could be added, false otherwise + */ + TResult CheckPosibilitytoAdd(const RequestPtr request); + + /** + * @brief Check Posibility to add new requests, or limits was exceeded + * @param pending_requests_amount - maximum count of request that should be + * allowed for all applications + * @return True if new request could be added, false otherwise + */ + bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount); + + private: + class Worker : public threads::ThreadDelegate { + public: + explicit Worker(RequestController* requestController); + virtual ~Worker(); + virtual void threadMain(); + virtual void exitThreadMain(); + + protected: + private: + RequestController* request_controller_; + sync_primitives::Lock thread_lock_; + volatile bool stop_flag_; + }; + + std::vector<threads::Thread*> pool_; + volatile TPoolState pool_state_; + uint32_t pool_size_; + sync_primitives::ConditionalVariable cond_var_; + + std::list<RequestPtr> mobile_request_list_; + sync_primitives::Lock mobile_request_list_lock_; + + /* + * Requests, that are waiting for responses + * RequestInfoSet provides correct processing of requests with thre same + * app_id and corr_id + */ + RequestInfoSet waiting_for_response_; + + /** + * @brief Set of HMI notifications with timeout. + */ + std::list<RequestPtr> notification_list_; + + /* + * timer for checking requests timeout + */ + timer::Timer timer_; + + bool is_low_voltage_; + const RequestControlerSettings& settings_; + DISALLOW_COPY_AND_ASSIGN(RequestController); }; } // namespace request_controller diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index 3b48d78d48..193699be78 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -48,333 +48,327 @@ namespace application_manager { namespace request_controller { +/* + * @brief Typedef for active mobile request + * + */ +typedef utils::SharedPtr<commands::Command> RequestPtr; + +struct RequestInfo { + enum RequestType { MobileRequest, HMIRequest }; + + RequestInfo() {} + virtual ~RequestInfo() {} + + RequestInfo(RequestPtr request, + const RequestType requst_type, + const uint64_t timeout_msec) + : request_(request) + , timeout_msec_(timeout_msec) + , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) { + start_time_ = date_time::DateTime::getCurrentTime(); + updateEndTime(); + requst_type_ = requst_type; + } + + RequestInfo(RequestPtr request, + const RequestType requst_type, + const TimevalStruct& start_time, + const uint64_t timeout_msec); + + void updateEndTime(); + + void updateTimeOut(const uint64_t& timeout_msec); + + bool isExpired(); + + TimevalStruct start_time() { + return start_time_; + } + + void update_start_time(TimevalStruct start_time) { + start_time_ = start_time; + } + + uint64_t timeout_msec() { + return timeout_msec_; + } + + void set_timeout_msec(uint64_t timeout) { + timeout_msec_ = timeout; + } + + TimevalStruct end_time() { + return end_time_; + } + + uint32_t app_id() { + return app_id_; + } + + mobile_apis::HMILevel::eType hmi_level() { + return hmi_level_; + } + + void set_hmi_level(const mobile_apis::HMILevel::eType& level) { + hmi_level_ = level; + } + + RequestType requst_type() const { + return requst_type_; + } + + uint32_t requestId() { + return correlation_id_; + } + + commands::Command* request() { + return request_.get(); + } + uint64_t hash(); + static uint64_t GenerateHash(uint32_t var1, uint32_t var2); + static uint32_t HmiConnectoinKey; + + protected: + RequestPtr request_; + TimevalStruct start_time_; + uint64_t timeout_msec_; + TimevalStruct end_time_; + uint32_t app_id_; + mobile_apis::HMILevel::eType hmi_level_; + RequestType requst_type_; + uint32_t correlation_id_; +}; + +typedef utils::SharedPtr<RequestInfo> RequestInfoPtr; + +struct MobileRequestInfo : public RequestInfo { + MobileRequestInfo(RequestPtr request, const uint64_t timeout_msec); + MobileRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_msec); +}; + +struct HMIRequestInfo : public RequestInfo { + HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec); + HMIRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_msec); +}; + +// Request info, for searching in request info set by log_n time +// Returns correct hash by app_id and corr_id +struct FakeRequestInfo : public RequestInfo { + FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id); +}; + +struct RequestInfoTimeComparator { + bool operator()(const RequestInfoPtr lhs, const RequestInfoPtr rhs) const; +}; + +struct RequestInfoHashComparator { + bool operator()(const RequestInfoPtr lhs, const RequestInfoPtr rhs) const; +}; + +typedef std::set<RequestInfoPtr, RequestInfoTimeComparator> + TimeSortedRequestInfoSet; +typedef std::set<RequestInfoPtr, RequestInfoHashComparator> + HashSortedRequestInfoSet; + +/* + * @brief RequestInfoSet provides uniue requests bu corralation_id and app_id + * + */ +class RequestInfoSet { + public: /* - * @brief Typedef for active mobile request - * + * @brief Add requests into colletion by log(n) time + * @param request_info - request to add + * @return false is request with the same app_id and correlation_id exist */ - typedef utils::SharedPtr<commands::Command> RequestPtr; + bool Add(RequestInfoPtr request_info); - struct RequestInfo { - enum RequestType {MobileRequest, HMIRequest}; + /* + * @brief Find requests int colletion by log(n) time + * @param connection_key - connection_key of request + * @param correlation_id - correlation_id of request + * @return founded request or shared_ptr with NULL + */ + RequestInfoPtr Find(const uint32_t connection_key, + const uint32_t correlation_id); - RequestInfo() {} - virtual ~RequestInfo() {} + /* + * @brief Get request with smalest end_time_ + * @return founded request or shared_ptr with NULL + */ + RequestInfoPtr Front(); - RequestInfo(RequestPtr request, - const RequestType requst_type, - const uint64_t timeout_sec) - : request_(request), - timeout_sec_(timeout_sec) { - start_time_ = date_time::DateTime::getCurrentTime(); - updateEndTime(); - requst_type_ = requst_type; - } + /* + * @brief Get request with smalest end_time_ != 0 + * @return founded request or shared_ptr with NULL + */ + RequestInfoPtr FrontWithNotNullTimeout(); - RequestInfo(RequestPtr request, const RequestType requst_type, - const TimevalStruct& start_time, const uint64_t timeout_sec); + /* + * @brief Erase request from colletion by log(n) time + * @param request_info - request to erase + * @return true if Erase succes, otherwise return false + */ + bool RemoveRequest(const RequestInfoPtr request_info); - void updateEndTime(); + /* + * @brief Erase request from colletion by connection_key + * @param connection_key - connection_key of requests to erase + * @return count of erased requests + */ + uint32_t RemoveByConnectionKey(uint32_t connection_key); - void updateTimeOut(const uint64_t& timeout_sec); + /* + * @brief Erase all mobile requests from controller + * @return count of erased requests + */ + uint32_t RemoveMobileRequests(); - bool isExpired(); + /* + * @return count of requestd in collections + */ + const size_t Size(); - TimevalStruct start_time() { - return start_time_; - } + /** + * @brief Check if this app is able to add new requests, + * or limits was exceeded + * @param app_id - application id + * @param app_time_scale - time scale (seconds) + * @param max_request_per_time_scale - maximum count of request + * that should be allowed for app_time_scale seconds + * @return True if new request could be added, false otherwise + */ + bool CheckTimeScaleMaxRequest(uint32_t app_id, + uint32_t app_time_scale, + uint32_t max_request_per_time_scale); - void update_start_time(TimevalStruct start_time) { - start_time_ = start_time; - } + /** + * @brief Check if this app is able to add new requests + * in current hmi_level, or limits was exceeded + * @param hmi_level - hmi level + * @param app_id - application id + * @param app_time_scale - time scale (seconds) + * @param max_request_per_time_scale - maximum count of request + * that should be allowed for app_time_scale seconds + * @return True if new request could be added, false otherwise + */ + bool CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level, + uint32_t app_id, + uint32_t app_time_scale, + uint32_t max_request_per_time_scale); - uint64_t timeout_sec() { - return timeout_sec_; - } + private: + /* + * @brief Comparator of connection key for std::find_if function + */ + struct AppIdCompararator { + enum CompareType { Equal, NotEqual }; + AppIdCompararator(CompareType compare_type, uint32_t app_id) + : app_id_(app_id), compare_type_(compare_type) {} + bool operator()(const RequestInfoPtr value_compare) const; + + private: + uint32_t app_id_; + CompareType compare_type_; + }; - void set_timeout_sec(uint64_t timeout) { - timeout_sec_ = timeout; - } + bool Erase(const RequestInfoPtr request_info); - TimevalStruct end_time() { - return end_time_; - } + /* + * @brief Erase requests from collection if filter allows + * @param filter - filtering predicate + * @return count of erased requests + */ + uint32_t RemoveRequests(const RequestInfoSet::AppIdCompararator& filter); - uint32_t app_id() { - return app_id_; - } + /* + * @brief Debug function, will raise assert if set sizes are noit equal + */ + inline void CheckSetSizes(); + TimeSortedRequestInfoSet time_sorted_pending_requests_; + HashSortedRequestInfoSet hash_sorted_pending_requests_; - mobile_apis::HMILevel::eType hmi_level() { - return hmi_level_; - } + // the lock caled this_lock_, since the class represent collection by itself. + sync_primitives::Lock this_lock_; +}; - void set_hmi_level(const mobile_apis::HMILevel::eType& level) { - hmi_level_ = level; +/** +* @brief Structure used in std algorithms to determine amount of request +* during time scale +*/ +struct TimeScale { + TimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id) + : start_(start), end_(end), app_id_(app_id) {} + + bool operator()(RequestInfoPtr setEntry) { + if (!setEntry.valid()) { + return false; } - RequestType requst_type() const { - return requst_type_; - } - - uint32_t requestId() { - return correlation_id_; + if (setEntry->app_id() != app_id_) { + return false; } - commands::Command* request() { - return request_.get(); + if ((setEntry->start_time() < start_) || (end_ < setEntry->start_time())) { + return false; } - uint64_t hash(); - static uint64_t GenerateHash(uint32_t var1, uint32_t var2); - static uint32_t HmiConnectoinKey; - protected: - RequestPtr request_; - TimevalStruct start_time_; - uint64_t timeout_sec_; - TimevalStruct end_time_; - uint32_t app_id_; - mobile_apis::HMILevel::eType hmi_level_; - RequestType requst_type_; - uint32_t correlation_id_; - }; - typedef utils::SharedPtr<RequestInfo> RequestInfoPtr; + return true; + } - struct MobileRequestInfo: public RequestInfo { - MobileRequestInfo(RequestPtr request, - const uint64_t timeout_sec); - MobileRequestInfo(RequestPtr request, - const TimevalStruct& start_time, - const uint64_t timeout_sec); - }; - - struct HMIRequestInfo: public RequestInfo { - HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec); - HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time, - const uint64_t timeout_sec); - }; - - // Request info, for searching in request info set by log_n time - // Returns correct hash by app_id and corr_id - struct FakeRequestInfo :public RequestInfo { - FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id); - }; - - struct RequestInfoTimeComparator { - bool operator() (const RequestInfoPtr lhs, - const RequestInfoPtr rhs) const; - }; - - struct RequestInfoHashComparator { - bool operator() (const RequestInfoPtr lhs, - const RequestInfoPtr rhs) const; - }; - - - typedef std::set<RequestInfoPtr, RequestInfoTimeComparator> TimeSortedRequestInfoSet; - typedef std::set<RequestInfoPtr, RequestInfoHashComparator> HashSortedRequestInfoSet; - - /* - * @brief RequestInfoSet provides uniue requests bu corralation_id and app_id - * - */ - class RequestInfoSet { - public: - /* - * @brief Add requests into colletion by log(n) time - * @param request_info - request to add - * @return false is request with the same app_id and correlation_id exist - */ - bool Add(RequestInfoPtr request_info); - - /* - * @brief Find requests int colletion by log(n) time - * @param connection_key - connection_key of request - * @param correlation_id - correlation_id of request - * @return founded request or shared_ptr with NULL - */ - RequestInfoPtr Find(const uint32_t connection_key, - const uint32_t correlation_id); - - /* - * @brief Get request with smalest end_time_ - * @return founded request or shared_ptr with NULL - */ - RequestInfoPtr Front(); - - /* - * @brief Get request with smalest end_time_ != 0 - * @return founded request or shared_ptr with NULL - */ - RequestInfoPtr FrontWithNotNullTimeout(); - - /* - * @brief Erase request from colletion by log(n) time - * @param request_info - request to erase - * @return true if Erase succes, otherwise return false - */ - bool RemoveRequest(const RequestInfoPtr request_info); - - /* - * @brief Erase request from colletion by connection_key - * @param connection_key - connection_key of requests to erase - * @return count of erased requests - */ - uint32_t RemoveByConnectionKey(uint32_t connection_key); - - /* - * @brief Erase all mobile requests from controller - * @return count of erased requests - */ - uint32_t RemoveMobileRequests(); - - /* - * @return count of requestd in collections - */ - const size_t Size(); - - /** - * @brief Check if this app is able to add new requests, - * or limits was exceeded - * @param app_id - application id - * @param app_time_scale - time scale (seconds) - * @param max_request_per_time_scale - maximum count of request - * that should be allowed for app_time_scale seconds - * @return True if new request could be added, false otherwise - */ - bool CheckTimeScaleMaxRequest(uint32_t app_id, - uint32_t app_time_scale, - uint32_t max_request_per_time_scale); - - /** - * @brief Check if this app is able to add new requests - * in current hmi_level, or limits was exceeded - * @param hmi_level - hmi level - * @param app_id - application id - * @param app_time_scale - time scale (seconds) - * @param max_request_per_time_scale - maximum count of request - * that should be allowed for app_time_scale seconds - * @return True if new request could be added, false otherwise - */ - bool CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level, - uint32_t app_id, - uint32_t app_time_scale, - uint32_t max_request_per_time_scale); - private: - /* - * @brief Comparator of connection key for std::find_if function - */ - struct AppIdCompararator { - enum CompareType {Equal, NotEqual}; - AppIdCompararator(CompareType compare_type, uint32_t app_id): - app_id_(app_id), - compare_type_(compare_type) {} - bool operator()(const RequestInfoPtr value_compare) const; - - private: - uint32_t app_id_; - CompareType compare_type_; - }; - - bool Erase(const RequestInfoPtr request_info); - - /* - * @brief Erase requests from collection if filter allows - * @param filter - filtering predicate - * @return count of erased requests - */ - uint32_t RemoveRequests(const RequestInfoSet::AppIdCompararator& filter); - - /* - * @brief Debug function, will raise assert if set sizes are noit equal - */ - inline void CheckSetSizes(); - TimeSortedRequestInfoSet time_sorted_pending_requests_; - HashSortedRequestInfoSet hash_sorted_pending_requests_; - - // the lock caled this_lock_, since the class represent collection by itself. - sync_primitives::Lock this_lock_; - }; + private: + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; +}; +/** +* @brief Structure used in std algorithms to determine amount of request +* during time scale for application in defined hmi level +*/ +struct HMILevelTimeScale { + HMILevelTimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id, + const mobile_apis::HMILevel::eType& hmi_level) + : start_(start), end_(end), app_id_(app_id), hmi_level_(hmi_level) {} + + bool operator()(RequestInfoPtr setEntry) { + if (!setEntry.valid()) { + return false; + } - /** - * @brief Structure used in std algorithms to determine amount of request - * during time scale - */ - struct TimeScale { - TimeScale(const TimevalStruct& start, - const TimevalStruct& end, - const uint32_t& app_id) - : start_(start), - end_(end), - app_id_(app_id) {} - - bool operator()(RequestInfoPtr setEntry) { - if (!setEntry.valid()) { - return false; - } - - if (setEntry->app_id() != app_id_) { - return false; - } - - if (date_time::DateTime::getmSecs(setEntry->start_time()) - < date_time::DateTime::getmSecs(start_) || - date_time::DateTime::getmSecs(setEntry->start_time()) - > date_time::DateTime::getmSecs(end_)) { - return false; - } - - return true; + if (setEntry->app_id() != app_id_) { + return false; } - private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; - }; + if (setEntry->hmi_level() != hmi_level_) { + return false; + } - /** - * @brief Structure used in std algorithms to determine amount of request - * during time scale for application in defined hmi level - */ - struct HMILevelTimeScale { - HMILevelTimeScale(const TimevalStruct& start, - const TimevalStruct& end, - const uint32_t& app_id, - const mobile_apis::HMILevel::eType& hmi_level) - : start_(start), - end_(end), - app_id_(app_id), - hmi_level_(hmi_level) {} - - bool operator()(RequestInfoPtr setEntry) { - if (!setEntry.valid()) { - return false; - } - - if (setEntry->app_id() != app_id_) { - return false; - } - - if (setEntry->hmi_level() != hmi_level_) { - return false; - } - - if (date_time::DateTime::getSecs(setEntry->start_time()) - < date_time::DateTime::getSecs(start_) || - date_time::DateTime::getSecs(setEntry->start_time()) - > date_time::DateTime::getSecs(end_)) { - return false; - } - - return true; + if (date_time::DateTime::getSecs(setEntry->start_time()) < + date_time::DateTime::getSecs(start_) || + date_time::DateTime::getSecs(setEntry->start_time()) > + date_time::DateTime::getSecs(end_)) { + return false; } - private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; - mobile_apis::HMILevel::eType hmi_level_; - }; + return true; + } + + private: + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; + mobile_apis::HMILevel::eType hmi_level_; +}; } // namespace request_controller diff --git a/src/components/application_manager/include/application_manager/resume_ctrl.h b/src/components/application_manager/include/application_manager/resume_ctrl.h deleted file mode 100644 index 4d90316365..0000000000 --- a/src/components/application_manager/include/application_manager/resume_ctrl.h +++ /dev/null @@ -1,525 +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. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H - -#include <stdint.h> -#include <vector> -#include <map> -#include <set> -#include <list> - -#include "json/json.h" -#include "interfaces/HMI_API.h" -#include "interfaces/HMI_API_schema.h" -#include "interfaces/MOBILE_API_schema.h" -#include "connection_handler/connection_handler_observer.h" -#include "connection_handler/device.h" -#include "application_manager/event_engine/event_observer.h" -#include "smart_objects/smart_object.h" -#include "application_manager/application.h" -#include "utils/timer_thread.h" - -namespace application_manager { - -namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; - -class ApplicationManagerImpl; -class Application; -class ResumeCtrl: public event_engine::EventObserver { - - public: - - /** - * @brief Constructor - * @param app_mngr ApplicationManager pointer - */ - explicit ResumeCtrl(ApplicationManagerImpl* app_mngr); - - /** - * @brief Event, that raised if application get resumption response from HMI - * @param event : event object, that contains smart_object with HMI message - */ - virtual void on_event(const event_engine::Event& event); - - /** - * @brief Save all applications info to the file system - */ - void SaveAllApplications(); - - /** - * @brief Save application persistent info for future resuming - * @param application is application witch need to be saved - */ - void SaveApplication(ApplicationConstSharedPtr application); - - /** - * @brief Set application HMI Level as saved - * @param application is application witch HMI Level is need to restore - * @return true if success, otherwise return false - */ - bool RestoreAppHMIState(ApplicationSharedPtr application); - - /** - * @brief Set application HMI Level as stored in policy - * @param application is application witch HMI Level is need to setup - * @return true if success, otherwise return false - */ - bool SetupDefaultHMILevel(ApplicationSharedPtr application); - - /** - * @brief Setup HmiLevel for application - * Do routine of setting up hmi_level - * @param application is application witch HMI Level is need to setup - * @param hmi_level HMI Level is needed to setup - * @param hmi_level AudioStreamingState is needed to setup - * @param check_policy indicate if policy data consent must be verified - * @return true if success, otherwise return false - */ - bool SetAppHMIState(ApplicationSharedPtr application, - const mobile_apis::HMILevel::eType hmi_level, - bool check_policy = true); - - /** - * @brief Set application HMI Level as saved - * @param application is application witch HMI Level is need to restore - * @return true if success, otherwise return false - */ - bool RestoreApplicationData(ApplicationSharedPtr application); - - /** - * @brief Check if Resume controller have saved instance of application - * @param application is application witch need to be checked - * @return true if exist, false otherwise - */ - bool ApplicationIsSaved(ApplicationConstSharedPtr application); - - /** - * @brief Remove application from list of saved applications - * @param mobile_app_id application witch need to be removed - * @return return true, if success, otherwise return false - */ - bool RemoveApplicationFromSaved(const std::string& mobile_app_id); - - /** - * @brief Increments ignition counter for all registered applications - * and remember ign_off time stamp - */ - void Suspend(); - - /** - * @brief Increments ignition counter for all registered applications - * and remember ign_off time stamp - */ - void OnAwake(); - - /** - * @brief Method starts timer "RsmCtrlPercist" when SDL receives onAwakeSDL notification - */ - void StartSavePersistentDataTimer(); - - /** - * @brief Method stops timer "RsmCtrlPercist" when SDL receives OnExitAllApplication notification - * with reason "SUSPEND" - */ - void StopSavePersistentDataTimer(); - - /** - * @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in Suspend() - */ - void StopRestoreHmiLevelTimer(); - - /** - * @brief Start timer for resumption applications - * Restore D1-D5 data - * @param application that is need to be restored - * @return true if it was saved, otherwise return false - */ - bool StartResumption(ApplicationSharedPtr application, const std::string& hash); - - /** - * @brief Start timer for resumption applications - * Does not restore D1-D5 data - * @param application that is need to be restored - * @return true if it was saved, otherwise return false - */ - bool StartResumptionOnlyHMILevel(ApplicationSharedPtr application); - - /** - * @brief Check if there are all files need for resumption - * @param application that is need to be restored - * @return true if it all files exist, otherwise return false - */ - bool CheckPersistenceFilesForResumption(ApplicationSharedPtr application); - - /** - * @brief Check application hash - * @param application that is need to be restored - * @return true if it was saved, otherwise return false - */ - bool CheckApplicationHash(ApplicationSharedPtr application, const std::string& hash); - - /** - * @brief Check if Resume controller have saved application with hmi app id - * @param hmi_app_id - hmi application id - * @return true if exist, false otherwise - */ - bool IsHMIApplicationIdExist(uint32_t hmi_app_id); - - /** - * @brief Check if Resume controller have saved instance of application - * @param mobile_app_id - mobile application id - * @return true if exist, false otherwise - */ - bool IsApplicationSaved(const std::string& mobile_app_id); - - /** - * @brief Function is used for application resume. HMI app ID must be - * the same(PASA VCA module use it for stored app info). - * Retrieves HMI app ID for the given mobile app ID from stored information. - * - * @param mobile_app_id - mobile application id - * @return HMI app ID - */ - uint32_t GetHMIApplicationID(const std::string& mobile_app_id); - - /** - * @brief SaveDataOnTimer : - * Timer callback for persisting ResumptionData each N seconds - * N gets from property - */ - void SaveDataOnTimer(); - - void ClearResumptionInfo(); - - void ApplicationsDataUpdated() { - is_data_saved = false; - } - - /** - * @brief Resume HMI Level and audio streaming state if needed - * @param application - application to restore hmi level - * and audio streaming state - */ - void StartAppHmiStateResumption(ApplicationSharedPtr application); - /** - * @brief Update launch_time_ to current - */ - void ResetLaunchTime(); - - private: - - - typedef std::pair<uint32_t, uint32_t> application_timestamp; - - std::set<ApplicationSharedPtr> retrieve_application(); - - /** - * @brief This struct need to map - * timestamp and application from correlationID - */ - struct ResumingApp { - uint32_t old_session_key; // session key is the same as app_id - ApplicationSharedPtr app; - }; - - struct TimeStampComparator { - bool operator() (const application_timestamp& lhs, - const application_timestamp& rhs) const{ - return lhs.second < rhs.second; - } - }; - - /** - * @brief geter for launch_time_ - * @return value of launch_time_ - */ - time_t launch_time() const; - - /** - * @brief Check device MAC address - * - * @param application that is need to be restored - * @param saved_device_mac Saved device MAC address - * - * @return TRUE on success, otherwise FALSE - */ - bool IsDeviceMacAddressEqual(ApplicationSharedPtr application, - const std::string& saved_device_mac); - /** - * @brief Get Resumption section of LastState - * @return Resumption section of LastState in Json - */ - Json::Value& GetResumptionData(); - - /** - * @brief Get applications for resumption of LastState - * @return applications for resumption of LastState - */ - Json::Value& GetSavedApplications(); - - /** - * @brief Get the last ignition off time from LastState - * @return the last ignition off time from LastState - */ - time_t GetIgnOffTime(); - - /** - * @brief Setup IgnOff time to LastState - * @param ign_off_time - igition off time - */ - void SetLastIgnOffTime(time_t ign_off_time); - - /** - * @brief Set applications for resumption to LastState - * @parems apps_json applications to write in LastState - */ - void SetSavedApplication(Json::Value& apps_json); - - Json::Value GetApplicationCommands( - ApplicationConstSharedPtr application); - Json::Value GetApplicationSubMenus( - ApplicationConstSharedPtr application); - Json::Value GetApplicationInteractionChoiseSets( - ApplicationConstSharedPtr application); - Json::Value GetApplicationGlobalProperties( - ApplicationConstSharedPtr application); - Json::Value GetApplicationSubscriptions( - ApplicationConstSharedPtr application); - Json::Value GetApplicationFiles( - ApplicationConstSharedPtr application); - Json::Value GetApplicationShow( - ApplicationConstSharedPtr application); - - Json::Value JsonFromSO(const smart_objects::SmartObject *so); - - uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params = NULL, - bool use_events = false); - - bool ProcessHMIRequest( - smart_objects::SmartObjectSPtr request = NULL, - bool use_events = false); - - void InsertToTimerQueue(uint32_t app_id, uint32_t time_stamp); - - /** - * @brief AddFiles allows to add files for the application - * which should be resumed - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void AddFiles(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief AddSubmenues allows to add sub menues for the application - * which should be resumed - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void AddSubmenues(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief AddCommands allows to add commands for the application - * which should be resumed - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void AddCommands(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief AddChoicesets allows to add choice sets for the application - * which should be resumed - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void AddChoicesets(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief SetGlobalProperties allows to restore global properties. - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void SetGlobalProperties(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief AddSubscriptions allows to restore subscriptions - * - * @param application application which will be resumed - * - * @param saved_app application specific section from backup file - */ - void AddSubscriptions(ApplicationSharedPtr application, const Json::Value& saved_app); - - /** - * @brief ProcessHMIRequests allows to process obtained requests. - * - * @param requests request that should be processed. - */ - void ProcessHMIRequests(const smart_objects::SmartObjectList& requests); - - /** - * @brief CheckIcons allows to check application icons - * - * @param application application under resumtion application - * - * @param json_object - * - * @return true in case icons exists, false otherwise - */ - bool CheckIcons(ApplicationSharedPtr application, const Json::Value& json_object); - - /** - * @brief GetFromSavedOrAppend allows to get existed record about application - * or adds the new one. - * - * @param mobile_app_id application id. - * - * @return the reference to the record in applications array. - */ - Json::Value& GetFromSavedOrAppend(const std::string& mobile_app_id); - - /** - * @brief CheckIgnCycleRestrictions checks if is needed to resume HMI state - * by ign cycle restrictions - * @param json_app - saved application - * @return true if resumptions allowed, otherwise return false - */ - bool CheckIgnCycleRestrictions(const Json::Value& json_app); - - /** - * @brief DisconnectedInLastIgnCycle should check if was connected in prev ign cycle - * @param json_app - saved applicationa - * @return true if app connected in frep ign_cycle otherwise return false - */ - bool DisconnectedInLastIgnCycle(const Json::Value& json_app); - - /** - * @brief DisconnectedJustBeforeIgnOff should check if application - * was dissconnected in N secconds delay before ign off. - * N will be readed from profile - * @param json_app - saved applicationa - * @return was dissconnected in N secconds delay before ign off - * otherwise return false - */ - bool DisconnectedJustBeforeIgnOff(const Json::Value& json_app); - - /** - * @brief CheckDelayAfterIgnOn should check if SDL was started less - * then N secconds ago. N will be readed from profile. - * @return true if SDL started N secconds ago, otherwise return false - */ - bool CheckDelayAfterIgnOn(); - - /** - * @brief CheckAppRestrictions checks if is needed to resume HMI state - * by application type and saved app_level - * @param json_app - saved application - * @return true if resumptions allowed, otherwise return false - */ - bool CheckAppRestrictions(ApplicationSharedPtr application, - const Json::Value& json_app); - /** - * @brief GetObjectIndex allows to obtain specified obbject index from - * applications arrays. - * - * @param mobile_app_id application id that should be found. - * - * @return application's index of or -1 if it doesn't exists - */ - int GetObjectIndex(const std::string& mobile_app_id); - - /** - * @brief Timer callback for restoring HMI Level - * - */ - void ApplicationResumptiOnTimer(); - - /* - * @brief Loads data on start up - */ - void LoadResumeData(); - - /* - * @brief Return true if application resumption data is valid, - * otherwise false - * - * @param index application index in the resumption list - */ - bool IsResumptionDataValid(uint32_t index); - - template<typename Iterator> - Json::Value Append(Iterator first, - Iterator last, - const std::string& key, - Json::Value& result) { - while (first != last) { - result[key].append(*first); - ++first; - } - return result; - } - - /** - * @brief times of IGN_OFF that zombie application have to be saved. - */ - static const uint32_t kApplicationLifes = 3; - - /** - *@brief Mapping applications to time_stamps - * wait for timer to resume HMI Level - * - */ - mutable sync_primitives::Lock queue_lock_; - sync_primitives::Lock resumtion_lock_; - ApplicationManagerImpl* app_mngr_; - timer::TimerThread<ResumeCtrl> save_persistent_data_timer_; - timer::TimerThread<ResumeCtrl> restore_hmi_level_timer_; - std::vector<uint32_t> waiting_for_timer_; - bool is_resumption_active_; - bool is_data_saved; - time_t launch_time_; -}; - -} // namespace application_manager -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h new file mode 100644 index 0000000000..853f91ff23 --- /dev/null +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -0,0 +1,506 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H + +#include <stdint.h> +#include <vector> +#include <map> +#include <set> +#include <list> + +#include "interfaces/HMI_API.h" +#include "interfaces/HMI_API_schema.h" +#include "interfaces/MOBILE_API_schema.h" +#include "application_manager/event_engine/event_observer.h" +#include "smart_objects/smart_object.h" +#include "application_manager/application.h" +#include "application_manager/resumption/resumption_data.h" +#include "utils/timer.h" + +namespace application_manager { +class ApplicationManager; +class Application; +} + +namespace resumption { + +class LastState; + +/** + * @brief Contains logic for storage/restore data of applications. + */ + +class ResumeCtrl : public application_manager::event_engine::EventObserver { + public: + /** + * @brief allows to create ResumeCtrl object + */ + ResumeCtrl(application_manager::ApplicationManager& application_manager); + + /** + * @brief allows to destroy ResumeCtrl object + */ + ~ResumeCtrl(); + + /** + * @brief Event, that raised if application get resumption response from HMI + * @param event : event object, that contains smart_object with HMI message + */ + virtual void on_event(const application_manager::event_engine::Event& event); + + /** + * @brief Save all applications info to the file system + */ + void SaveAllApplications(); + + /** + * @brief Save application persistent info for future resuming + * @param application is application witch need to be saved + */ + void SaveApplication(application_manager::ApplicationSharedPtr application); + + /** + * @brief Set application HMI Level and ausio_state as saved + * @param application is application witch HMI Level is need to restore + * @return true if success, otherwise return false + */ + bool RestoreAppHMIState( + application_manager::ApplicationSharedPtr application); + + /** + * @brief Set application HMI Level as stored in policy + * @param application is application witch HMI Level is need to setup + * @return true if success, otherwise return false + */ + bool SetupDefaultHMILevel( + application_manager::ApplicationSharedPtr application); + + /** + * @brief Setup HmiLevel for application + * Do routine of setting up hmi_level + * @param application is application witch HMI Level is need to setup + * @param hmi_level HMI Level is needed to setup + * @param hmi_level AudioStreamingState is needed to setup + * @param check_policy indicate if policy data consent must be verified + * @return true if success, otherwise return false + */ + bool SetAppHMIState(application_manager::ApplicationSharedPtr application, + const mobile_apis::HMILevel::eType hmi_level, + bool check_policy = true); + + /** + * @brief Check if Resume controller have saved instance of application + * @param application is application witch need to be checked + * @return true if exist, false otherwise + */ + bool ApplicationIsSaved( + application_manager::ApplicationConstSharedPtr application); + + /** + * @brief Remove application from list of saved applications + * @param application is application which need to be removed + * @return return true, if success, otherwise return false + */ + bool RemoveApplicationFromSaved( + application_manager::ApplicationConstSharedPtr application); + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + void OnSuspend(); + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + void OnAwake(); + + /** + * @brief Method starts timer "RsmCtrlPercist" when + * SDL receives onAwakeSDL notification + */ + void StartSavePersistentDataTimer(); + + /** + * @brief Method stops timer "RsmCtrlPercist" when SDL + * receives OnExitAllApplication notification + * with reason "SUSPEND" + */ + void StopSavePersistentDataTimer(); + + /** + * @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in OnSuspend() + */ + void StopRestoreHmiLevelTimer(); + + /** + * @brief Start timer for resumption applications + * Restore D1-D5 data + * @param application that is need to be restored + * @return true if it was saved, otherwise return false + */ + bool StartResumption(application_manager::ApplicationSharedPtr application, + const std::string& hash); + + /** + * @brief Start timer for resumption applications + * Does not restore D1-D5 data + * @param application that is need to be restored + * @return true if it was saved, otherwise return false + */ + bool StartResumptionOnlyHMILevel( + application_manager::ApplicationSharedPtr application); + + /** + * @brief Check if there are all files need for resumption + * @param application that is need to be restored + * @return true if it all files exist, otherwise return false + */ + bool CheckPersistenceFilesForResumption( + application_manager::ApplicationSharedPtr application); + + /** + * @brief Check application hash + * @param application that is need to be restored + * @return true if it was saved, otherwise return false + */ + bool CheckApplicationHash( + application_manager::ApplicationSharedPtr application, + const std::string& hash); + + /** + * @brief Checks if Resume controller have saved application with hmi app id + * @param hmi_app_id - hmi application id + * @return true if exist, false otherwise + */ + bool IsHMIApplicationIdExist(uint32_t hmi_app_id); + + /** + * @brief Check if Resume controller have saved instance of application + * @param policy_app_id - mobile application id + * @param device_id - id of device where application is run + * @return true if exist, false otherwise + */ + bool IsApplicationSaved(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Function is used for application resume. HMI app ID must be + * the same(PASA VCA module use it for stored app info). + * Retrieves HMI app ID for the given policy app ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - id of device where application is run + * @return HMI app ID + */ + uint32_t GetHMIApplicationID(const std::string& policy_app_id, + const std::string& device_id) const; + /** + * @brief SaveDataOnTimer : + * Timer callback for persisting ResumptionData each N seconds + * N gets from property + */ + void SaveDataOnTimer(); + + /** + * @brief Updates flag for saving application data + */ + void ApplicationsDataUpdated() { + is_data_saved_ = false; + } + + /** + * @brief Resume HMI Level and audio streaming state if needed + * @param application - application to restore hmi level + * and audio streaming state + */ + void StartAppHmiStateResumption( + application_manager::ApplicationSharedPtr application); + + /** + * @brief Update launch_time_ to current + */ + void ResetLaunchTime(); + + /** + * @brief Timer callback for restoring HMI Level + * + */ + void ApplicationResumptiOnTimer(); + + /** + * @brief Removes activated application from resumption list + * + * @param application application witch need to be removed from resumption + */ + void OnAppActivated(application_manager::ApplicationSharedPtr application); + + /** + * @brief Removes app from resumption list + * + * app_id Application to remove + */ + void RemoveFromResumption(uint32_t app_id); + + /** + * @brief Initialization data for Resume controller + * @return true if initialization is success otherwise + * returns false + */ + bool Init(LastState& last_state); + + /** + * @brief Notify resume controller about new application + * @param policy_app_id - mobile application id + * @param device_id - id of device where application is run + */ + void OnAppRegistrationStart(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Notify resume controller about delete new application + */ + void OnAppRegistrationEnd(); + +#ifdef BUILD_TESTS + void set_resumption_storage(utils::SharedPtr<ResumptionData> mock_storage); +#endif // BUILD_TESTS + private: + /** + * @brief restores saved data of application + * @param application contains application for which restores data + * @return true if success, otherwise return false + */ + bool RestoreApplicationData( + application_manager::ApplicationSharedPtr application); + + /** + * @brief AddFiles allows to add files for the application + * which should be resumed + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddFiles(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief AddSubmenues allows to add sub menues for the application + * which should be resumed + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddSubmenues(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief AddCommands allows to add commands for the application + * which should be resumed + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddCommands(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief AddChoicesets allows to add choice sets for the application + * which should be resumed + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddChoicesets(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief SetGlobalProperties allows to restore global properties. + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void SetGlobalProperties( + application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief AddSubscriptions allows to restore subscriptions + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddSubscriptions(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief AddWayPointsSubscription allows to restore subscription + * for WayPoints + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void AddWayPointsSubscription( + application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app); + + bool CheckIgnCycleRestrictions(const smart_objects::SmartObject& saved_app); + + bool DisconnectedJustBeforeIgnOff( + const smart_objects::SmartObject& saved_app); + + bool CheckAppRestrictions( + application_manager::ApplicationConstSharedPtr application, + const smart_objects::SmartObject& saved_app); + + /** + * @brief CheckIcons allows to check application icons + * @param application application under resumtion application + * @param json_object + * @return true in case icons exists, false otherwise + */ + bool CheckIcons(application_manager::ApplicationSharedPtr application, + smart_objects::SmartObject& obj); + + /** + * @brief CheckDelayAfterIgnOn should check if SDL was started less + * then N secconds ago. N will be readed from profile. + * @return true if SDL started N secconds ago, otherwise return false + */ + bool CheckDelayAfterIgnOn(); + + typedef std::pair<uint32_t, uint32_t> ApplicationTimestamp; + + std::set<application_manager::ApplicationSharedPtr> retrieve_application(); + + /** + * @brief This struct need to map + * timestamp and application from correlationID + */ + struct ResumingApp { + uint32_t old_session_key; // session key is the same as app_id + application_manager::ApplicationSharedPtr app; + }; + + struct TimeStampComparator { + bool operator()(const ApplicationTimestamp& lhs, + const ApplicationTimestamp& rhs) const { + return lhs.second < rhs.second; + } + }; + + /** + * @brief geter for launch_time_ + * @return value of launch_time_ + */ + time_t launch_time() const; + + /** + * @brief Check device MAC address + * @param application that is need to be restored + * @param saved_device_mac Saved device MAC address + * @return TRUE on success, otherwise FALSE + */ + bool IsDeviceMacAddressEqual( + application_manager::ApplicationSharedPtr application, + const std::string& saved_device_mac); + + /** + * @brief Get the last ignition off time from LastState + * @return the last ignition off time from LastState + */ + time_t GetIgnOffTime(); + + /** + * @brief Setup IgnOff time to LastState + * @param ign_off_time - igition off time + */ + void SetLastIgnOffTime(time_t ign_off_time); + + /** + * @brief Process specified HMI request + * @param request Request to process + * @param use_events Process request events or not flag + * @return TRUE on success, otherwise FALSE + */ + bool ProcessHMIRequest(smart_objects::SmartObjectSPtr request = NULL, + bool use_events = false); + + /** + * @brief Process list of HMI requests using ProcessHMIRequest method + * @param requests List of requests to process + */ + void ProcessHMIRequests(const smart_objects::SmartObjectList& requests); + + void InsertToTimerQueue(uint32_t app_id, uint32_t time_stamp); + + void AddToResumptionTimerQueue(const uint32_t app_id); + + void LoadResumeData(); + + /** + * @brief Checks, if application data needs to be resumed + * @param application Application data from storage + * @return true, if data resumption must be skipped, otherwise - false + */ + bool IsAppDataResumptionExpired( + const smart_objects::SmartObject& application) const; + /** + * @brief Checks from resume data, if application has been disconnected + * unexpectedly + * @param app Application section from resume data + * @return true, if it has been unexpectedly disconnected, otherwise - false + */ + bool IsUnexpectedlyDisconnected(const smart_objects::SmartObject& app) const; + + /** + * @brief Checks, if application can be resumed + * @param application Application + * @return true, if no restrictions currently, otherwise - false + */ + bool IsResumeAllowed( + const application_manager::ApplicationSharedPtr application) const; + + /** + *@brief Mapping applications to time_stamps + * wait for timer to resume HMI Level + * + */ + mutable sync_primitives::Lock queue_lock_; + timer::Timer restore_hmi_level_timer_; + timer::Timer save_persistent_data_timer_; + typedef std::list<uint32_t> WaitingForTimerList; + WaitingForTimerList waiting_for_timer_; + bool is_resumption_active_; + bool is_data_saved_; + time_t launch_time_; + utils::SharedPtr<ResumptionData> resumption_storage_; + application_manager::ApplicationManager& application_manager_; +}; + +} // namespace resumption +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h new file mode 100644 index 0000000000..469be2c902 --- /dev/null +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h @@ -0,0 +1,274 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_ + +#include "smart_objects/smart_object.h" +#include "application_manager/application.h" +#include "application_manager/application_manager.h" + +namespace application_manager { +class ApplicationManagerSettings; +} + +namespace resumption { + +namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; +namespace app_mngr = application_manager; + +/** + * @brief Abstract class which provides an interface for storage/restore + * application data. Contains methods for receiving application data + * from application. + */ + +class ResumptionData { + public: + /** + * @brief Constructor of ResumptionData + */ + ResumptionData( + const application_manager::ApplicationManager& application_manager); + + /** + * @brief Destructor of ResumptionData + */ + virtual ~ResumptionData() {} + + /** + * @brief Save application persistent info for future resuming + * @param application is application witch need to be saved + */ + virtual void SaveApplication(app_mngr::ApplicationSharedPtr application) = 0; + + /** + * @brief Checks if saved data of applications have hmi app id + * @param hmi_app_id - hmi application id + * @return true if exist, false otherwise + */ + virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const = 0; + + /** + * @brief Retrieves HMI app ID for the given mobile app ID + * and device ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return HMI app ID + */ + virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id, + const std::string& device_id) const = 0; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnSuspend() = 0; + + /** + * @brief Retrieves hash ID for the given mobile app ID + * and device ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hash_id - parameter which will contain HASH id from saved + * application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetHashId(const std::string& policy_app_id, + const std::string& device_id, + std::string& hash_id) const = 0; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnAwake() = 0; + + /** + * @brief Retrieves data of saved application for the given mobile app ID + * and device ID + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param saved_app - parameter which will contain data of saved application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetSavedApplication( + const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const = 0; + + /** + * @brief Remove application from list of saved applications + * @param policy_app_id application which need to be removed + * @param device_id - contains id of device on which is running application + * @return return true, if success, otherwise return false + */ + virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id, + const std::string& device_id) = 0; + + /** + * @brief Get the last ignition off time from LastState + * @return the last ignition off time from LastState + */ + virtual uint32_t GetIgnOffTime() const = 0; + + /** + * @brief Checks if saved data have application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return index if data of application exists, otherwise returns -1 + */ + virtual ssize_t IsApplicationSaved(const std::string& policy_app_id, + const std::string& device_id) const = 0; + + /** + * @brief Retrieves data from saved application + * @param saved_data - will be contain data for resume_ctrl + */ + virtual void GetDataForLoadResumeData( + smart_objects::SmartObject& saved_data) const = 0; + + /** + * @brief Updates HMI level of saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hmi_level - contains hmi level for saved application + */ + virtual void UpdateHmiLevel(const std::string& policy_app_id, + const std::string& device_id, + mobile_apis::HMILevel::eType hmi_level) = 0; + + /** + * @brief Init storage + */ + virtual bool Init() = 0; + + /** + * @brief Drops data related to applicaton data resumption + * @param device_id Device ID + * @param app_id Application ID + * @return true, if dropped successfully, otherwise - false + */ + virtual bool DropAppDataResumption(const std::string& device_id, + const std::string& app_id) = 0; + + /** + * @brief Persist saves resumption data on file system + */ + virtual void Persist() = 0; + + protected: + /** + * @brief Retrieves of commands from application + * @param application contains application of which selection commands + * @return list of commands + */ + smart_objects::SmartObject GetApplicationCommands( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief Retrieves of submenues from application + * @param application contains application of which selection submenues + * @return list of submenues + */ + smart_objects::SmartObject GetApplicationSubMenus( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief Retrieves of interactionChoiceSet from application + * @param application contains application of which selection + * interactionChoiceSet + * @return list of interaction choice set + */ + smart_objects::SmartObject GetApplicationInteractionChoiseSets( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief Retrieves of global properties from application + * @param application contains application of which selection global + * properties + * @return global properties of application + */ + smart_objects::SmartObject GetApplicationGlobalProperties( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief Retrieves of subscriptions from application + * @param application contains application of which selection subscriptions + * @return subscriptions of application + */ + smart_objects::SmartObject GetApplicationSubscriptions( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief Retrieves of files from application + * @param application contains application of which selection files + * @return files of application + */ + smart_objects::SmartObject GetApplicationFiles( + app_mngr::ApplicationConstSharedPtr application) const; + + /** + * @brief checks pointer that it is not equal NULL + * @param ptr - contains pointer which need to check + * @return smartObject from pointer + */ + smart_objects::SmartObject PointerToSmartObj( + const smart_objects::SmartObject* ptr) const; + + /** + * @brief Creates smart array from received data + * @param first - iterator points to beginning of the data + * @param last - iterator points to ending of the data + * @param key - contains smart array's name + * @param result - will contain created array + */ + template <typename Iterator> + void Append(Iterator first, + Iterator last, + const std::string& key, + smart_objects::SmartObject& result) const { + int i = 0; + result[key] = smart_objects::SmartObject(smart_objects::SmartType_Array); + while (first != last) { + result[key][i++] = *first; + ++first; + } + } + mutable sync_primitives::Lock resumption_lock_; + const application_manager::ApplicationManager& application_manager_; +}; +} // namespace resumption + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_ diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h new file mode 100644 index 0000000000..d08ecc2ae1 --- /dev/null +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h @@ -0,0 +1,838 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_ +#include "application_manager/resumption/resumption_data.h" + +#include "sql_database.h" +#include "sql_query.h" + +namespace resumption { + +/** + * @brief Points what structure contains vr commands + */ +enum AccessoryVRCommand { kVRCommandFromChoice = 0, kVRCommandFromCommand }; + +struct ApplicationParams { + ApplicationParams(const smart_objects::SmartObject& application); + ApplicationParams(app_mngr::ApplicationSharedPtr application); + + std::string m_hash; + int64_t m_grammar_id; + int64_t m_connection_key; + int64_t m_hmi_app_id; + mobile_apis::HMILevel::eType m_hmi_level; + bool m_is_media_application; + bool m_is_valid; +}; + +/** + * @brief Show should database be saved in a disk file or in memory + */ +enum DbStorage { In_Memory_Storage = 0, In_File_Storage }; + +/** + * @brief class contains logic for representation application data in + * data base + */ +class ResumptionDataDB : public ResumptionData { + public: + /** + * @brief Constructor of ResumptionDataDB + * @param db_storage show database should be saved in a disk file or in memory + */ + ResumptionDataDB( + DbStorage db_storage, + const application_manager::ApplicationManager& application_manager); + + /** + * @brief allows to destroy ResumptionDataDB object + */ + virtual ~ResumptionDataDB(); + + /** + * @brief Creates or opens DB and initialize it + * @return false if DB doesn't initialize + * otherwise returns true + */ + virtual bool Init(); + + /** + * @brief Save application persistent info for future resuming to db + * @param application is application which need to be saved + */ + void SaveApplication(app_mngr::ApplicationSharedPtr application) OVERRIDE; + /** + * @brief Checks if saved data of applications have hmi app id + * @param hmi_app_id - hmi application id + * @return true if exist, otherwise false + */ + virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const; + /** + * @brief Retrieves HMI app ID for the given mobile app ID + * and device ID from stored data. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return HMI app ID + */ + virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnSuspend(); + + /** + * @brief Retrieves hash ID for the given mobile app ID + * and device ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hash_id - parameter which will contain HASH id from saved + * application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetHashId(const std::string& policy_app_id, + const std::string& device_id, + std::string& hash_id) const; + + /** + * @brief Decrements ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnAwake(); + + /** + * @brief Retrieves data of saved application for the given mobile app ID + * and device ID + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param saved_app - parameter which will contain data of saved application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetSavedApplication(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Remove application from list of saved applications + * @param policy_app_id application witch need to be removed + * @param device_id - contains id of device on which is running application + * @return return true, if success, otherwise return false + */ + virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Get the last ignition off time from LastState + * @return the last ignition off time from LastState + */ + virtual uint32_t GetIgnOffTime() const; + + /** + * @brief Checks if saved data have application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return 0 if saved data contains application otherwise returns -1 + */ + virtual ssize_t IsApplicationSaved(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Retrieves data from saved application + * @param will contain data for resume_ctrl + */ + virtual void GetDataForLoadResumeData( + smart_objects::SmartObject& saved_data) const; + + /** + * @brief Updates HMI level of saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hmi_level - contains hmi level for saved application + */ + virtual void UpdateHmiLevel(const std::string& policy_app_id, + const std::string& device_id, + mobile_apis::HMILevel::eType hmi_level); + + /** + * @brief Re-creates and re-init DB + * @return true if success, otherwise - false + */ + bool RefreshDB() const; + + /** + * @brief Gets all the data from DB to memory + * @param data Object which holds resumption data + * @return true if success, otherwise - false + */ + bool GetAllData(smart_objects::SmartObject& data) const; + + /** + * @brief Saves all the data to DB + * @param data Object, which holds resumption data + * @return true if success, otherwise - false + */ + bool SaveAllData(const smart_objects::SmartObject& data); + + /** + * @brief Checks, if DB version is actual to current schema + * @return true if success, otherwise - false + */ + bool IsDBVersionActual() const; + + /** + * @brief Updates DB version accordingly to current schema + * @return true if success, otherwise - false + */ + bool UpdateDBVersion() const; + + bool DropAppDataResumption(const std::string& device_id, + const std::string& app_id) OVERRIDE; + /** + * @brief Write json resumption info to file system + */ + void Persist() OVERRIDE; + + protected: + /** + * @brief returns pointer to data base + */ + utils::dbms::SQLDatabase* db() const; + + private: + /** + * @brief Calculates DB version from current schema + * @return version + */ + const int32_t GetDBVersion() const; + + /** + * @brief Retrieves hmi level from db + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hmi_level - will contains hmi level for saved application + * @return true if application with mobile id and device id has hmi level + * otherwise returns false + */ + bool SelectHMILevel(const std::string& policy_app_id, + const std::string& device_id, + int& hmi_level) const; + /** + * @brief Checks existence HMI id in DB + * @param hmi_app_id - HMI id + * return true if hmiID is same with saved hmiID otherwise returns false + */ + bool CheckExistenceHMIId(uint32_t hmi_app_id) const; + + /** + * @brief Select HMI id from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hmi_id - will contains hmi id from saved application + */ + void SelectHMIId(const std::string& policy_app_id, + const std::string& device_id, + uint32_t& hmi_id) const; + + /** + * @brief Select hash id from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hash_id - will contains hash id from saved application + */ + bool SelectHashId(const std::string& policy_app_id, + const std::string& device_id, + std::string& hash_id) const; + + /** + * @brief Select Ign off time + * @return Ign off time from saved data + */ + uint32_t SelectIgnOffTime() const; + + /** + * @brief Checks existence application in DB + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param application_exist will contain true if restored data contain + * application + * otherwise will contain false + * return if we have problem with access to DB returns FALSE otherwise + * returns TRUE + */ + bool CheckExistenceApplication(const std::string& policy_app_id, + const std::string& device_id, + bool& application_exist) const; + + /** + * @brief Retrieves data from saved application + * @param will contain data for resume_ctrl + */ + void SelectDataForLoadResumeData( + smart_objects::SmartObject& saved_data) const; + + /** + * @brief Deletes saved application from db + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if application data was deleted otherwise returns + * false + */ + bool DeleteSavedApplication(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes file from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedFiles(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes submenu from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedSubMenu(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes subscriptions from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedSubscriptions(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes commands from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedCommands(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes choice set from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedChoiceSet(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Deletes global properties from saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteSavedGlobalProperties(const std::string& policy_app_id, + const std::string& device_id); + /** + * @brief Deletes data from application table + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if data was deleted otherwise returns + * false + */ + bool DeleteDataFromApplicationTable(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Saves files data to DB + * @param files contains data for saving + * @param application_primary_key - primary key from DB table application + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertFilesData(const smart_objects::SmartObject& files, + int64_t application_primary_key) const; + + /** + * @brief Saves submenu data to DB + * @param submenus contains data for saving + * @param application_primary_key - primary key from DB table application + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertSubMenuData(const smart_objects::SmartObject& submenus, + int64_t application_primary_key) const; + + /** + * @brief Saves commands data to DB + * @param commands contains data for saving + * @param application_primary_key - primary key from DB table application + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertCommandsData(const smart_objects::SmartObject& commands, + int64_t application_primary_key) const; + + /** + * @brief Saves subscriptions data to DB + * @param subscriptions contains data for saving + * @param application_primary_key - primary key from DB table application + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertSubscriptionsData(const smart_objects::SmartObject& subscriptions, + int64_t application_primary_key) const; + + /** + * @brief Saves choice set data to DB + * @param choicesets contains data for saving + * @param application_primary_key - primary key from DB table application + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertChoiceSetData(const smart_objects::SmartObject& choicesets, + int64_t application_primary_key) const; + + /** + * @brief Saves globalProperties data to DB + * @param global_properties contains data for saving + * @param global_properties_key - will contain primary key from global + * properties table + * @return true if data was saved successfully otherwise returns + * false + */ + bool InsertGlobalPropertiesData( + const smart_objects::SmartObject& global_properties, + int64_t& global_properties_key) const; + + /** + * @brief Saves application data to DB + * @param application contains data for saving + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if application data was saved successfully + * otherwise returns false + */ + bool SaveApplicationToDB(app_mngr::ApplicationSharedPtr application, + const std::string& policy_app_id, + const std::string& device_id) const; + + bool SaveApplicationToDB(const smart_objects::SmartObject& application, + const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Updates ignition of count on saved applications after onAwake + * notification + */ + void UpdateDataOnAwake(); + + /** + * @brief Execute query for delete data of application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param text_query - contains text of query + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecQueryToDeleteData(const std::string& policy_app_id, + const std::string& device_id, + const std::string& text_query); + + /** + * @brief Execute union query for delete data of application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param text_query - contains text of query + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecUnionQueryToDeleteData(const std::string& policy_app_id, + const std::string& device_id, + const std::string& text_query); + + /** + * @brief Execute query in order to insert image to DB + * @param image_primary_key - will contain primary key from image table + * @param image contains data for saving to DB + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertImage(int64_t& image_primary_key, + const smart_objects::SmartObject& image) const; + + /** + * @brief Execute query in order to insert choice to DB + * @param choice_set_key - contain primary key from + * applicationChoiceSet table + * @param choice_array contains data for saving to DB + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertChoice(int64_t choice_set_key, + const smart_objects::SmartObject& choice_array) const; + + /** + * @brief Execute query in order to insert vr commands to DB + * @param primary_key - will contain primary key from command table or + * choice table + * @param vr_commands_array contains data for saving to DB + * @param value indicates which structure contains vrcommands + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertVrCommands(const int64_t primary_key, + const smart_objects::SmartObject& vr_commands_array, + AccessoryVRCommand value) const; + + /** + * @brief Execute query in order to insert choice set data to DB + * @param choice_set_primary_key - will contain primary key from + * applicationChoiceSet table + * @param choiceset contains data for saving to DB + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertApplicationChoiceSet( + int64_t& choice_set_primary_key, + const smart_objects::SmartObject& choiceset) const; + + /** + * @brief combines primary key from several table to new table + * @param first_primary_key - will contain primary key from first DB table + * @param second_primary_key - will contain primary key from second DB table + * @param text_query - contains text of query + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertDataToArray(int64_t first_primary_key, + int64_t second_primary_key, + const std::string& text_query) const; + + /** + * @brief Execute query in order to insert characters array to DB + * @param global_properties_key contains primary key from globalproperties + * table + * @param characters_array contains data for saving to DB + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertLimitedCharacters( + int64_t global_properties_key, + const smart_objects::SmartObject& characters_array) const; + + /** + * @brief Execute query in order to insert vr help item array to DB + * @param global_properties_key contains primary key from globalproperties + * table + * @param vrhelp_array contains data for saving to DB + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertVRHelpItem( + int64_t global_properties_key, + const smart_objects::SmartObject& vrhelp_array) const; + + /** + * @brief Execute query in order to insert data to ttsChunk table + * @param tts_chunk contains data for saving to DB + * @param tts_chunk_key will contain primary key from ttsChunk table + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertTTSChunks(const smart_objects::SmartObject& tts_chunk, + int64_t& tts_chunk_key) const; + + /** + * @brief Execute query in order to insert data to helpTimeoutPromptArray + * @param global_properties contains data for saving to DB + * @param global_properties_key contains primary key from globalproperties + * table + * @return true if query was run successfully otherwise returns + * false + */ + bool ExecInsertHelpTimeoutArray( + const smart_objects::SmartObject& global_properties, + int64_t global_properties_key) const; + + /** + * @brief Execute query in order to insert or update data in application table + * @param application contains data for saving to DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param application_primary_key will contain primary key from application + * table + * @param global_properties_key contains primary key from globalproperties + * table + * @return true if query was run successfully otherwise returns + * false + */ + bool InsertApplicationData(const ApplicationParams& application, + const std::string& policy_app_id, + const std::string& device_id, + int64_t* application_primary_key, + int64_t global_properties_key) const; + + /** + * @brief Calls InsertApplicationData method + * @param application contains data for saving to DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @return true if InsertApplicationData works successfully, otherwise + * returns false; + */ + bool InsertApplicationData(app_mngr::ApplicationSharedPtr application, + const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Delete application data where ign_off_count >= application_lifes + * @param application_lifes contains amount ign off + * @return true if query was run successfully otherwise returns + * false + */ + bool DeleteAppWithIgnCount(const int application_lifes); + + /** + * @brief Selects data from file table + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain data from file table + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectFilesData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects data from subMenu table + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain data from subMenu table + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectSubmenuData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects data from commands table + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain commands + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectCommandData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects data from applicationSubscribtionsArray table + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain subscriptions + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectSubscriptionsData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects choice set data from DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain choiceSets + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectChoiceSetData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects global properties data from DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain global properties + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectGlobalPropertiesData(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects image data from DB + * @param image_key primary key from image table + * @param image will contain image data from DB + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectImageData(int64_t image_key, + smart_objects::SmartObject& image) const; + + /** + * @brief Selects ttsChunk data from DB + * @param tts_chunk_key primary key from ttsChunk table + * @param tts_chunk will contain ttsChunk data from DB + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectTTSChunkData(int64_t tts_chunk_key, + smart_objects::SmartObject& tts_chunk) const; + + /** + * @brief Selects VR help items data from DB + * @param global_properties_key primary key from global properties table + * @param global_properties will contain VR help items + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectVrHelpItemsData( + int64_t global_properties_key, + smart_objects::SmartObject& global_properties) const; + + /** + * @brief Selects table limited character data from DB + * @param global_properties_key primary key from global properties table + * @param keyboard_properties will contain table limited character + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectCharactersData( + int64_t global_properties_key, + smart_objects::SmartObject& keyboard_properties) const; + + /** + * @brief Selects data from application table of DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param saved_app will contain data from application table + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectDataFromAppTable(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Selects count from array table + * @param count_item will contain amount item in table + * @param text_query - contains text of query + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @return true if query was run successfully otherwise returns + * false + */ + bool SelectCountFromArray(uint32_t& count_item, + const std::string& text_query, + const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Binds data from smart object with query + * @param key contains key from smart object + * @param so contains data which needs to bind with query + * @param query object of query for DB + * @param pos contains position for binding query + */ + void CustomBind(const std::string& key, + const smart_objects::SmartObject& so, + utils::dbms::SQLQuery& query, + const int pos) const; + + /** + * @brief prepare and bind the same type query + * @param query object of query for DB + * @param policy_app_id contains mobile application id of application + * @param device_id contains id of device on which is running application + * @param text_query - contains text of query + * @return true if query was binded successfully otherwise returns + * false + */ + bool PrepareSelectQuery(utils::dbms::SQLQuery& query, + const std::string& policy_app_id, + const std::string& device_id, + const std::string& text_query) const; + + /** + * @brief Updates HMI level and time stamp in application table + * @param application contains data for saving + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return true if application data were updated successfully + * otherwise returns false + */ + bool UpdateApplicationData(app_mngr::ApplicationConstSharedPtr application, + const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Writes data to DB after update + */ + void WriteDb(); + + /** + * @brief Updates grammarID for application + * @param policy_app_id Application ID + * @param device_id Device ID + * @param grammar_id GrammarID + * @return true if succedeed, otherwise - false + */ + bool UpdateGrammarID(const std::string& policy_app_id, + const std::string& device_id, + const uint32_t grammar_id); + + DISALLOW_COPY_AND_ASSIGN(ResumptionDataDB); + + utils::dbms::SQLDatabase* db_; +}; +} // namespace resumption + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_ diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h new file mode 100644 index 0000000000..0be6d64db2 --- /dev/null +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h @@ -0,0 +1,235 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_ + +#include "application_manager/resumption/resumption_data.h" +#include "json/json.h" +#include "resumption/last_state.h" + +namespace resumption { + +/** + * @brief class contains logic for representation application data in + * json file + */ +class ResumptionDataJson : public ResumptionData { + public: + /** + * @brief Constructor of ResumptionDataJson + */ + ResumptionDataJson( + LastState& last_state, + const application_manager::ApplicationManager& application_manager); + + /** + * @brief allows to destroy ResumptionDataJson object + */ + virtual ~ResumptionDataJson(); + + /** + * @brief Save application persistent info for future resuming on json format + * @param application is application witch need to be saved + */ + virtual void SaveApplication( + app_mngr::ApplicationSharedPtr application) OVERRIDE; + + /** + * @brief Checks if saved data of applications have hmi app id + * @param hmi_app_id - hmi application id + * @return true if exist, false otherwise + */ + virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const; + + /** + * @brief Retrieves HMI app ID for the given mobile app ID + * and device ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return HMI app ID + */ + virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnSuspend(); + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + virtual void OnAwake(); + + /** + * @brief Retrieves hash ID for the given mobile app ID + * and device ID from stored information. + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hash_id - parameter which will contain HASH id from saved + * application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetHashId(const std::string& policy_app_id, + const std::string& device_id, + std::string& hash_id) const; + + /** + * @brief Retrieves data of saved application for the given mobile app ID + * and device ID + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param saved_app - parameter which will contain data of saved application + * @return TRUE if application will be found in saved data otherwise + * returns FALSE + */ + virtual bool GetSavedApplication(const std::string& policy_app_id, + const std::string& device_id, + smart_objects::SmartObject& saved_app) const; + + /** + * @brief Remove application from list of saved applications + * @param policy_app_id application witch need to be removed + * @param device_id - contains id of device on which is running application + * @return return true, if success, otherwise return false + */ + virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id, + const std::string& device_id); + + /** + * @brief Get the last ignition off time from LastState + * @return the last ignition off time from LastState + */ + virtual uint32_t GetIgnOffTime() const; + + /** + * @brief Checks if saved data have application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @return index if data of application exists, otherwise returns -1 + */ + virtual ssize_t IsApplicationSaved(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Retrieves data from saved application + * @param will be contain data for resume_ctrl + */ + virtual void GetDataForLoadResumeData( + smart_objects::SmartObject& saved_data) const; + + /** + * @brief Updates HMI level of saved application + * @param policy_app_id - mobile application id + * @param device_id - contains id of device on which is running application + * @param hmi_level - contains hmi level for saved application + */ + virtual void UpdateHmiLevel(const std::string& policy_app_id, + const std::string& device_id, + mobile_apis::HMILevel::eType hmi_level); + + virtual bool Init(); + + bool DropAppDataResumption(const std::string& device_id, + const std::string& app_id) OVERRIDE; + + /** + * @brief Write json resumption info to file system + */ + void Persist() OVERRIDE; + + resumption::LastState& last_state() const { + return last_state_; + } + + private: + /** + * @brief GetFromSavedOrAppend allows to get existed record about application + * or adds the new one. + * @param policy_app_id application id. + * @param device_id unique id of device. + * @return the reference to the record in applications array. + */ + Json::Value& GetFromSavedOrAppend(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Get applications for resumption of LastState + * @return applications for resumption of LastState + */ + Json::Value& GetSavedApplications() const; + + /** + * @brief Get Resumption section of LastState + * @return Resumption section of LastState in Json + */ + Json::Value& GetResumptionData() const; + + /** + * @brief GetObjectIndex allows to obtain specified object index from + * applications arrays. + * @param policy_app_id application id that should be found. + * @param device_id unique id of device. + * @return application's index of or -1 if it doesn't exists + */ + ssize_t GetObjectIndex(const std::string& policy_app_id, + const std::string& device_id) const; + + /** + * @brief Set applications for resumption to LastState + * @parems apps_json applications to write in LastState + */ + void SetSavedApplication(Json::Value& apps_json); + + /** + * @brief Setup IgnOff time to LastState + * @param ign_off_time - igition off time + */ + void SetLastIgnOffTime(time_t ign_off_time); + + /* + * @brief Return true if application resumption data is valid, + * otherwise false + * @param index application index in the resumption list + */ + bool IsResumptionDataValid(uint32_t index) const; + + LastState& last_state_; + DISALLOW_COPY_AND_ASSIGN(ResumptionDataJson); +}; +} // namespace resumption + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_ diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h new file mode 100644 index 0000000000..3f8ca3a416 --- /dev/null +++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_ + +#include <string> + +namespace resumption { + +extern const std::string kCreateSchema; +extern const std::string kDropSchema; +extern const std::string kInsertInitData; +extern const std::string kChecksResumptionData; +extern const std::string kSelectCountHMILevel; +extern const std::string kSelectHMILevel; +extern const std::string kCheckHMIId; +extern const std::string kSelectHMIId; +extern const std::string kSelectCountHMIId; +extern const std::string kCountHashId; +extern const std::string kSelectHashId; +extern const std::string kSelectIgnOffTime; +extern const std::string kCheckApplication; +extern const std::string kCountApplications; +extern const std::string kSelectDataForLoadResumeData; +extern const std::string kUpdateHMILevel; +extern const std::string kUpdateIgnOffCount; +extern const std::string kCountApplicationsIgnOff; +extern const std::string kSelectApplicationsIgnOffCount; +extern const std::string kUpdateSuspendData; +extern const std::string KUpdateLastIgnOffTime; +extern const std::string kDeleteFile; +extern const std::string kDeleteApplicationFilesArray; +extern const std::string kDeleteSubMenu; +extern const std::string kDeleteApplicationSubMenuArray; +extern const std::string kDeleteApplicationSubscribtionsArray; +extern const std::string kDeleteImageFromCommands; +extern const std::string kDeleteVrCommands; +extern const std::string kDeleteCommands; +extern const std::string kDeleteApplicationCommandsArray; +extern const std::string kDeleteImageFromChoiceSet; +extern const std::string kDeleteVrCommandsFromChoiceSet; +extern const std::string kDeleteChoice; +extern const std::string kDeleteChoiceArray; +extern const std::string kDeleteApplicationChoiceSet; +extern const std::string kDeleteApplicationChoiceSetArray; +extern const std::string kDeleteImageFromGlobalProperties; +extern const std::string kDeletevrHelpItem; +extern const std::string kDeletevrHelpItemArray; +extern const std::string kDeleteTableLimitedCharacterList; +extern const std::string kDeleteCharacterArray; +extern const std::string kDeleteTTSChunk; +extern const std::string kDeleteFromApplicationTable; +extern const std::string kDeleteHelpTimeoutPromptArray; +extern const std::string kDeleteGlobalProperties; +extern const std::string kSelectCountImage; +extern const std::string kSelectPrimaryKeyImage; +extern const std::string kInsertImage; +extern const std::string kInsertToFile; +extern const std::string kInsertToApplicationFilesArray; +extern const std::string kInsertToSubMenu; +extern const std::string kInsertToApplicationSubMenuArray; +extern const std::string kInsertToVrCommandsArray; +extern const std::string kInsertToCommand; +extern const std::string kInsertApplicationCommandArray; +extern const std::string kInsertVrCommand; +extern const std::string kInsertSubscriptions; +extern const std::string kInsertChoice; +extern const std::string kInsertApplicationChoiceSet; +extern const std::string kInsertChoiceArray; +extern const std::string kInsertApplicationChoiceSetArray; +extern const std::string kInsertGlobalProperties; +extern const std::string kInsertTableLimitedCharacter; +extern const std::string kInsertCharacterArray; +extern const std::string kInsertVRHelpItem; +extern const std::string kInsertVRHelpItemArray; +extern const std::string kInsertHelpTimeoutPromptArray; +extern const std::string kInsertTTSChunk; +extern const std::string kInsertApplication; +extern const std::string kSelectCountFiles; +extern const std::string kSelectFiles; +extern const std::string kSelectCountSubMenu; +extern const std::string kSelectSubMenu; +extern const std::string kSelectCountCommands; +extern const std::string kSelectCommands; +extern const std::string kSelectCountSubscriptions; +extern const std::string kSelectSubscriptions; +extern const std::string kSelectCountChoiceSet; +extern const std::string kSelectChoiceSets; +extern const std::string kSelectImage; +extern const std::string kSelectCountGlobalProperties; +extern const std::string kSelectGlobalProperties; +extern const std::string kChecksVrHelpItem; +extern const std::string kSelectVrHelpItem; +extern const std::string kChecksCharacter; +extern const std::string kSelectCharacter; +extern const std::string kSelectTTSChunk; +extern const std::string kSelectAppTable; +extern const std::string kSelectAllApps; +extern const std::string kUpdateApplicationData; +extern const std::string kSelectDBVersion; +extern const std::string kUpdateDBVersion; +extern const std::string kUpdateGrammarID; +extern const std::string kInsertSubscribedForWayPoints; +extern const std::string kSelectSubscribedForWayPoints; +extern const std::string kDeleteSubscribedForWayPoints; +} // namespace resumption + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_ diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index cebac3fef3..1fda170c34 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -37,381 +37,400 @@ namespace application_manager { namespace strings { -const char params[] = "params"; -const char message_type[] = "message_type"; -const char correlation_id[] = "correlation_id"; -const char function_id[] = "function_id"; -const char protocol_version[] = "protocol_version"; -const char protocol_type[] = "protocol_type"; -const char connection_key[] = "connection_key"; -const char error[] = "error"; -const char error_msg[] = "message"; -const char default_app_id[] = "default"; -const char msg_params[] = "msg_params"; -const char method_name[] = "methodName"; -const char info[] = "info"; -const char app_id[] = "appID"; -const char hmi_app_id[] = "hmiAppID"; -const char device_mac[] = "deviceMAC"; -const char url[] = "url"; -const char urlScheme[] = "urlScheme"; -const char packageName[] = "packageName"; -const char cmd_icon[] = "cmdIcon"; -const char result_code[] = "resultCode"; -const char success[] = "success"; -const char sync_msg_version[] = "syncMsgVersion"; -const char major_version[] = "majorVersion"; -const char minor_version[] = "minorVersion"; -const char app_name[] = "appName"; -const char ngn_media_screen_app_name[] = "ngnMediaScreenAppName"; -const char vr_synonyms[] = "vrSynonyms"; -const char uses_vehicle_data[] = "usesVehicleData"; -const char is_media_application[] = "isMediaApplication"; -const char greyOut[] = "greyOut"; -const char language_desired[] = "languageDesired"; -const char auto_activated_id[] = "autoActivateID"; -const char app_type[] = "appType"; -const char app_hmi_type[] = "appHMIType"; -const char tts_name[] = "ttsName"; -const char binary_data[] = "binary_data"; -const char timeout_prompt[] = "timeoutPrompt"; -const char timeout[] = "timeout"; -const char vr_help_title[] = "vrHelpTitle"; -const char vr_help[] = "vrHelp"; -const char main_field_1[] = "mainField1"; -const char main_field_2[] = "mainField2"; -const char main_field_3[] = "mainField3"; -const char main_field_4[] = "mainField4"; -const char eta[] = "eta"; -const char time_to_destination[] = "timeToDestination"; -const char total_distance[] = "totalDistance"; -const char alignment[] = "alignment"; -const char graphic[] = "graphic"; -const char secondary_graphic[] = "secondaryGraphic"; -const char status_bar[] = "statusBar"; -const char media_clock[] = "mediaClock"; -const char media_track[] = "mediaTrack"; -const char properties[] = "properties"; -const char cmd_id[] = "cmdID"; -const char menu_params[] = "menuParams"; -const char menu_title[] = "menuTitle"; -const char menu_icon[] = "menuIcon"; -const char keyboard_properties[] = "keyboardProperties"; -const char vr_commands[] = "vrCommands"; -const char position[] = "position"; -const char num_ticks[] = "numTicks"; -const char slider_footer[] = "sliderFooter"; -const char menu_id[] = "menuID"; -const char menu_name[] = "menuName"; -const char interaction_choice_set_id[] = "interactionChoiceSetID"; -const char interaction_choice_set_id_list[] = "interactionChoiceSetIDList"; -const char choice_set[] = "choiceSet"; -const char choice_id[] = "choiceID"; -const char grammar_id[] = "grammarID"; -const char navigation_text_1[] = "navigationText1"; -const char navigation_text_2[] = "navigationText2"; -const char alert_text1[] = "alertText1"; -const char alert_text2[] = "alertText2"; -const char alert_text3[] = "alertText3"; -const char tts_chunks[] = "ttsChunks"; -const char initial_prompt[] = "initialPrompt"; -const char initial_text[] = "initialText"; -const char duration[] = "duration"; -const char progress_indicator[] = "progressIndicator"; -const char alert_type[] = "alertType"; -const char play_tone[] = "playTone"; -const char soft_buttons[] = "softButtons"; -const char soft_button_id[] = "softButtonID"; -const char custom_presets[] = "customPresets"; -const char audio_pass_display_text1[] = "audioPassThruDisplayText1"; -const char audio_pass_display_text2[] = "audioPassThruDisplayText2"; -const char max_duration[] = "maxDuration"; -const char sampling_rate[] = "samplingRate"; -const char bits_per_sample[] = "bitsPerSample"; -const char audio_type[] = "audioType"; -const char mute_audio[] = "muteAudio"; -const char button_name[] = "buttonName"; -const char button_event_mode[] = "buttonEventMode"; -const char button_press_mode[] = "buttonPressMode"; -const char custom_button_id[] = "customButtonID"; -const char data_type[] = "dataType"; -const char turn_list[] = "turnList"; -const char turn_icon[] = "turnIcon"; -const char next_turn_icon[] = "nextTurnIcon"; -const char value[] = "value"; -const char hmi_display_language[] = "hmiDisplayLanguage"; -const char language[] = "language"; -const char data[] = "data"; -const char start_time[] = "startTime"; -const char end_time[] = "endTime"; -const char hours[] = "hours"; -const char minutes[] = "minutes"; -const char seconds [] = "seconds"; -const char update_mode[] = "updateMode"; -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 system_context[] = "systemContext"; -const char speech_capabilities[] = "speechCapabilities"; -const char vr_capabilities[] = "vrCapabilities"; -const char audio_pass_thru_capabilities[] = "audioPassThruCapabilities"; +extern const char* params; +extern const char* message_type; +extern const char* correlation_id; +extern const char* function_id; +extern const char* protocol_version; +extern const char* protocol_type; +extern const char* connection_key; +extern const char* error; +extern const char* error_msg; +extern const char* default_app_id; +extern const char* msg_params; +extern const char* method_name; +extern const char* info; +extern const char* app_id; +extern const char* hmi_app_id; +extern const char* device_id; +extern const char* subscribed_for_way_points; +extern const char* url; +extern const char* urlScheme; +extern const char* packageName; +extern const char* cmd_icon; +extern const char* result_code; +extern const char* success; +extern const char* sync_msg_version; +extern const char* major_version; +extern const char* minor_version; +extern const char* app_name; +extern const char* ngn_media_screen_app_name; +extern const char* vr_synonyms; +extern const char* uses_vehicle_data; +extern const char* is_media_application; +extern const char* greyOut; +extern const char* language_desired; +extern const char* auto_activated_id; +extern const char* app_type; +extern const char* app_hmi_type; +extern const char* tts_name; +extern const char* binary_data; +extern const char* timeout_prompt; +extern const char* timeout; +extern const char* vr_help_title; +extern const char* vr_help; +extern const char* main_field_1; +extern const char* main_field_2; +extern const char* main_field_3; +extern const char* main_field_4; +extern const char* eta; +extern const char* time_to_destination; +extern const char* total_distance; +extern const char* alignment; +extern const char* graphic; +extern const char* secondary_graphic; +extern const char* status_bar; +extern const char* media_clock; +extern const char* media_track; +extern const char* properties; +extern const char* cmd_id; +extern const char* menu_params; +extern const char* menu_title; +extern const char* menu_icon; +extern const char* keyboard_properties; +extern const char* vr_commands; +extern const char* position; +extern const char* num_ticks; +extern const char* slider_footer; +extern const char* menu_id; +extern const char* menu_name; +extern const char* interaction_choice_set_id; +extern const char* interaction_choice_set_id_list; +extern const char* choice_set; +extern const char* choice_id; +extern const char* grammar_id; +extern const char* navigation_text_1; +extern const char* navigation_text_2; +extern const char* alert_text1; +extern const char* alert_text2; +extern const char* alert_text3; +extern const char* tts_chunks; +extern const char* initial_prompt; +extern const char* initial_text; +extern const char* duration; +extern const char* progress_indicator; +extern const char* alert_type; +extern const char* play_tone; +extern const char* soft_buttons; +extern const char* soft_button_id; +extern const char* custom_presets; +extern const char* audio_pass_display_text1; +extern const char* audio_pass_display_text2; +extern const char* max_duration; +extern const char* sampling_rate; +extern const char* bits_per_sample; +extern const char* audio_type; +extern const char* mute_audio; +extern const char* button_name; +extern const char* button_event_mode; +extern const char* button_press_mode; +extern const char* custom_button_id; +extern const char* data_type; +extern const char* turn_list; +extern const char* turn_icon; +extern const char* next_turn_icon; +extern const char* value; +extern const char* hmi_display_language; +extern const char* language; +extern const char* data; +extern const char* start_time; +extern const char* end_time; +extern const char* hours; +extern const char* minutes; +extern const char* seconds; +extern const char* update_mode; +extern const char* trigger_source; +extern const char* hmi_level; +extern const char* activate_app_hmi_level; +extern const char* audio_streaming_state; +extern const char* system_context; +extern const char* speech_capabilities; +extern const char* vr_capabilities; +extern const char* audio_pass_thru_capabilities; +extern const char* pcm_stream_capabilities; + // PutFile -const char sync_file_name[] = "syncFileName"; -const char file_name[] = "fileName"; -const char file_type[] = "fileType"; -const char file_size[] = "fileSize"; -const char request_type[] = "requestType"; -const char persistent_file[] = "persistentFile"; -const char file_data[] = "fileData"; -const char space_available[] = "spaceAvailable"; -const char image_type[] = "imageType"; -const char image[] = "image"; -const char type[] = "type"; -const char system_file[] = "systemFile"; -const char offset[] = "offset"; -const char length[] = "length"; -const char secondary_image[] = "secondaryImage"; -const char filenames[] = "filenames"; +extern const char* sync_file_name; +extern const char* file_name; +extern const char* file_type; +extern const char* file_size; +extern const char* request_type; +extern const char* persistent_file; +extern const char* file_data; +extern const char* space_available; +extern const char* image_type; +extern const char* image; +extern const char* type; +extern const char* system_file; +extern const char* offset; +extern const char* length; +extern const char* secondary_image; +extern const char* filenames; -const char hmi_display_language_desired[] = "hmiDisplayLanguageDesired"; -const char ecu_name[] = "ecuName"; -const char dtc_mask[] = "dtcMask"; -const char did_location[] = "didLocation"; -const char app_list[] = "appList"; -const char device_list[] = "deviceList"; -const char device_info[] = "deviceInfo"; -const char name[] = "name"; -const char id[] = "id"; -const char isSDLAllowed[] = "isSDLAllowed"; -const char transport_type[] = "transportType"; -const char application[] = "application"; -const char applications[] = "applications"; -const char icon[] = "icon"; -const char device_name[] = "deviceName"; -const char reason[] = "reason"; -const char available[] = "available"; -const char text[] = "text"; -const char character_set[] = "characterSet"; -const char secondary_text[] = "secondaryText"; -const char tertiary_text[] = "tertiaryText"; -const char hardware[] = "hardware"; -const char firmware_rev[] = "firmwareRev"; -const char os[] = "os"; -const char os_version[] = "osVersion"; -const char carrier[] = "carrier"; -const char slider_header[] = "sliderHeader"; +extern const char* hmi_display_language_desired; +extern const char* ecu_name; +extern const char* dtc_mask; +extern const char* did_location; +extern const char* app_list; +extern const char* device_list; +extern const char* device_info; +extern const char* name; +extern const char* id; +extern const char* isSDLAllowed; +extern const char* transport_type; +extern const char* application; +extern const char* applications; +extern const char* icon; +extern const char* device_name; +extern const char* reason; +extern const char* available; +extern const char* text; +extern const char* character_set; +extern const char* secondary_text; +extern const char* tertiary_text; +extern const char* hardware; +extern const char* firmware_rev; +extern const char* os; +extern const char* os_version; +extern const char* carrier; +extern const char* slider_header; +extern const char* key_press_mode; // duplicate names from hmi_request -const char limited_character_list[] = "limitedCharacterList"; -const char auto_complete_text[] = "autoCompleteText"; -const char navigation_text[] = "navigationText"; +extern const char* limited_character_list; +extern const char* auto_complete_text; +extern const char* navigation_text; // vehicle info -const char gps[] = "gps"; -const char speed[] = "speed"; -const char rpm[] = "rpm"; -const char fuel_level[] = "fuelLevel"; -const char fuel_level_state[] = "fuelLevel_State"; -const char instant_fuel_consumption[] = "instantFuelConsumption"; -const char external_temp[] = "externalTemperature"; -const char vin[] = "vin"; -const char prndl[] = "prndl"; -const char tire_pressure[] = "tirePressure"; -const char odometer[] = "odometer"; -const char belt_status[] = "beltStatus"; -const char body_information[] = "bodyInformation"; -const char device_status[] = "deviceStatus"; -const char driver_braking[] = "driverBraking"; -const char wiper_status[] = "wiperStatus"; -const char head_lamp_status[] = "headLampStatus"; -const char engine_torque[] = "engineTorque"; -const char acc_pedal_pos[] = "accPedalPosition"; -const char steering_wheel_angle[] = "steeringWheelAngle"; -const char e_call_info[] = "eCallInfo"; -const char airbag_status[] = "airbagStatus"; -const char emergency_event[] = "emergencyEvent"; -const char cluster_mode_status[] = "clusterModeStatus"; -const char my_key[] = "myKey"; -const char help_prompt[] = "helpPrompt"; -const char scroll_message_body[] = "scrollableMessageBody"; -const char data_result[] = "dataResult"; -const char dtc_list[] = "dtcList"; -const char interaction_mode[] = "interactionMode"; -const char slider_position[] = "sliderPosition"; -const char system_action[] = "systemAction"; -const char prerecorded_speech[] = "prerecordedSpeech"; -const char supported_diag_modes[] = "supportedDiagModes"; -const char hmi_capabilities[] = "hmiCapabilities"; -const char navigation[] = "navigation"; -const char phone_call[] = "phoneCall"; -const char sdl_version[] = "sdlVersion"; -const char system_software_version[] = "systemSoftwareVersion"; -const char priority[] = "priority"; +extern const char* gps; +extern const char* speed; +extern const char* rpm; +extern const char* fuel_level; +extern const char* fuel_level_state; +extern const char* instant_fuel_consumption; +extern const char* external_temp; +extern const char* vin; +extern const char* prndl; +extern const char* tire_pressure; +extern const char* odometer; +extern const char* belt_status; +extern const char* body_information; +extern const char* device_status; +extern const char* driver_braking; +extern const char* wiper_status; +extern const char* head_lamp_status; +extern const char* engine_torque; +extern const char* acc_pedal_pos; +extern const char* steering_wheel_angle; +extern const char* e_call_info; +extern const char* airbag_status; +extern const char* emergency_event; +extern const char* cluster_mode_status; +extern const char* my_key; +extern const char* help_prompt; +extern const char* scroll_message_body; +extern const char* data_result; +extern const char* dtc_list; +extern const char* interaction_mode; +extern const char* slider_position; +extern const char* system_action; +extern const char* prerecorded_speech; +extern const char* supported_diag_modes; +extern const char* hmi_capabilities; +extern const char* navigation; +extern const char* phone_call; +extern const char* sdl_version; +extern const char* system_software_version; +extern const char* priority; + +// resuming +extern const char* application_commands; +extern const char* application_submenus; +extern const char* application_choice_sets; +extern const char* application_global_properties; +extern const char* application_vehicle_info; +extern const char* application_buttons; +extern const char* application_subscribtions; +extern const char* application_files; +extern const char* application_show; +extern const char* resumption; +extern const char* resume_app_list; +extern const char* last_ign_off_time; + +extern const char* resume_vr_grammars; -//resuming -const char application_commands[] = "applicationCommands"; -const char application_submenus[] = "applicationSubMenus"; -const char application_choise_sets[] = "applicationChoiceSets"; -const char application_global_properties[] = "globalProperties"; -const char application_vehicle_info[] = "vehicleInfo"; -const char application_buttons[] = "buttons"; -const char application_subscribtions[] = "subscribtions"; -const char application_files[] = "applicationFiles"; -const char application_show[] = "applicationShow"; -const char resumption[] = "resumption"; -const char resume_app_list[] = "resume_app_list"; -const char last_ign_off_time[] = "last_ign_off_time"; +extern const char* ign_off_count; -const char resume_vr_grammars[] = "resumeVrGrammars"; +extern const char* connection_info; +extern const char* is_download_complete; -const char ign_off_count[] = "ign_off_count"; -const char suspend_count[] = "suspend_count"; +extern const char* longitude_degrees; +extern const char* latitude_degrees; +extern const char* address; +extern const char* country_name; +extern const char* country_code; +extern const char* postal_code; +extern const char* administrative_area; +extern const char* locality; +extern const char* sub_locality; +extern const char* thoroughfare; +extern const char* sub_thoroughfare; -const char connection_info[] = "connection_info"; -const char is_download_complete[] = "is_download_complete"; +extern const char* hash_id; +extern const char* time_stamp; +extern const char* manual_text_entry; +extern const char* image_type_supported; +extern const char* unexpected_disconnect; +extern const char* location_name; +extern const char* location_description; +extern const char* address_lines; +extern const char* phone_number; +extern const char* number; +extern const char* location_image; +extern const char* is_suscribed; +extern const char* message_data; -const char hash_id[] = "hashID"; -const char time_stamp[] = "timeStamp"; -const char manual_text_entry[] = "manualTextEntry"; -const char image_type_supported[] = "imageTypeSupported"; -const char unexpected_disconnect[] = "unexpectedDisconnect"; -const char location_name[] = "locationName"; -const char location_description[] = "locationDescription"; -const char address_lines[] = "addressLines"; -const char phone_number[] = "phoneNumber"; -const char number[] = "number"; -const char location_image[] = "locationImage"; -const char is_suscribed[] = "isSubscribed"; -const char message_data[] = "messageData"; +extern const char* delivery_mode; } // namespace strings namespace json { -const char appId[] = "appId"; -const char name[] = "name"; -const char ios[] = "ios"; -const char android[] = "android"; -const char appHmiType[] = "appHmiType"; -const char urlScheme[] = "urlScheme"; -const char packageName[] = "packageName"; -const char response[] = "response"; -const char is_media_application[] = "isMediaApplication"; -const char default_[] = "default"; -const char languages[] = "languages"; -const char ttsName[] = "ttsName"; -const char vrSynonyms[] = "vrSynonyms"; -} // namespace json +extern const char* appId; +extern const char* name; +extern const char* ios; +extern const char* android; +extern const char* appHmiType; +extern const char* urlScheme; +extern const char* packageName; +extern const char* response; +extern const char* is_media_application; +extern const char* default_; +extern const char* languages; +extern const char* ttsName; +extern const char* vrSynonyms; +} // namespace json namespace http_request { -const char httpRequest[] = "HTTPRequest"; -const char headers[] = "headers"; -const char content_type[] = "ContentType"; -const char connect_timeout[] = "ConnectTimout"; -const char do_output[] = "DoOutput"; -const char do_input[] = "DoInput"; -const char use_caches[] = "UseCaches"; -const char request_method[] = "RequestMethod"; -const char read_timeout[] = "ReadTimeout"; -const char instance_follow_redirect[] = "InstanceFollowRedirect"; -const char charset[] = "charset"; -const char content_lenght[] = "Content_Lenght"; -const char GET[] = "GET"; -} // http_request +extern const char* httpRequest; +extern const char* headers; +extern const char* content_type; +extern const char* connect_timeout; +extern const char* do_output; +extern const char* do_input; +extern const char* use_caches; +extern const char* request_method; +extern const char* read_timeout; +extern const char* instance_follow_redirect; +extern const char* charset; +extern const char* content_lenght; +extern const char* GET; +} // http_request namespace mobile_notification { -const char state[] = "state"; -const char syncp_timeout[] = "Timeout"; -const char syncp_url[] = "URL"; +extern const char* state; +extern const char* syncp_timeout; +extern const char* syncp_url; } // namespace mobile_notification namespace hmi_levels { -const char kFull[] = "FULL"; -const char kLimited[] = "LIMITED"; -const char kBackground[] = "BACKGROUND"; -const char kNone[] = "NONE"; +extern const char* kFull; +extern const char* kLimited; +extern const char* kBackground; +extern const char* kNone; } namespace hmi_request { -const char parent_id[] = "parentID"; -const char field_name[] = "fieldName"; -const char field_text[] = "fieldText"; -const char alert_strings[] = "alertStrings"; -const char duration[] = "duration"; -const char soft_buttons[] = "softButtons"; -const char tts_chunks[] = "ttsChunks"; -const char speak_type[] = "speakType"; -const char audio_pass_display_texts[] = "audioPassThruDisplayTexts"; -const char max_duration[] = "maxDuration"; -const char reason[] = "reason"; -const char message_text[] = "messageText"; -const char initial_text[] = "initialText"; -const char navi_texts[] = "navigationTexts"; -const char navi_text[] = "navigationText"; -const char show_strings[] = "showStrings"; -const char interaction_layout[] = "interactionLayout"; -const char menu_title[] = "menuTitle"; -const char menu_icon[] = "menuIcon"; -const char keyboard_properties[] = "keyboardProperties"; -const char method_name[] = "methodName"; -const char keyboard_layout[] = "keyboardLayout"; -const char limited_character_list[] = "limitedCharacterList"; -const char auto_complete_text[] = "autoCompleteText"; -const char file[] = "file"; -const char retry[] = "retry"; -const char service[] = "service"; +extern const char* parent_id; +extern const char* field_name; +extern const char* field_text; +extern const char* alert_strings; +extern const char* duration; +extern const char* soft_buttons; +extern const char* tts_chunks; +extern const char* speak_type; +extern const char* audio_pass_display_texts; +extern const char* max_duration; +extern const char* reason; +extern const char* message_text; +extern const char* initial_text; +extern const char* navi_texts; +extern const char* navi_text; +extern const char* show_strings; +extern const char* interaction_layout; +extern const char* menu_title; +extern const char* menu_icon; +extern const char* keyboard_properties; +extern const char* method_name; +extern const char* keyboard_layout; +extern const char* limited_character_list; +extern const char* auto_complete_text; +extern const char* file; +extern const char* retry; +extern const char* service; } // namespace hmi_request namespace hmi_response { -const char code[] = "code"; -const char message[] = "message"; -const char method[] = "method"; -const char try_again_time[] = "tryAgainTime"; -const char custom_button_id[] = "customButtonID"; -const char button_name[] = "name"; -const char button_mode[] = "mode"; -const char attenuated_supported[] = "attenuatedSupported"; -const char languages[] = "languages"; -const char language[] = "language"; -const char display_capabilities[] = "displayCapabilities"; -const char hmi_zone_capabilities[] = "hmiZoneCapabilities"; -const char soft_button_capabilities[] = "softButtonCapabilities"; -const char image_supported[] = "imageSupported"; -const char button_capabilities[] = "buttonCapabilities"; -const char capabilities[] = "capabilities"; -const char speech_capabilities[] = "speechCapabilities"; -const char prerecorded_speech_capabilities[] = "prerecordedSpeechCapabilities"; -const char preset_bank_capabilities[] = "presetBankCapabilities"; -const char allowed[] = "allowed"; -const char vehicle_type[] = "vehicleType"; -const char did_result[] = "didResult"; -const char result_code[] = "resultCode"; -const char dtc[] = "dtc"; -const char ecu_header[] = "ecuHeader"; -const char image_capabilities[] = "imageCapabilities"; -const char display_type[] = "displayType"; -const char text_fields[] = "textFields"; -const char media_clock_formats[] = "mediaClockFormats"; -const char graphic_supported[] = "graphicSupported"; -const char image_fields[] = "imageFields"; -const char templates_available[] = "templatesAvailable"; -const char screen_params[] = "screenParams"; -const char num_custom_presets_available[] = "numCustomPresetsAvailable"; -const char urls[] = "urls"; -const char policy_app_id[] = "policyAppID"; -const char enabled[] = "enabled"; +extern const char* code; +extern const char* message; +extern const char* method; +extern const char* try_again_time; +extern const char* custom_button_id; +extern const char* button_name; +extern const char* button_mode; +extern const char* attenuated_supported; +extern const char* languages; +extern const char* language; +extern const char* display_capabilities; +extern const char* hmi_zone_capabilities; +extern const char* soft_button_capabilities; +extern const char* image_supported; +extern const char* button_capabilities; +extern const char* capabilities; +extern const char* speech_capabilities; +extern const char* prerecorded_speech_capabilities; +extern const char* preset_bank_capabilities; +extern const char* allowed; +extern const char* vehicle_type; +extern const char* did_result; +extern const char* result_code; +extern const char* dtc; +extern const char* ecu_header; +extern const char* image_capabilities; +extern const char* display_type; +extern const char* text_fields; +extern const char* media_clock_formats; +extern const char* graphic_supported; +extern const char* image_fields; +extern const char* templates_available; +extern const char* screen_params; +extern const char* num_custom_presets_available; +extern const char* urls; +extern const char* policy_app_id; +extern const char* enabled; } // namespace hmi_response namespace hmi_notification { -const char prndl[] = "prndl"; -const char file_name[] = "file_name"; -const char system_context[] = "systemContext"; -const char state[] = "state"; -const char result[] = "result"; -const char statistic_type[] = "statisticType"; -const char error[] = "error"; -const char policyfile[] = "policyfile"; -const char is_active[] = "isActive"; +extern const char* prndl; +extern const char* file_name; +extern const char* system_context; +extern const char* state; +extern const char* result; +extern const char* statistic_type; +extern const char* error; +extern const char* policyfile; +extern const char* is_active; +extern const char* is_deactivated; +extern const char* event_name; } // namespace hmi_notification diff --git a/src/components/application_manager/include/application_manager/state_context.h b/src/components/application_manager/include/application_manager/state_context.h deleted file mode 100644 index 94962c23b4..0000000000 --- a/src/components/application_manager/include/application_manager/state_context.h +++ /dev/null @@ -1,75 +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. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTEXT_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTEXT_H_ - -#include <inttypes.h> - -namespace application_manager { -/** -* @brief The StateContext implement acessing to data, that is required by HmiState -*/ -class StateContext { - public: - - /** - * @brief is_navi_app check if app is navi - * @param app_id application id - * @return true if app is navi, otherwise return false - */ - bool is_navi_app(const uint32_t app_id) const; - - /** - * @brief is_meida_app check if app is is meida - * @param app_id application id - * @return @return true if meida_app, otherwise return false - */ - bool is_meida_app(const uint32_t app_id) const; - - /** - * @brief is_voice_comunication_app check if app is voice comunication - * @param app_id application id - * @return @return true if voice_comunication_app, otherwise return false - */ - bool is_voice_comunication_app(const uint32_t app_id) const; - - /** - * @brief is_attenuated_supported check if HMI support attenuated mode - * @return true if supported, otherwise return false - */ - bool is_attenuated_supported() const; -}; - -} -#endif // STATE_CONTEXT_H - diff --git a/src/components/application_manager/include/application_manager/state_controller.h b/src/components/application_manager/include/application_manager/state_controller.h deleted file mode 100644 index a09d11f18e..0000000000 --- a/src/components/application_manager/include/application_manager/state_controller.h +++ /dev/null @@ -1,408 +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. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_ -#include <list> - -#include "application_manager/hmi_state.h" -#include "application_manager/application.h" -#include "event_engine/event_observer.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "application_manager/state_context.h" -#include "utils/lock.h" - -namespace application_manager { -class ApplicationManagerImpl; -class StateController : public event_engine::EventObserver { -public: - StateController(); - - /** - * @brief SetRegularState setup regular hmi state, tha will appear if no - * specific events are active - * @param app appication to setup regular State - * @param state state of new regular state - */ - template <bool SendActivateApp> - void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) { - if (!app) { - return; - } - DCHECK_OR_RETURN_VOID(state); - DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); - - if (SendActivateApp) { - uint32_t corr_id = MessageHelper::SendActivateAppToHMI(app->app_id()); - subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp, - corr_id); - waiting_for_activate[app->app_id()] = state; - } else { - ApplyRegularState(app, state); - } - } - - /** - * @brief SetRegularState Change regular audio state - * @param app appication to setup regular State - * @param audio_state of new regular state - */ - void - SetRegularState(ApplicationSharedPtr app, - const mobile_apis::AudioStreamingState::eType audio_state); - - /** - * @brief SetRegularState Change regular hmi level and audio state - * @param app appication to setup regular State - * @param hmi_level of new regular state - * @param audio_state of new regular state - * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ - template <bool SendActivateApp> - void - SetRegularState(ApplicationSharedPtr app, - const mobile_apis::HMILevel::eType hmi_level, - const mobile_apis::AudioStreamingState::eType audio_state) { - if (!app) { - return; - } - HmiStatePtr prev_regular = app->RegularHmiState(); - DCHECK_OR_RETURN_VOID(prev_regular); - HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), 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_system_context(prev_regular->system_context()); - SetRegularState<SendActivateApp>(app, hmi_state); - } - - /** - * @brief SetRegularState Change regular hmi level - * @param app appication to setup regular State - * @param hmi_level of new regular state - * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ - template <bool SendActivateApp> - void SetRegularState(ApplicationSharedPtr app, - const mobile_apis::HMILevel::eType hmi_level) { - if (!app) { - return; - } - HmiStatePtr prev_regular = app->RegularHmiState(); - DCHECK_OR_RETURN_VOID(prev_regular); - HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); - DCHECK_OR_RETURN_VOID(hmi_state); - hmi_state->set_hmi_level(hmi_level); - hmi_state->set_audio_streaming_state(prev_regular->audio_streaming_state()); - hmi_state->set_system_context(prev_regular->system_context()); - SetRegularState<SendActivateApp>(app, hmi_state); - } - - /** - * @brief SetRegularState Change regular hmi level, audio state and system - * context - * @param app appication to setup regular State - * @param hmi_level of new regular state - * @param audio_state of new regular state - * @param system_context of new regular state - * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ - template <bool SendActivateApp> - void - SetRegularState(ApplicationSharedPtr app, - const mobile_apis::HMILevel::eType hmi_level, - const mobile_apis::AudioStreamingState::eType audio_state, - const mobile_apis::SystemContext::eType system_context) { - if (!app) { - return; - } - - HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), 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_system_context(system_context); - SetRegularState<SendActivateApp>(app, hmi_state); - } - - /** - * @brief SetRegularState Change regular system context - * @param app appication to setup regular State - * @param system_context of new regular state - */ - void SetRegularState(ApplicationSharedPtr app, - const mobile_apis::SystemContext::eType system_context) { - if (!app) { - return; - } - HmiStatePtr prev_regular = app->RegularHmiState(); - DCHECK_OR_RETURN_VOID(prev_regular); - HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); - DCHECK_OR_RETURN_VOID(hmi_state); - hmi_state->set_hmi_level(prev_regular->hmi_level()); - hmi_state->set_audio_streaming_state(prev_regular->audio_streaming_state()); - hmi_state->set_system_context(system_context); - SetRegularState<false>(app, hmi_state); - } - - // EventObserver interface - void on_event(const event_engine::Event &event); - - /** - * @brief Sets default application state and apply currently active HMI states - * on application registration - * @param app application to apply states - * @param default_level default HMI level - */ - virtual void - OnApplicationRegistered(ApplicationSharedPtr app, - const mobile_apis::HMILevel::eType default_level); - - /** - * @brief OnStateChanged send HMIStatusNotification if neded - * @param app application - * @param old_state state before change - * @param new_state state after change - */ - void OnStateChanged(ApplicationSharedPtr app, HmiStatePtr old_state, - HmiStatePtr new_state); - /** - * @brief state_context getter for state_context - * @return - */ - const StateContext &state_context() const { return state_context_; } - - /** - * @brief OnNaviStreamingStarted process Navi streaming started - */ - void OnNaviStreamingStarted(); - - /** - * @brief OnNaviStreamingStopped process Navi streaming stopped - */ - void OnNaviStreamingStopped(); - -private: - /** - * Execute Unary punction for each application - */ - template <typename UnaryFunction, - typename ContextAcessor = ApplicationManagerImpl> - void ForEachApplication(UnaryFunction func) { - using namespace utils; - typename ContextAcessor::ApplicationListAccessor accessor; - typedef typename ContextAcessor::ApplictionSetConstIt Iter; - for (Iter it = accessor.begin(); it != accessor.end(); ++it) { - if (it->valid()) { - ApplicationConstSharedPtr const_app = *it; - func(ContextAcessor::instance()->application(const_app->app_id())); - } - } - } - - /** - * @brief The HmiLevelConflictResolver struct - * Move other application to HmiStates if applied moved to FULL or LIMITED - */ - struct HmiLevelConflictResolver { - ApplicationSharedPtr applied_; - HmiStatePtr state_; - StateController *state_ctrl_; - HmiLevelConflictResolver(ApplicationSharedPtr app, HmiStatePtr state, - StateController *state_ctrl) - : applied_(app), state_(state) {} - void operator()(ApplicationSharedPtr to_resolve); - }; - - /** - * Function to add new temporary HmiState for application - */ - template <HmiState::StateID ID> - void HMIStateStarted(ApplicationSharedPtr app) { - DCHECK_OR_RETURN_VOID(app); - HmiStatePtr old_hmi_state = app->CurrentHmiState(); - HmiStatePtr new_hmi_state = CreateHmiState(app->app_id(), ID); - DCHECK_OR_RETURN_VOID(new_hmi_state); - DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() != - HmiState::STATE_ID_REGULAR); - new_hmi_state->set_parent(old_hmi_state); - app->AddHMIState(new_hmi_state); - OnStateChanged(app, old_hmi_state, new_hmi_state); - } - - /** - * @brief TempStateStarted add HMI State ID in StateController collection - * @param ID state identifier - */ - void TempStateStarted(HmiState::StateID ID); - - /** - * @brief TempStateStopped remove HMI State ID from StateController collection - * @param ID state identifier - */ - void TempStateStopped(HmiState::StateID ID); - - /** - * Function to remove temporary HmiState for application - */ - template <HmiState::StateID ID> - void HMIStateStopped(ApplicationSharedPtr app) { - DCHECK_OR_RETURN_VOID(app); - HmiStatePtr cur = app->CurrentHmiState(); - HmiStatePtr old_hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); - DCHECK_OR_RETURN_VOID(old_hmi_state); - old_hmi_state->set_hmi_level(cur->hmi_level()); - old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state()); - old_hmi_state->set_system_context(cur->system_context()); - app->RemoveHMIState(ID); - HmiStatePtr new_hmi_state = app->CurrentHmiState(); - OnStateChanged(app, old_hmi_state, new_hmi_state); - } - - /** - * @brief ApplyRegularState setup regular hmi state, that will appear if no - * specific events are active, without sending ActivateApp - * @param app appication to setup default State - * @param state state of new defailt state - */ - void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state); - - /** - * @brief SetupRegularHmiState set regular HMI State without - * resolwing conflicts and ActivateApp request - * @param app application - * @param state hmi_state to setup - */ - void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state); - - /** - * @brief IsSameAppType checkis if apps has same types - * @param app1 - * @param app2 - * @return true if aps have same types, otherwise return false - */ - bool IsSameAppType(ApplicationConstSharedPtr app1, - ApplicationConstSharedPtr app2); - - /** - * @brief SetupRegularHmiState set regular HMI State without - * resolwing conflicts and ActivateApp request - * @param app application - * @param hmi_level of new regular state - * @param audio_state of new regular state - * @param system_context of new regular state - */ - void SetupRegularHmiState( - ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const mobile_apis::AudioStreamingState::eType audio_state, - const mobile_apis::SystemContext::eType system_context); - - /** - * @brief SetupRegularHmiState set regular HMI State without - * resolwing conflicts and ActivateApp request - * @param app application - * @param hmi_level of new regular state - * @param audio_state of new regular state - */ - void SetupRegularHmiState( - ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const mobile_apis::AudioStreamingState::eType audio_state); - - /** - * @brief OnActivateAppResponse calback for activate app response - * @param message Smart Object - */ - void OnActivateAppResponse(const smart_objects::SmartObject &message); - - /** - * @brief OnPhoneCallStarted process Phone Call Started event - */ - void OnPhoneCallStarted(); - - /** - * @brief OnPhoneCallEnded process Phone Call Ended event - */ - void OnPhoneCallEnded(); - - /** - * @brief OnSafetyModeEnabled process Safety Mode Enable event - */ - void OnSafetyModeEnabled(); - - /** - * @brief OnSafetyModeDisabled process Safety Mode Disable event - */ - void OnSafetyModeDisabled(); - - /** - * @brief OnVRStarted process VR session started - */ - void OnVRStarted(); - - /** - * @brief OnVREnded process VR session ended - */ - void OnVREnded(); - /** - * @brief OnTTSStarted process TTS session started - */ - void OnTTSStarted(); - - /** - * @brief OnTTSEnded process TTS session ended - */ - void OnTTSStopped(); - - /** - * @brief CreateHmiState creates Hmi state according to state_id - * @param app_id application ID - * @param state_id state id - * @return - */ - HmiStatePtr CreateHmiState(uint32_t app_id, HmiState::StateID state_id); - - mobile_apis::AudioStreamingState::eType - CalcAudioState(ApplicationSharedPtr app, - const mobile_apis::HMILevel::eType hmi_level) const; - - typedef std::list<HmiState::StateID> StateIDList; - StateIDList active_states_; - sync_primitives::Lock active_states_lock_; - std::map<uint32_t, HmiStatePtr> waiting_for_activate; - StateContext state_context_; -}; -} - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_ diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h new file mode 100644 index 0000000000..f2f9fb39a4 --- /dev/null +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -0,0 +1,448 @@ +/* + * 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. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_IMPL_H_ +#include <list> + +#include "application_manager/hmi_state.h" +#include "application_manager/application.h" +#include "application_manager/application_manager.h" +#include "event_engine/event_observer.h" +#include "application_manager/state_controller.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" +#include "utils/lock.h" +#include "utils/helpers.h" + +namespace application_manager { + +class StateControllerImpl : public event_engine::EventObserver, + public StateController { + public: + explicit StateControllerImpl(ApplicationManager& app_mngr); + + /** + * @brief SetRegularState setup regular hmi state, that will appear if + * no specific events are active + * @param app appication to setup regular State + * @param state state of new regular state + */ + + virtual void SetRegularState(ApplicationSharedPtr app, + HmiStatePtr state, + const bool SendActivateApp); + + /** + * @brief SetRegularState Change regular hmi level and audio state + * @param app appication to setup regular State + * @param hmi_level of new regular state + * @param audio_state of new regular state + * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ + + virtual void SetRegularState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state, + const bool SendActivateApp); + + /** + * @brief SetRegularState Change regular hmi level + * @param app appication to setup regular State + * @param hmi_level of new regular state + * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI + */ + virtual void SetRegularState(ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level, + const bool SendActivateApp); + + /** + * @brief SetRegularState Change regular hmi level, audio state and system + * context + * @param app appication to setup regular State + * @param hmi_level of new regular state + * @param audio_state of new regular state + * @param system_context of new regular state + * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */ + + virtual void SetRegularState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::SystemContext::eType system_context, + const bool SendActivateApp); + + /** + * @brief SetRegularState Sets regular state with new hmi level + * to application + * @param app appication to setup regular state + * @param hmi_level new hmi level for application + */ + virtual void SetRegularState(ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level); + + /** + * @brief SetRegularState Change regular audio state + * @param app appication to setup regular State + * @param audio_state of new regular state + */ + virtual void SetRegularState( + ApplicationSharedPtr app, + const mobile_apis::AudioStreamingState::eType audio_state); + + /** + * @brief SetRegularState Change regular system context + * @param app appication to setup regular State + * @param system_context of new regular state + */ + virtual void SetRegularState( + ApplicationSharedPtr app, + const mobile_apis::SystemContext::eType system_context); + + /** + * @brief SetRegularState Sets new regular state to application + * @param app appication to setup regular state + * @param state new hmi state for application + */ + virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state); + + // EventObserver interface + void on_event(const event_engine::Event& event); + + /** + * @brief Sets default application state and apply currently active HMI states + * on application registration + * @param app application to apply states + * @param default_level default HMI level + */ + virtual void OnApplicationRegistered( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType default_level); + + /** + * @brief OnNaviStreamingStarted process Navi streaming started + */ + virtual void OnNaviStreamingStarted(); + + /** + * @brief OnNaviStreamingStopped process Navi streaming stopped + */ + virtual void OnNaviStreamingStopped(); + + /** + * @brief OnStateChanged send HMIStatusNotification if neded + * @param app application + * @param old_state state before change + * @param new_state state after change + */ + virtual void OnStateChanged(ApplicationSharedPtr app, + HmiStatePtr old_state, + HmiStatePtr new_state); + + /** + * @brief Checks activity of Deactivate HMI state. + * @return Returns TRUE if deactivate HMI state is active, otherwise returns + * FALSE. + */ + virtual bool IsStateActive(HmiState::StateID state_id) const; + + private: + int64_t SendBCActivateApp(ApplicationConstSharedPtr app, + hmi_apis::Common_HMILevel::eType level, + bool send_policy_priority); + /** + * @brief The HmiLevelConflictResolver struct + * Move other application to HmiStates if applied moved to FULL or LIMITED + */ + struct HmiLevelConflictResolver { + ApplicationSharedPtr applied_; + HmiStatePtr state_; + StateControllerImpl* state_ctrl_; + HmiLevelConflictResolver(ApplicationSharedPtr app, + HmiStatePtr state, + StateControllerImpl* state_ctrl) + : applied_(app), state_(state), state_ctrl_(state_ctrl) {} + void operator()(ApplicationSharedPtr to_resolve); + }; + + template <typename UnaryFunction> + void ForEachApplication(UnaryFunction func) const { + DataAccessor<ApplicationSet> accessor = app_mngr_.applications(); + ApplicationSet::iterator it = accessor.GetData().begin(); + for (; it != accessor.GetData().end(); ++it) { + ApplicationConstSharedPtr const_app = *it; + if (const_app) { + func(app_mngr_.application(const_app->app_id())); + } + } + } + + /** + * @brief ResolveHmiState Checks if requested hmi state is + * allowed by current states context and correct it if it possible + * + * @param app application to apply state + * + * @param state state to be checked + * + * @return Resolved hmi state or empty pointer in case requested + * hmi state is not allowed + */ + HmiStatePtr ResolveHmiState(ApplicationSharedPtr app, + HmiStatePtr state) const; + + /** + * @brief IsResumptionAllowed checks, if app is allowed to be resumed in + * current state + * @param app Application + * @param state State to be checked + * @return true, if app is allowed to be resumed, otherwise - false + */ + bool IsResumptionAllowed(ApplicationSharedPtr app, HmiStatePtr state) const; + + /** + * @brief GetAvailableHmiLevel Returns closest to requested + * available hmi level for application + * + * @param app application to apply state + * + * @param hmi_level requested hmi level + * + * @return Resolved hmi state or empty pointer in case requested + * hmi state is not allowed + */ + mobile_apis::HMILevel::eType GetAvailableHmiLevel( + ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const; + + /** + * @brief IsStateAvailable Checks if hmi state is available + * to apply for specified application + * + * @param app application to apply state + * + * @param state state to be checked + * + * @return true if state is available, false otherwise + */ + bool IsStateAvailable(ApplicationSharedPtr app, HmiStatePtr state) const; + + /** + * @brief IsStateAvailableForResumption Checks if hmi state is available + * to apply for specified application during resumption + * + * @param app application to apply state + * + * @param state state to be checked + * + * @return true if state is available, false otherwise + */ + bool IsStateAvailableForResumption(ApplicationSharedPtr app, + HmiStatePtr state) const; + + /** + * @brief ApplyPostponedStateForApp tries to apply postponed state + * to application if it's allowed by current active states + */ + void ApplyPostponedStateForApp(ApplicationSharedPtr app); + + /** + * @brief IsTempStateActive Checks if specified temp state + * is currently active + * + * @return true if state is active, false otherwise + */ + bool IsTempStateActive(HmiState::StateID ID) const; + + /** + * Function to add new temporary HmiState for application + */ + template <HmiState::StateID ID> + void HMIStateStarted(ApplicationSharedPtr app) { + DCHECK_OR_RETURN_VOID(app); + HmiStatePtr old_hmi_state = app->CurrentHmiState(); + HmiStatePtr new_hmi_state = CreateHmiState(app->app_id(), ID); + DCHECK_OR_RETURN_VOID(new_hmi_state); + DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() != + HmiState::STATE_ID_REGULAR); + new_hmi_state->set_parent(old_hmi_state); + app->AddHMIState(new_hmi_state); + OnStateChanged(app, old_hmi_state, new_hmi_state); + } + + /** + * @brief TempStateStarted add HMI State ID in StateControllerImpl collection + * @param ID state identifier + */ + void TempStateStarted(HmiState::StateID ID); + + /** + * @brief TempStateStopped remove HMI State ID from StateControllerImpl + * collection + * @param ID state identifier + */ + void TempStateStopped(HmiState::StateID ID); + + /** + * @brief Sets BACKGROUND or LIMITED hmi level to application + * depends on application type + * @param app Application to deactivate + */ + void DeactivateApp(ApplicationSharedPtr app); + + /** + * Function to remove temporary HmiState for application + */ + template <HmiState::StateID ID> + void HMIStateStopped(ApplicationSharedPtr app) { + DCHECK_OR_RETURN_VOID(app); + HmiStatePtr cur = app->CurrentHmiState(); + HmiStatePtr old_hmi_state = + CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + DCHECK_OR_RETURN_VOID(old_hmi_state); + old_hmi_state->set_hmi_level(cur->hmi_level()); + old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state()); + old_hmi_state->set_system_context(cur->system_context()); + app->RemoveHMIState(ID); + HmiStatePtr new_hmi_state = app->CurrentHmiState(); + OnStateChanged(app, old_hmi_state, new_hmi_state); + } + + /** + * @brief ApplyRegularState setup regular hmi state, that will appear if no + * specific events are active, without sending ActivateApp + * @param app appication to setup default State + * @param state state of new defailt state + */ + void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state); + + /** + * @brief SetupRegularHmiState set regular HMI State without + * resolving conflicts and ActivateApp request + * @param app application + * @param state hmi_state to setup + */ + void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state); + + /** + * @brief IsSameAppType checks if apps has same types + * @param app1 + * @param app2 + * @return true if aps have same types, otherwise return false + */ + bool IsSameAppType(ApplicationConstSharedPtr app1, + ApplicationConstSharedPtr app2); + + /** + * @brief SetupRegularHmiState set regular HMI State without + * resolving conflicts and ActivateApp request + * @param app application + * @param hmi_level of new regular state + * @param audio_state of new regular state + * @param system_context of new regular state + */ + void SetupRegularHmiState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::SystemContext::eType system_context); + + /** + * @brief SetupRegularHmiState set regular HMI State without + * resolving conflicts and ActivateApp request + * @param app application + * @param hmi_level of new regular state + * @param audio_state of new regular state + */ + void SetupRegularHmiState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level, + const mobile_apis::AudioStreamingState::eType audio_state); + + /** + * @brief OnActivateAppResponse calback for activate app response + * @param message Smart Object + */ + void OnActivateAppResponse(const smart_objects::SmartObject& message); + + /** + * @brief OnAppDeactivated callback for OnAppDeactivated notification + * @param message Smart Object + */ + void OnAppDeactivated(const smart_objects::SmartObject& message); + + /** + * @brief OnAppActivated callback for OnAppActivated notification + * @param message Smart Object + */ + void OnAppActivated(const smart_objects::SmartObject& message); + + /** + * @brief Apply temporary state + */ + template <HmiState::StateID ID> + void ApplyTempState() { + ForEachApplication(std::bind1st( + std::mem_fun(&StateControllerImpl::HMIStateStarted<ID>), this)); + TempStateStarted(ID); + } + + /** + * @brief Cancel temporary state + */ + template <HmiState::StateID ID> + void CancelTempState() { + ForEachApplication(std::bind1st( + std::mem_fun(&StateControllerImpl::HMIStateStopped<ID>), this)); + TempStateStopped(ID); + } + + /** + * @brief CreateHmiState creates Hmi state according to state_id + * @param app_id application ID + * @param state_id state id + * @return + */ + HmiStatePtr CreateHmiState(uint32_t app_id, HmiState::StateID state_id) const; + + mobile_apis::AudioStreamingState::eType CalcAudioState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level) const; + + typedef std::list<HmiState::StateID> StateIDList; + StateIDList active_states_; + mutable sync_primitives::Lock active_states_lock_; + std::map<uint32_t, HmiStatePtr> waiting_for_activate; + ApplicationManager& app_mngr_; +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/time_metric_observer.h b/src/components/application_manager/include/application_manager/telemetry_observer.h index de3deb8372..ab995fcf91 100644 --- a/src/components/application_manager/include/application_manager/time_metric_observer.h +++ b/src/components/application_manager/include/application_manager/telemetry_observer.h @@ -33,7 +33,6 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TIME_METRIC_OBSERVER_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TIME_METRIC_OBSERVER_H_ - #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "json/json.h" @@ -43,7 +42,7 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; namespace application_manager { -class AMMetricObserver { +class AMTelemetryObserver { public: struct MessageMetric { TimevalStruct begin; @@ -53,7 +52,7 @@ class AMMetricObserver { typedef utils::SharedPtr<MessageMetric> MessageMetricSharedPtr; virtual void OnMessage(MessageMetricSharedPtr) = 0; - virtual ~AMMetricObserver(){} + virtual ~AMTelemetryObserver() {} }; } // application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_ diff --git a/src/components/application_manager/include/application_manager/usage_statistics.h b/src/components/application_manager/include/application_manager/usage_statistics.h index d6ff1f2c49..b84c820a60 100644 --- a/src/components/application_manager/include/application_manager/usage_statistics.h +++ b/src/components/application_manager/include/application_manager/usage_statistics.h @@ -34,16 +34,24 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_ #include <string> -#include "usage_statistics/counter.h" +#include <memory> +#include "policy/usage_statistics/counter.h" +#include "policy/usage_statistics/app_stopwatch.h" +#include "utils/macro.h" +#include "utils/shared_ptr.h" #include "interfaces/MOBILE_API.h" namespace application_manager { class UsageStatistics { public: - UsageStatistics(const std::string& app_id, - utils::SharedPtr<usage_statistics::StatisticsManager> - statistics_manager); + UsageStatistics( + const std::string& app_id, + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager); + UsageStatistics( + const std::string& app_id, + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + usage_statistics::AppStopwatch* time_in_hmi_state_ptr); void RecordHmiStateChanged(mobile_apis::HMILevel::eType new_hmi_level); void RecordAppRegistrationGuiLanguage( mobile_apis::Language::eType gui_language); @@ -54,9 +62,10 @@ class UsageStatistics { void RecordAppUserSelection(); void RecordRunAttemptsWhileRevoked(); void RecordRemovalsForBadBehavior(); + void RecordTLSError(); private: - usage_statistics::AppStopwatch time_in_hmi_state_; + std::auto_ptr<usage_statistics::AppStopwatch> time_in_hmi_state_sptr_; usage_statistics::AppInfo app_registration_language_gui_; usage_statistics::AppInfo app_registration_language_vui_; usage_statistics::AppCounter count_of_rejected_rpc_calls_; @@ -64,6 +73,8 @@ class UsageStatistics { usage_statistics::AppCounter count_of_user_selections_; usage_statistics::AppCounter count_of_run_attempts_while_revoked_; usage_statistics::AppCounter count_of_removals_for_bad_behavior_; + usage_statistics::AppCounter count_of_tls_error_; + DISALLOW_COPY_AND_ASSIGN(UsageStatistics); }; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/vehicle_info_data.h b/src/components/application_manager/include/application_manager/vehicle_info_data.h index 0cac4fd8f9..390a1707c8 100644 --- a/src/components/application_manager/include/application_manager/vehicle_info_data.h +++ b/src/components/application_manager/include/application_manager/vehicle_info_data.h @@ -34,10 +34,10 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_ namespace application_manager { - /* - * @brief Typedef for the vehicle data types that can - * be published and subscribed to - */ +/* +*@brief Typedef for the vehicle data types that can +*be published and subscribed to +*/ enum VehicleDataType { GPS = 0, SPEED, |