diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager')
19 files changed, 458 insertions, 9 deletions
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h index 253ed2a439..b910118942 100644 --- a/src/components/application_manager/include/application_manager/app_service_manager.h +++ b/src/components/application_manager/include/application_manager/app_service_manager.h @@ -36,6 +36,7 @@ #include "application_manager/application.h" #include "interfaces/MOBILE_API.h" #include "smart_objects/smart_object.h" +#include "application_manager/application.h" namespace resumption { class LastState; @@ -130,6 +131,9 @@ class AppServiceManager { */ std::vector<smart_objects::SmartObject> GetAllServices(); + void GetProvider(const std::string& service_type, + ApplicationSharedPtr& app, + bool& hmi_service); std::pair<std::string, AppService> ActiveServiceByType( std::string service_type); diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 16bfb9e7de..07f11eddaa 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -388,6 +388,13 @@ class ApplicationManagerImpl ApplicationConstSharedPtr app) const; /* + * @brief Returns unique correlation ID for to mobile request + * + * @return Unique correlation ID + */ + uint32_t GetNextMobileCorrelationID() OVERRIDE; + + /* * @brief Returns unique correlation ID for HMI request * * @return Unique correlation ID @@ -1429,6 +1436,7 @@ class ApplicationManagerImpl hmi_apis::HMI_API* hmi_so_factory_; mobile_apis::MOBILE_API* mobile_so_factory_; + static uint32_t mobile_corelation_id_; static uint32_t corelation_id_; static const uint32_t max_corelation_id_; diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index f8ea7db24d..d832995b8d 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -112,7 +112,12 @@ class Command { */ virtual void SetAllowedToTerminate(const bool allowed) = 0; - enum CommandSource { SOURCE_SDL, SOURCE_MOBILE, SOURCE_HMI }; + enum CommandSource { + SOURCE_SDL, + SOURCE_MOBILE, + SOURCE_HMI, + SOURCE_SDL_TO_HMI + }; }; typedef smart_objects::SmartObjectSPtr MessageSharedPtr; diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h index 8741dae540..e8485a3abc 100644 --- a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h @@ -53,6 +53,11 @@ class CommandNotificationFromMobileImpl : public CommandImpl { virtual bool CleanUp(); virtual void Run(); void SendNotification(); + void SendNotificationToMobile(); + void SendNotificationToHMI( + const hmi_apis::FunctionID::eType& hmi_function_id); + void SendNotificationToConsumers( + const hmi_apis::FunctionID::eType& hmi_function_id); private: DISALLOW_COPY_AND_ASSIGN(CommandNotificationFromMobileImpl); 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 27aa93d1d8..a5ecd7274b 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 @@ -149,6 +149,8 @@ class CommandRequestImpl : public CommandImpl, */ virtual void on_event(const event_engine::Event& event); + virtual void on_event(const event_engine::MobileEvent& event); + /* * @brief Creates Mobile response * @@ -170,6 +172,16 @@ class CommandRequestImpl : public CommandImpl, */ bool CheckSyntax(const std::string& str, bool allow_empty_line = false); + void SendProviderRequest( + const mobile_apis::FunctionID::eType& mobile_function_id, + const hmi_apis::FunctionID::eType& hmi_function_id, + const smart_objects::SmartObject* msg, + bool use_events = false); + + void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, + smart_objects::SmartObjectSPtr msg, + bool use_events = false); + /* * @brief Sends HMI request * @@ -235,6 +247,14 @@ class CommandRequestImpl : public CommandImpl, bool HasDisallowedParams() const; /** + * @brief Checks result code from Mobile for single RPC + * @param result_code contains result code from Mobile response + * @return true if result code complies successful result codes, + * false otherwise. + */ + bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) 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 diff --git a/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h new file mode 100644 index 0000000000..a1e63561bf --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h @@ -0,0 +1,73 @@ +/* + Copyright (c) 2018, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_ + +#include "application_manager/commands/command_impl.h" +#include "application_manager/application_manager.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" + +namespace application_manager { + +namespace commands { + +class CommandRequestToMobile : public CommandImpl { + public: + CommandRequestToMobile(const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + ~CommandRequestToMobile(); + bool Init() OVERRIDE; + bool CleanUp() OVERRIDE; + void Run() OVERRIDE; + void SendRequest(); + + /* + * @brief Retrieves application ID + */ + inline uint32_t application_id() const { + return (*message_)[strings::msg_params][strings::app_id].asUInt(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(CommandRequestToMobile); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h new file mode 100644 index 0000000000..65983d82f8 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h @@ -0,0 +1,73 @@ +/* + Copyright (c) 2018, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_ + +#include "application_manager/commands/command_impl.h" +#include "application_manager/application_manager.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" + +namespace application_manager { + +namespace commands { + +class CommandResponseFromMobile : public CommandImpl { + public: + CommandResponseFromMobile(const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + ~CommandResponseFromMobile(); + bool Init() OVERRIDE; + bool CleanUp() OVERRIDE; + void Run() OVERRIDE; + void SendResponse(); + + /* + * @brief Retrieves application ID + */ + inline uint32_t application_id() const { + return (*message_)[strings::msg_params][strings::app_id].asUInt(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(CommandResponseFromMobile); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h index 8bbbd0e3de..25cfd7b207 100644 --- a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h @@ -53,8 +53,14 @@ class NotificationFromHMI : public CommandImpl { virtual bool CleanUp(); virtual void Run(); void SendNotificationToMobile(const MessageSharedPtr& message); + void SendNotificationToMobile( + const MessageSharedPtr& message, + const mobile_apis::FunctionID::eType& mobile_function_id); + void SendNotificationToHMI(MessageSharedPtr& message); void CreateHMIRequest(const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject& msg_params) const; + void SendNotificationToConsumers( + const mobile_apis::FunctionID::eType& mobile_function_id); private: DISALLOW_COPY_AND_ASSIGN(NotificationFromHMI); diff --git a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h index d980e98576..0a5f5d7eee 100644 --- a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h @@ -55,17 +55,20 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { virtual bool CleanUp(); virtual void Run(); virtual void on_event(const event_engine::Event& event); + void on_event(const event_engine::MobileEvent& event) OVERRIDE; /** * @brief SendResponse allows to send response to hmi * @param correlation_id the correlation id for the rfesponse. * @param function_id the function id for which response will be sent * @param result_code the result code. */ - void SendResponse(const bool success, - const uint32_t correlation_id, - const hmi_apis::FunctionID::eType function_id, - const hmi_apis::Common_Result::eType result_code, - const smart_objects::SmartObject* response_params = NULL); + void SendResponse( + const bool success, + const uint32_t correlation_id, + const hmi_apis::FunctionID::eType function_id, + const hmi_apis::Common_Result::eType result_code, + const smart_objects::SmartObject* response_params = NULL, + commands::Command::CommandSource source = commands::Command::SOURCE_HMI); /** * @brief SendResponse allows to send error response to hmi @@ -79,6 +82,25 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { const hmi_apis::Common_Result::eType result_code, const std::string error_message); + void SendProviderRequest( + const mobile_apis::FunctionID::eType& mobile_function_id, + const hmi_apis::FunctionID::eType& hmi_function_id, + const smart_objects::SmartObject* msg, + bool use_events = false); + + void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, + const ApplicationSharedPtr app, + const smart_objects::SmartObject* msg_params, + bool use_events); + + void SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, + const smart_objects::SmartObject* msg_params, + bool use_events); + + bool ProcessHMIInterfacesAvailability( + const uint32_t hmi_correlation_id, + const hmi_apis::FunctionID::eType& function_id); + private: /** * @brief Fills common parameters for SO @@ -91,6 +113,12 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { const uint32_t correlation_id, const hmi_apis::FunctionID::eType function_id); + protected: + bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) const; + + bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const; + private: DISALLOW_COPY_AND_ASSIGN(RequestFromHMI); }; diff --git a/src/components/application_manager/include/application_manager/event_engine/event.h b/src/components/application_manager/include/application_manager/event_engine/event.h index 68ee508a9b..cfd6e95693 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event.h +++ b/src/components/application_manager/include/application_manager/event_engine/event.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_ENGINE_EVENT_H_ #include <interfaces/HMI_API.h> +#include <interfaces/MOBILE_API.h> #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -141,6 +142,104 @@ int32_t Event::smart_object_type() const { .asInt(); } +class MobileEvent { + public: + // Typedef for possible Event ID's from mobile_apis functionID enum + typedef mobile_apis::FunctionID::eType MobileEventID; + + /* + * @brief Constructor with parameters + * + * @param id Event ID. Please see mobile_apis::FunctionID for possible ID's + */ + explicit MobileEvent(const MobileEventID& id); + + /* + * @brief Destructor + */ + virtual ~MobileEvent(); + + /* + * @brief Sends synchronously event to all subscribers. + * + */ + void raise(EventDispatcher& event_dispatcher); + + /* + * @brief Provides event ID + */ + inline const MobileEventID& id() const; + + /* + * @brief Sets event smart object + * + * @param so The smart_object received in Mobile response + */ + void set_smart_object(const smart_objects::SmartObject& so); + + /* + * @brief Retrieves event smart object + * + * @return The smart_object received in Mobile response + */ + inline const smart_objects::SmartObject& smart_object() const; + + /* + * @brief Retrieves smart object request ID + */ + inline int32_t smart_object_function_id() const; + + /* + * @brief Retrieves smart object correlation ID + */ + inline int32_t smart_object_correlation_id() const; + + /* + * @brief Retrieves smart_object response type + */ + inline int32_t smart_object_type() const; + + protected: + private: + MobileEventID id_; + smart_objects::SmartObject response_so_; + + /* + * @brief Default constructor + * + * Unimplemented to avoid misusing + */ + MobileEvent(); + + DISALLOW_COPY_AND_ASSIGN(MobileEvent); +}; + +const MobileEvent::MobileEventID& MobileEvent::id() const { + return id_; +} + +const smart_objects::SmartObject& MobileEvent::smart_object() const { + return response_so_; +} + +int32_t MobileEvent::smart_object_function_id() const { + return response_so_.getElement(strings::params) + .getElement(strings::function_id) + .asInt(); +} + +int32_t MobileEvent::smart_object_correlation_id() const { + return response_so_.getElement(strings::params) + .getElement(strings::correlation_id) + .asInt(); +} + +int32_t MobileEvent::smart_object_type() const { + return response_so_.getElement(strings::params) + .getElement(strings::message_type) + .asInt(); +} + } // namespace event_engine } // namespace application_manager 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 813dda0295..0656372f47 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,42 @@ class EventDispatcher { */ virtual void remove_observer(EventObserver& observer) = 0; + // Mobile Events + + /* + * @brief Delivers the event to all subscribers + * + * @param event Received event + */ + virtual void raise_mobile_event(const MobileEvent& event) = 0; + + /* + * @brief Subscribe the observer to event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + * @param observer The observer to subscribe for event + */ + virtual void add_mobile_observer(const MobileEvent::MobileEventID& event_id, + int32_t mobile_correlation_id, + EventObserver& observer) = 0; + + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to unsubscribe from + * @param observer The observer to be unsubscribed + */ + virtual void remove_mobile_observer( + const MobileEvent::MobileEventID& event_id, EventObserver& observer) = 0; + + /* + * @brief Unsubscribes the observer from all events + * + * @param observer The observer to be unsubscribed + */ + virtual void remove_mobile_observer(EventObserver& observer) = 0; + /* * @brief Destructor */ 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 ed923369ac..75e77e603c 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 @@ -52,6 +52,8 @@ class EventDispatcherImpl : public EventDispatcher { typedef std::vector<EventObserver*> ObserverVector; typedef std::map<int32_t, ObserverVector> ObserversMap; typedef std::map<Event::EventID, ObserversMap> EventObserverMap; + typedef std::map<MobileEvent::MobileEventID, ObserversMap> + MobileEventObserverMap; /* * @brief Destructor */ @@ -66,6 +68,9 @@ class EventDispatcherImpl : public EventDispatcher { EventObserverMap get_observers() const { return observers_event_; } + MobileEventObserverMap get_mobile_observers() const { + return mobile_observers_event_; + } ObserverVector get_observers_list() const { return observers_; } @@ -105,6 +110,41 @@ class EventDispatcherImpl : public EventDispatcher { */ void remove_observer(EventObserver& observer) OVERRIDE; + // Mobile requests + /* + * @brief Delivers the event to all subscribers + * + * @param event Received event + */ + void raise_mobile_event(const MobileEvent& event) OVERRIDE; + + /* + * @brief Subscribe the observer to event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + * @param observer The observer to subscribe for event + */ + void add_mobile_observer(const MobileEvent::MobileEventID& event_id, + int32_t mobile_correlation_id, + EventObserver& observer) OVERRIDE; + + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to unsubscribe from + * @param observer The observer to be unsubscribed + */ + void remove_mobile_observer(const MobileEvent::MobileEventID& event_id, + EventObserver& observer) OVERRIDE; + + /* + * @brief Unsubscribes the observer from all events + * + * @param observer The observer to be unsubscribed + */ + void remove_mobile_observer(EventObserver& observer) OVERRIDE; + private: /* * @brief removes observer @@ -113,14 +153,25 @@ class EventDispatcherImpl : public EventDispatcher { */ void remove_observer_from_vector(EventObserver& observer); + /* + * @brief removes observer + * when occurs unsubscribe from event + * @param observer to be removed + */ + void remove_mobile_observer_from_vector(EventObserver& observer); + DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl); private: // Members section sync_primitives::Lock state_lock_; + sync_primitives::Lock mobile_state_lock_; sync_primitives::RecursiveLock observer_lock_; + sync_primitives::RecursiveLock mobile_observer_lock_; EventObserverMap observers_event_; + MobileEventObserverMap mobile_observers_event_; ObserverVector observers_; + ObserverVector mobile_observers_; }; } // namespace event_engine diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h index 593f1df657..7a7fe7c2ec 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h @@ -72,6 +72,8 @@ class EventObserver { */ virtual void on_event(const Event& event) = 0; + virtual void on_event(const MobileEvent& event); + protected: /* * @brief Subscribe to an event @@ -94,7 +96,38 @@ class EventObserver { * @brief Unsubscribes the observer from all events * */ - void unsubscribe_from_all_events(); + DEPRECATED void unsubscribe_from_all_events(); + + /* + * @brief Unsubscribes the observer from all events + * + */ + void unsubscribe_from_all_hmi_events(); + + // Mobile Events + + /* + * @brief Subscribe to an event + * + * @param event_id The event ID to subscribe for + * @param mobile_correlation_id The event mobile correlation ID. + * If param is omitted, it means subscription for mobile notification + */ + void subscribe_on_event(const MobileEvent::MobileEventID& event_id, + int32_t mobile_correlation_id = 0); + + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to unsubscribe from + */ + void unsubscribe_from_event(const MobileEvent::MobileEventID& event_id); + + /* + * @brief Unsubscribes the observer from all events + * + */ + void unsubscribe_from_all_mobile_events(); private: ObserverID id_; diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces.h b/src/components/application_manager/include/application_manager/hmi_interfaces.h index 59ec32694a..5f172b415d 100644 --- a/src/components/application_manager/include/application_manager/hmi_interfaces.h +++ b/src/components/application_manager/include/application_manager/hmi_interfaces.h @@ -60,7 +60,8 @@ class HmiInterfaces { HMI_INTERFACE_Navigation, HMI_INTERFACE_VehicleInfo, HMI_INTERFACE_SDL, - HMI_INTERFACE_RC + HMI_INTERFACE_RC, + HMI_INTERFACE_AppService }; /** diff --git a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h index 8c904bf513..3168b80b5a 100644 --- a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h +++ b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h @@ -48,6 +48,7 @@ class PolicyEventObserver application_manager::event_engine::EventDispatcher& event_dispatcher); void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler); void on_event(const application_manager::event_engine::Event& event); + void on_event(const application_manager::event_engine::MobileEvent& event); void subscribe_on_event( const application_manager::event_engine::Event::EventID& event_id, int32_t hmi_correlation_id = 0); diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h index f4924111b3..4a104812a4 100644 --- a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h +++ b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h @@ -48,6 +48,7 @@ class PolicyEventObserver application_manager::event_engine::EventDispatcher& event_dispatcher); void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler); void on_event(const application_manager::event_engine::Event& event); + void on_event(const application_manager::event_engine::MobileEvent& event); void subscribe_on_event( const application_manager::event_engine::Event::EventID& event_id, int32_t hmi_correlation_id = 0); diff --git a/src/components/application_manager/include/application_manager/rpc_service_impl.h b/src/components/application_manager/include/application_manager/rpc_service_impl.h index 1eaeb46255..98767672ca 100644 --- a/src/components/application_manager/include/application_manager/rpc_service_impl.h +++ b/src/components/application_manager/include/application_manager/rpc_service_impl.h @@ -108,7 +108,9 @@ class RPCServiceImpl : public RPCService, bool ManageMobileCommand(const commands::MessageSharedPtr message, commands::Command::CommandSource source) OVERRIDE; - bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE; + bool ManageHMICommand(const commands::MessageSharedPtr message, + commands::Command::CommandSource source = + commands::Command::SOURCE_HMI) OVERRIDE; // CALLED ON messages_to_hmi_ thread! void Handle(const impl::MessageToHmi message) OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 615b8ab767..d6c5f165da 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -318,6 +318,8 @@ extern const char* service_id; extern const char* service_manifest; extern const char* service_published; extern const char* service_active; +extern const char* service_data; +extern const char* subscribe; extern const char* app_services; extern const char* update_reason; extern const char* updated_app_service_record; diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h index 99113d6d00..8270e9b807 100644 --- a/src/components/application_manager/include/application_manager/state_controller_impl.h +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -144,6 +144,7 @@ class StateControllerImpl : public event_engine::EventObserver, // EventObserver interface void on_event(const event_engine::Event& event); + void on_event(const event_engine::MobileEvent& event); /** * @brief Sets default application state and apply currently active HMI states |