diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/resume_ctrl.h')
-rw-r--r-- | src/components/application_manager/include/application_manager/resume_ctrl.h | 135 |
1 files changed, 129 insertions, 6 deletions
diff --git a/src/components/application_manager/include/application_manager/resume_ctrl.h b/src/components/application_manager/include/application_manager/resume_ctrl.h index 463df0b867..9d03fb0577 100644 --- a/src/components/application_manager/include/application_manager/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resume_ctrl.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -137,6 +137,7 @@ class ResumeCtrl: public event_engine::EventObserver { */ void IgnitionOff(); + /** * @brief Start timer for resumption applications * Restore D1-D5 data @@ -192,13 +193,27 @@ class ResumeCtrl: public event_engine::EventObserver { uint32_t GetHMIApplicationID(const std::string& mobile_app_id); /** - * @brief Timer callback function + * @brief Timer callback for restoring HMI Level * */ - void onTimer(); + void ApplicationResumptiOnTimer(); + + + /** + * @brief SaveDataOnTimer : + * Timer callback for persisting ResumptionData each N seconds + * N gets from property + */ + void SaveDataOnTimer(); void ClearResumptionInfo(); + void ApplicationsDataUpdated() { + is_data_saved = false; + } + + void RestoreHmiLevel(uint32_t time_stamp, ApplicationSharedPtr application); + private: typedef std::pair<uint32_t, uint32_t> application_timestamp; @@ -260,10 +275,115 @@ class ResumeCtrl: public event_engine::EventObserver { NsSmartDeviceLink::NsSmartObjects::SmartObject* 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 Time step to check resumption TIME_OUT + * @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 std::vector<smart_objects::SmartObject*> & 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. */ - static const uint32_t kTimeStep = 3; + Json::Value& GetFromSavedOrAppend(const std::string& mobile_app_id); + + /** + * @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); + + 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. @@ -278,7 +398,10 @@ class ResumeCtrl: public event_engine::EventObserver { std::multiset<application_timestamp, TimeStampComparator> waiting_for_timer_; mutable sync_primitives::Lock queue_lock_; ApplicationManagerImpl* app_mngr_; - timer::TimerThread<ResumeCtrl> timer_; + timer::TimerThread<ResumeCtrl> restore_hmi_level_timer_; + timer::TimerThread<ResumeCtrl> save_persistent_data_timer_; + bool is_data_saved; + }; } // namespace application_manager |