diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/commands/command_request_impl.h')
-rw-r--r-- | src/components/application_manager/include/application_manager/commands/command_request_impl.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 8a00764ca3..30859765ba 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -47,8 +47,54 @@ class SmartObject; namespace application_manager { namespace commands { +struct ResponseInfo { + ResponseInfo() + : result_code(hmi_apis::Common_Result::INVALID_ENUM) + , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_invalid_enum(false) {} + ResponseInfo(hmi_apis::Common_Result::eType result, + HmiInterfaces::InterfaceID interface) + : result_code(result) + , interface(interface) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_invalid_enum(false) {} + hmi_apis::Common_Result::eType result_code; + HmiInterfaces::InterfaceID interface; + HmiInterfaces::InterfaceState interface_state; + bool is_ok; + bool is_unsupported_resource; + bool is_invalid_enum; +}; + namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; +/** + * @brief MergeInfos merge 2 infos in one string + * @param first - info string that should be first in result info + * @param second - info string that should be second in result info + * @return if first is empty return second + * if second is empty return first + * if both are empty return empty string + * if both are not empty return empty first +", " + second + */ +std::string MergeInfos(const std::string& first, const std::string& second); + +/** + * @brief MergeInfos merge 3 infos in one string + * @param first - info string that should be first in result info + * @param second - info string that should be second in result info + * @param third - info string that should be second in result info + * @return resulting string contain merge all incoming parameters + */ +std::string MergeInfos(const std::string& first, + const std::string& second, + const std::string& third); + class CommandRequestImpl : public CommandImpl, public event_engine::EventObserver { public: @@ -153,6 +199,55 @@ class CommandRequestImpl : public CommandImpl, */ bool HasDisallowedParams() const; + /** + * @brief Checks result code from HMI for single RPC + * and returns parameter for sending to mobile app. + * @param result_code contains result code from HMI response + * @param interface contains interface for which HMI sent response + * @return true if result code complies successful result cods + * otherwise returns false. + */ + bool PrepareResultForMobileResponse( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const; + + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response + * @return true if result code complies successful result code + * otherwise returns false + */ + bool PrepareResultForMobileResponse(ResponseInfo& out_first, + ResponseInfo& out_second) const; + /** + * @brief If message from HMI contains returns this info + * or process result code from HMI and checks state of interface + * and create info. + * @param interface contains interface for which HMI sent response + * @param result_code contains result code from HMI + * @param response_from_hmi contains response from HMI + * @param out_info contain info for sending to application + */ + void GetInfo(HmiInterfaces::InterfaceID interface, + hmi_apis::Common_Result::eType result_code, + const smart_objects::SmartObject& response_from_hmi, + std::string& out_info); + + /** + * @brief Prepare result code for sending to mobile application + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return resulting code for sending to mobile application. + */ + mobile_apis::Result::eType PrepareResultCodeForResponse( + const ResponseInfo& first, const ResponseInfo& second); + protected: /** * @brief Returns policy parameters permissions |