diff options
author | JackLivio <jack@livio.io> | 2018-10-19 15:05:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 15:05:09 -0400 |
commit | d36316738785c96dab2ee892762ed08c059fffde (patch) | |
tree | 168a7c0705b5bc8f0dee7ce4b511ccf71759d9b4 /src/components/application_manager/include/application_manager/message_helper.h | |
parent | 7f7fcbb998fb17f2954fd103349af67ea9b71a3f (diff) | |
parent | 83c5e805346d55ec7fb9f4ba8b6f6855d992273e (diff) | |
download | sdl_core-d36316738785c96dab2ee892762ed08c059fffde.tar.gz |
Merge pull request #2572 from smartdevicelink/release/5.0.05.0.0hotfix/templates_updatesfeature/show_app_menufeature/progress_bar_seekfeature/open-menu-rpcfeature/open-menu-rfeature/button
Release 5.0.0
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 | 145 |
1 files changed, 110 insertions, 35 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 fc84538dae..609b240301 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -2,6 +2,9 @@ Copyright (c) 2015, Ford Motor Company All rights reserved. + Copyright (c) 2017, Livio, Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -47,6 +50,7 @@ #include "application_manager/policies/policy_handler_interface.h" #include "smart_objects/smart_object.h" #include "transport_manager/common.h" +#include <application_manager/smart_object_keys.h> namespace policy { class PolicyHandlerInterface; @@ -69,7 +73,23 @@ typedef std::map<std::string, mobile_apis::VehicleDataType::eType> VehicleData; class MessageHelper { public: /** - * @brief Creates request for different interfaces(JSON, DBUS) + * @brief CreateNotification creates basic mobile notification smart object + * @param function_id Notification function ID + * @param app_id application to send notification + * @return basic mobile notification smart object + */ + static smart_objects::SmartObjectSPtr CreateNotification( + mobile_apis::FunctionID::eType function_id, uint32_t app_id); + /** + * @brief CreateHMINotification creates basic hmi notification smart object + * @param function_id Notification function ID + * @return basic hmi notification smart object + */ + static smart_objects::SmartObjectSPtr CreateHMINotification( + hmi_apis::FunctionID::eType function_id); + + /** + * @brief Creates request for different interfaces(JSON) * @param correlation_id unique ID * @param params Vector of arguments that we need in GetVehicleData request * (e.g. gps, odometer, fuel_level) @@ -104,6 +124,15 @@ class MessageHelper { static void SendDecryptCertificateToHMI(const std::string& file_name, ApplicationManager& app_mngr); + /** + * @brief SendGetSystemTimeRequest sends mentioned request to HMI. + * @param correlation_id the message correlation id, required for proper + * response processing. + * @param app_mngr + */ + static void SendGetSystemTimeRequest(const uint32_t correlation_id, + ApplicationManager& app_mngr); + /* * @brief Retrieve vehicle data map for param name in mobile request * to VehicleDataType @@ -215,18 +244,6 @@ class MessageHelper { 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( @@ -286,6 +303,24 @@ class MessageHelper { ApplicationManager& app_mngr); /* + * @brief Create Common.DeviceInfo struct from device handle + * @param device_handle device handle of the app + * @param session_observer instance of SessionObserver to retrieve device + * information + * @param policy_handler instance of PolicyHandlerInterface to get the value + * of 'isSDLAllowed' + * @param app_mngr instance of ApplicationManager + * @param output smart object to store created Common.DeviceInfo struct + * @return true on success, false otherwise + */ + static bool CreateDeviceInfo( + connection_handler::DeviceHandle device_handle, + const protocol_handler::SessionObserver& session_observer, + const policy::PolicyHandlerInterface& policy_handler, + ApplicationManager& app_mngr, + smart_objects::SmartObject* output); + + /* * @brief Create Common.HMIApplication struct application instance * @param app : applicaton instace * @param output smart object to store Common.HMIApplication struct @@ -313,7 +348,7 @@ class MessageHelper { bool is_unexpected_disconnect, ApplicationManager& app_mngr); - static NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr + static ns_smart_device_link::ns_smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI( ApplicationConstSharedPtr app, const protocol_handler::SessionObserver& session_observer, @@ -425,7 +460,7 @@ class MessageHelper { static void SendSystemRequestNotification( uint32_t connection_key, - NsSmartDeviceLink::NsSmartObjects::SmartObject& content, + ns_smart_device_link::ns_smart_objects::SmartObject& content, ApplicationManager& app_mngr); /** @@ -533,7 +568,7 @@ class MessageHelper { /** * @brief Sends UnsubscribeWayPoints request - * @return true if UnSubscribedWayPoints is send otherwise false + * @return true if UnsubscribedWayPoints is send otherwise false */ static bool SendUnsubscribedWayPoints(ApplicationManager& app_mngr); @@ -544,16 +579,46 @@ class MessageHelper { int32_t result_code); /** + * @brief Get the full file path of an app file + * + * @param file_name The relative path of an application file + * @param app Current application + * @param app_mngr Application manager + * + * @return The full file path of the application file if valid, + * empty string otherwise + */ + static std::string GetAppFilePath(std::string file_name, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + /** + * @brief Verify that all ttsChunks with FILE type + * in an array include an existing file and set full path + * + * @param tts_chunks SmartObject with an array of TTSChunks + * @param app Current application + * @param app_mngr Application manager + * + * @return FILE_NOT_FOUND if one of the TTSChunks + * included a file which wasn't present on disk, + * SUCCESS otherwise + */ + static mobile_apis::Result::eType VerifyTtsFiles( + smart_objects::SmartObject& tts_chunks, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); + + /** * @brief Verify image and add image file full path * and add path, although the image doesn't exist * @param SmartObject with image * @param app current application * @return verification result */ - static mobile_apis::Result::eType VerifyImageApplyPath( - smart_objects::SmartObject& image, - ApplicationConstSharedPtr app, - ApplicationManager& app_mngr); + static void ApplyImagePath(smart_objects::SmartObject& image, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr); /* * @brief Verify image and add image file full path @@ -570,6 +635,21 @@ class MessageHelper { ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + /** + * @brief Stores whether each choice in a set has the vrCommands parameter + * MIXED means some choices have vrCommands and others don't + * ALL means all do, NONE means none do + */ + enum ChoiceSetVRCommandsStatus { MIXED, ALL, NONE }; + + /** + * @brief Check whether each choice in the set has the vrCommands parameter + * @param choice set to check + * @return a ChoiceSetVRCommandsStatus with the state of the choice set + */ + static ChoiceSetVRCommandsStatus CheckChoiceSetVRCommands( + const smart_objects::SmartObject& choice_set); + /* * @brief Finds "Image" structure in request and verify image file presence * in Core. @@ -598,7 +678,7 @@ class MessageHelper { * @return returns FALSE if string contains incorrect character or * string is empty otherwise returns TRUE */ - static bool VerifySoftButtonString(const std::string& str); + static bool VerifyString(const std::string& str); static mobile_apis::Result::eType ProcessSoftButtons( smart_objects::SmartObject& message_params, @@ -620,6 +700,14 @@ class MessageHelper { ApplicationSharedPtr app, int32_t function_id); + /** + * @brief Prints SmartObject contents to log file + * @param object - SmartObject to print + * @return always True as this function is used for internal debug purposes + * only + * @note Function prints SmartObject only in DEBUG build mode. There will not + * be any print in RELEASE build mode + */ static bool PrintSmartObject(const smart_objects::SmartObject& object); template <typename From, typename To> @@ -758,18 +846,6 @@ class MessageHelper { ApplicationManager& app_mngr); /** - * @brief SendUnsubscribeIVIRequest sends request to HMI to remove vehicle - * data subscription for application - * @param ivi_id Vehicle data item id - * @param application Application to unsubscribe - * @param app_mngr Application manager - */ - static void SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr); - -#ifdef SDL_REMOTE_CONTROL - /** * @brief Sends HMI status notification to mobile * @param application_impl application with changed HMI status **/ @@ -791,9 +867,7 @@ class MessageHelper { ApplicationManager& application_manager, hmi_apis::Common_HMILevel::eType level = hmi_apis::Common_HMILevel::FULL, bool send_policy_priority = true); -#endif // SDL_REMOTE_CONTROL - private: /** * @brief CreateMessageForHMI Creates HMI message with prepared header * acccoring to message type @@ -804,6 +878,7 @@ class MessageHelper { static smart_objects::SmartObjectSPtr CreateMessageForHMI( hmi_apis::messageType::eType message_type, const uint32_t correlation_id); + private: /** * @brief Allows to fill SO according to the current permissions. * @param permissions application permissions. |