diff options
author | Andriy Byzhynar <abyzhynar@luxoft.com> | 2019-07-12 13:05:32 +0300 |
---|---|---|
committer | Andriy Byzhynar (GitHub) <AByzhynar@luxoft.com> | 2019-08-20 21:17:13 +0300 |
commit | 7a85545717b20be1f778435bda3fd88b028dbd23 (patch) | |
tree | 89f6189ec540a6be4d7cb8771084240561a93f36 /src/components/application_manager/include | |
parent | 1301602d1111ae05080eaa8772ee166a07077023 (diff) | |
download | sdl_core-7a85545717b20be1f778435bda3fd88b028dbd23.tar.gz |
Implement Resumption for widgets
Implemented resumption for widget support
Updated unit tests for data resumption
Diffstat (limited to 'src/components/application_manager/include')
4 files changed, 93 insertions, 2 deletions
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 00c365d334..93901f03e4 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -303,6 +303,30 @@ class MessageHelper { const uint32_t app_id, ApplicationManager& app_mngr); + /** + * @brief Creates UI.CreateWindow request + * @param application application instance + * @param app_mngr reference to application manager + * @param windows_info smart object containing saved windows info + * @return smart object with UI.CreateWindow request + */ + static smart_objects::SmartObjectSPtr CreateUICreateWindowRequestToHMI( + ApplicationSharedPtr application, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& window_info); + + /** + * @brief Creates UI.CreateWindow requests + * @param application application instance + * @param app_mngr reference to application manager + * @param windows_info smart object containing saved windows info + * @return list of smart objects with UI.CreateWindow requests + */ + static smart_objects::SmartObjectList CreateUICreateWindowRequestsToHMI( + application_manager::ApplicationSharedPtr application, + ApplicationManager& app_mngr, + const smart_objects::SmartObject& windows_info); + /* * @brief Create Common.DeviceInfo struct from device handle * @param device_handle device handle of the app @@ -712,6 +736,15 @@ class MessageHelper { */ static bool PrintSmartObject(const smart_objects::SmartObject& object); + /** + * @brief Extract window unique ID from message, this id is used for identify + * the window + * @param s_map contains application's window id + * @return window id from current message + */ + static WindowID ExtractWindowIdFromSmartObject( + const smart_objects::SmartObject& s_map); + template <typename From, typename To> static To ConvertEnumAPINoCheck(const From& input) { return static_cast<To>(input); 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 index 0b744eec7f..6b64fcdb6e 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -81,6 +81,13 @@ class ResumeCtrl { application_manager::ApplicationSharedPtr application) = 0; /** + * @brief Restore widgets HMI level on the resumption response from HMI + * @param response_message smart_object with HMI message + */ + virtual void RestoreWidgetsHMIState( + const smart_objects::SmartObject& response_message) = 0; + + /** * @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 @@ -103,6 +110,16 @@ class ResumeCtrl { bool check_policy = true) = 0; /** + * @brief RestoreAppWidgets add widgets for the application + * @param application application which will be resumed + * @param saved_app application specific section from backup file + * @return true if widgets resumed successfully otherwise - false + */ + virtual void RestoreAppWidgets( + application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app) = 0; + + /** * @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 diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h index a70e2453de..532e04b828 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h @@ -95,6 +95,9 @@ class ResumeCtrlImpl : public ResumeCtrl, */ bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application) OVERRIDE; + void RestoreWidgetsHMIState( + const smart_objects::SmartObject& response_message) OVERRIDE; + /** * @brief Set application HMI Level as stored in policy * @param application is application witch HMI Level is need to setup @@ -117,6 +120,14 @@ class ResumeCtrlImpl : public ResumeCtrl, bool check_policy = true) OVERRIDE; /** + * @brief RestoreAppWidgets add widgets for the application + * @param application application which will be resumed + * @param saved_app application specific section from backup file + */ + void RestoreAppWidgets(application_manager::ApplicationSharedPtr application, + const smart_objects::SmartObject& saved_app) OVERRIDE; + + /** * @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 @@ -609,6 +620,13 @@ class ResumeCtrlImpl : public ResumeCtrl, time_t wake_up_time_; std::shared_ptr<ResumptionData> resumption_storage_; application_manager::ApplicationManager& application_manager_; + /** + *@brief Mapping correlation id to request + *wait for on event response from HMI to resume HMI Level + */ + typedef std::map<int32_t, smart_objects::SmartObjectSPtr> + WaitingResponseToRequest; + WaitingResponseToRequest requests_msg_; }; } // namespace resumption 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 index 7db7a09cb4..d1dada345c 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h @@ -1,5 +1,5 @@ -/* - * Copyright (c) 2015, Ford Motor Company +/* + * Copyright (c) 2019, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -256,6 +256,14 @@ class ResumptionData { app_mngr::ApplicationConstSharedPtr application) const; /** + * @brief Retrieves of windows info from list of available window + * @param application contains list of available windows + * @return windows info from list of available window + */ + smart_objects::SmartObject GetApplicationWidgetsInfo( + 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 @@ -264,6 +272,21 @@ class ResumptionData { const smart_objects::SmartObject* ptr) const; /** + * @brief creates smart object containing window info + * @param window_id window id + * @param window_type window type + * @param window_name window name + * @param window_optional_params_map collection containing optional params for + * creating window + * @return smart object with window data + */ + smart_objects::SmartObject CreateWindowInfoSO( + const application_manager::WindowID window_id, + const mobile_apis::WindowType::eType window_type, + const application_manager::WindowParamsMap& window_optional_params_map) + 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 |