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 | 114 |
1 files changed, 30 insertions, 84 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 380b14af1e..7af9bacf27 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -49,6 +49,7 @@ #include "interfaces/MOBILE_API.h" #include "policy/policy_types.h" #include "protocol_handler/session_observer.h" +#include "smart_objects/enum_schema_item.h" #include "smart_objects/smart_object.h" #include "transport_manager/common.h" #include "utils/macro.h" @@ -103,6 +104,35 @@ struct ResetGlobalPropertiesResult { typedef std::map<std::string, mobile_apis::VehicleDataType::eType> VehicleData; /** + * @brief Converts stringified value to enum value + * @param str stringified value + * @return Enum value if succedeed, otherwise - + * INVALID_ENUM + */ +template <typename T> +T StringToEnum(const std::string& str) { + using namespace ns_smart_device_link::ns_smart_objects; + T enum_value; + EnumConversionHelper<T>::StringToEnum(str, &enum_value); + return enum_value; +} + +/** + * @brief Converts enum value to string + * @param enum_value enum value + * @return stringified value for enum if succedeed, otherwise - empty string + */ +template <typename T> +std::string EnumToString(T enum_value) { + using namespace ns_smart_device_link::ns_smart_objects; + const char* str = 0; + if (EnumConversionHelper<T>::EnumToCString(enum_value, &str)) { + return str; + } + return std::string(); +} + +/** * @brief MessageHelper class **/ class MessageHelper { @@ -184,42 +214,9 @@ class MessageHelper { */ 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); - static std::string GetDeviceMacAddressForHandle( const transport_manager::DeviceHandle device_handle, const ApplicationManager& app_mngr); - /** - * @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 @@ -239,23 +236,6 @@ class MessageHelper { 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( - const mobile_apis::HMILevel::eType hmi_level); - - /** * @brief Used to obtain function name by its id * @param function_id Function ID */ @@ -888,29 +868,6 @@ class MessageHelper { } 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 mobile language to string representation - * @param language Mobile UI language - * @return Mobile language string representation - */ - static std::string MobileLanguageToString( - mobile_apis::Language::eType language); - - /** - * @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 @@ -963,17 +920,6 @@ class MessageHelper { const std::string& icon_path, ApplicationManager& application_manager); - static hmi_apis::Common_Language::eType CommonLanguageFromString( - const std::string& language); - - /** - * @brief CommonLightNameFromString convert string to LightName enum value - * @param lightName string to convert - * @return value LightName enum value - */ - static hmi_apis::Common_LightName::eType CommonLightNameFromString( - const std::string& lightName); - static smart_objects::SmartObjectSPtr GetOnAppInterfaceUnregisteredNotificationToMobile( int32_t connection_key, |