diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/message_helper.h')
-rw-r--r-- | src/components/application_manager/include/application_manager/message_helper.h | 103 |
1 files changed, 54 insertions, 49 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 9797442e34..9cfb504b00 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -273,52 +273,46 @@ class MessageHelper { const std::string& path_to_icon, uint32_t app_id); /** - * @brief Sends button subscription notification - * @param app_id Application ID - * @param button Enum with button name - * @param is_subscribed true if subscribed, false otherwise + * @brief Creates button subscription requests for buttons + * that application is subscribed on + * @param app application to be subscribed for button + * @param button_subscriptions collection of subscribed buttons + * @param function_id function ID * @param app_mngr reference to application manager + * @return list of all buttons subscription requests ready to be sent to hmi + * @note for every button separate request is created in the list */ - static void SendOnButtonSubscriptionNotification( - const uint32_t app_id, - const hmi_apis::Common_ButtonName::eType button, - const bool is_subscribed, + static smart_objects::SmartObjectList + CreateButtonSubscriptionsHandlingRequestsList( + ApplicationConstSharedPtr app, + const ButtonSubscriptions& button_subscriptions, + const hmi_apis::FunctionID::eType function_id, ApplicationManager& app_mngr); /** - * @brief Creates button subscription notification - * @param app_id Application ID - * @param button Enum with button name - * @param is_subscribed true if subscribed, false otherwise - * @return notification message in SmartObject format - */ - static smart_objects::SmartObjectSPtr CreateOnButtonSubscriptionNotification( - const uint32_t app_id, - const hmi_apis::Common_ButtonName::eType button, - const bool is_subscribed); - - /** - * @brief Sends button subscription notifications for all buttons - * that application is subscribed on + * @brief Creates button subscription request to mobile * @param app shared pointer to application instance - * @param app_mngr reference to application manager + * @param source_message source message + * @return Smart object with fulfilled request */ - static void SendAllOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + static smart_objects::SmartObjectSPtr CreateButtonNotificationToMobile( + ApplicationSharedPtr app, + const smart_objects::SmartObject& source_message); /** - * @brief Creates button subscription notifications for buttons - * that application is subscribed on - * @param app shared pointer to application instance + * @brief Creates button subscription request to hmi + * @param app_id id of application for which request should be created + * @param button_name button to be subscribed + * @param function_id function ID * @param app_mngr reference to application manager - * @param button_subscriptions collection of subscribed buttons - * @return list of notification messages in SmartObject format + * @return Smart object with fulfilled request */ - static smart_objects::SmartObjectList - CreateOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, - ApplicationManager& app_mngr, - const ButtonSubscriptions& button_subscriptions); + static smart_objects::SmartObjectSPtr + CreateButtonSubscriptionHandlingRequestToHmi( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button_name, + const hmi_apis::FunctionID::eType function_id, + ApplicationManager& app_mngr); static void SendAppDataToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_man); @@ -490,18 +484,22 @@ class MessageHelper { * @param permissions Array of groups permissions * @param external_consent_status External user consent status * @param correlation_id Correlation id of request + * @param app_mngr ApplicationManager instance + * @param success_flag Indication that we were able to collect permissions */ #ifdef EXTERNAL_PROPRIETARY_MODE static void SendGetListOfPermissionsResponse( const std::vector<policy::FunctionalGroupPermission>& permissions, const policy::ExternalConsentStatus& external_consent_status, const uint32_t correlation_id, - ApplicationManager& app_mngr); + ApplicationManager& app_mngr, + const bool success_flag = true); #else static void SendGetListOfPermissionsResponse( const std::vector<policy::FunctionalGroupPermission>& permissions, const uint32_t correlation_id, - ApplicationManager& app_mngr); + ApplicationManager& app_mngr, + const bool success_flag = true); #endif // EXTERNAL_PROPRIETARY_MODE /** @@ -989,18 +987,6 @@ class MessageHelper { ApplicationManager& app_mngr); /** - * @brief SendUnsubscribeButtonNotification sends notification to HMI to - * remove button subscription for application - * @param button Button type - * @param application Application to unsubscribe - * @param app_mngr Application manager - */ - static void SendUnsubscribeButtonNotification( - mobile_apis::ButtonName::eType button, - ApplicationSharedPtr application, - ApplicationManager& app_mngr); - - /** * @brief Sends HMI status notification to mobile * @param application application with changed HMI status * @param window_id id of affected window @@ -1109,6 +1095,25 @@ class MessageHelper { ApplicationManager& app_mngr, const WindowID window_id); + /** + * @brief Recursively removes empty parameters of composite type from message + * @param msg_params smart object containing message params + * @return amount of empty parameters removed + */ + static uint16_t RemoveEmptyMessageParams( + smart_objects::SmartObject& msg_params); + + /** + * @brief AddDefaultParamsToTireStatus adds missing default sub-params to + * tirePressure param, if version of related application requires presence of + * all sub-params in response + * @param application shared pointer to related application + * @param response_from_hmi reference to response from HMI + */ + static void AddDefaultParamsToTireStatus( + ApplicationSharedPtr application, + smart_objects::SmartObject& response_from_hmi); + private: /** * @brief Allows to fill SO according to the current permissions. |