diff options
author | Yaroslav Mamykin (GitHub) <ymamykin@luxoft.com> | 2019-11-29 14:02:58 +0200 |
---|---|---|
committer | Yaroslav Mamykin (GitHub) <ymamykin@luxoft.com> | 2019-11-29 14:02:58 +0200 |
commit | ede1f58fce89195398be0eb12f19b5d6d114ed82 (patch) | |
tree | e6c12a342dfccb57218564286e06838b20494351 | |
parent | 2f91f7a463c5bba72873a85876e52a3baa5367d4 (diff) | |
download | sdl_core-ede1f58fce89195398be0eb12f19b5d6d114ed82.tar.gz |
COMMIT 3/7
7 files changed, 41 insertions, 17 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 d6abc6a867..fd9b42e06e 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 @@ -78,56 +78,56 @@ class CommandImpl : public Command { /** * @brief Checks command permissions according to policy table */ - virtual bool CheckPermissions() OVERRIDE; + bool CheckPermissions() OVERRIDE; /** * @brief Init required by command resources **/ - virtual bool Init() OVERRIDE; + bool Init() OVERRIDE; /** * @brief Cleanup all resources used by command **/ - virtual bool CleanUp() OVERRIDE; + bool CleanUp() OVERRIDE; /** * @brief Execute corresponding command by calling the action on reciever **/ - virtual void Run() OVERRIDE; + 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 OVERRIDE; + uint32_t default_timeout() const OVERRIDE; /* * @brief Retrieves correlation ID */ - virtual uint32_t correlation_id() const OVERRIDE; + uint32_t correlation_id() const OVERRIDE; /* * @brief Retrieves connection key */ - virtual uint32_t connection_key() const OVERRIDE; + uint32_t connection_key() const OVERRIDE; /* * @brief Retrieves request ID */ - virtual int32_t function_id() const OVERRIDE; + int32_t function_id() const OVERRIDE; /* * @brief Retrieves Window ID */ - virtual WindowID window_id() const OVERRIDE; + WindowID window_id() const OVERRIDE; /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * */ - virtual void HandleTimeOut() OVERRIDE; + void HandleTimeOut() OVERRIDE; /** * @brief AllowedToTerminate tells request Controller if it can terminate this @@ -137,13 +137,13 @@ class CommandImpl : public Command { * false * @return allowed_to_terminate_ value */ - virtual bool AllowedToTerminate() OVERRIDE; + bool AllowedToTerminate() OVERRIDE; /** * @brief SetAllowedToTerminate set up allowed to terminate flag. * If true, request controller will terminate request on response */ - virtual void SetAllowedToTerminate(const bool allowed) OVERRIDE; + void SetAllowedToTerminate(const bool allowed) OVERRIDE; // members static const int32_t hmi_protocol_type_; diff --git a/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h index 450f770142..fab8e3656b 100644 --- a/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h +++ b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h @@ -34,7 +34,6 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ #include "application_manager/commands/command_request_impl.h" -#include "application_manager/commands/command_impl.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "utils/lock.h" diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h index 0656372f47..ae9891db44 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h @@ -77,6 +77,15 @@ class EventDispatcher { */ virtual void remove_observer(EventObserver& observer) = 0; + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + */ + virtual void remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) = 0; + // Mobile Events /* diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h index 3644299499..e3fe701e1d 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h @@ -83,6 +83,10 @@ class EventDispatcherImpl : public EventDispatcher { */ void raise_event(const Event& event) OVERRIDE; + void remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) OVERRIDE; + + /* * @brief Subscribe the observer to event * diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc index 3fbcb46d38..a28d4dc8f9 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc @@ -85,7 +85,7 @@ void RCCommandRequest::OnTimeOut() { bool RCCommandRequest::CheckDriverConsent() { LOG4CXX_AUTO_TRACE(logger_); app_mngr::ApplicationSharedPtr app = - application_manager_.application(RequestFromMobileImpl::connection_key()); + application_manager_.application(connection_key()); const std::string module_type = ModuleType(); rc_rpc_plugin::TypeAccess access = CheckModule(module_type, app); @@ -131,7 +131,7 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) { void RCCommandRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); app_mngr::ApplicationSharedPtr app = - application_manager_.application(RequestFromMobileImpl::connection_key()); + application_manager_.application(connection_key()); if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) { LOG4CXX_WARN(logger_, "HMI interface RC is not available"); @@ -295,7 +295,7 @@ void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type, const std::string& module_id) { LOG4CXX_AUTO_TRACE(logger_); auto app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); const std::string policy_app_id = app->policy_app_id(); const std::string mac_address = app->mac_address(); @@ -323,7 +323,7 @@ void RCCommandRequest::SendGetUserConsent( const smart_objects::SmartObject& module_ids) { LOG4CXX_AUTO_TRACE(logger_); app_mngr::ApplicationSharedPtr app = - application_manager_.application(RequestFromMobileImpl::connection_key()); + application_manager_.application(connection_key()); DCHECK(app); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 356e1ee9cd..f647b31cb4 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -321,6 +321,10 @@ bool CommandRequestImpl::IsInterfaceAwaited( return helpers::in_range(awaiting_response_interfaces_, interface_id); } +#ifdef __QNX__ +void CommandRequestImpl::OnHMIMessageSent() {} +#endif + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc index 0823cdc767..5e82047f51 100644 --- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc +++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc @@ -113,6 +113,14 @@ void EventDispatcherImpl::remove_observer(EventObserver& observer) { } } +void EventDispatcherImpl::remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) { + auto& observers = observers_event_[event_id][hmi_correlation_id]; + for (auto observer : observers) { + remove_observer_from_vector(*observer); + } +} + void EventDispatcherImpl::remove_observer_from_vector(EventObserver& observer) { AutoLock auto_lock(observer_lock_); |