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 | 80 |
1 files changed, 60 insertions, 20 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 aa3c216d4d..74a884a223 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 @@ -43,27 +43,18 @@ 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) {} + DEPRECATED ResponseInfo(hmi_apis::Common_Result::eType result, + HmiInterfaces::InterfaceID interface); + ResponseInfo(); + ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager); 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; + bool is_not_used; }; namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; @@ -290,6 +281,19 @@ class CommandRequestImpl : public CommandImpl, mobile_apis::Result::eType PrepareResultCodeForResponse( const ResponseInfo& first, const ResponseInfo& second); + /** + * @brief Resolves if the return code must be + * UNSUPPORTED_RESOURCE + * @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 the communication return code must be + * UNSUPPORTED_RESOURCE, otherwise false. + */ + bool IsResultCodeUnsupported(const ResponseInfo& first, + const ResponseInfo& second) const; + protected: /** * @brief Returns policy parameters permissions @@ -297,6 +301,35 @@ class CommandRequestImpl : public CommandImpl, */ const CommandParametersPermissions& parameters_permissions() const; + /** + * @brief Adds interface to be awaited for by sdl request command + @param interface_id interface which SDL expects to response in given time + */ + void StartAwaitForInterface(const HmiInterfaces::InterfaceID interface_id); + + /** + * @brief Gets interface await state. + * @param interface_id interface which SDL awaits for response in given time + * @return true if SDL awaits for response from given interface in + * interface_id + */ + bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; + + /** + * @brief Sets given HMI interface await status to false + * @param interface_id interface which SDL no longer awaits for response in + * given time + */ + void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); + + /** + * @brief This set stores all the interfaces which are awaited by SDL to + * return a response on some request + */ + std::set<HmiInterfaces::InterfaceID> awaiting_response_interfaces_; + + mutable sync_primitives::Lock awaiting_response_interfaces_lock_; + RequestState current_state_; sync_primitives::Lock state_lock_; CommandParametersPermissions parameters_permissions_; @@ -331,10 +364,10 @@ class CommandRequestImpl : public CommandImpl, const hmi_apis::FunctionID::eType& function_id); /** - * @brief UpdateHash updates hash field for application and sends - * OnHashChanged notification to mobile side in case of approriate hash mode - * is set - */ + * @brief UpdateHash updates hash field for application and sends + * OnHashChanged notification to mobile side in case of approriate hash mode + * is set + */ void UpdateHash(); /** @@ -342,6 +375,13 @@ class CommandRequestImpl : public CommandImpl, * it is value of 'success' field of appropriate response sent to mobile */ bool is_success_result_; + + /** + * @brief Add information for the component of response in case of timeout + * @param response Response message, which info should be extended + */ + void AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const; }; } // namespace commands |