diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/commands/command_impl.h')
-rw-r--r-- | src/components/application_manager/include/application_manager/commands/command_impl.h | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 6cc8f82330..439b1756ef 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -34,6 +34,9 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_IMPL_H_ #include "application_manager/commands/command.h" +#include "application_manager/event_engine/event_observer.h" +#include "application_manager/application_manager.h" +#include "application_manager/smart_object_keys.h" #include "utils/logger.h" namespace application_manager { @@ -49,7 +52,6 @@ struct CommandParametersPermissions { }; namespace commands { - /** * @brief Class is intended to encapsulate RPC as an object **/ @@ -60,7 +62,8 @@ class CommandImpl : public Command { * * @param message Incoming SmartObject message **/ - explicit CommandImpl(const MessageSharedPtr& message); + CommandImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager); /** * @brief CommandImpl class destructor @@ -71,52 +74,51 @@ class CommandImpl : public Command { /** * @brief Checks command permissions according to policy table */ - virtual bool CheckPermissions(); + bool CheckPermissions() OVERRIDE; /** * @brief Init required by command resources **/ - virtual bool Init(); + bool Init() OVERRIDE; /** * @brief Cleanup all resources used by command **/ - virtual bool CleanUp(); + bool CleanUp() OVERRIDE; /** * @brief Execute corresponding command by calling the action on reciever **/ - virtual void Run(); - + void Run() OVERRIDE; /** * @brief Retrieves request default timeout. * If request has a custom timeout, request_timeout_ should be reassign to it * * @return Request default timeout */ - virtual uint32_t default_timeout() const; + uint32_t default_timeout() const OVERRIDE; /* * @brief Retrieves correlation ID */ - virtual uint32_t correlation_id() const; + uint32_t correlation_id() const OVERRIDE; /* * @brief Retrieves connection key */ - virtual uint32_t connection_key() const; + uint32_t connection_key() const OVERRIDE; /* * @brief Retrieves request ID */ - virtual int32_t function_id() const; + int32_t function_id() const OVERRIDE; /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * */ - virtual void onTimeOut(); + void onTimeOut() OVERRIDE; /** * @brief AllowedToTerminate tells request Controller if it can terminate this @@ -125,30 +127,42 @@ class CommandImpl : public Command { * If request need to terminate itself, it should override this function false * @return allowed_to_terminate_ value */ - virtual bool AllowedToTerminate() { - return allowed_to_terminate_; - } + bool AllowedToTerminate() OVERRIDE; /** * @brief SetAllowedToTerminate set up allowed to terminate flag. * If true, request controller will terminate request on response */ - virtual void SetAllowedToTerminate(bool allowed) { - allowed_to_terminate_ = allowed; - } + void SetAllowedToTerminate(const bool allowed) OVERRIDE; // members static const int32_t hmi_protocol_type_; static const int32_t mobile_protocol_type_; - static const int32_t protocol_version_; + static const int32_t protocol_version_; protected: + /** + * @brief Parse smartObject and replace mobile app Id by HMI app ID + * + * @param message Smartobject to be parsed + */ + void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); + + /** + * @brief Parse smartObject and replace HMI app ID by mobile app Id + * + * @param message Smartobject to be parsed + */ + void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); + MessageSharedPtr message_; uint32_t default_timeout_; bool allowed_to_terminate_; + ApplicationManager& application_manager_; + #ifdef ENABLE_LOG static log4cxx::LoggerPtr logger_; -#endif // ENABLE_LOG +#endif // ENABLE_LOG private: DISALLOW_COPY_AND_ASSIGN(CommandImpl); |