diff options
author | VladSemenyuk <VSemenyuk@luxoft.com> | 2021-08-27 22:36:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 15:36:43 -0400 |
commit | b9a2a53cca954b710ed5b25ba91d3267cc2996fd (patch) | |
tree | 3134bbc7db30e32f5ab9ee9fbfbe130268d11d0c | |
parent | 2fc754452eac4e08e4919245742cd4dfb945a3d8 (diff) | |
download | sdl_core-b9a2a53cca954b710ed5b25ba91d3267cc2996fd.tar.gz |
Fix/ccb 3141 change command request inheritance structure (#3591)
* Change command request inheritance structure.
Fix data races during requests event processing.
* Change commands according to new inheritance structure.
* Change unit tests according new inheritance structure.
* Fix review comments
* Fix build after merge
* Fix format style
* Fix recursion in SetGlobalProperties
* Add delay before request releasing
That gives to event dispatcher some time to figure
out that event should not be rasied for a finalized request
and this request will be released soon. Also, this allows
to avoid calling some virtual functions on pointer to
invalidated object.
* Fix data races in EventDispatcher
Now reference counter is increased indirectly
by event dispatcher before calling `HandleOnEvent()`
of specific observer.
This will guarantee that during `HandleOnEvent` the
command object is still be alive.
* Revert changes for SetGlobalProperties
Co-authored-by: v-seme12 <vsemenyuk@kiev.luxoft.com>
Co-authored-by: Andrii Kalinich <AKalinich@luxoft.com>
290 files changed, 3047 insertions, 2276 deletions
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 c64ae2bbd2..f75a5220c6 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 @@ -686,6 +686,15 @@ class ApplicationManagerImpl const uint32_t corr_id, const int32_t function_id) OVERRIDE; + bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool IsStillWaitingForResponse(const uint32_t connection_key, + const uint32_t correlation_id) const OVERRIDE; + void OnQueryAppsRequest( const connection_handler::DeviceHandle device) OVERRIDE; 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 a7241ce16d..f8bc66df2a 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -115,7 +115,14 @@ class Command { * has exceed it's limit * */ - virtual void onTimeOut() = 0; + virtual void HandleTimeOut() = 0; + + /** + * @brief Function is called by RequestInfo when request controller + * updates request timeout + * Function sets request state to "AwaitingResponse" + */ + virtual void OnUpdateTimeOut() = 0; /** * @brief AllowedToTerminate tells if request controller is allowed 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 6105f7c5d6..534f07aa37 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 @@ -164,7 +164,7 @@ class CommandImpl : public Command { * has exceed it's limit * */ - void onTimeOut() OVERRIDE; + void HandleTimeOut() OVERRIDE; /** * @brief AllowedToTerminate tells request Controller if it can terminate this @@ -182,6 +182,8 @@ class CommandImpl : public Command { */ void SetAllowedToTerminate(const bool allowed) OVERRIDE; + void OnUpdateTimeOut() OVERRIDE; + /** * @brief Calculates command`s internal consecutive number * for specified application used during resumption. 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 e2c95a085b..97e2dce0eb 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 @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2016, Ford Motor Company All rights reserved. @@ -33,178 +33,104 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ +#include <memory> + +#include "application_manager/application_manager.h" #include "application_manager/commands/command_impl.h" +#include "application_manager/event_engine/event_observer.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/smart_object_keys.h" #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" #include "smart_objects/smart_object.h" #include "utils/lock.h" namespace application_manager { -namespace commands { - -struct ResponseInfo { - 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_not_used; -}; - -namespace ns_smart = ns_smart_device_link::ns_smart_objects; - -/** - * @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 2 infos into one string with info - * @param first_info -contains result_code from HMI response and - * interface that returns response - * @param first_str - info string that should be first in result info - * @param second_info -contains result_code from HMI response and - * interface that returns response - * @param second_str - info string that should be second in result info - * @return if first_info is not available and second_str not empty return second - * if second_info is not available and first_str not empty return first - * other cases return result MergeInfos for 2 params - */ -std::string MergeInfos(const ResponseInfo& first_info, - const std::string& first_str, - const ResponseInfo& second_info, - const std::string& second_str); +namespace commands { /** - * @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); - + * @brief Class is intended to encapsulate RPC as an object + **/ class CommandRequestImpl : public CommandImpl, public event_engine::EventObserver { public: - enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted }; + enum RequestState { + kAwaitingResponse = 0, + kTimedOut, + kProcessEvent, + }; /** - * @brief The HashUpdateMode enum defines whether request has to update - * hash after its execution is finished - */ - enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate }; - + * @brief CommandRequestImpl class constructor + * + * @param message Incoming SmartObject message + **/ CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); - ~CommandRequestImpl(); - - /** - * @brief Checks command permissions according to policy table - */ - bool CheckPermissions() OVERRIDE; - /** - * @brief Init sets hash update mode for request - */ - bool Init() OVERRIDE; + * @brief CommandRequestImpl class destructor + * + **/ + virtual ~CommandRequestImpl(); /** - * @brief Cleanup all resources used by command + * @brief Send request to mobile + * @param function_id Function id + * @param msg Request to mobile + * @param use_event - true if request should be subscribed to an event, + * otherwise false **/ - bool CleanUp() OVERRIDE; + void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, + smart_objects::SmartObjectSPtr msg, + bool use_events); /** * @brief Execute corresponding command by calling the action on reciever **/ void Run() OVERRIDE; + virtual void on_event(const event_engine::MobileEvent& event); + /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * */ - virtual void onTimeOut(); + void HandleTimeOut() FINAL; /** * @brief Default EvenObserver's pure virtual method implementation * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); - - virtual void on_event(const event_engine::MobileEvent& event); + void HandleOnEvent(const event_engine::Event& event) FINAL; - /* - * @brief Creates Mobile response + /** + * @brief Default EvenObserver's pure virtual method implementation * - * @param success true if successful; false, if failed - * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c) - * @param info Provides additional human readable info regarding the result - * @param response_params Additional params in response + * @param event The received event */ - void SendResponse( - const bool success, - const mobile_apis::Result::eType& result_code, - const char* info = NULL, - const smart_objects::SmartObject* response_params = NULL, - const std::vector<uint8_t> binary_data = std::vector<uint8_t>()); - - 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 HandleOnEvent(const event_engine::MobileEvent& event) FINAL; - void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, - smart_objects::SmartObjectSPtr msg, - bool use_events = false); - - /* - * @brief Sends HMI request - * - * @param function_id HMI request ID - * @param msg_params HMI request msg params - * @param use_events true if we need subscribe on event(HMI request) - * @return hmi correlation id + /** + * @brief Function is called by RequestController when request execution time + * has exceeded its limit + * @note default value is required as a lot of requests don't use it + * as they use automatically generated reason */ - uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params = NULL, - bool use_events = false); + virtual void OnTimeOut(); - /* - * @brief Creates HMI request - * - * @param function_id HMI request ID - * @param msg_params HMI request msg params - */ - void CreateHMINotification(const hmi_apis::FunctionID::eType& function_id, - const ns_smart::SmartObject& msg_params) const; + virtual void on_event(const event_engine::Event&); - /** - * @brief Converts HMI result code to Mobile result code - * - * @param hmi_code HMI result code - * @return Mobile result code - */ - mobile_apis::Result::eType GetMobileResultCode( - const hmi_apis::Common_Result::eType& hmi_code) const; + void OnUpdateTimeOut() OVERRIDE; + + bool IncrementReferenceCount() const OVERRIDE; + + bool DecrementReferenceCount() const OVERRIDE; protected: /** @@ -217,146 +143,50 @@ class CommandRequestImpl : public CommandImpl, bool CheckAllowedParameters(const Command::CommandSource source); /** - * @brief Checks HMI capabilities for specified button support - * @param button Button to check - * @return true if button is present in HMI capabilities - * otherwise returns false - */ - bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; - - /** - * @brief Checks if any request param was marked as disallowed by policy - * @return true if any param was marked as disallowed - */ - 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 + * @brief Adds interface to be awaited by SDL request + * @param interface_id interface from which SDL expects response in given time */ - bool PrepareResultForMobileResponse(ResponseInfo& out_first, - ResponseInfo& out_second) const; + void StartAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); /** - * @brief Checks result code from HMI for splitted RPC - * and returns parameter for sending to mobile app. - * @param out_first Contains result_code from HMI response and - * interface that returns response - * @param out_second Contains result_code from HMI response and - * interface that returns response - * @param out_third 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, - ResponseInfo& out_third) 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(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); - - /** - * @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. + * @brief Gets interface awaiting 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 */ - mobile_apis::Result::eType PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second, - const ResponseInfo& third); + bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; /** - * @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. + * @brief Stops SDL awaiting from given HMI interface + * @param interface_id interface from which SDL no longer awaits + * for response in given time */ - bool IsResultCodeUnsupported(const ResponseInfo& first, - const ResponseInfo& second) const; + void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); /** - * @brief CheckResult checks whether the overall result - * of the responses is successful - * @param first response - * @param second response - * @return true if the overall result is successful - * otherwise - false + * @brief Checks if there some not delivered hmi responses exist + * @return true if pending responses exist, otherwise - false */ - bool CheckResult(const ResponseInfo& first, const ResponseInfo& second) const; + bool IsPendingResponseExist() const; - protected: /** - * @brief Returns policy parameters permissions - * @return Parameters permissions struct reference + * @brief Checks if there some not delivered hmi responses exist + * @return true if pending responses exist, otherwise - false */ - 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 + * @brief Returns current state of request + * @return current request state. E.g. kAwaitingResponse, kTimedOut, + * kResponded */ - bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; + virtual RequestState current_state() const; /** - * @brief Sets given HMI interface await status to false - * @param interface_id interface which SDL no longer awaits for response in - * given time + * @brief Sets current state of request + * @param request state to set. E.g. kAwaitingResponse, kTimedOut, + * kResponded */ - void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); + virtual void set_current_state(const RequestState state); /** * @brief This set stores all the interfaces which are awaited by SDL to @@ -366,52 +196,33 @@ class CommandRequestImpl : public CommandImpl, mutable sync_primitives::Lock awaiting_response_interfaces_lock_; - RequestState current_state_; - sync_primitives::Lock state_lock_; + /** + * @brief This lock is used to guarantee thread safe access to request state + */ + mutable sync_primitives::RecursiveLock state_lock_; /** - * @brief hash_update_mode_ Defines whether request must update hash value of - * application or not + * @brief Current state of request to synchronize its life cycle */ - HashUpdateMode hash_update_mode_; + RequestState current_state_; private: DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl); - bool ProcessHMIInterfacesAvailability( - const uint32_t hmi_correlation_id, - 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 Changes request state to "kProcessEvent", retain request instance + * @return false if request is not ready to handle event right now. + * If request is succesfully retained returns true */ - void UpdateHash(); + bool StartOnEventHandling(); /** - * @brief is_success_result_ Defines whether request succeded, at the moment - * it is value of 'success' field of appropriate response sent to mobile + * @brief Changes request state to "kAwaitingResponse", removes request + * instance retained before */ - 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; - /** - * @brief AddRequestToTimeoutHandler checks the request and adds it to - * request_timeout_handler map for tracking - * @param request_to_hmi request to HMI - */ - void AddRequestToTimeoutHandler( - const smart_objects::SmartObject& request_to_hmi) const; + void FinalizeOnEventHandling(); }; } // namespace commands - } // namespace application_manager - #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ 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 0e03b31e74..c4fd25f5e0 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 @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_ -#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/command_request_impl.h" #include "interfaces/HMI_API.h" #include "smart_objects/smart_object.h" @@ -43,7 +43,7 @@ namespace commands { namespace ns_smart = ns_smart_device_link::ns_smart_objects; -class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { +class RequestFromHMI : public CommandRequestImpl { public: RequestFromHMI(const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,8 +54,11 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { virtual bool Init(); virtual bool CleanUp(); virtual void Run(); - virtual void on_event(const event_engine::Event& event); + + void on_event(const event_engine::Event& event); void on_event(const event_engine::MobileEvent& event) OVERRIDE; + void OnTimeOut() OVERRIDE; + /** * @brief SendResponse allows to send response to hmi * @param correlation_id the correlation id for the rfesponse. @@ -91,7 +94,7 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { 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); + bool use_events); void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, const ApplicationSharedPtr app, 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 new file mode 100644 index 0000000000..e4f0bed223 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h @@ -0,0 +1,372 @@ +/* + Copyright (c) 2020, 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_REQUEST_FROM_MOBILE_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ + +#include "application_manager/commands/command_request_impl.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" +#include "utils/lock.h" + +namespace application_manager { +namespace commands { + +struct ResponseInfo { + 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_not_used; +}; + +/** + * @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 2 infos into one string with info + * @param first_info -contains result_code from HMI response and + * interface that returns response + * @param first_str - info string that should be first in result info + * @param second_info -contains result_code from HMI response and + * interface that returns response + * @param second_str - info string that should be second in result info + * @return if first_info is not available and second_str not empty return second + * if second_info is not available and first_str not empty return first + * other cases return result MergeInfos for 2 params + */ +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str); + +/** + * @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 RequestFromMobileImpl : public CommandRequestImpl { + public: + /** + * @brief The HashUpdateMode enum defines whether request has to update + * hash after its execution is finished + */ + enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate }; + + RequestFromMobileImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + /** + * @brief RequestFromMobileImpl class destructor + * + **/ + virtual ~RequestFromMobileImpl(); + + /** + * @brief Checks command permissions according to policy table + */ + bool CheckPermissions() OVERRIDE; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() OVERRIDE; + + /** + * @brief Cleanup all resources used by command + **/ + bool CleanUp() OVERRIDE; + + /** + * @brief Execute corresponding command by calling the action on reciever + **/ + void Run() OVERRIDE; + + void on_event(const event_engine::Event& event) OVERRIDE; + void on_event(const event_engine::MobileEvent& event) OVERRIDE; + + void OnTimeOut() OVERRIDE; + + 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); + + /* + * @brief Creates Mobile response + * + * @param success true if successful; false, if failed + * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c) + * @param info Provides additional human readable info regarding the result + * @param response_params Additional params in response + */ + void SendResponse( + const bool success, + const mobile_apis::Result::eType& result_code, + const char* info = NULL, + const smart_objects::SmartObject* response_params = NULL, + const std::vector<uint8_t> binary_data = std::vector<uint8_t>()); + /* + * @brief Sends HMI request + * + * @param function_id HMI request ID + * @param msg_params HMI request msg params + * @param use_events true if we need subscribe on event(HMI request) + * @return hmi correlation id + */ + uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, + const smart_objects::SmartObject* msg_params = NULL, + bool use_events = false); + + /* + * @brief Creates HMI request + * + * @param function_id HMI request ID + * @param msg_params HMI request msg params + */ + void CreateHMINotification( + const hmi_apis::FunctionID::eType& function_id, + const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params) + const; + + /** + * @brief Converts HMI result code to Mobile result code + * + * @param hmi_code HMI result code + * @return Mobile result code + */ + mobile_apis::Result::eType GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const; + + protected: + /** + * @brief Checks HMI capabilities for specified button support + * @param button Button to check + * @return true if button is present in HMI capabilities + * otherwise returns false + */ + bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; + + /** + * @brief Remove from current message parameters disallowed by policy table + */ + void RemoveDisallowedParameters(); + + /** + * @brief Checks if any request param was marked as disallowed by policy + * @return true if any param was marked as disallowed + */ + 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 code + * 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 out_first contains result_code from HMI response and + * interface that returns response + * @param out_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 Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param out_first Contains result_code from HMI response and + * interface that returns response + * @param out_second Contains result_code from HMI response and + * interface that returns response + * @param out_third 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, + ResponseInfo& out_third) 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 response_from_hmi contains response from HMI + * @param out_info contain info for sending to application + */ + void GetInfo(const smart_objects::SmartObject& response_from_hmi, + std::string& out_info) const; + + /** + * @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); + + /** + * @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, + const ResponseInfo& third); + + /** + * @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; + + /** + * @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 CheckResultCode(const ResponseInfo& first, + const ResponseInfo& second) const; + + /** + * @brief Returns policy parameters permissions + * @return Parameters permissions struct reference + */ + const CommandParametersPermissions& parameters_permissions() const; + + /** + * @brief hash_update_mode_ Defines whether request must update hash value of + * application or not + */ + HashUpdateMode hash_update_mode_; + + private: + DISALLOW_COPY_AND_ASSIGN(RequestFromMobileImpl); + + /** + * @brief Checks if HMI interface is available for the target function + * @param hmi_correlation_id HMI correlation id + * @param function_id Response message, which info should be extended + */ + bool ProcessHMIInterfacesAvailability( + const uint32_t hmi_correlation_id, + 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 + */ + void UpdateHash(); + + /** + * @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; + + /** + * @brief AddRequestToTimeoutHandler checks the request and adds it to + * request_timeout_handler map for tracking + * @param request_to_hmi request to HMI + */ + void AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const; + + /** + * @brief is_success_result_ Defines whether request succeded, at the moment + * it is value of 'success' field of appropriate response sent to mobile + */ + bool is_success_result_; +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h index 3057476937..78c8281a03 100644 --- a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h @@ -35,6 +35,7 @@ #include "application_manager/application_manager.h" #include "application_manager/commands/command_impl.h" +#include "application_manager/commands/command_request_impl.h" namespace application_manager { @@ -61,7 +62,7 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, const smart_objects::SmartObject& response_from_hmi, HmiInterfaces::InterfaceID interface); -class RequestToHMI : public CommandImpl { +class RequestToHMI : public CommandRequestImpl { public: RequestToHMI(const MessageSharedPtr& message, ApplicationManager& 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 0656372f47..b232875f43 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 @@ -64,6 +64,15 @@ class EventDispatcher { /* * @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; + + /* + * @brief Unsubscribes the observer from specific event + * * @param event_id The event ID to unsubscribe from * @param observer The observer to be unsubscribed */ 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..ffe659a07c 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,9 @@ 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/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h index 1f4eccaf46..0ebf90133e 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 @@ -70,9 +70,23 @@ class EventObserver { * * @param event The received event */ - virtual void on_event(const Event& event) = 0; + virtual void HandleOnEvent(const Event& event) = 0; - virtual void on_event(const MobileEvent& event); + virtual void HandleOnEvent(const MobileEvent& event); + + /** + * @brief Increments reference count to avoid observer destruction while + * event dispatcher keeping pointer to that observer + * @return true if request reference was incremented, otherwise returns false + */ + virtual bool IncrementReferenceCount() const; + + /** + * @brief Decrements reference count to allow observer be safely destroyed + * as event dispatcher does not keep any pointers to it + * @return true if request reference was decremented, otherwise returns false + */ + virtual bool DecrementReferenceCount() const; protected: /* diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h index 5db5a844da..10ae1f8967 100644 --- a/src/components/application_manager/include/application_manager/hmi_language_handler.h +++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h @@ -78,7 +78,7 @@ class HMILanguageHandler : public event_engine::EventObserver { */ hmi_apis::Common_Language::eType get_language_for(Interface interface) const; - void on_event(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; /** * @brief Trigger waiting for response 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 7d71611a3c..93b35ff99d 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 @@ -47,8 +47,10 @@ class PolicyEventObserver policy::PolicyHandlerInterface* const policy_handler, 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 HandleOnEvent( + const application_manager::event_engine::Event& event) OVERRIDE; + void HandleOnEvent( + const application_manager::event_engine::MobileEvent& event) OVERRIDE; 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 4a104812a4..479d433d50 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 @@ -47,8 +47,10 @@ class PolicyEventObserver policy::PolicyHandlerInterface* const policy_handler, 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 HandleOnEvent( + const application_manager::event_engine::Event& event) OVERRIDE; + void HandleOnEvent( + const application_manager::event_engine::MobileEvent& event) OVERRIDE; 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/request_controller_impl.h b/src/components/application_manager/include/application_manager/request_controller_impl.h index 7277cdc3fa..41d2419ba6 100644 --- a/src/components/application_manager/include/application_manager/request_controller_impl.h +++ b/src/components/application_manager/include/application_manager/request_controller_impl.h @@ -40,6 +40,7 @@ #include "utils/lock.h" #include "utils/conditional_variable.h" +#include "utils/threads/async_runner.h" #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" #include "utils/timer.h" @@ -47,6 +48,7 @@ #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" +#include "application_manager/event_engine/event_dispatcher_impl.h" #include "application_manager/request_controller.h" #include "application_manager/request_controller_settings.h" #include "application_manager/request_info.h" @@ -56,14 +58,15 @@ namespace application_manager { namespace request_controller { -class RequestControllerImpl : public RequestController { +class RequestControllerImpl : public RequestController, threads::AsyncRunner { public: /** * @brief Class constructor * */ RequestControllerImpl(const RequestControlerSettings& settings, - RequestTimeoutHandler& request_timeout_handler); + RequestTimeoutHandler& request_timeout_handler, + event_engine::EventDispatcher& event_disptacher); ~RequestControllerImpl(); @@ -81,6 +84,25 @@ class RequestControllerImpl : public RequestController { void AddNotification(const RequestPtr ptr) OVERRIDE; + bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool IsStillWaitingForResponse(const uint32_t connection_key, + const uint32_t correlation_id) const OVERRIDE; + + /** + * @brief Removes request from queue + * + * @param correlation_id Active request correlation ID, + * @param connection_key Active request connection key (0 for HMI requersts) + * @param function_id Active request function id + * @param force_terminate if true, request controller will terminate + * even if not allowed by request + */ + void TerminateRequest(const uint32_t correlation_id, const uint32_t connection_key, const int32_t function_id, @@ -126,6 +148,15 @@ class RequestControllerImpl : public RequestController { void TerminateWaitingForResponseAppRequests(const uint32_t app_id); /** + * @brief Starts a new async task for cleaning up the provided requests + * references + * and perform the rest of cleanup actions for each request + * @param requests list of requests to cleanup + */ + typedef std::list<RequestInfoPtr> RequestInfoPtrs; + void scheduleRequestsCleanup(const RequestInfoPtrs& requests); + + /** * @brief Checks whether all constraints are met before adding of request into * processing queue. Verifies amount of pending requests, amount of requests * per time scale for different HMI levels @@ -159,6 +190,19 @@ class RequestControllerImpl : public RequestController { volatile bool stop_flag_; }; + class RequestCleanerDelegate : public threads::ThreadDelegate { + public: + explicit RequestCleanerDelegate(const RequestInfoPtrs& requests); + ~RequestCleanerDelegate(); + void threadMain() OVERRIDE; + void exitThreadMain() OVERRIDE; + + private: + sync_primitives::Lock state_lock_; + sync_primitives::ConditionalVariable state_cond_; + RequestInfoPtrs requests_; + }; + std::vector<threads::Thread*> pool_; volatile TPoolState pool_state_; uint32_t pool_size_; @@ -167,14 +211,20 @@ class RequestControllerImpl : public RequestController { std::list<RequestPtr> mobile_request_list_; sync_primitives::Lock mobile_request_list_lock_; - /* - * Requests, that are waiting for responses + /** + * @brief Requests, that are waiting for responses * RequestInfoSet provides correct processing of requests with thre same * app_id and corr_id */ RequestInfoSet waiting_for_response_; /** + * @brief Requests, that are retained to be not destroyed right after + * sending response to mobile request + */ + HashSortedRequestInfoSet retained_mobile_requests_; + + /** * @brief Tracker verifying time scale and maximum requests amount in * different HMI levels */ @@ -206,7 +256,9 @@ class RequestControllerImpl : public RequestController { bool is_low_voltage_; const RequestControlerSettings& settings_; + RequestTimeoutHandler& request_timeout_handler_; + event_engine::EventDispatcher& event_dispatcher_; DISALLOW_COPY_AND_ASSIGN(RequestControllerImpl); }; diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index e3d5dfd491..3d9ecfa630 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -39,7 +39,7 @@ #include <stdint.h> #include <set> -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "commands/request_to_hmi.h" #include "utils/date_time.h" @@ -213,6 +213,15 @@ class RequestInfoSet { */ RequestInfoPtr FrontWithNotNullTimeout(); + /** + * @brief GetRequestsByConnectionKey gets all pending requests by provided + * connection key + * @param connection_key connection key for related requests + * @return list of all pending requests for a specified connection key + */ + std::list<RequestInfoPtr> GetRequestsByConnectionKey( + const uint32_t connection_key); + /* * @brief Erase request from colletion by log(n) time * @param request_info - request to erase diff --git a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h index c58d09598f..207f19e0c5 100644 --- a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h +++ b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h @@ -49,7 +49,7 @@ class RequestTimeoutHandlerImpl : public event_engine::EventObserver, void AddRequest(const uint32_t hmi_correlation_id, const Request& request) OVERRIDE; void RemoveRequest(const uint32_t hmi_correlation_id) OVERRIDE; - void on_event(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h index edb3581737..312302d157 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h @@ -79,7 +79,7 @@ class ResumptionDataProcessorImpl smart_objects::SmartObject& saved_app, ResumeCtrl::ResumptionCallBack callback) override; - void on_event(const app_mngr::event_engine::Event& event) override; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleOnTimeOut(const uint32_t correlation_id, const hmi_apis::FunctionID::eType function_id) override; 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 4dc4c1ad7d..6845851f97 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 @@ -103,6 +103,10 @@ class StateControllerImpl : public event_engine::EventObserver, ApplicationSharedPtr app, const mobile_apis::HMILevel::eType default_level) OVERRIDE; + // EventObserver interface + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::MobileEvent& event) OVERRIDE; + void OnAppWindowAdded( ApplicationSharedPtr app, const WindowID window_id, @@ -120,10 +124,6 @@ class StateControllerImpl : public event_engine::EventObserver, bool IsStateActive(HmiState::StateID state_id) const OVERRIDE; - // EventObserver interface - void on_event(const event_engine::Event& event) OVERRIDE; - void on_event(const event_engine::MobileEvent& event) OVERRIDE; - void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE; void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE; void DeactivateApp(ApplicationSharedPtr app, @@ -139,6 +139,7 @@ class StateControllerImpl : public event_engine::EventObserver, int64_t RequestHMIStateChange(ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority); + /** * @brief The HmiLevelConflictResolver struct * Move other application to HmiStates if applied moved to FULL or LIMITED diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h index a8ba796a1b..23e140ff29 100644 --- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h +++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h @@ -70,7 +70,8 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler, * in order to send system time query and GetSystemTimeResponse in order * to retrieve utc time and notify all the listeners with new time value. */ - void on_event(const application_manager::event_engine::Event& event) FINAL; + void HandleOnEvent( + const application_manager::event_engine::Event& event) FINAL; /** * @brief DoSystemTimeQuery sends the appropriate request to the system diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h index d9eb7528e4..dc8bfa4533 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h @@ -71,7 +71,7 @@ class ASGetAppServiceDataRequestFromHMI /** * @brief onTimeOut from request controller */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; /** * @brief on_event allows to handle events diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h index 36acf116f4..09b7829745 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h @@ -86,7 +86,7 @@ class ASPerformAppServiceInteractionRequestFromHMI /** * @brief onTimeOut from request controller */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h index 6971354806..f628b94cd1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,8 @@ namespace commands { /** * @brief GetAppServiceDataRequest command class **/ -class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { +class GetAppServiceDataRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetAppServiceDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h index 854ed3c6aa..e0665b9427 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -45,7 +45,7 @@ namespace commands { * @brief PerformAppServiceInteractionRequest command class **/ class PerformAppServiceInteractionRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformAppServiceInteractionRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index d70f279658..5145b42171 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,8 @@ namespace commands { /** * @brief PublishAppServiceRequest command class **/ -class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { +class PublishAppServiceRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PublishAppServiceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h index 4a883b92ee..6a85d10fd4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,7 @@ namespace commands { * @brief UnpublishAppServiceRequest command class **/ class UnpublishAppServiceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UnpublishAppServiceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index 25f389abd0..ff9d4e436a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -276,7 +276,7 @@ void ASGetAppServiceDataRequestFromHMI::on_event( } } -void ASGetAppServiceDataRequestFromHMI::onTimeOut() { +void ASGetAppServiceDataRequestFromHMI::OnTimeOut() { SDL_LOG_AUTO_TRACE(); SendErrorResponse(correlation_id(), hmi_apis::FunctionID::AppService_GetAppServiceData, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 315d06b85f..eafefa663f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -150,7 +150,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event( application_manager::commands::Command::SOURCE_SDL_TO_HMI); } -void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() { +void ASPerformAppServiceInteractionRequestFromHMI::OnTimeOut() { SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject response_params; response_params[strings::info] = diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index b0063a327f..8560112bf3 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -50,11 +50,11 @@ GetAppServiceDataRequest::GetAppServiceDataRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetAppServiceDataRequest::~GetAppServiceDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 64110a8e23..35b7543a2c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -49,11 +49,11 @@ PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index f2bc66520b..b2ae67610e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -51,11 +51,11 @@ PublishAppServiceRequest::PublishAppServiceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} PublishAppServiceRequest::~PublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc index 200bae01d9..cba87d3173 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc @@ -49,11 +49,11 @@ UnpublishAppServiceRequest::UnpublishAppServiceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h index f81919f4fa..e10b794685 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h @@ -51,7 +51,7 @@ class RCGetInteriorVehicleDataRequest const RCCommandParams& params); void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; ~RCGetInteriorVehicleDataRequest(); }; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h index 6bca1017e0..91f9b6564a 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "rc_rpc_plugin/commands/rc_command_params.h" #include "rc_rpc_plugin/interior_data_cache.h" #include "rc_rpc_plugin/rc_app_extension.h" @@ -48,7 +48,7 @@ enum TypeAccess { kDisallowed, kAllowed }; namespace commands { -class RCCommandRequest : public app_mngr::commands::CommandRequestImpl { +class RCCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief RCCommandRequest class constructor @@ -65,11 +65,11 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl { virtual ~RCCommandRequest(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void Run() OVERRIDE; - virtual void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; protected: bool is_subscribed; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h index 944d47b052..eeeb9988d7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h @@ -22,7 +22,8 @@ class RCPendingResumptionHandler : public resumption::PendingResumptionHandler { application_manager::ApplicationManager& application_manager, rc_rpc_plugin::InteriorDataCache& interior_data_cache); - void on_event(const application_manager::event_engine::Event& event) override; + void HandleOnEvent( + const application_manager::event_engine::Event& event) override; void HandleResumptionSubscriptionRequest( application_manager::AppExtension& extension, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc index fede1dbd11..0aaee81ad4 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc @@ -57,7 +57,7 @@ void RCGetInteriorVehicleDataRequest::Run() { SendRequest(); } -void RCGetInteriorVehicleDataRequest::onTimeOut() { +void RCGetInteriorVehicleDataRequest::OnTimeOut() { SDL_LOG_TRACE("function_id: " << function_id() << " correlation_id: " << correlation_id()); using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc index 9bf7977bdf..297c4b70bb 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc @@ -125,7 +125,7 @@ AcquireResult::eType ButtonPressRequest::AcquireResource( SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); return resource_allocation_manager_.AcquireResource( module_type, ModuleId(), app->app_id()); @@ -141,8 +141,7 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type, const ResourceState::eType state) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); - + application_manager_.application(RequestFromMobileImpl::connection_key()); resource_allocation_manager_.SetResourceState( module_type, ModuleId(), app->app_id(), state); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index c3b0a7d4a5..f5c5c9278d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -315,7 +315,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription( const_cast<smart_objects::SmartObject&>(hmi_response); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); const auto extension = RCHelpers::GetRCExtension(*app); const char* module_type; ns_smart_device_link::ns_smart_objects:: @@ -403,8 +403,8 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() { message_params::kSubscribe); if (is_subscribe_present_in_request) { - app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + app_mngr::ApplicationSharedPtr app = application_manager_.application( + RequestFromMobileImpl::connection_key()); const auto extension = RCHelpers::GetRCExtension(*app); const std::string module_type = ModuleType(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index dea660b780..5b500dfa30 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -372,7 +372,7 @@ AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource( SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); return resource_allocation_manager_.AcquireResource( module_type, ModuleId(), app->app_id()); @@ -387,7 +387,7 @@ void SetInteriorVehicleDataRequest::SetResourceState( const std::string& module_type, const ResourceState::eType state) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); resource_allocation_manager_.SetResourceState( module_type, ModuleId(), app->app_id(), state); } 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 e179c0c0d7..376723b964 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 @@ -31,7 +31,9 @@ */ #include "rc_rpc_plugin/commands/rc_command_request.h" + #include <sstream> + #include "application_manager/hmi_interfaces.h" #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler_interface.h" @@ -49,7 +51,7 @@ namespace commands { RCCommandRequest::RCCommandRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) - : application_manager::commands::CommandRequestImpl( + : application_manager::commands::RequestFromMobileImpl( message, params.application_manager_, params.rpc_service_, @@ -74,18 +76,18 @@ bool RCCommandRequest::IsInterfaceAvailable( return app_mngr::HmiInterfaces::STATE_NOT_AVAILABLE != state; } -void RCCommandRequest::onTimeOut() { +void RCCommandRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); SetResourceState(module_type, ResourceState::FREE); - SendResponse( - false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired"); + + RequestFromMobileImpl::OnTimeOut(); } bool RCCommandRequest::CheckDriverConsent() { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); const std::string module_type = ModuleType(); rc_rpc_plugin::TypeAccess access = CheckModule(module_type, app); @@ -131,7 +133,7 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) { void RCCommandRequest::Run() { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) { SDL_LOG_WARN("HMI interface RC is not available"); @@ -224,19 +226,19 @@ void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) { void RCCommandRequest::ProcessAccessResponse( const app_mngr::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); - app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + + auto app = application_manager_.application(connection_key()); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); + if (!app) { SDL_LOG_ERROR("NULL pointer."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, ""); return; } - const smart_objects::SmartObject& message = event.smart_object(); - - mobile_apis::Result::eType result_code = + const auto& message = event.smart_object(); + const auto result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[app_mngr::strings::params][app_mngr::hmi_response::code] .asUInt())); @@ -328,7 +330,7 @@ void RCCommandRequest::SendGetUserConsent( const smart_objects::SmartObject& module_ids) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::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/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc index e66023f27a..ba681b0136 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc @@ -14,7 +14,7 @@ RCPendingResumptionHandler::RCPendingResumptionHandler( , rpc_service_(application_manager.GetRPCService()) , interior_data_cache_(interior_data_cache) {} -void RCPendingResumptionHandler::on_event( +void RCPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); namespace am_strings = application_manager::strings; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc index 15b2148187..1b83034daf 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc @@ -113,7 +113,8 @@ class RCGetInteriorVehicleDataConsentTest , rpc_protection_manager_( std::make_shared<application_manager::MockRPCProtectionManager>()) , request_controller(mock_request_controler, - mock_request_timeout_handler_) + mock_request_timeout_handler_, + event_dispatcher_) , rpc_service_(app_mngr_, request_controller, &mock_protocol_handler, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc index fe8ade1e05..077d0d2927 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc @@ -369,7 +369,7 @@ TEST_F(RCPendingResumptionHandlerTest, EXPECT_CALL(event_dispatcher_mock_, raise_event(EventCheck(kAppId_2))); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); } TEST_F(RCPendingResumptionHandlerTest, @@ -415,7 +415,7 @@ TEST_F(RCPendingResumptionHandlerTest, EXPECT_CALL(mock_rpc_service_, ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI)); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); } } // namespace rc_rpc_plugin_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h index 2208671e0b..b6406901be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h @@ -61,12 +61,7 @@ class BasicCommunicationGetSystemTimeRequest app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); - /** - * @brief onTimeOut allows to handle case when - * system does not respond for certain request in - * appropriate time window. - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; }; } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h index 62be7e8836..7b0e3f4590 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h @@ -64,7 +64,7 @@ class ButtonGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ButtonGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h index 0b82feb1c5..98f96c29c4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h @@ -67,9 +67,9 @@ class GetSystemInfoRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; /** - * @brief onTimeOut from request controller + * @brief OnTimeOut from request controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h index ac6f1474e6..0cf1e0872e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief AudioStartStreamRequest command class **/ -class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief AudioStartStreamRequest class constructor @@ -62,10 +61,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, **/ virtual ~AudioStartStreamRequest(); - /** - * @brief onTimeOut from requrst Controller - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; /** * @brief Execute command @@ -75,7 +71,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, /** * @brief On event callback **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h index d2bda320a3..7cc4181f6e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviIsReadyRequest command class **/ -class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviIsReadyRequest class constructor @@ -72,7 +71,7 @@ class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI, **/ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h index 437d58861c..8a62f31933 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviSetVideoConfigRequest command class **/ -class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviSetVideoConfigRequest class constructor @@ -76,7 +75,7 @@ class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut callback */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviSetVideoConfigRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h index 76413cd55d..9527ae0a7d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviStartStreamRequest command class **/ -class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviStartStreamRequest class constructor @@ -70,12 +69,9 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI, /** * @brief On event callback **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief onTimeOut from requrst Controller - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h index 898a2a8f67..c836ad3cc8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h @@ -65,7 +65,7 @@ class NaviSubscribeWayPointsRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h index 6dd06f283d..353b265908 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h @@ -63,7 +63,7 @@ class RCGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(RCGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h index 15b2e13867..393442801c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief RCIsReadyRequest command class **/ -class RCIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class RCIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief RCIsReadyRequest class constructor @@ -75,7 +74,7 @@ class RCIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(RCIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h index 2751104486..21dc6a3bb2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h @@ -76,7 +76,7 @@ class SDLActivateAppRequest : public app_mngr::commands::RequestFromHMI { * @brief onTimeOut allows to process case when timeout has appeared * during request execution. */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; /** * @brief on_event allows to handle events diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h index f3e08d0a23..3d38e10525 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h @@ -45,8 +45,7 @@ namespace hmi { /** * @brief SubscribeButtonRequest command class **/ -class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief SubscribeButtonRequest class constructor @@ -68,7 +67,7 @@ class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI, **/ void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h index 4ddd6f25fc..6d87158e57 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h @@ -63,7 +63,7 @@ class TTSGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h index b00fc9cffa..c2c02e50ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h @@ -63,7 +63,7 @@ class TTSGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h index 802a196c46..e4a7ec5dee 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h @@ -65,7 +65,7 @@ class TTSGetSupportedLanguagesRequest void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h index 039df31972..97d8e02e59 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief TTSIsReadyRequest command class **/ -class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief TTSIsReadyRequest class constructor @@ -77,7 +76,7 @@ class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h index 2ac47ab013..536fe767bc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h @@ -67,7 +67,7 @@ class TTSSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSSetGlobalPropertiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h index 20e9004503..a572aa53e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h @@ -66,7 +66,7 @@ class UIAddCommandRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIAddCommandRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h index 660c81c4f8..0823e7e7b3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h @@ -66,7 +66,7 @@ class UIAddSubmenuRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIAddSubmenuRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h index baa181fb53..015dca8789 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h @@ -55,7 +55,7 @@ class UICreateWindowRequest : public app_mngr::commands::RequestToHMI { void Run() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h index 32e878e733..bb4799c0d0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h @@ -63,7 +63,7 @@ class UIGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h index d642beb341..3b395dc685 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h @@ -63,7 +63,7 @@ class UIGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h index 9c2492b9fe..1422035a2c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h @@ -64,7 +64,7 @@ class UIGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h index 5c7f6d4cc8..168f961e50 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief UIIsReadyRequest command class **/ -class UIIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class UIIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief UIIsReadyRequest class constructor @@ -77,7 +76,7 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h index 145f1d7c07..6f8002ce78 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h @@ -67,7 +67,7 @@ class UISetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UISetGlobalPropertiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h index b377a536cb..5a5f9228e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h @@ -44,8 +44,7 @@ namespace commands { namespace hmi { -class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI { public: UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -57,7 +56,7 @@ class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; @@ -72,4 +71,4 @@ class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, } // namespace sdl_rpc_plugin -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_
\ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h index ba4c49ab01..44cb779beb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h @@ -66,7 +66,7 @@ class VRAddCommandRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRAddCommandRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h index 7f8485ffa0..40e63651cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h @@ -63,7 +63,7 @@ class VRGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h index abcaa35726..3e3976244e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h @@ -63,7 +63,7 @@ class VRGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h index fb6d05b0aa..4bf7d68e75 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h @@ -64,7 +64,7 @@ class VRGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h index cbd77087b2..651f318b9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief VRIsReadyRequest command class **/ -class VRIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class VRIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief VRIsReadyRequest class constructor @@ -77,7 +76,7 @@ class VRIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h index 6ccd57947c..d55b4f5af7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h @@ -37,7 +37,7 @@ #include <string> #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -48,7 +48,7 @@ namespace commands { /** * @brief AddCommandRequest command class **/ -class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { +class AddCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AddCommandRequest class constructor @@ -71,18 +71,9 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; /** * @brief Init sets hash update mode for request @@ -117,13 +108,6 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { DISALLOW_COPY_AND_ASSIGN(AddCommandRequest); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - /** * @brief Checks add command param * When type is String there is a check on the contents \t\n \\t \\n @@ -140,17 +124,14 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { * @return info for mobile response */ const std::string GenerateMobileResponseInfo(); - bool send_ui_; - bool send_vr_; - - bool is_ui_received_; - bool is_vr_received_; std::string ui_info_; std::string vr_info_; hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; + bool ui_is_sent_; + bool vr_is_sent_; }; } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h index d99c5dab38..943d634f70 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief AddSubMenuRequest command class **/ -class AddSubMenuRequest : public app_mngr::commands::CommandRequestImpl { +class AddSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AddSubMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h index 8b7e86fb3f..4abe7d4ece 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h @@ -34,8 +34,8 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/pending.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -47,7 +47,7 @@ namespace commands { /** * @brief AlertManeuverRequest command class **/ -class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl { +class AlertManeuverRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AlertManeuverRequest class constructor @@ -70,12 +70,7 @@ class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl { **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h index 2250d7a8de..5352148289 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h @@ -36,7 +36,7 @@ #include <string> -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -48,7 +48,7 @@ namespace commands { /** * @brief AlertRequest command class **/ -class AlertRequest : public app_mngr::commands::CommandRequestImpl { +class AlertRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AlertRequest class constructor @@ -76,12 +76,9 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl { **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + void OnTimeOut() FINAL; protected: private: @@ -116,7 +113,7 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl { /* * @brief Tells if there are sent requests without responses */ - bool HasHmiResponsesToWait(); + bool IsPendingResponseExist(); /* * @brief Check if all strings have valid syntax in request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h index 0063c07512..f381317cf0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,8 @@ namespace commands { /** * @brief CancelInteractionRequest command class **/ -class CancelInteractionRequest : public app_mngr::commands::CommandRequestImpl { +class CancelInteractionRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CancelInteractionRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h index f9f780b84b..384b9da4ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h @@ -36,8 +36,8 @@ #include <strings.h> -#include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/pending.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/custom_string.h" #include "utils/macro.h" @@ -52,7 +52,7 @@ namespace custom_str = utils::custom_string; * @brief ChangeRegistrationRequest command class **/ class ChangeRegistrationRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ChangeRegistrationRequest class constructor @@ -75,12 +75,7 @@ class ChangeRegistrationRequest **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /* @@ -104,13 +99,6 @@ class ChangeRegistrationRequest */ bool IsLanguageSupportedByTTS(const int32_t& hmi_display_lang); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - /** * @brief Checks change_registration params(ttsName, appname, * ngnMediaScreenAppName, vrSynonyms) on invalid characters. @@ -164,8 +152,6 @@ class ChangeRegistrationRequest const custom_str::CustomString& newItem_; }; - app_mngr::commands::Pending pending_requests_; - hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; hmi_apis::Common_Result::eType tts_result_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h index b965e880b4..3f768c95e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,8 @@ namespace commands { /** * @brief CloseApplicationRequest command class **/ -class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl { +class CloseApplicationRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CloseApplicationRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h index aba2ce3be5..82967b717b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h @@ -37,7 +37,7 @@ #include <string> #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event_observer.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -53,7 +53,7 @@ namespace commands { * @brief CreateInteractionChoiceSetRequest command class **/ class CreateInteractionChoiceSetRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CreateInteractionChoiceSetRequest class constructor @@ -77,18 +77,9 @@ class CreateInteractionChoiceSetRequest **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; /** * @brief Init sets hash update mode for request @@ -137,12 +128,6 @@ class CreateInteractionChoiceSetRequest volatile bool error_from_hmi_; sync_primitives::Lock error_from_hmi_lock_; - /** - * @brief Flag shows if request already was expired by timeout - */ - volatile bool is_timed_out_; - sync_primitives::Lock is_timed_out_lock_; - sync_primitives::RecursiveLock vr_commands_lock_; /* * @brief Sends VR AddCommand request to HMI diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h index cfbfc460b7..3a3f84c0b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/hmi_state.h" #include "utils/macro.h" @@ -45,7 +45,7 @@ namespace commands { /** * @brief CreateWindow request command class **/ -class CreateWindowRequest : public app_mngr::commands::CommandRequestImpl { +class CreateWindowRequest : public app_mngr::commands::RequestFromMobileImpl { public: CreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h index 45864ca3aa..0092b0c917 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h @@ -36,7 +36,7 @@ #include <string> -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { /** * @brief DeleteCommandRequest command class **/ -class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteCommandRequest class constructor @@ -70,11 +70,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; /** @@ -86,13 +81,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest); /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - - /* * @brief Prepare result code and result for sending to mobile application * @param result_code contains result code for sending to mobile application * @param info contains info for mobile app. @@ -101,12 +89,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { bool PrepareResponseParameters(mobile_apis::Result::eType& result_code, std::string& info); - bool is_ui_send_; - bool is_vr_send_; - - bool is_ui_received_; - bool is_vr_received_; - hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; std::string ui_info_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h index 8e4d63df4a..60633cfbea 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { /** * @brief DeleteFileRequest command class **/ -class DeleteFileRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h index d5fa89c8be..ad478bc70d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h @@ -39,6 +39,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -52,7 +53,7 @@ typedef std::set<uint32_t> SentRequestsSet; * @brief DeleteInteractionChoiceSetRequest command class **/ class DeleteInteractionChoiceSetRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteInteractionChoiceSetRequest class constructor @@ -89,12 +90,6 @@ class DeleteInteractionChoiceSetRequest */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; - private: /* * @brief Check if requested choice set ID in use by perform interaction diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h index 20fff456d5..acb1565ec5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h @@ -36,6 +36,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { /** * @brief DeleteSubMenuRequest command class **/ -class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteSubMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h index b837724d7b..8be513d9ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/hmi_state.h" #include "utils/macro.h" @@ -45,7 +45,7 @@ namespace commands { /** * @brief CreateWindow request command class **/ -class DeleteWindowRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteWindowRequest : public app_mngr::commands::RequestFromMobileImpl { public: DeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h index 750288f5e8..b7865122aa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief DialNumber request command class **/ -class DialNumberRequest : public app_mngr::commands::CommandRequestImpl { +class DialNumberRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief DialNumberRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h index 1c18de3237..4f56a1b5f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,8 @@ namespace commands { /** * @brief EndAudioPassThruRequest command class **/ -class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl { +class EndAudioPassThruRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief EndAudioPassThruRequest class constructor @@ -73,7 +74,7 @@ class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(EndAudioPassThruRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h index 3d74a80dc2..1166fead63 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h @@ -1,7 +1,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -9,7 +9,7 @@ namespace app_mngr = application_manager; namespace commands { class GetCloudAppPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: GetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h index d4182ea004..2f9f591c73 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief GetFileRequest command class **/ -class GetFileRequest : public app_mngr::commands::CommandRequestImpl { +class GetFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h index a5d1611f02..deff991b9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -42,7 +42,7 @@ namespace app_mngr = application_manager; namespace commands { class GetSystemCapabilityRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: GetSystemCapabilityRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -55,7 +55,7 @@ class GetSystemCapabilityRequest virtual void Run() OVERRIDE; - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h index ec656820e5..a4aa606bd4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -43,7 +43,7 @@ namespace commands { /** * @brief GetWayPointsRequest command class **/ -class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl { +class GetWayPointsRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief GetWayPointsRequest class constructor @@ -63,12 +63,8 @@ class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl { * @brief Execute command **/ virtual void Run() OVERRIDE; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h index d98fa433b4..9435e80222 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief ListFilesRequest command class **/ -class ListFilesRequest : public app_mngr::commands::CommandRequestImpl { +class ListFilesRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ListFilesRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h index 434b6de028..da8f13c5d7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -47,7 +47,7 @@ namespace commands { * @brief PerformAudioPassThruRequest command class **/ class PerformAudioPassThruRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformAudioPassThruRequest class constructor @@ -67,13 +67,6 @@ class PerformAudioPassThruRequest virtual ~PerformAudioPassThruRequest(); /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - * - */ - virtual void onTimeOut(); - - /** * @brief Init required by command resources **/ bool Init(); @@ -83,12 +76,14 @@ class PerformAudioPassThruRequest **/ virtual void Run(); + void on_event(const app_mngr::event_engine::Event& event) FINAL; + /** - * @brief Interface method that is called whenever new event received + * @brief Function is called by RequestController when request execution time + * has exceed it's limit * - * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void OnTimeOut() FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h index 88182a0b8e..8652464fba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h @@ -38,6 +38,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -51,7 +52,7 @@ namespace commands { * @brief PerformInteractionRequest command class **/ class PerformInteractionRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformInteractionRequest class constructor @@ -79,19 +80,9 @@ class PerformInteractionRequest **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; - /* - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - * - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; protected: /** @@ -265,12 +256,11 @@ class PerformInteractionRequest smart_objects::SmartObject& msg_param) const; mobile_apis::InteractionMode::eType interaction_mode_; + std::int32_t ui_choice_id_received_; std::int32_t vr_choice_id_received_; std::string ui_text_entry_received_; - bool ui_response_received_; - bool vr_response_received_; bool app_pi_was_active_before_; static uint32_t pi_requests_count_; hmi_apis::Common_Result::eType vr_result_code_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h index b3e04f7796..f7aa0278a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h @@ -36,6 +36,7 @@ #include "application_manager/application_manager.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { /** * @brief PutFileRequest command class **/ -class PutFileRequest : public app_mngr::commands::CommandRequestImpl { +class PutFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PutFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index b3359f7752..d54f061228 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/policies/policy_handler_interface.h" #include "utils/custom_string.h" #include "utils/macro.h" @@ -56,7 +56,7 @@ namespace custom_str = utils::custom_string; * @brief Register app interface request command class **/ class RegisterAppInterfaceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief RegisterAppInterfaceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h index 760eb09c2d..d156371ccd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_ #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { * @brief ResetGlobalPropertiesRequest command class **/ class ResetGlobalPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ResetGlobalPropertiesRequest class constructor @@ -71,11 +71,6 @@ class ResetGlobalPropertiesRequest **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; /** @@ -94,13 +89,6 @@ class ResetGlobalPropertiesRequest bool PrepareResponseParameters(mobile_apis::Result::eType& out_result_code, std::string& out_response_info); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - DISALLOW_COPY_AND_ASSIGN(ResetGlobalPropertiesRequest); hmi_apis::Common_Result::eType ui_result_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h index 58b7b4491a..fc7b8e0207 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief scrollable message request command class **/ -class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl { +class ScrollableMessageRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ScrollableMessageRequest class constructor @@ -77,7 +78,7 @@ class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ScrollableMessageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h index 2f00b58d9e..96f560bd9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h @@ -34,8 +34,9 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ #include <string> + #include "application_manager/application_manager.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" #include "smart_objects/smart_object.h" @@ -47,7 +48,7 @@ namespace commands { /** * @brief SendHapticDataRequest command class **/ -class SendHapticDataRequest : public app_mngr::commands::CommandRequestImpl { +class SendHapticDataRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SendHapticDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h index 5a0dc67f35..c035ffca34 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_ #include <list> -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -45,7 +45,7 @@ namespace commands { /** * @brief send location request command class */ -class SendLocationRequest : public app_mngr::commands::CommandRequestImpl { +class SendLocationRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SendLocationRquest class constructor @@ -71,7 +71,7 @@ class SendLocationRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h index 520f27d8b9..aed482a8ab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief SetIconRequest command class **/ -class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl { +class SetAppIconRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief Contains information about the type of image @@ -73,7 +73,7 @@ class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h index a3a3ea12f9..c05ba16684 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h @@ -1,7 +1,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -9,7 +9,7 @@ namespace app_mngr = application_manager; namespace commands { class SetCloudAppPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: SetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -28,4 +28,4 @@ class SetCloudAppPropertiesRequest } // namespace commands } // namespace sdl_rpc_plugin -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
\ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h index 2f9c0946d3..0e0105c880 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,8 @@ namespace commands { /** * @brief SetDisplayLayoutRequest command class **/ -class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl { +class SetDisplayLayoutRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SetDisplayLayoutRequest class constructor @@ -68,7 +69,7 @@ class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h index fbf3056e58..37ad705930 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h @@ -33,8 +33,9 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_ #include <string> + #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { * @brief Register app interface request command class **/ class SetGlobalPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SetGlobalPropertiesRequest class constructor @@ -82,7 +83,7 @@ class SetGlobalPropertiesRequest */ bool Init() FINAL; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; /** * @brief Prepares total result for mobile according to three results: diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h index 3023bf4fec..af7427b2a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief SetMediaClockRequest request command class **/ -class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl { +class SetMediaClockRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SetMediaClockRequest class constructor @@ -71,7 +71,7 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: bool isDataValid(std::string& info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h index c9691a808f..3cc7c4d539 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -43,7 +43,7 @@ namespace commands { /** * @brief ShowAppMenuRequest command class **/ -class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl { +class ShowAppMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ShowAppMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h index 7694070a72..692cf4b137 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief ShowConstantTBTRequest command class **/ -class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl { +class ShowConstantTBTRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ShowConstantTBTRequest class constructor @@ -74,7 +75,7 @@ class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h index 26612609a4..1d9988c765 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief show request command class **/ -class ShowRequest : public app_mngr::commands::CommandRequestImpl { +class ShowRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief ShowRequest class constructor @@ -72,7 +72,7 @@ class ShowRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /* diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h index 5dbcbb7d41..f9cf401c7c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief slider request command class **/ -class SliderRequest : public app_mngr::commands::CommandRequestImpl { +class SliderRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SliderRequest class constructor @@ -76,7 +76,7 @@ class SliderRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h index 68e35fcd1d..f753c02990 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief speak request command class **/ -class SpeakRequest : public app_mngr::commands::CommandRequestImpl { +class SpeakRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SpeakRequest class constructor @@ -71,7 +71,7 @@ class SpeakRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /* diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h index ecb390095e..332d622895 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_ #include "application_manager/application_impl.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +46,8 @@ namespace commands { /** * @brief SubscribeButtonRequest command class **/ -class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { +class SubscribeButtonRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubscribeButtonRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h index 69154d7669..fbda174553 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,7 @@ namespace commands { * @brief SubsribeWayPointsRequest command class **/ class SubscribeWayPointsRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SubscribeWayPointsRequest class constructor @@ -76,7 +76,7 @@ class SubscribeWayPointsRequest */ bool Init() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h index 4789d35e60..c966be4dbe 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief SubtleAlertRequest command class **/ -class SubtleAlertRequest : public app_mngr::commands::CommandRequestImpl { +class SubtleAlertRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubtleAlertRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h index eb2398f279..9b031859c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h @@ -37,6 +37,7 @@ #include <string> #include "application_manager/application_manager.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" #include "smart_objects/smart_object.h" @@ -48,7 +49,7 @@ namespace commands { /** * @brief SystemRequest command class **/ -class SystemRequest : public app_mngr::commands::CommandRequestImpl { +class SystemRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SystemRequest class constructor @@ -76,7 +77,7 @@ class SystemRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h index 0bc01f2aaa..90d0c24b88 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +46,7 @@ namespace commands { * @brief Unregister app interface request command class **/ class UnregisterAppInterfaceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief UnregisterAppInterfaceRequest class constructor @@ -57,11 +57,11 @@ class UnregisterAppInterfaceRequest app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} /** * \brief UnregisterAppInterfaceRequest class destructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h index 5adecb4d7a..42e2a7ffde 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -42,7 +42,11 @@ namespace app_mngr = application_manager; namespace commands { -class UnsubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { +/** + * @brief UnsubscribeButtonRequest command class + **/ +class UnsubscribeButtonRequest + : public app_mngr::commands::RequestFromMobileImpl { public: UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h index c4357d7529..33aa9f743a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -41,7 +41,7 @@ namespace app_mngr = application_manager; namespace commands { class UnsubscribeWayPointsRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief UnsubscribeWayPointsRequest class constructor @@ -75,7 +75,7 @@ class UnsubscribeWayPointsRequest */ bool Init() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h index e1e5df2289..29bc269938 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief UpdateTurnListRequest command class **/ -class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl { +class UpdateTurnListRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UpdateTurnListRequest class constructor @@ -74,7 +74,7 @@ class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h index 871359bc9a..17842c17ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h @@ -47,7 +47,7 @@ class WayPointsPendingResumptionHandler app_mngr::ApplicationManager& application_manager); // EventObserver interface - void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleResumptionSubscriptionRequest( app_mngr::AppExtension& extension, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc index a6e95f9f72..3429bd6059 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc @@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest( hmi_capabilities, policy_handler) {} -void BasicCommunicationGetSystemTimeRequest::onTimeOut() { +void BasicCommunicationGetSystemTimeRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc index d9c7901c67..2cda09dadc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h" + #include "utils/logger.h" namespace sdl_rpc_plugin { @@ -60,7 +61,7 @@ void ButtonGetCapabilitiesRequest::Run() { SendRequest(); } -void ButtonGetCapabilitiesRequest::onTimeOut() { +void ButtonGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::Buttons_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc index 1b42abd055..33651426c9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc @@ -61,7 +61,7 @@ void GetSystemInfoRequest::Run() { SendRequest(); } -void GetSystemInfoRequest::onTimeOut() { +void GetSystemInfoRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateCachedCapabilities(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index 05d0a4e8f2..7d030f9c66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -53,7 +53,6 @@ AudioStartStreamRequest::AudioStartStreamRequest( rpc_service, hmi_capabilities, policy_handle) - , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { SDL_LOG_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = @@ -138,7 +137,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { } } -void AudioStartStreamRequest::onTimeOut() { +void AudioStartStreamRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RetryStartSession(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc index 850f292972..7eb2233202 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc @@ -49,8 +49,7 @@ NaviIsReadyRequest::NaviIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} NaviIsReadyRequest::~NaviIsReadyRequest() {} @@ -86,7 +85,7 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) { } } -void NaviIsReadyRequest::onTimeOut() { +void NaviIsReadyRequest::OnTimeOut() { hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::Navigation_IsReady); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index 613dfc24a3..a660887019 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h" + #include <string> #include <vector> @@ -51,8 +52,7 @@ NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {} @@ -132,7 +132,7 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { } } -void NaviSetVideoConfigRequest::onTimeOut() { +void NaviSetVideoConfigRequest::OnTimeOut() { SDL_LOG_WARN("Timed out while waiting for SetVideoConfig response"); ApplicationSharedPtr app = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index c671b11282..d2db777e94 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -53,7 +53,6 @@ NaviStartStreamRequest::NaviStartStreamRequest( rpc_service, hmi_capabilities, policy_handle) - , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { SDL_LOG_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = @@ -140,7 +139,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { } } -void NaviStartStreamRequest::onTimeOut() { +void NaviStartStreamRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RetryStartSession(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc index 7305ae37b1..63735d84db 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc @@ -60,7 +60,7 @@ void NaviSubscribeWayPointsRequest::Run() { SendRequest(); } -void NaviSubscribeWayPointsRequest::onTimeOut() { +void NaviSubscribeWayPointsRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc index 774acf54f1..63aa4b11ef 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc @@ -59,7 +59,7 @@ void RCGetCapabilitiesRequest::Run() { SendRequest(); } -void RCGetCapabilitiesRequest::onTimeOut() { +void RCGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc index 3d31953474..725a55c2b5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc @@ -53,8 +53,7 @@ RCIsReadyRequest::RCIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} RCIsReadyRequest::~RCIsReadyRequest() {} @@ -99,7 +98,7 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) { } } -void RCIsReadyRequest::onTimeOut() { +void RCIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 4de8b17b8d..a8b34bf2d4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -272,7 +272,7 @@ void SDLActivateAppRequest::Run() { } #endif // EXTERNAL_PROPRIETARY_MODE -void SDLActivateAppRequest::onTimeOut() { +void SDLActivateAppRequest::OnTimeOut() { using namespace hmi_apis::FunctionID; using namespace hmi_apis::Common_Result; using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc index b1699534bc..5a2420b223 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc @@ -53,8 +53,7 @@ SubscribeButtonRequest::SubscribeButtonRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) { + policy_handle) { hmi_apis::Common_ButtonName::eType button_name = static_cast<hmi_apis::Common_ButtonName::eType>( (*message_)[app_mngr::strings::msg_params] @@ -133,7 +132,7 @@ void SubscribeButtonRequest::on_event(const event_engine::Event& event) { } } -void SubscribeButtonRequest::onTimeOut() { +void SubscribeButtonRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.AddExpiredButtonRequest( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc index 3bca6c05c1..9b5eb6f14b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc @@ -59,7 +59,7 @@ void TTSGetCapabilitiesRequest::Run() { SendRequest(); } -void TTSGetCapabilitiesRequest::onTimeOut() { +void TTSGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc index 2b409c68de..42de944da3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc @@ -59,7 +59,7 @@ void TTSGetLanguageRequest::Run() { SendRequest(); } -void TTSGetLanguageRequest::onTimeOut() { +void TTSGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc index 87df2402bb..2fb74fbb46 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void TTSGetSupportedLanguagesRequest::Run() { SendRequest(); } -void TTSGetSupportedLanguagesRequest::onTimeOut() { +void TTSGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc index 5ff7bc5a50..6a09616926 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc @@ -50,8 +50,7 @@ TTSIsReadyRequest::TTSIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handler) {} TTSIsReadyRequest::~TTSIsReadyRequest() {} @@ -92,7 +91,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) { } } -void TTSIsReadyRequest::onTimeOut() { +void TTSIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc index 35059bf48d..574230ee11 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc @@ -60,7 +60,7 @@ void TTSSetGlobalPropertiesRequest::Run() { SendRequest(); } -void TTSSetGlobalPropertiesRequest::onTimeOut() { +void TTSSetGlobalPropertiesRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc index 067ada3153..2cd40b1705 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc @@ -60,7 +60,7 @@ void UIAddCommandRequest::Run() { SendRequest(); } -void UIAddCommandRequest::onTimeOut() { +void UIAddCommandRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc index 275c411eae..8b9ecf4932 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc @@ -60,7 +60,7 @@ void UIAddSubmenuRequest::Run() { SendRequest(); } -void UIAddSubmenuRequest::onTimeOut() { +void UIAddSubmenuRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc index e98ad5c45e..1acbb9e682 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc @@ -60,7 +60,7 @@ void UICreateWindowRequest::Run() { SendRequest(); } -void UICreateWindowRequest::onTimeOut() { +void UICreateWindowRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc index 00a8ad761e..604f293c4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc @@ -59,7 +59,7 @@ void UIGetCapabilitiesRequest::Run() { SendRequest(); } -void UIGetCapabilitiesRequest::onTimeOut() { +void UIGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc index bf91b7e294..597452a471 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc @@ -59,7 +59,7 @@ void UIGetLanguageRequest::Run() { SendRequest(); } -void UIGetLanguageRequest::onTimeOut() { +void UIGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc index 480fa2499f..c67f552fe2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void UIGetSupportedLanguagesRequest::Run() { SendRequest(); } -void UIGetSupportedLanguagesRequest::onTimeOut() { +void UIGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc index f3da33c5b5..630a54e3cc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc @@ -50,8 +50,7 @@ UIIsReadyRequest::UIIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} UIIsReadyRequest::~UIIsReadyRequest() {} @@ -91,7 +90,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { } } -void UIIsReadyRequest::onTimeOut() { +void UIIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc index c82a4d2131..9b664bb81c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc @@ -60,7 +60,7 @@ void UISetGlobalPropertiesRequest::Run() { SendRequest(); } -void UISetGlobalPropertiesRequest::onTimeOut() { +void UISetGlobalPropertiesRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc index dbebf79018..e2cbb4e467 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc @@ -53,8 +53,7 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) { + policy_handle) { hmi_apis::Common_ButtonName::eType button_name = static_cast<hmi_apis::Common_ButtonName::eType>( (*message_)[app_mngr::strings::msg_params] @@ -74,7 +73,7 @@ void UnsubscribeButtonRequest::Run() { SendRequest(); } -void UnsubscribeButtonRequest::onTimeOut() { +void UnsubscribeButtonRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.AddExpiredButtonRequest( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc index c8979ca62b..69bc299c7e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc @@ -60,7 +60,7 @@ void VRAddCommandRequest::Run() { SendRequest(); } -void VRAddCommandRequest::onTimeOut() { +void VRAddCommandRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc index 3f528f2f58..d26d91f701 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc @@ -59,7 +59,7 @@ void VRGetCapabilitiesRequest::Run() { SendRequest(); } -void VRGetCapabilitiesRequest::onTimeOut() { +void VRGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc index f5e9b0e848..f15ed3017b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc @@ -59,7 +59,7 @@ void VRGetLanguageRequest::Run() { SendRequest(); } -void VRGetLanguageRequest::onTimeOut() { +void VRGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc index 73e68e8503..3f6a268e70 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void VRGetSupportedLanguagesRequest::Run() { SendRequest(); } -void VRGetSupportedLanguagesRequest::onTimeOut() { +void VRGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc index 2efd227add..3e8fd0b4e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc @@ -50,8 +50,7 @@ VRIsReadyRequest::VRIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} VRIsReadyRequest::~VRIsReadyRequest() {} @@ -92,7 +91,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { } } -void VRIsReadyRequest::onTimeOut() { +void VRIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index 03b0ee20fc..ddd2c9db35 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/add_command_request.h" + #include <string> #include "application_manager/application.h" @@ -56,24 +57,22 @@ AddCommandRequest::AddCommandRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , send_ui_(false) - , send_vr_(false) - , is_ui_received_(false) - , is_vr_received_(false) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) + , ui_is_sent_(false) + , vr_is_sent_(false) {} AddCommandRequest::~AddCommandRequest() {} -void AddCommandRequest::onTimeOut() { +void AddCommandRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RemoveCommand(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } bool AddCommandRequest::Init() { @@ -184,6 +183,7 @@ void AddCommandRequest::Run() { smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { ui_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -201,6 +201,9 @@ void AddCommandRequest::Run() { (*message_)[strings::msg_params][strings::cmd_icon]; } + ui_is_sent_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + if (((*message_)[strings::msg_params].keyExists( strings::secondary_image)) && ((*message_)[strings::msg_params][strings::secondary_image].keyExists( @@ -211,8 +214,6 @@ void AddCommandRequest::Run() { ui_msg_params[strings::secondary_image] = (*message_)[strings::msg_params][strings::secondary_image]; } - - send_ui_ = true; } smart_objects::SmartObject vr_msg_params = @@ -227,16 +228,15 @@ void AddCommandRequest::Run() { vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; vr_msg_params[strings::grammar_id] = app->get_grammar_id(); - send_vr_ = true; + vr_is_sent_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); } - if (send_ui_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true); } - if (send_vr_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true); } } @@ -322,7 +322,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_AddCommand: { SDL_LOG_INFO("Received UI_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_info_); @@ -334,7 +333,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_AddCommand: { SDL_LOG_INFO("Received VR_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, vr_info_); @@ -350,6 +348,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } @@ -505,10 +504,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { &(message[strings::msg_params])); } -bool AddCommandRequest::IsPendingResponseExist() { - return send_ui_ != is_ui_received_ || send_vr_ != is_vr_received_; -} - bool AddCommandRequest::IsWhiteSpaceExist() { SDL_LOG_AUTO_TRACE(); const char* str = NULL; @@ -559,7 +554,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { } bool AddCommandRequest::BothSend() const { - return send_vr_ && send_ui_; + return ui_is_sent_ && vr_is_sent_; } const std::string AddCommandRequest::GenerateMobileResponseInfo() { @@ -607,17 +602,18 @@ void AddCommandRequest::RemoveCommand() { app->RemoveCommand(cmd_id); - if (BothSend() && !(is_vr_received_ || is_ui_received_)) { + if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) && + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) { // in case we have send bth UI and VR and no one respond // we have nothing to remove from HMI so no DeleteCommand expected return; } - if (BothSend() && !is_vr_received_) { + if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); } - if (BothSend() && !is_ui_received_) { + if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { msg_params[strings::grammar_id] = app->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc index 309f07e443..635734a74d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc @@ -50,11 +50,11 @@ AddSubMenuRequest::AddSubMenuRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} AddSubMenuRequest::~AddSubMenuRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc index 0e0d91f05d..89b305ae9d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc @@ -26,8 +26,10 @@ */ #include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h" + #include <cstring> #include <string> + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler.h" @@ -45,11 +47,11 @@ AlertManeuverRequest::AlertManeuverRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , tts_speak_result_code_(hmi_apis::Common_Result::INVALID_ENUM) , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -171,6 +173,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_Speak: { SDL_LOG_INFO("Received TTS_Speak event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); + pending_requests_.Remove(event_id); tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -186,12 +189,11 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } } - if (!pending_requests_.IsFinal(event_id)) { - SDL_LOG_DEBUG( - "There are some pending responses from HMI. " - "AlertManeuverRequest still waiting."); + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } + std::string return_info; mobile_apis::Result::eType result_code; const bool result = PrepareResponseParameters(result_code, return_info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index 26c209bf2a..aab2c8c486 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -37,7 +37,6 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" - #include "application_manager/policies/policy_handler.h" #include "smart_objects/smart_object.h" #include "utils/helpers.h" @@ -55,11 +54,11 @@ AlertRequest::AlertRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , awaiting_ui_alert_response_(false) , awaiting_tts_speak_response_(false) , awaiting_tts_stop_speaking_response_(false) @@ -121,6 +120,17 @@ void AlertRequest::Run() { } } +void AlertRequest::OnTimeOut() { + SDL_LOG_AUTO_TRACE(); + if (!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + RequestFromMobileImpl::OnTimeOut(); + return; + } + SDL_LOG_INFO( + "Default timeout ignored. " + "AlertRequest with soft buttons wait timeout on HMI side"); +} + void AlertRequest::on_event(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); @@ -175,9 +185,11 @@ void AlertRequest::on_event(const event_engine::Event& event) { } } - if (HasHmiResponsesToWait()) { + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command is still waiting for HMI response"); return; } + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; std::string info; const bool result = PrepareResponseParameters(result_code, info); @@ -443,7 +455,7 @@ bool AlertRequest::CheckStrings() { return true; } -bool AlertRequest::HasHmiResponsesToWait() { +bool AlertRequest::IsPendingResponseExist() { SDL_LOG_AUTO_TRACE(); return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || awaiting_tts_stop_speaking_response_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc index 27020f2719..53511cb83f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc @@ -49,11 +49,11 @@ CancelInteractionRequest::CancelInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CancelInteractionRequest::~CancelInteractionRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc index 13a57cf9a8..47ff7cbea1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc @@ -32,8 +32,11 @@ */ #include "sdl_rpc_plugin/commands/mobile/change_registration_request.h" + #include <string.h> + #include <algorithm> + #include "application_manager/application_impl.h" #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" @@ -44,14 +47,14 @@ namespace { namespace custom_str = utils::custom_string; struct IsSameNickname { - explicit IsSameNickname(const custom_str::CustomString& app_id) - : app_id_(app_id) {} + explicit IsSameNickname(const custom_str::CustomString& app_name) + : app_name(app_name) {} bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); + return app_name.CompareIgnoreCase(nickname.c_str()); } private: - const custom_str::CustomString app_id_; + const custom_str::CustomString& app_name; }; } // namespace @@ -68,11 +71,11 @@ ChangeRegistrationRequest::ChangeRegistrationRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -83,7 +86,6 @@ void ChangeRegistrationRequest::SendVRRequest( ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::VR_ChangeRegistration; - pending_requests_.Add(function); smart_objects::SmartObject vr_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -102,7 +104,6 @@ void ChangeRegistrationRequest::SendTTSRequest( ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::TTS_ChangeRegistration; - pending_requests_.Add(function); smart_objects::SmartObject tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -124,7 +125,6 @@ void ChangeRegistrationRequest::SendUIRequest( const int32_t hmi_language) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::UI_ChangeRegistration; - pending_requests_.Add(function); // UI processing smart_objects::SmartObject ui_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -231,17 +231,22 @@ void ChangeRegistrationRequest::Run() { return; } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) { - // VR processing - SendVRRequest(app, msg_params); + StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) { - // TTS processing - SendTTSRequest(app, msg_params); + StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) { SendUIRequest(app, msg_params, hmi_language); } + + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { + SendTTSRequest(app, msg_params); + } + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { + SendVRRequest(app, msg_params); + } } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { @@ -254,7 +259,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_ChangeRegistration: { SDL_LOG_INFO("Received UI_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - pending_requests_.Remove(event_id); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_response_info_); @@ -263,7 +267,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_ChangeRegistration: { SDL_LOG_INFO("Received VR_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - pending_requests_.Remove(event_id); vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, vr_response_info_); @@ -272,7 +275,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_ChangeRegistration: { SDL_LOG_INFO("Received TTS_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - pending_requests_.Remove(event_id); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, tts_response_info_); @@ -284,43 +286,39 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { } } - if (pending_requests_.IsFinal(event_id)) { - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - SDL_LOG_ERROR("NULL pointer"); - return; - } + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); + return; + } - if (hmi_apis::Common_Result::SUCCESS == ui_result_) { - application->set_ui_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::hmi_display_language] - .asInt())); - } + ApplicationSharedPtr application = + application_manager_.application(connection_key()); - if (hmi_apis::Common_Result::SUCCESS == vr_result_ || - hmi_apis::Common_Result::SUCCESS == tts_result_) { - application->set_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string response_info; - const bool result = PrepareResponseParameters(result_code, response_info); + if (!application) { + SDL_LOG_ERROR("NULL pointer"); + return; + } - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::eType::ChangeRegistrationID; + if (hmi_apis::Common_Result::SUCCESS == ui_result_) { + application->set_ui_language(static_cast<mobile_api::Language::eType>( + (*message_)[strings::msg_params][strings::hmi_display_language] + .asInt())); + } - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - } else { - SDL_LOG_INFO( - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + if (hmi_apis::Common_Result::SUCCESS == vr_result_ || + hmi_apis::Common_Result::SUCCESS == tts_result_) { + application->set_language(static_cast<mobile_api::Language::eType>( + (*message_)[strings::msg_params][strings::language].asInt())); } -} + + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + std::string response_info; + const bool result = PrepareResponseParameters(result_code, response_info); + SendResponse(result, + result_code, + response_info.empty() ? NULL : response_info.c_str(), + &(message[strings::msg_params])); +} // namespace commands namespace { void CheckInfo(std::string& str) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc index b4a09844f2..5154ace4ee 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc @@ -47,11 +47,11 @@ CloseApplicationRequest::CloseApplicationRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CloseApplicationRequest::~CloseApplicationRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 2f624efe76..98e26e1aa9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h" + #include <algorithm> #include <cstring> #include <string> @@ -58,17 +59,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , choice_set_id_(0) , expected_chs_count_(0) , received_chs_count_(0) , should_send_warnings_(false) - , error_from_hmi_(false) - , is_timed_out_(false) {} + , error_from_hmi_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { SDL_LOG_AUTO_TRACE(); @@ -406,13 +406,13 @@ void CreateInteractionChoiceSetRequest::on_event( } } -void CreateInteractionChoiceSetRequest::onTimeOut() { +void CreateInteractionChoiceSetRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_) { - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); + RequestFromMobileImpl::OnTimeOut(); } - CommandRequestImpl::onTimeOut(); + DeleteChoices(); auto& resume_ctrl = application_manager_.resume_controller(); @@ -421,10 +421,6 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { correlation_id(), static_cast<hmi_apis::FunctionID::eType>(function_id())); - // We have to keep request alive until receive all responses from HMI - // according to SDLAQ-CRS-2976 - sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_); - is_timed_out_ = true; application_manager_.TerminateRequest( connection_key(), correlation_id(), function_id()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc index 8febbf4f60..81b8985cd5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc @@ -53,11 +53,11 @@ CreateWindowRequest::CreateWindowRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CreateWindowRequest::~CreateWindowRequest() {} @@ -214,7 +214,7 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); - const auto result_code = CommandRequestImpl::GetMobileResultCode( + const auto result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( response_message[strings::params][hmi_response::code].asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc index 358a002606..dead764811 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc @@ -52,15 +52,11 @@ DeleteCommandRequest::DeleteCommandRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , is_ui_send_(false) - , is_vr_send_(false) - , is_ui_received_(false) - , is_vr_received_(false) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -99,17 +95,11 @@ void DeleteCommandRequest::Run() { /* Need to set all flags before sending request to HMI * for correct processing this flags in method on_event */ if (command.keyExists(strings::menu_params)) { - is_ui_send_ = true; - } - // check vr params - if (command.keyExists(strings::vr_commands)) { - is_vr_send_ = true; - } - if (is_ui_send_) { StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); } - if (is_vr_send_) { + // check vr params + if (command.keyExists(strings::vr_commands)) { // VR params msg_params[strings::grammar_id] = application->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; @@ -151,7 +141,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_DeleteCommand: { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); SDL_LOG_DEBUG("Received UI_DeleteCommand event with result " @@ -161,7 +150,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::VR_DeleteCommand: { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); SDL_LOG_DEBUG("Received VR_DeleteCommand event with result " @@ -216,11 +204,6 @@ bool DeleteCommandRequest::Init() { return true; } -bool DeleteCommandRequest::IsPendingResponseExist() { - SDL_LOG_AUTO_TRACE(); - return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_; -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc index 127843813c..268d1fa0cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc @@ -50,11 +50,11 @@ DeleteFileRequest::DeleteFileRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DeleteFileRequest::~DeleteFileRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index b675042d16..eac43bb22b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -51,11 +51,11 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , response_result_codes_() {} DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} @@ -130,11 +130,6 @@ void DeleteInteractionChoiceSetRequest::on_event( } } -void DeleteInteractionChoiceSetRequest::onTimeOut() { - SDL_LOG_AUTO_TRACE(); - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); -} - bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( ApplicationConstSharedPtr app) { SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 09346dc20a..aa16c9b218 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -52,11 +52,11 @@ DeleteSubMenuRequest::DeleteSubMenuRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , requests_list_() , pending_request_corr_id_(0) {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc index 6f36f99c6c..73fa7f4774 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc @@ -47,11 +47,11 @@ DeleteWindowRequest::DeleteWindowRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DeleteWindowRequest::~DeleteWindowRequest() {} @@ -130,7 +130,7 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); - const auto result_code = CommandRequestImpl::GetMobileResultCode( + const auto result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( response_message[strings::params][hmi_response::code].asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc index f0ef2e0028..c14eb02dae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc @@ -49,11 +49,11 @@ DialNumberRequest::DialNumberRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DialNumberRequest::~DialNumberRequest() {} @@ -118,7 +118,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { SDL_LOG_INFO("Received DialNumber event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - result_code = CommandRequestImpl::GetMobileResultCode( + result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt())); break; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc index f5506503e9..00e75b0c26 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc @@ -47,11 +47,11 @@ EndAudioPassThruRequest::EndAudioPassThruRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} EndAudioPassThruRequest::~EndAudioPassThruRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc index 585636bfa8..93da86f2be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -14,11 +14,11 @@ GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index 620d901f3c..d9a592adfd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -67,11 +67,11 @@ GetFileRequest::GetFileRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , file_name_("") , file_type_(mobile_apis::FileType::INVALID_ENUM) , length_(0) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 64eae885a8..b044556f64 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -50,11 +50,11 @@ GetSystemCapabilityRequest::GetSystemCapabilityRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc index 9e156bf755..e371889574 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h" + #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" @@ -47,11 +48,11 @@ GetWayPointsRequest::GetWayPointsRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetWayPointsRequest::~GetWayPointsRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc index 9262466e34..9ab636aaf5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc @@ -52,11 +52,11 @@ ListFilesRequest::ListFilesRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ListFilesRequest::~ListFilesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index 74b474f76b..a690c0bc9b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h" + #include <cstring> #include "application_manager/application_impl.h" @@ -53,21 +54,21 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM) , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {} PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} -void PerformAudioPassThruRequest::onTimeOut() { +void PerformAudioPassThruRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); FinishTTSSpeak(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } bool PerformAudioPassThruRequest::Init() { @@ -192,7 +193,8 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { return; } } - if (IsWaitingHMIResponse()) { + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index da1f744689..bf0f05ba32 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -68,16 +68,14 @@ PerformInteractionRequest::PerformInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM) , ui_choice_id_received_(INVALID_CHOICE_ID) , vr_choice_id_received_(INVALID_CHOICE_ID) - , ui_response_received_(false) - , vr_response_received_(false) , app_pi_was_active_before_(false) , vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM) , ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { @@ -226,6 +224,10 @@ void PerformInteractionRequest::Run() { app->set_perform_interaction_layout(interaction_layout); // increment amount of active requests ++pi_requests_count_; + + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendVRPerformInteractionRequest(app); SendUIPerformInteractionRequest(app); } @@ -238,7 +240,6 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_PerformInteraction: { SDL_LOG_DEBUG("Received UI_PerformInteraction event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - ui_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -250,7 +251,6 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_PerformInteraction: { SDL_LOG_DEBUG("Received VR_PerformInteraction"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - vr_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -281,19 +281,20 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { } } -void PerformInteractionRequest::onTimeOut() { +void PerformInteractionRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { SDL_LOG_DEBUG("Interaction Mode: BOTH"); - if (true == vr_response_received_) { + if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } else { application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout_); + set_current_state(RequestState::kAwaitingResponse); } break; } @@ -301,14 +302,14 @@ void PerformInteractionRequest::onTimeOut() { SDL_LOG_DEBUG("Interaction Mode: VR_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { SDL_LOG_DEBUG("InteractionMode: MANUAL_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); break; } default: { @@ -352,7 +353,7 @@ bool PerformInteractionRequest::ProcessVRResponse( return false; } - if (!ui_response_received_ && + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) && InteractionMode::MANUAL_ONLY != interaction_mode_) { SendClosePopupRequestToHMI(); } @@ -990,7 +991,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( const bool PerformInteractionRequest::HasHMIResponsesToWait() const { SDL_LOG_AUTO_TRACE(); - return !ui_response_received_ || !vr_response_received_; + return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) || + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR); } void PerformInteractionRequest::SendBothModeResponse( @@ -1055,8 +1057,8 @@ PerformInteractionRequest::PrepareResultCodeForResponse( return mobile_ui_result_code; } - return CommandRequestImpl::PrepareResultCodeForResponse(ui_response, - vr_response); + return RequestFromMobileImpl::PrepareResultCodeForResponse(ui_response, + vr_response); } bool PerformInteractionRequest::PrepareResultForMobileResponse( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index 5263991716..1db62f0669 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -69,11 +69,11 @@ PutFileRequest::PutFileRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , offset_(0) , sync_file_name_() , length_(0) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 53820eccbb..2224f17c4e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -134,11 +134,11 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , are_tts_chunks_invalid_(false) , are_hmi_types_invalid_(false) , is_resumption_failed_(false) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index dd5e3d3e88..92c5d19a05 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -35,7 +35,6 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" - #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -52,11 +51,11 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -218,12 +217,6 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( return result; } -bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { - return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_RC); -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc index 7cfe5f5414..573c340201 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc @@ -54,11 +54,11 @@ ScrollableMessageRequest::ScrollableMessageRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ScrollableMessageRequest::~ScrollableMessageRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc index 2b0a36cb9d..b5e629320a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc @@ -48,11 +48,11 @@ SendHapticDataRequest::SendHapticDataRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SendHapticDataRequest::~SendHapticDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc index fcc898b348..7cf226c968 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc @@ -48,11 +48,11 @@ SendLocationRequest::SendLocationRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SendLocationRequest::~SendLocationRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc index 9eb4c82721..8eb3b9e1ec 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc @@ -54,11 +54,11 @@ SetAppIconRequest::SetAppIconRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , is_icons_saving_enabled_(false) { const std::string path = application_manager_.get_settings().app_icons_folder(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc index 45ff0078fb..98cae4856f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -15,11 +15,11 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc index b2ca3e6cfa..ba0a20b459 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc @@ -49,11 +49,11 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index 0aab000376..b8f1e3d70f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -73,11 +73,11 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , is_ui_send_(false) , is_tts_send_(false) , is_rc_send_(false) @@ -426,10 +426,10 @@ bool SetGlobalPropertiesRequest::Init() { return true; } -void SetGlobalPropertiesRequest::onTimeOut() { +void SetGlobalPropertiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); auto& resume_ctrl = application_manager_.resume_controller(); @@ -455,7 +455,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( bool result = false; if (!is_rc_send_) { - result = CommandRequestImpl::PrepareResultForMobileResponse( + result = RequestFromMobileImpl::PrepareResultForMobileResponse( ui_properties_info, tts_properties_info); } else { result = PrepareResultForMobileResponse( @@ -476,7 +476,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( } if (!is_rc_send_) { - result_code = CommandRequestImpl::PrepareResultCodeForResponse( + result_code = RequestFromMobileImpl::PrepareResultCodeForResponse( ui_properties_info, tts_properties_info); } else { result_code = PrepareResultCodeForResponse( @@ -517,8 +517,9 @@ bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse( (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code) || (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code); - const bool final_result = CommandRequestImpl::CheckResult(both_info, third) || - CommandRequestImpl::CheckResult(third, both_info); + const bool final_result = + RequestFromMobileImpl::CheckResultCode(both_info, third) || + RequestFromMobileImpl::CheckResultCode(third, both_info); return final_result; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc index 285118749a..b2c9f46940 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc @@ -52,11 +52,11 @@ SetMediaClockRequest::SetMediaClockRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetMediaClockRequest::~SetMediaClockRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc index fdcf9d2434..4f7a46d1e7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -47,11 +47,11 @@ ShowAppMenuRequest::ShowAppMenuRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ShowAppMenuRequest::~ShowAppMenuRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc index e8dbe579c5..6e21861e0a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc @@ -54,11 +54,11 @@ ShowConstantTBTRequest::ShowConstantTBTRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ShowConstantTBTRequest::~ShowConstantTBTRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc index 910ab9ef23..7b7518f4d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc @@ -52,11 +52,11 @@ ShowRequest::ShowRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , core_result_code_(mobile_apis::Result::INVALID_ENUM) , current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) , template_config_(smart_objects::SmartType::SmartType_Null) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index 0fdc412572..fb332970ab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -51,11 +51,11 @@ SliderRequest::SliderRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SliderRequest::~SliderRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc index f8307f8355..593faf795e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc @@ -36,6 +36,7 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" +#include "interfaces/HMI_API.h" #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -51,11 +52,11 @@ SpeakRequest::SpeakRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SpeakRequest::~SpeakRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc index 723a1ececa..da48f193e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc @@ -50,11 +50,11 @@ SubscribeButtonRequest::SubscribeButtonRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SubscribeButtonRequest::~SubscribeButtonRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc index 11cbdac14a..da9a6e2adc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc @@ -49,11 +49,11 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} @@ -121,7 +121,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } -void SubscribeWayPointsRequest::onTimeOut() { +void SubscribeWayPointsRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (application_manager_.GetAppServiceManager().FindWayPointsHandler() != nullptr) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc index 8491a859e6..eba1abd3ff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc @@ -48,11 +48,11 @@ SubtleAlertRequest::SubtleAlertRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , awaiting_ui_subtle_alert_response_(false) , awaiting_tts_speak_response_(false) , awaiting_tts_stop_speaking_response_(false) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index 518c256d94..10be518409 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -411,11 +411,11 @@ SystemRequest::SystemRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SystemRequest::~SystemRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc index 09de35773a..74eec08c46 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc @@ -52,11 +52,11 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc index 7aa6e2b40a..c715612ba5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc @@ -49,11 +49,11 @@ UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {} @@ -127,7 +127,7 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } -void UnsubscribeWayPointsRequest::onTimeOut() { +void UnsubscribeWayPointsRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (application_manager_.GetAppServiceManager().FindWayPointsHandler() != nullptr) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc index 3da9206184..3fbaad77b0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc @@ -56,11 +56,11 @@ UpdateTurnListRequest::UpdateTurnListRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UpdateTurnListRequest::~UpdateTurnListRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc index af6c7f3c1d..5c0a0d746b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc @@ -140,7 +140,7 @@ void WayPointsPendingResumptionHandler::RaiseFakeSuccessfulResponse( event.raise(application_manager_.event_dispatcher()); } -void WayPointsPendingResumptionHandler::on_event( +void WayPointsPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { using namespace application_manager; SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc index 7dadad59fe..e841b4ae81 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc @@ -97,6 +97,8 @@ TEST_F(ActivateAppRequestTest, Run_SUCCESS) { (*msg)[strings::msg_params][strings::activate_app_hmi_level] = mobile_apis::HMILevel::HMI_FULL; #endif + InitEventDispatcher(); + ActivateAppRequestPtr command(CreateCommand<ActivateAppRequest>(msg)); EXPECT_CALL(app_mngr_, set_application_id(kCorrelationId, kAppId)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc index 9cd87b053d..751eb84e53 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc @@ -62,7 +62,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) { .WillByDefault(ReturnRef(mock_protocol_handler)); EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed()); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace basic_communication_get_system_time_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc index f3d8dd4f93..81a105f8e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc @@ -75,6 +75,9 @@ class ButtonGetCapabilitiesRequestTest TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand<ButtonGetCapabilitiesRequest>(command_msg)); @@ -92,6 +95,9 @@ TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(ButtonGetCapabilitiesRequestTest, onTimeOut_ButtonsGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand<ButtonGetCapabilitiesRequest>(command_msg)); @@ -101,7 +107,7 @@ TEST_F(ButtonGetCapabilitiesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc index 5b860499dd..0fa2edd9c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc @@ -71,6 +71,8 @@ TEST_F(GetSystemInfoRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + InitEventDispatcher(); + RequestToHMIPtr command(CreateCommand<GetSystemInfoRequest>(command_msg)); const uint32_t kAppId = command->application_id(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc index 64bf167f83..babfb71756 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc @@ -70,6 +70,8 @@ TEST_F(MixingAudioSupportedRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand<MixingAudioSupportedRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc index 7ce3a353e9..9bf5257676 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc @@ -199,7 +199,7 @@ TEST_F(NaviSetVideoConfigRequestTest, OnTimeout) { EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(1); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace navi_set_video_config_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc index f7da89df0b..56a6cd2e2f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc @@ -73,6 +73,8 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + InitEventDispatcher(); + RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); ASSERT_TRUE(command->Init()); @@ -88,6 +90,7 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(RCGetCapabilitiesRequestTest, onTimeOut_OnCapabilityInitialized_RemoveRCGetCapabilities) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<RCGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -96,7 +99,7 @@ TEST_F(RCGetCapabilitiesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace rc_get_capabilities_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc index cb90859018..f4e3784642 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc @@ -217,7 +217,7 @@ TEST_F(RCIsReadyRequestTest, Run_ErrorMessage_StateNotAvailable) { TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace rc_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index a2dc705f60..443050b47f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -59,6 +59,7 @@ namespace hmi_response = am::hmi_response; using am::ApplicationSet; using am::commands::MessageSharedPtr; using am::event_engine::Event; +using application_manager::event_engine::EventObserver; using connection_handler_test::MockConnectionHandler; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::SDLActivateAppRequest; @@ -504,10 +505,11 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); - ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); + ON_CALL(mock_event_dispatcher_, + remove_observer(_, testing::Matcher<EventObserver&>(_))); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc index 21260250ae..482ca93f3e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc @@ -114,6 +114,7 @@ using event_engine_test::MockEventDispatcher; class RequestToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { + InitEventDispatcher(); std::shared_ptr<am_commands::RequestToHMI> command( CreateCommand<am_commands::RequestToHMI>()); @@ -124,6 +125,8 @@ TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { } TEST_F(RequestToHMITest, SendRequest_SUCCESS) { + InitEventDispatcher(); + std::shared_ptr<am_commands::RequestToHMI> command( CreateCommand<am_commands::RequestToHMI>()); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -222,6 +225,8 @@ TYPED_TEST_CASE(RequestToHMICommandsTest3, RequestCommandsList3); TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + this->InitEventDispatcher(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); @@ -233,6 +238,8 @@ TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + this->InitEventDispatcher(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -243,6 +250,8 @@ TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest3, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + EXPECT_CALL(this->event_dispatcher_, remove_observer(_)); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc index d339a4acf8..61214d64a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc @@ -141,7 +141,7 @@ TEST_F(HMISubscribeButtonRequestTest, .WillByDefault(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(kCorrelationId, kFunctionID)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(HMISubscribeButtonRequestTest, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc index bae6b6082e..b3ba2d30a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class TTSGetCapabilitiesRequestTest TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<TTSGetCapabilitiesRequest>(command_msg)); @@ -93,6 +94,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<TTSGetCapabilitiesRequest>(command_msg)); @@ -102,7 +104,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc index a0bf0887db..275f4a18ff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc @@ -77,6 +77,7 @@ class TTSGetLanguageRequestTest TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<TTSGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc index 1561e1def5..373d217ee6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc @@ -77,6 +77,7 @@ class TTSGetSupportedLanguagesRequestTest TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg)); @@ -94,6 +95,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetSupportedLanguagesRequestTest, onTimeOut_TTSGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<TTSGetSupportedLanguagesRequest>(command_msg)); @@ -103,7 +105,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc index e758bfca1f..3428cc8923 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc @@ -242,7 +242,7 @@ TEST_F(TTSIsReadyRequestTest, ASSERT_TRUE(command_->Init()); command_->Run(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace tts_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc index 1057a89cc6..ca568ba630 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class UIGetCapabilitiesRequestTest TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<UIGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc index c944f1b49b..6cdcd6eb00 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc @@ -77,6 +77,7 @@ class UIGetLanguageRequestTest TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<UIGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc index 251b6b7d58..69d0f6d117 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc @@ -77,6 +77,7 @@ class UIGetSupportedLanguagesRequestTest TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<UIGetSupportedLanguagesRequest>(command_msg)); @@ -94,6 +95,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetSupportedLanguagesRequestTest, onTimeOut_UIGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<UIGetSupportedLanguagesRequest>(command_msg)); @@ -103,7 +105,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc index a82ad39d83..4db9f5cf62 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc @@ -208,7 +208,7 @@ TEST_F(UIIsReadyRequestTest, TEST_F(UIIsReadyRequestTest, OnTimeout_SUCCESS_CacheIsAbsent) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace ui_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc index 3236987d14..434738a2e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc @@ -112,7 +112,7 @@ TEST_F(HMIUnsubscribeButtonRequestTest, .WillByDefault(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(HMIUnsubscribeButtonRequestTest, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc index 9760462d05..0c95013964 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc @@ -64,6 +64,7 @@ namespace strings = am::strings; namespace hmi_response = am::hmi_response; using am::commands::CommandImpl; using am::event_engine::Event; +using application_manager::event_engine::EventObserver; using sdl_rpc_plugin::commands::UpdateDeviceListRequest; typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr; @@ -90,6 +91,8 @@ class UpdateDeviceListRequestTest }; TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( @@ -111,6 +114,8 @@ TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) { } TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESS) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( @@ -132,6 +137,8 @@ TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESS) { } TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsFalse_UNSUCCESS) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc index 92e3fa1187..b6aa134dfc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc @@ -69,6 +69,8 @@ TEST_F(UpdateSDLRequestTest, RUN_SUCCESS) { (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + InitEventDispatcher(); + UpdateSDLRequestPtr command(CreateCommand<UpdateSDLRequest>(command_msg)); EXPECT_CALL(mock_policy_handler_, PTExchangeAtUserRequest(kCorrelationId)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc index cef87f06b4..2933b6aa44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class VRGetCapabilitiesRequestTest TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<VRGetCapabilitiesRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc index 6235b41691..fffc56b979 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc @@ -77,6 +77,7 @@ class VRGetLanguageRequestTest TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand<VRGetLanguageRequest>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc index 73657528e9..af2faa12e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc @@ -77,7 +77,7 @@ class VRGetSupportedLanguagesRequestTest TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); - + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<VRGetSupportedLanguagesRequest>(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -94,6 +94,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetSupportedLanguagesRequestTest, onTimeOut_VRGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand<VRGetSupportedLanguagesRequest>(command_msg)); @@ -103,7 +104,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc index 3d2a46707e..ea1b90598e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc @@ -192,7 +192,7 @@ TEST_F(VRIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout_CacheIsAbsent) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace vr_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc index 93ae813535..b4795dae21 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc @@ -74,6 +74,7 @@ using ::testing::_; using ::testing::InSequence; using ::testing::Return; using namespace smart_objects; +using app_mngr::commands::RequestFromMobileImpl; namespace custom_str = utils::custom_string; namespace strings = ::application_manager::strings; @@ -222,10 +223,9 @@ class AddCommandRequestTest mock_rpc_service_, ManageMobileCommand(response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr<CommandRequestImpl> base_class_request = - static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr); - base_class_request->onTimeOut(); + std::shared_ptr<RequestFromMobileImpl> base_class_request = + static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr); + base_class_request->OnTimeOut(); } MessageSharedPtr msg_; @@ -608,22 +608,41 @@ TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_UI_DeleteCommand) { } TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) { - MessageSharedPtr command_msg = CreateMessage(SmartType_Map); - (*command_msg)[params][connection_key] = kConnectionKey; - MessageSharedPtr event_msg = CreateMessage(SmartType_Map); - (*event_msg)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; - (*event_msg)[msg_params][cmd_id] = kCmdId; + CreateBasicParamsVRRequest(); + CreateBasicParamsUIRequest(); + SmartObject& params = (*msg_)[strings::params]; + params[hmi_response::code] = hmi_apis::Common_Result::WARNINGS; + SmartObject& image = (*msg_)[msg_params][cmd_icon]; + EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _)) + .WillOnce(Return(mobile_apis::Result::SUCCESS)); Event event_ui(hmi_apis::FunctionID::UI_AddCommand); - event_ui.set_smart_object(*event_msg); - + event_ui.set_smart_object(*msg_); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); - event_vr.set_smart_object(*event_msg); + event_vr.set_smart_object(*msg_); + + am::CommandsMap commands_map; + EXPECT_CALL(*mock_app_, commands_map()) + .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>( + commands_map, lock_ptr_))); + + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) + .WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) + .WillOnce(Return(true)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0); std::shared_ptr<AddCommandRequest> request_ptr = - CreateCommand<AddCommandRequest>(command_msg); + CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); request_ptr->on_event(event_ui); request_ptr->on_event(event_vr); @@ -1097,11 +1116,10 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr<CommandRequestImpl> base_class_request = - static_cast<std::shared_ptr<CommandRequestImpl> >( + std::shared_ptr<RequestFromMobileImpl> base_class_request = + static_cast<std::shared_ptr<RequestFromMobileImpl> >( CreateCommand<AddCommandRequest>(msg_)); - base_class_request->onTimeOut(); + base_class_request->OnTimeOut(); } TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { @@ -1148,10 +1166,9 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr<CommandRequestImpl> base_class_request = - static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr); - base_class_request->onTimeOut(); + std::shared_ptr<RequestFromMobileImpl> base_class_request = + static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr); + base_class_request->OnTimeOut(); } } // namespace add_command_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index 9130fa52a0..233a99a8cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -56,6 +56,7 @@ using am::MockMessageHelper; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::event_engine::Event; +using app_mngr::commands::RequestFromMobileImpl; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::AlertRequest; using ::testing::_; @@ -207,7 +208,7 @@ TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) { ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] .asBool(), false); @@ -259,13 +260,13 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { class CallOnTimeOut { public: - CallOnTimeOut(CommandRequestImpl& command) : command_(command) {} + CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {} void operator()() { - command_.onTimeOut(); + command_.OnTimeOut(); } - CommandRequestImpl& command_; + RequestFromMobileImpl& command_; }; TEST_F(AlertRequestTest, Init_DurationExists_SUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index d77e0588f8..3f8ac0028b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -165,11 +165,6 @@ class CreateInteractionChoiceSetResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { - MessageSharedPtr msg_vr = CreateMessage(smart_objects::SmartType_Map); - (*msg_vr)[strings::msg_params][strings::result_code] = - am::mobile_api::Result::GENERIC_ERROR; - (*msg_vr)[strings::msg_params][strings::success] = false; - std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr = CreateCommand<CreateInteractionChoiceSetRequest>(); @@ -179,6 +174,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { ON_CALL(*mock_app, get_grammar_id()).WillByDefault(Return(kConnectionKey)); ON_CALL(*mock_app, RemoveCommand(_)).WillByDefault(Return()); + InitNegativeResponse(); + MessageSharedPtr vr_command_result; EXPECT_CALL( @@ -191,7 +188,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - req_vr->onTimeOut(); + req_vr->OnTimeOut(); EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::success].asBool(), false); @@ -706,6 +703,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidErrorFromHMI_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); + InitNegativeResponse(); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), @@ -716,8 +715,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); - - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, @@ -766,7 +764,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { @@ -811,12 +809,13 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(invalid_app)); EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0); + resumption_test::MockResumeCtrl mock_resume_ctrl; EXPECT_CALL(app_mngr_, resume_controller()) .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, @@ -871,7 +870,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillOnce(Return(mock_app_)); EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)); - command_->onTimeOut(); + InitNegativeResponse(); + + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index c7627b7e55..b23e8eefeb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -184,7 +184,7 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) { ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ((*vr_command_result)[am::strings::msg_params][am::strings::success] .asBool(), false); @@ -732,10 +732,20 @@ TEST_F(PerformAudioPassThruRequestTest, // For setting current_state_ -> kCompleted EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); - command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); - command_sptr_->onTimeOut(); + MessageSharedPtr timeout_response = + CreateMessage(smart_objects::SmartType_Map); + (*timeout_response)[am::strings::msg_params][am::strings::result_code] = + am::mobile_api::Result::GENERIC_ERROR; + (*timeout_response)[am::strings::msg_params][am::strings::success] = false; + + EXPECT_CALL( + mock_message_helper_, + CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) + .WillOnce(Return(timeout_response)); + + command_sptr_->OnTimeOut(); } TEST_F(PerformAudioPassThruRequestTest, @@ -806,7 +816,7 @@ TEST_F(PerformAudioPassThruRequestTest, HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(false)); - command_sptr_->onTimeOut(); + command_sptr_->OnTimeOut(); } } // namespace perform_audio_pass_thru_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc index 193229eeb0..196c83d144 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc @@ -173,6 +173,26 @@ class PerformInteractionRequestTest performinteraction_choice_set_lock_ptr_; }; +class PerformInteractionRequestTestClass : public PerformInteractionRequest { + public: + PerformInteractionRequestTestClass( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : PerformInteractionRequest(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + + void StartAwaitForInterfaces() { + StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_VR); + StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_UI); + } +}; + TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); @@ -182,8 +202,8 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map); (*request_msg)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::BOTH; - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(request_msg); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(request_msg); MockAppPtr mock_app; ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); @@ -192,6 +212,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { event.set_smart_object(*response_msg_vr); command->Init(); + command->StartAwaitForInterfaces(); command->on_event(event); MessageSharedPtr response_to_mobile = CreateMessage(smart_objects::SmartType_Map); @@ -208,7 +229,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::success].asBool(), @@ -222,8 +243,8 @@ TEST_F(PerformInteractionRequestTest, OnEvent_BOTHMode_UIChoiceIdReceivedFirst) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); @@ -244,6 +265,8 @@ TEST_F(PerformInteractionRequestTest, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); + command->StartAwaitForInterfaces(); + command->on_event(event_ui); command->on_event(event_vr); @@ -256,8 +279,8 @@ TEST_F(PerformInteractionRequestTest, OnEvent_BOTHMode_VRChoiceIdReceivedFirst) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); @@ -278,6 +301,8 @@ TEST_F(PerformInteractionRequestTest, _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true))); + command->StartAwaitForInterfaces(); + command->on_event(event_vr); EXPECT_EQ(hmi_apis::FunctionID::UI_ClosePopUp, (*request_to_hmi)[strings::params][strings::function_id].asInt()); @@ -298,11 +323,13 @@ TEST_F(PerformInteractionRequestTest, OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -344,11 +371,13 @@ TEST_F(PerformInteractionRequestTest, OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -387,11 +416,13 @@ TEST_F( MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -429,11 +460,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR is not supported by system"); @@ -478,11 +511,13 @@ TEST_F( MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID( hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID); MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID( @@ -526,11 +561,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage( hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE"); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); @@ -574,11 +611,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, ""); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); @@ -622,11 +661,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr<PerformInteractionRequest> command = - CreateCommand<PerformInteractionRequest>(msg_from_mobile); + std::shared_ptr<PerformInteractionRequestTestClass> command = + CreateCommand<PerformInteractionRequestTestClass>(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage( hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR error message"); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index f62f6b4682..f1bb7b64ca 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -440,7 +440,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(ResetGlobalPropertiesRequestTest, @@ -507,7 +507,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(ResetGlobalPropertiesRequestTest, @@ -564,7 +564,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace reset_global_properties diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index d9bffc6b4a..e9077cb7f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -55,6 +55,7 @@ namespace am = application_manager; using am::MockMessageHelper; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; +using app_mngr::commands::RequestFromMobileImpl; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::SliderRequest; using ::testing::_; @@ -182,13 +183,13 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { class CallOnTimeOut { public: - CallOnTimeOut(CommandRequestImpl& command) : command_(command) {} + CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {} void operator()() { - command_.onTimeOut(); + command_.OnTimeOut(); } - CommandRequestImpl& command_; + RequestFromMobileImpl& command_; }; TEST_F(SliderRequestTest, Init_SUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h index 74f12c07d4..2edf9358c4 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h @@ -61,7 +61,7 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VIGetVehicleTypeRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h index 96f8c8ecb8..3a835caa5c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h @@ -44,8 +44,7 @@ namespace commands { /** * @brief VIIsReadyRequest command class **/ -class VIIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class VIIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief VIIsReadyRequest class constructor @@ -73,7 +72,7 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VIIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h index 7fc84b7986..b066fa9654 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h @@ -66,7 +66,7 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: CustomVehicleDataManager& custom_vehicle_data_manager_; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h index 56f0e39621..2c78086cfd 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief DiagnosticMessageRequest command class **/ -class DiagnosticMessageRequest : public app_mngr::commands::CommandRequestImpl { +class DiagnosticMessageRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DiagnosticMessageRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h index 562d7f236b..6643c1e158 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief GetDTCsRequest command class **/ -class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl { +class GetDTCsRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetDTCsRequest class constructor @@ -71,7 +71,7 @@ class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetDTCsRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h index 8a594b0647..5e6e4c0227 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief GetVehicleDataRequest command class **/ -class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl { +class GetVehicleDataRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetVehicleDataRequest class constructor @@ -67,7 +67,7 @@ class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl { virtual void Run(); protected: - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h index 8566075504..0e27e7402d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" namespace vehicle_info_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief ReadDIDRequest command class **/ -class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl { +class ReadDIDRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ReadDIDRequest class constructor @@ -65,7 +65,7 @@ class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h index 663e64f2a0..4a92d736a3 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h @@ -39,6 +39,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/custom_vehicle_data_manager.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" @@ -53,7 +54,7 @@ namespace commands { * @brief SubscribeVehicleDataRequest command class **/ class SubscribeVehicleDataRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubscribeVehicleDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h index 4f2a01244f..f728c44753 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h @@ -36,6 +36,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/custom_vehicle_data_manager.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" @@ -50,7 +51,7 @@ namespace commands { * @brief UnsubscribeVehicleDataRequest command class **/ class UnsubscribeVehicleDataRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UnsubscribeVehicleDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h index 78f8f685cc..271f950d03 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h @@ -52,7 +52,7 @@ class VehicleInfoPendingResumptionHandler app_mngr::ApplicationManager& application_manager, CustomVehicleDataManager& custom_vehicle_data_manager); - void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleResumptionSubscriptionRequest(app_mngr::AppExtension& extension, app_mngr::Application& app) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc index 26a9990079..808b8c85c2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc @@ -56,7 +56,7 @@ void VIGetVehicleTypeRequest::Run() { SendRequest(); } -void VIGetVehicleTypeRequest::onTimeOut() { +void VIGetVehicleTypeRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_GetVehicleType); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc index 2c9ac78523..cbbf8a2a3f 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc @@ -51,8 +51,7 @@ VIIsReadyRequest::VIIsReadyRequest( params.application_manager_, params.rpc_service_, params.hmi_capabilities_, - params.policy_handler_) - , EventObserver(application_manager_.event_dispatcher()) {} + params.policy_handler_) {} VIIsReadyRequest::~VIIsReadyRequest() {} @@ -99,7 +98,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { } } -void VIIsReadyRequest::onTimeOut() { +void VIIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_IsReady); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc index da925e68e7..ee0fac65e7 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc @@ -77,7 +77,7 @@ void VISubscribeVehicleDataRequest::Run() { SendRequest(); } -void VISubscribeVehicleDataRequest::onTimeOut() { +void VISubscribeVehicleDataRequest::OnTimeOut() { event_engine::Event timeout_event( hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData); SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc index 762528c51b..37f99857e2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc @@ -49,11 +49,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") DiagnosticMessageRequest::DiagnosticMessageRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} DiagnosticMessageRequest::~DiagnosticMessageRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc index 2f236dd8b2..9044e0a1aa 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc @@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") GetDTCsRequest::GetDTCsRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} GetDTCsRequest::~GetDTCsRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index 854d78b684..3cc1645825 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -54,11 +54,11 @@ namespace str = strings; GetVehicleDataRequest::GetVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} GetVehicleDataRequest::~GetVehicleDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc index c718d18965..443bcd3e8c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc @@ -48,11 +48,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") ReadDIDRequest::ReadDIDRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} ReadDIDRequest::~ReadDIDRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc index 9e35e96ce3..db3922e1a2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, VehicleInfoCommandParams params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {} @@ -103,7 +103,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { } EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); if (!app) { SDL_LOG_ERROR("NULL pointer."); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 7d81701a64..e04e529a67 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -52,11 +52,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {} @@ -189,7 +189,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); if (!app) { SDL_LOG_ERROR("NULL pointer."); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc index 6721d93658..c9affa5760 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc @@ -205,7 +205,7 @@ void VehicleInfoPendingResumptionHandler::TriggerPendingResumption() { } } -void VehicleInfoPendingResumptionHandler::on_event( +void VehicleInfoPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(pending_resumption_lock_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc index 20bf34f2ca..75f5ea3b83 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc @@ -99,7 +99,7 @@ TEST_F( ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace vi_get_vehicle_type_request diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc index f207faad77..5828630f24 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc @@ -210,7 +210,7 @@ TEST_F(VIIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) { ASSERT_TRUE(command_->Init()); command_->Run(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace vi_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc index 5b2f4d5e25..82c5aaeafa 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc @@ -380,7 +380,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, raise_event(EventCheck(subscribed_correlation_id, expected_data_in_event))); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -427,7 +427,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, expected_data_in_event))); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -469,7 +469,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -506,7 +506,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -550,7 +550,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, TwoAppsOneSharedDataSuccess) { resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -599,7 +599,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); @@ -648,7 +648,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); const std::map<std::string, hmi_apis::Common_VehicleDataResultCode::eType> second_subscriptions_result = { @@ -661,7 +661,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, VehicleInfo_SubscribeVehicleData); second_event.set_smart_object(second_response); - resumption_handler_->on_event(second_event); + resumption_handler_->HandleOnEvent(second_event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index bfb83d8de8..55c437d506 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -175,7 +175,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( , request_timeout_handler_( new request_controller::RequestTimeoutHandlerImpl(*this)) , request_ctrl_(new request_controller::RequestControllerImpl( - am_settings, *request_timeout_handler_)) + am_settings, *request_timeout_handler_, event_dispatcher_)) , mobile_correlation_id_(0) , correlation_id_(0) , max_correlation_id_(UINT_MAX) @@ -5033,6 +5033,22 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( } } +bool ApplicationManagerImpl::RetainRequestInstance( + const uint32_t connection_key, const uint32_t correlation_id) { + return request_ctrl_->RetainRequestInstance(connection_key, correlation_id); +} + +bool ApplicationManagerImpl::RemoveRetainedRequest( + const uint32_t connection_key, const uint32_t correlation_id) { + return request_ctrl_->RemoveRetainedRequest(connection_key, correlation_id); +} + +bool ApplicationManagerImpl::IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const { + return request_ctrl_->IsStillWaitingForResponse(connection_key, + correlation_id); +} + void ApplicationManagerImpl::AddExpiredButtonRequest( const uint32_t app_id, const int32_t corr_id, diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 8751823e85..8eb7171274 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -39,12 +39,6 @@ namespace application_manager { namespace { -struct AppExtensionPredicate { - AppExtensionUID uid; - bool operator()(const ApplicationSharedPtr app) { - return app ? (app->QueryInterface(uid).use_count() != 0) : false; - } -}; /** * @brief Functor for build info string @@ -132,6 +126,8 @@ bool CommandImpl::CleanUp() { void CommandImpl::Run() {} +void CommandImpl::OnUpdateTimeOut() {} + uint32_t CommandImpl::default_timeout() const { return default_timeout_; } @@ -157,6 +153,8 @@ uint32_t CommandImpl::connection_key() const { return (*message_)[strings::params][strings::connection_key].asUInt(); } +void CommandImpl::HandleTimeOut() {} + void CommandImpl::set_warning_info(const std::string info) { warning_info_ = info; } @@ -165,8 +163,6 @@ std::string CommandImpl::warning_info() const { return warning_info_; } -void CommandImpl::onTimeOut() {} - bool CommandImpl::AllowedToTerminate() { return allowed_to_terminate_; } 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 65fbf7e66f..2929144883 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -30,144 +30,18 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include <algorithm> -#include <numeric> -#include <string> -#include "utils/macro.h" - #include "application_manager/commands/command_request_impl.h" -#include "application_manager/app_service_manager.h" -#include "application_manager/application_manager.h" +#include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" -#include "smart_objects/smart_object.h" - #include "smart_objects/enum_schema_item.h" -#include "utils/helpers.h" +#include "smart_objects/smart_object.h" namespace application_manager { - namespace commands { -SDL_CREATE_LOG_VARIABLE("Commands"); - -std::string MergeInfos(const ResponseInfo& first_info, - const std::string& first_str, - const ResponseInfo& second_info, - const std::string& second_str) { - if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !second_str.empty()) { - return second_str; - } - - if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !first_str.empty()) { - return first_str; - } - - return MergeInfos(first_str, second_str); -} - -std::string MergeInfos(const std::string& first, const std::string& second) { - return first + ((!first.empty() && !second.empty()) ? ", " : "") + second; -} - -std::string MergeInfos(const std::string& first, - const std::string& second, - const std::string& third) { - std::string result = MergeInfos(first, second); - return MergeInfos(result, third); -} - -const std::string CreateInfoForUnsupportedResult( - HmiInterfaces::InterfaceID interface) { - switch (interface) { - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): { - return "VR is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { - return "TTS is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { - return "UI is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { - return "Navigation is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): { - return "VehicleInfo is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): { - return "RC is not supported by system"; - } - default: - SDL_LOG_WARN( - "Could not create info because" - " interface isn't valid. Interface is:" - << static_cast<int32_t>(interface)); - return ""; - } -} - -bool CommandRequestImpl::CheckResult(const ResponseInfo& first, - const ResponseInfo& second) const { - if (first.is_ok && second.is_unsupported_resource) { - return true; - } - if (first.is_ok && second.is_not_used) { - return true; - } - if (first.is_ok && second.is_ok) { - return true; - } - return false; -} - -bool IsResultCodeWarning(const ResponseInfo& first, - const ResponseInfo& second) { - const bool first_is_ok_second_is_warn = - (first.is_ok || first.is_not_used) && - hmi_apis::Common_Result::WARNINGS == second.result_code; - - const bool both_warnings = - hmi_apis::Common_Result::WARNINGS == first.result_code && - hmi_apis::Common_Result::WARNINGS == second.result_code; - - return first_is_ok_second_is_warn || both_warnings; -} - -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_not_used(false) {} - -ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, - const HmiInterfaces::InterfaceID hmi_interface, - ApplicationManager& application_manager) - : result_code(result) - , interface(hmi_interface) - , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) - , is_ok(false) - , is_unsupported_resource(false) - , is_not_used(false) { - using namespace helpers; - - interface_state = - application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); - - is_ok = IsHMIResultSuccess(result_code); - - is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; - - is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; -} +SDL_CREATE_LOG_VARIABLE("Commands") CommandRequestImpl::CommandRequestImpl( const MessageSharedPtr& message, @@ -181,266 +55,25 @@ CommandRequestImpl::CommandRequestImpl( hmi_capabilities, policy_handler) , EventObserver(application_manager.event_dispatcher()) - , current_state_(kAwaitingHMIResponse) - , hash_update_mode_(kSkipHashUpdate) - , is_success_result_(false) {} + , current_state_(RequestState::kAwaitingResponse) {} CommandRequestImpl::~CommandRequestImpl() { - UpdateHash(); -} - -bool CommandRequestImpl::Init() { - return true; -} - -bool CommandRequestImpl::CheckPermissions() { - return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE); -} - -bool CommandRequestImpl::CleanUp() { - return true; + CleanUp(); } void CommandRequestImpl::Run() {} -void CommandRequestImpl::onTimeOut() { - SDL_LOG_AUTO_TRACE(); - - unsubscribe_from_all_hmi_events(); - unsubscribe_from_all_mobile_events(); - { - // FIXME (dchmerev@luxoft.com): atomic_xchg fits better - sync_primitives::AutoLock auto_lock(state_lock_); - if (kCompleted == current_state_) { - SDL_LOG_DEBUG("current_state_ = kCompleted"); - // don't send timeout if request completed - return; - } - - current_state_ = kTimedOut; - } - - smart_objects::SmartObjectSPtr response = - MessageHelper::CreateNegativeResponse(connection_key(), - function_id(), - correlation_id(), - mobile_api::Result::GENERIC_ERROR); - AddTimeOutComponentInfoToMessage(*response); - rpc_service_.ManageMobileCommand(response, SOURCE_SDL); -} - -void CommandRequestImpl::on_event(const event_engine::Event& event) {} - -void CommandRequestImpl::on_event(const event_engine::MobileEvent& event) {} - -void CommandRequestImpl::SendResponse( - const bool success, - const mobile_apis::Result::eType& result_code, - const char* info, - const smart_objects::SmartObject* response_params, - const std::vector<uint8_t> binary_data) { - SDL_LOG_AUTO_TRACE(); - { - sync_primitives::AutoLock auto_lock(state_lock_); - if (kTimedOut == current_state_) { - // don't send response if request timeout expired - return; - } - - current_state_ = kCompleted; - } - - smart_objects::SmartObjectSPtr result = - std::make_shared<smart_objects::SmartObject>(); - - smart_objects::SmartObject& response = *result; - - response[strings::params][strings::message_type] = MessageType::kResponse; - response[strings::params][strings::correlation_id] = correlation_id(); - response[strings::params][strings::protocol_type] = - CommandImpl::mobile_protocol_type_; - response[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - response[strings::params][strings::connection_key] = connection_key(); - response[strings::params][strings::function_id] = function_id(); - if (!binary_data.empty()) { - response[strings::params][strings::binary_data] = binary_data; - } - if (response_params) { - response[strings::msg_params] = *response_params; - } - - if (info && *info != '\0') { - response[strings::msg_params][strings::info] = std::string(info); - } - - // Add disallowed parameters and info from request back to response with - // appropriate reasons (VehicleData result codes) - if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED && - result_code != mobile_apis::Result::INVALID_DATA) { - FormatResponse(response); - } - - response[strings::msg_params][strings::success] = success; - if ((result_code == mobile_apis::Result::SUCCESS || - result_code == mobile_apis::Result::WARNINGS) && - !warning_info().empty()) { - response[strings::msg_params][strings::info] = - (info && *info != '\0') ? std::string(info) + "\n" + warning_info() - : warning_info(); - response[strings::msg_params][strings::result_code] = - mobile_apis::Result::WARNINGS; - } else if (mobile_apis::Result::INVALID_ENUM == result_code) { - response[strings::msg_params][strings::result_code] = - mobile_apis::Result::GENERIC_ERROR; - response[strings::msg_params][strings::info] = - "Invalid result received from vehicle"; - } else { - response[strings::msg_params][strings::result_code] = result_code; - } - - is_success_result_ = success; - - rpc_service_.ManageMobileCommand(result, SOURCE_SDL); -} - -smart_objects::SmartObject CreateUnsupportedResourceResponse( - const hmi_apis::FunctionID::eType function_id, - const uint32_t hmi_correlation_id, - HmiInterfaces::InterfaceID interface) { - smart_objects::SmartObject response(smart_objects::SmartType_Map); - smart_objects::SmartObject& params = response[strings::params]; - params[strings::message_type] = MessageType::kResponse; - params[strings::correlation_id] = hmi_correlation_id; - params[strings::protocol_type] = CommandImpl::hmi_protocol_type_; - params[strings::protocol_version] = CommandImpl::protocol_version_; - params[strings::function_id] = function_id; - params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - smart_objects::SmartObject& msg_params = response[strings::msg_params]; - msg_params[strings::info] = CreateInfoForUnsupportedResult(interface); - return response; -} - -bool CommandRequestImpl::ProcessHMIInterfacesAvailability( - const uint32_t hmi_correlation_id, - const hmi_apis::FunctionID::eType& function_id) { - SDL_LOG_AUTO_TRACE(); - HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - HmiInterfaces::InterfaceID interface = - hmi_interfaces.GetInterfaceFromFunction(function_id); - DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM); - const HmiInterfaces::InterfaceState state = - hmi_interfaces.GetInterfaceState(interface); - if (HmiInterfaces::STATE_NOT_AVAILABLE == state) { - event_engine::Event event(function_id); - event.set_smart_object(CreateUnsupportedResourceResponse( - function_id, hmi_correlation_id, interface)); - event.raise(application_manager_.event_dispatcher()); - return false; - } - return true; -} - -void CommandRequestImpl::UpdateHash() { - SDL_LOG_AUTO_TRACE(); - if (hash_update_mode_ == kSkipHashUpdate) { - SDL_LOG_DEBUG("Hash update is disabled for " << function_id()); - return; - } - - if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { - SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated."); - return; - } - - if (!is_success_result_) { - SDL_LOG_WARN("Command is not succeeded. Hash won't be updated."); - return; - } - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (!application) { - SDL_LOG_ERROR("Application with connection key " - << connection_key() - << " not found. Not able to update hash."); - return; - } - - SDL_LOG_DEBUG( - "Updating hash for application with connection key " - << connection_key() << " while processing function id " - << MessageHelper::StringifiedFunctionID( - static_cast<mobile_api::FunctionID::eType>(function_id()))); - - application->UpdateHash(); -} - -void CommandRequestImpl::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) { +bool CommandRequestImpl::CheckAllowedParameters( + const Command::CommandSource source) { SDL_LOG_AUTO_TRACE(); - bool hmi_destination = false; - ApplicationSharedPtr app; - // Default error code and error message - std::string error_msg = "No app service provider available"; - mobile_apis::Result::eType error_code = - mobile_apis::Result::DATA_NOT_AVAILABLE; - - if ((*msg)[strings::msg_params].keyExists(strings::service_type)) { - std::string service_type = - (*msg)[strings::msg_params][strings::service_type].asString(); - application_manager_.GetAppServiceManager().GetProviderByType( - service_type, true, app, hmi_destination); - error_msg = "No app service provider with serviceType: " + service_type + - " is available"; - error_code = mobile_apis::Result::DATA_NOT_AVAILABLE; - } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) { - std::string service_id = - (*msg)[strings::msg_params][strings::service_id].asString(); - application_manager_.GetAppServiceManager().GetProviderByID( - service_id, true, app, hmi_destination); - error_msg = "No app service provider with serviceId: " + service_id + - " is available"; - error_code = mobile_apis::Result::INVALID_ID; - } - - if (hmi_destination) { - SDL_LOG_DEBUG("Sending Request to HMI Provider"); - application_manager_.IncreaseForwardedRequestTimeout(connection_key(), - correlation_id()); - SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); - return; - } - - if (!app) { - SDL_LOG_DEBUG("Invalid App Provider pointer"); - SendResponse(false, error_code, error_msg.c_str()); - return; - } - if (connection_key() == app->app_id()) { - SendResponse(false, - mobile_apis::Result::IGNORED, - "Consumer app is same as producer app"); - return; + // RegisterAppInterface should always be allowed + if (mobile_apis::FunctionID::RegisterAppInterfaceID == + static_cast<mobile_apis::FunctionID::eType>(function_id())) { + return true; } - smart_objects::SmartObjectSPtr new_msg = - std::make_shared<smart_objects::SmartObject>(); - smart_objects::SmartObject& request = *new_msg; - - request[strings::params] = (*msg)[strings::params]; - request[strings::msg_params] = (*msg)[strings::msg_params]; - request[strings::params][strings::connection_key] = app->app_id(); - - application_manager_.IncreaseForwardedRequestTimeout(connection_key(), - correlation_id()); - SendMobileRequest(mobile_function_id, new_msg, use_events); + return CommandImpl::CheckAllowedParameters(source); } void CommandRequestImpl::SendMobileRequest( @@ -465,325 +98,91 @@ void CommandRequestImpl::SendMobileRequest( } } -uint32_t CommandRequestImpl::SendHMIRequest( - const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params, - bool use_events) { - SDL_LOG_AUTO_TRACE(); - smart_objects::SmartObjectSPtr result = - std::make_shared<smart_objects::SmartObject>(); +void CommandRequestImpl::OnTimeOut() {} - const uint32_t hmi_correlation_id = - application_manager_.GetNextHMICorrelationID(); +void CommandRequestImpl::on_event(const event_engine::Event&) {} +void CommandRequestImpl::on_event(const event_engine::MobileEvent&) {} - smart_objects::SmartObject& request = *result; - request[strings::params][strings::message_type] = MessageType::kRequest; - request[strings::params][strings::function_id] = function_id; - request[strings::params][strings::correlation_id] = hmi_correlation_id; - request[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - request[strings::params][strings::protocol_type] = - CommandImpl::hmi_protocol_type_; - - if (msg_params) { - request[strings::msg_params] = *msg_params; - } - - if (use_events) { - SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " " - << hmi_correlation_id); - subscribe_on_event(function_id, hmi_correlation_id); - } - if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { - if (rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - AddRequestToTimeoutHandler(request); - } else { - SDL_LOG_ERROR("Unable to send request"); - SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); - } - } else { - SDL_LOG_DEBUG("Interface is not available"); - } - return hmi_correlation_id; -} - -void CommandRequestImpl::CreateHMINotification( - const hmi_apis::FunctionID::eType& function_id, - const ns_smart::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = - std::make_shared<smart_objects::SmartObject>(); - if (!result) { - SDL_LOG_ERROR("Memory allocation failed."); - return; - } - smart_objects::SmartObject& notify = *result; - - notify[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - notify[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - notify[strings::params][strings::protocol_type] = - CommandImpl::hmi_protocol_type_; - notify[strings::params][strings::function_id] = function_id; - notify[strings::msg_params] = msg_params; - - if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - SDL_LOG_ERROR("Unable to send HMI notification"); - } -} - -mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( - const hmi_apis::Common_Result::eType& hmi_code) const { - mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR; - switch (hmi_code) { - case hmi_apis::Common_Result::SUCCESS: { - mobile_result = mobile_apis::Result::SUCCESS; - break; - } - case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: { - mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST; - break; - } - case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: { - mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE; - break; - } - case hmi_apis::Common_Result::DISALLOWED: { - mobile_result = mobile_apis::Result::DISALLOWED; - break; - } - case hmi_apis::Common_Result::REJECTED: { - mobile_result = mobile_apis::Result::REJECTED; - break; - } - case hmi_apis::Common_Result::ABORTED: { - mobile_result = mobile_apis::Result::ABORTED; - break; - } - case hmi_apis::Common_Result::IGNORED: { - mobile_result = mobile_apis::Result::IGNORED; - break; - } - case hmi_apis::Common_Result::RETRY: { - mobile_result = mobile_apis::Result::RETRY; - break; - } - case hmi_apis::Common_Result::IN_USE: { - mobile_result = mobile_apis::Result::IN_USE; - break; - } - case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: { - mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE; - break; - } - case hmi_apis::Common_Result::TIMED_OUT: { - mobile_result = mobile_apis::Result::TIMED_OUT; - break; - } - case hmi_apis::Common_Result::INVALID_DATA: { - mobile_result = mobile_apis::Result::INVALID_DATA; - break; - } - case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: { - mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED; - break; - } - case hmi_apis::Common_Result::INVALID_ID: { - mobile_result = mobile_apis::Result::INVALID_ID; - break; - } - case hmi_apis::Common_Result::DUPLICATE_NAME: { - mobile_result = mobile_apis::Result::DUPLICATE_NAME; - break; - } - case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::WRONG_LANGUAGE: { - mobile_result = mobile_apis::Result::WRONG_LANGUAGE; - break; - } - case hmi_apis::Common_Result::OUT_OF_MEMORY: { - mobile_result = mobile_apis::Result::OUT_OF_MEMORY; - break; - } - case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: { - mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS; - break; - } - case hmi_apis::Common_Result::NO_APPS_REGISTERED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::WARNINGS: { - mobile_result = mobile_apis::Result::WARNINGS; - break; - } - case hmi_apis::Common_Result::GENERIC_ERROR: { - mobile_result = mobile_apis::Result::GENERIC_ERROR; - break; - } - case hmi_apis::Common_Result::USER_DISALLOWED: { - mobile_result = mobile_apis::Result::USER_DISALLOWED; - break; - } - case hmi_apis::Common_Result::SAVED: { - mobile_result = mobile_apis::Result::SAVED; - break; - } - case hmi_apis::Common_Result::READ_ONLY: { - mobile_result = mobile_apis::Result::READ_ONLY; - break; - } - default: { - SDL_LOG_ERROR("Unknown HMI result code " << hmi_code); - break; +void CommandRequestImpl::HandleTimeOut() { + SDL_LOG_AUTO_TRACE(); + { + sync_primitives::AutoLock auto_lock(state_lock_); + if (RequestState::kProcessEvent == current_state()) { + SDL_LOG_DEBUG("Current request state is: " + << current_state() << ". Timeout request ignored"); + return; } + set_current_state(RequestState::kTimedOut); } - return mobile_result; + OnTimeOut(); } -bool CommandRequestImpl::CheckAllowedParameters( - const Command::CommandSource source) { +bool CommandRequestImpl::StartOnEventHandling() { SDL_LOG_AUTO_TRACE(); - // RegisterAppInterface should always be allowed - if (mobile_apis::FunctionID::RegisterAppInterfaceID == - static_cast<mobile_apis::FunctionID::eType>(function_id())) { - return true; + { + sync_primitives::AutoLock auto_lock(state_lock_); + if (RequestState::kTimedOut == current_state()) { + SDL_LOG_DEBUG("current_state_ = kTimedOut"); + return false; + } + set_current_state(RequestState::kProcessEvent); } - return CommandImpl::CheckAllowedParameters(source); + return true; } -bool CommandRequestImpl::CheckHMICapabilities( - const mobile_apis::ButtonName::eType button) const { - SDL_LOG_AUTO_TRACE(); - - using namespace smart_objects; - using namespace mobile_apis; - - if (!hmi_capabilities_.is_ui_cooperating()) { - SDL_LOG_ERROR("UI is not supported by HMI"); - return false; - } - - auto button_capabilities = hmi_capabilities_.button_capabilities(); - if (!button_capabilities) { - SDL_LOG_ERROR("Invalid button capabilities object"); - return false; - } +void CommandRequestImpl::FinalizeOnEventHandling() { + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); - for (size_t i = 0; i < button_capabilities->length(); ++i) { - const SmartObject& capabilities = (*button_capabilities)[i]; - const ButtonName::eType current_button = static_cast<ButtonName::eType>( - capabilities.getElement(hmi_response::button_name).asInt()); - if (current_button == button) { - SDL_LOG_DEBUG("Button capabilities for " << button << " was found"); - return true; - } + if (application_manager_.IsStillWaitingForResponse(conn_key, corr_id)) { + SDL_LOG_DEBUG("Request (" << conn_key << ", " << corr_id + << ") is still waiting for repsonse"); + set_current_state(RequestState::kAwaitingResponse); } - - SDL_LOG_DEBUG("Button capabilities for " << button << " was not found"); - return false; -} - -bool CommandRequestImpl::HasDisallowedParams() const { - return ((!removed_parameters_permissions_.disallowed_params.empty()) || - (!removed_parameters_permissions_.undefined_params.empty())); } -bool CommandRequestImpl::PrepareResultForMobileResponse( - hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const { +void CommandRequestImpl::HandleOnEvent(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); - return IsHMIResultSuccess(result_code, interface); -} -bool CommandRequestImpl::PrepareResultForMobileResponse( - ResponseInfo& out_first, ResponseInfo& out_second) const { - SDL_LOG_AUTO_TRACE(); - bool result = - CheckResult(out_first, out_second) || CheckResult(out_second, out_first); - return result; + if (StartOnEventHandling()) { + on_event(event); + FinalizeOnEventHandling(); + } } -bool CommandRequestImpl::PrepareResultForMobileResponse( - ResponseInfo& out_first, - ResponseInfo& out_second, - ResponseInfo& out_third) const { +void CommandRequestImpl::HandleOnEvent(const event_engine::MobileEvent& event) { SDL_LOG_AUTO_TRACE(); - bool result = (PrepareResultForMobileResponse(out_first, out_second) || - PrepareResultForMobileResponse(out_second, out_third)) && - PrepareResultForMobileResponse(out_first, out_third); - return result; -} -void CommandRequestImpl::GetInfo( - const smart_objects::SmartObject& response_from_hmi, - std::string& out_info) { - if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { - if (!response_from_hmi[strings::msg_params][strings::info].empty()) { - out_info = - response_from_hmi[strings::msg_params][strings::info].asString(); - } + if (StartOnEventHandling()) { + on_event(event); + FinalizeOnEventHandling(); } } -mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( - const ResponseInfo& first, const ResponseInfo& second) { +bool CommandRequestImpl::IncrementReferenceCount() const { SDL_LOG_AUTO_TRACE(); - if (IsResultCodeUnsupported(first, second) || - IsResultCodeUnsupported(second, first)) { - return mobile_apis::Result::UNSUPPORTED_RESOURCE; - } - if (IsResultCodeWarning(first, second) || - IsResultCodeWarning(second, first)) { - return mobile_apis::Result::WARNINGS; - } - // If response contains erroneous result code SDL need return erroneus - // result code. - hmi_apis::Common_Result::eType first_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType second_result = - hmi_apis::Common_Result::INVALID_ENUM; - if (!first.is_unsupported_resource) { - first_result = first.result_code; - } - if (!second.is_unsupported_resource) { - second_result = second.result_code; - } - mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); - return result_code; + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); + return application_manager_.RetainRequestInstance(conn_key, corr_id); } -mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second, - const ResponseInfo& third) { +bool CommandRequestImpl::DecrementReferenceCount() const { SDL_LOG_AUTO_TRACE(); - - const auto first_comparison = PrepareResultCodeForResponse(first, second); - const auto second_comparison = PrepareResultCodeForResponse(second, third); - const auto third_comparison = PrepareResultCodeForResponse(first, third); - - return std::max({first_comparison, second_comparison, third_comparison}); + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); + return application_manager_.RemoveRetainedRequest(conn_key, corr_id); } -const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() - const { - return parameters_permissions_; +void CommandRequestImpl::OnUpdateTimeOut() { + SDL_LOG_AUTO_TRACE(); + set_current_state(RequestState::kAwaitingResponse); } void CommandRequestImpl::StartAwaitForInterface( - const HmiInterfaces::InterfaceID interface_id) { + const HmiInterfaces::InterfaceID& interface_id) { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); awaiting_response_interfaces_.insert(interface_id); } @@ -791,139 +190,31 @@ void CommandRequestImpl::StartAwaitForInterface( bool CommandRequestImpl::IsInterfaceAwaited( const HmiInterfaces::InterfaceID& interface_id) const { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - std::set<HmiInterfaces::InterfaceID>::const_iterator it = - awaiting_response_interfaces_.find(interface_id); - return (it != awaiting_response_interfaces_.end()); + + return helpers::in_range(awaiting_response_interfaces_, interface_id); } void CommandRequestImpl::EndAwaitForInterface( const HmiInterfaces::InterfaceID& interface_id) { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - std::set<HmiInterfaces::InterfaceID>::const_iterator it = - awaiting_response_interfaces_.find(interface_id); - if (it != awaiting_response_interfaces_.end()) { - awaiting_response_interfaces_.erase(it); - } else { - SDL_LOG_WARN( - "EndAwaitForInterface called on interface \ - which was not put into await state: " - << interface_id); - } -} - -bool CommandRequestImpl::IsResultCodeUnsupported( - const ResponseInfo& first, const ResponseInfo& second) const { - const bool first_ok_second_unsupported = - (first.is_ok || first.is_not_used) && second.is_unsupported_resource; - const bool both_unsupported = - first.is_unsupported_resource && second.is_unsupported_resource; - return first_ok_second_unsupported || both_unsupported; -} - -std::string GetComponentNameFromInterface( - const HmiInterfaces::InterfaceID& interface) { - switch (interface) { - case HmiInterfaces::HMI_INTERFACE_Buttons: - return hmi_interface::buttons; - case HmiInterfaces::HMI_INTERFACE_BasicCommunication: - return hmi_interface::basic_communication; - case HmiInterfaces::HMI_INTERFACE_VR: - return hmi_interface::vr; - case HmiInterfaces::HMI_INTERFACE_TTS: - return hmi_interface::tts; - case HmiInterfaces::HMI_INTERFACE_UI: - return hmi_interface::ui; - case HmiInterfaces::HMI_INTERFACE_Navigation: - return hmi_interface::navigation; - case HmiInterfaces::HMI_INTERFACE_VehicleInfo: - return hmi_interface::vehicle_info; - case HmiInterfaces::HMI_INTERFACE_SDL: - return hmi_interface::sdl; - case HmiInterfaces::HMI_INTERFACE_RC: - return hmi_interface::rc; - case HmiInterfaces::HMI_INTERFACE_AppService: - return hmi_interface::app_service; - default: - return "Unknown type"; - } -} - -const std::string InfoInterfaceSeparator( - const std::string& sum, const HmiInterfaces::InterfaceID container_value) { - return sum.empty() - ? GetComponentNameFromInterface(container_value) - : sum + ", " + GetComponentNameFromInterface(container_value); + awaiting_response_interfaces_.erase(interface_id); } -void CommandRequestImpl::AddTimeOutComponentInfoToMessage( - smart_objects::SmartObject& response) const { - using ns_smart_device_link::ns_smart_objects::SmartObject; - SDL_LOG_AUTO_TRACE(); +bool CommandRequestImpl::IsPendingResponseExist() const { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - if (awaiting_response_interfaces_.empty()) { - SDL_LOG_ERROR("No interfaces awaiting, info param is empty"); - return; - } - - const std::string not_responding_interfaces_string = - std::accumulate(awaiting_response_interfaces_.begin(), - awaiting_response_interfaces_.end(), - std::string(""), - InfoInterfaceSeparator); - SDL_LOG_DEBUG( - "Not responding interfaces string: " << not_responding_interfaces_string); - if (!not_responding_interfaces_string.empty()) { - const std::string component_info = - not_responding_interfaces_string + " component does not respond"; - response[strings::msg_params][strings::info] = component_info; - } + return !awaiting_response_interfaces_.empty(); } -void CommandRequestImpl::AddRequestToTimeoutHandler( - const smart_objects::SmartObject& request_to_hmi) const { - auto function_id = static_cast<hmi_apis::FunctionID::eType>( - request_to_hmi[strings::params][strings::function_id].asUInt()); - // SDL must not apply "default timeout for RPCs processing" for - // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI - // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR - // to mobile app), so the OnResetTimeout logic is not applicable for - // DialNumber RPC - if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>( - function_id, - hmi_apis::FunctionID::BasicCommunication_DialNumber, - hmi_apis::FunctionID::INVALID_ENUM)) { - SDL_LOG_DEBUG( - "Current RPC is DialNumber or Invalid, OnResetTimeout " - "logic is not applicable in this case"); - return; - } - - // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use - // timeout tracking for response, so the OnResetTimeout logic is not - // applicable in this case - if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>( - function_id, - hmi_apis::FunctionID::UI_Alert, - hmi_apis::FunctionID::UI_SubtleAlert)) { - if (request_to_hmi.keyExists(strings::msg_params)) { - if (request_to_hmi[strings::msg_params].keyExists( - strings::soft_buttons)) { - SDL_LOG_DEBUG("Soft buttons are present in " - << EnumToString(function_id) - << " RPC, OnResetTimeout " - "logic is not applicable in this case"); - return; - } - } - } +CommandRequestImpl::RequestState CommandRequestImpl::current_state() const { + sync_primitives::AutoLock auto_lock(state_lock_); + return current_state_; +} - const application_manager::request_controller::Request request{ - correlation_id(), connection_key(), static_cast<uint32_t>(function_id)}; - application_manager_.get_request_timeout_handler().AddRequest( - request_to_hmi[strings::params][strings::correlation_id].asUInt(), - request); +void CommandRequestImpl::set_current_state( + const CommandRequestImpl::RequestState state) { + sync_primitives::AutoLock auto_lock(state_lock_); + current_state_ = state; } } // namespace commands - } // namespace application_manager diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index fca48854e2..5a2e9f0730 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -53,12 +53,11 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , EventObserver(application_manager.event_dispatcher()) { + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) { // Replace HMI app id with Mobile connection id ReplaceHMIWithMobileAppId(*message); } @@ -79,6 +78,8 @@ void RequestFromHMI::on_event(const event_engine::Event& event) {} void RequestFromHMI::on_event(const event_engine::MobileEvent& event) {} +void RequestFromHMI::OnTimeOut() {} + void RequestFromHMI::SendResponse( const bool success, const uint32_t correlation_id, diff --git a/src/components/application_manager/src/commands/request_from_mobile_impl.cc b/src/components/application_manager/src/commands/request_from_mobile_impl.cc new file mode 100644 index 0000000000..42df13f034 --- /dev/null +++ b/src/components/application_manager/src/commands/request_from_mobile_impl.cc @@ -0,0 +1,906 @@ +/* + Copyright (c) 2020, 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. + */ + +#include "application_manager/commands/request_from_mobile_impl.h" + +#include <algorithm> +#include <numeric> +#include <string> + +#include "application_manager/app_service_manager.h" +#include "application_manager/application_manager.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "smart_objects/smart_object.h" +#include "utils/helpers.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace smart_objects = ns_smart_device_link::ns_smart_objects; + +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str) { + if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !second_str.empty()) { + return second_str; + } + + if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !first_str.empty()) { + return first_str; + } + + return MergeInfos(first_str, second_str); +} + +std::string MergeInfos(const std::string& first, const std::string& second) { + return first + ((!first.empty() && !second.empty()) ? ", " : "") + second; +} + +std::string MergeInfos(const std::string& first, + const std::string& second, + const std::string& third) { + std::string result = MergeInfos(first, second); + return MergeInfos(result, third); +} + +const std::string CreateInfoForUnsupportedResult( + HmiInterfaces::InterfaceID interface) { + switch (interface) { + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): { + return "VR is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { + return "TTS is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { + return "UI is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { + return "Navigation is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): { + return "VehicleInfo is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): { + return "Remote control is not supported by system"; + } + default: + SDL_LOG_WARN( + "Could not create info because" + " interface isn't valid. Interface is:" + << static_cast<int32_t>(interface)); + return ""; + } +} + +bool RequestFromMobileImpl::CheckResultCode(const ResponseInfo& first, + const ResponseInfo& second) const { + if (first.is_ok && second.is_unsupported_resource) { + return true; + } + if (first.is_ok && second.is_not_used) { + return true; + } + if (first.is_ok && second.is_ok) { + return true; + } + return false; +} + +bool IsResultCodeWarning(const ResponseInfo& first, + const ResponseInfo& second) { + const bool first_is_ok_second_is_warn = + (first.is_ok || first.is_not_used) && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + const bool both_warnings = + hmi_apis::Common_Result::WARNINGS == first.result_code && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + return first_is_ok_second_is_warn || both_warnings; +} + +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_not_used(false) {} + +ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager) + : result_code(result) + , interface(hmi_interface) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_not_used(false) { + using namespace helpers; + + interface_state = + application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); + + is_ok = IsHMIResultSuccess(result_code); + + is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; + + is_unsupported_resource = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; +} + +RequestFromMobileImpl::RequestFromMobileImpl( + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) + , hash_update_mode_(kSkipHashUpdate) + , is_success_result_(false) {} + +RequestFromMobileImpl::~RequestFromMobileImpl() { + UpdateHash(); +} + +bool RequestFromMobileImpl::Init() { + return true; +} + +bool RequestFromMobileImpl::CheckPermissions() { + return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE); +} + +bool RequestFromMobileImpl::CleanUp() { + unsubscribe_from_all_mobile_events(); + unsubscribe_from_all_hmi_events(); // To prevent on_event calls + + // Cleanup for mobile requests can be done only if OnEvent/OnTimeout events + // are not processed at that moment + return kAwaitingResponse == current_state(); +} + +void RequestFromMobileImpl::Run() {} + +void RequestFromMobileImpl::OnTimeOut() { + SDL_LOG_AUTO_TRACE(); + + unsubscribe_from_all_mobile_events(); + unsubscribe_from_all_hmi_events(); + + smart_objects::SmartObjectSPtr response = + MessageHelper::CreateNegativeResponse(connection_key(), + function_id(), + correlation_id(), + mobile_api::Result::GENERIC_ERROR); + + AddTimeOutComponentInfoToMessage(*response); + + rpc_service_.ManageMobileCommand(response, SOURCE_SDL); +} + +void RequestFromMobileImpl::on_event(const event_engine::Event& event) {} + +void RequestFromMobileImpl::on_event(const event_engine::MobileEvent& event) {} + +void RequestFromMobileImpl::SendResponse( + const bool success, + const mobile_apis::Result::eType& result_code, + const char* info, + const smart_objects::SmartObject* response_params, + const std::vector<uint8_t> binary_data) { + SDL_LOG_AUTO_TRACE(); + + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); + + smart_objects::SmartObject& response = *result; + + response[strings::params][strings::message_type] = MessageType::kResponse; + response[strings::params][strings::correlation_id] = correlation_id(); + response[strings::params][strings::protocol_type] = + CommandImpl::mobile_protocol_type_; + response[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + response[strings::params][strings::connection_key] = connection_key(); + response[strings::params][strings::function_id] = function_id(); + if (!binary_data.empty()) { + response[strings::params][strings::binary_data] = binary_data; + } + if (response_params) { + response[strings::msg_params] = *response_params; + } + + if (info && *info != '\0') { + response[strings::msg_params][strings::info] = std::string(info); + } + + // Add disallowed parameters and info from request back to response with + // appropriate reasons (VehicleData result codes) + if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED && + result_code != mobile_apis::Result::INVALID_DATA) { + FormatResponse(response); + } + + response[strings::msg_params][strings::success] = success; + if ((result_code == mobile_apis::Result::SUCCESS || + result_code == mobile_apis::Result::WARNINGS) && + !warning_info().empty()) { + response[strings::msg_params][strings::info] = + (info && *info != '\0') ? std::string(info) + "\n" + warning_info() + : warning_info(); + response[strings::msg_params][strings::result_code] = + mobile_apis::Result::WARNINGS; + } else if (mobile_apis::Result::INVALID_ENUM == result_code) { + response[strings::msg_params][strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + response[strings::msg_params][strings::info] = + "Invalid result received from vehicle"; + } else { + response[strings::msg_params][strings::result_code] = result_code; + } + + is_success_result_ = success; + + rpc_service_.ManageMobileCommand(result, SOURCE_SDL); +} + +smart_objects::SmartObject CreateUnsupportedResourceResponse( + const hmi_apis::FunctionID::eType function_id, + const uint32_t hmi_correlation_id, + HmiInterfaces::InterfaceID interface) { + smart_objects::SmartObject response(smart_objects::SmartType_Map); + smart_objects::SmartObject& params = response[strings::params]; + params[strings::message_type] = MessageType::kResponse; + params[strings::correlation_id] = hmi_correlation_id; + params[strings::protocol_type] = CommandImpl::hmi_protocol_type_; + params[strings::protocol_version] = CommandImpl::protocol_version_; + params[strings::function_id] = function_id; + params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; + smart_objects::SmartObject& msg_params = response[strings::msg_params]; + msg_params[strings::info] = CreateInfoForUnsupportedResult(interface); + return response; +} + +bool RequestFromMobileImpl::ProcessHMIInterfacesAvailability( + const uint32_t hmi_correlation_id, + const hmi_apis::FunctionID::eType& function_id) { + SDL_LOG_AUTO_TRACE(); + HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + HmiInterfaces::InterfaceID interface = + hmi_interfaces.GetInterfaceFromFunction(function_id); + DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM); + const HmiInterfaces::InterfaceState state = + hmi_interfaces.GetInterfaceState(interface); + if (HmiInterfaces::STATE_NOT_AVAILABLE == state) { + event_engine::Event event(function_id); + event.set_smart_object(CreateUnsupportedResourceResponse( + function_id, hmi_correlation_id, interface)); + event.raise(application_manager_.event_dispatcher()); + return false; + } + return true; +} + +void RequestFromMobileImpl::UpdateHash() { + SDL_LOG_AUTO_TRACE(); + if (hash_update_mode_ == kSkipHashUpdate) { + SDL_LOG_DEBUG("Hash update is disabled for " << function_id()); + return; + } + + if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { + SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated."); + return; + } + + if (!is_success_result_) { + SDL_LOG_WARN("Command is not succeeded. Hash won't be updated."); + return; + } + + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + if (!application) { + SDL_LOG_ERROR("Application with connection key " + << connection_key() + << " not found. Not able to update hash."); + return; + } + + SDL_LOG_DEBUG( + "Updating hash for application with connection key " + << connection_key() << " while processing function id " + << MessageHelper::StringifiedFunctionID( + static_cast<mobile_api::FunctionID::eType>(function_id()))); + + application->UpdateHash(); +} + +uint32_t RequestFromMobileImpl::SendHMIRequest( + const hmi_apis::FunctionID::eType& function_id, + const smart_objects::SmartObject* msg_params, + bool use_events) { + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); + + const uint32_t hmi_correlation_id = + application_manager_.GetNextHMICorrelationID(); + + smart_objects::SmartObject& request = *result; + request[strings::params][strings::message_type] = MessageType::kRequest; + request[strings::params][strings::function_id] = function_id; + request[strings::params][strings::correlation_id] = hmi_correlation_id; + request[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + request[strings::params][strings::protocol_type] = + CommandImpl::hmi_protocol_type_; + + if (msg_params) { + request[strings::msg_params] = *msg_params; + } + + if (use_events) { + SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " " + << hmi_correlation_id); + subscribe_on_event(function_id, hmi_correlation_id); + } + if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { + if (rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + AddRequestToTimeoutHandler(request); + } else { + SDL_LOG_ERROR("Unable to send request"); + SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); + } + } else { + SDL_LOG_DEBUG("Interface is not available"); + } + return hmi_correlation_id; +} + +void RequestFromMobileImpl::CreateHMINotification( + const hmi_apis::FunctionID::eType& function_id, + const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params) + const { + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); + if (!result) { + SDL_LOG_ERROR("Memory allocation failed."); + return; + } + smart_objects::SmartObject& notify = *result; + + notify[strings::params][strings::message_type] = + static_cast<int32_t>(application_manager::MessageType::kNotification); + notify[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + notify[strings::params][strings::protocol_type] = + CommandImpl::hmi_protocol_type_; + notify[strings::params][strings::function_id] = function_id; + notify[strings::msg_params] = msg_params; + + if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + SDL_LOG_ERROR("Unable to send HMI notification"); + } +} + +mobile_apis::Result::eType RequestFromMobileImpl::GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const { + mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR; + switch (hmi_code) { + case hmi_apis::Common_Result::SUCCESS: { + mobile_result = mobile_apis::Result::SUCCESS; + break; + } + case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: { + mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST; + break; + } + case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: { + mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE; + break; + } + case hmi_apis::Common_Result::DISALLOWED: { + mobile_result = mobile_apis::Result::DISALLOWED; + break; + } + case hmi_apis::Common_Result::REJECTED: { + mobile_result = mobile_apis::Result::REJECTED; + break; + } + case hmi_apis::Common_Result::ABORTED: { + mobile_result = mobile_apis::Result::ABORTED; + break; + } + case hmi_apis::Common_Result::IGNORED: { + mobile_result = mobile_apis::Result::IGNORED; + break; + } + case hmi_apis::Common_Result::RETRY: { + mobile_result = mobile_apis::Result::RETRY; + break; + } + case hmi_apis::Common_Result::IN_USE: { + mobile_result = mobile_apis::Result::IN_USE; + break; + } + case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: { + mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE; + break; + } + case hmi_apis::Common_Result::TIMED_OUT: { + mobile_result = mobile_apis::Result::TIMED_OUT; + break; + } + case hmi_apis::Common_Result::INVALID_DATA: { + mobile_result = mobile_apis::Result::INVALID_DATA; + break; + } + case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: { + mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED; + break; + } + case hmi_apis::Common_Result::INVALID_ID: { + mobile_result = mobile_apis::Result::INVALID_ID; + break; + } + case hmi_apis::Common_Result::DUPLICATE_NAME: { + mobile_result = mobile_apis::Result::DUPLICATE_NAME; + break; + } + case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::WRONG_LANGUAGE: { + mobile_result = mobile_apis::Result::WRONG_LANGUAGE; + break; + } + case hmi_apis::Common_Result::OUT_OF_MEMORY: { + mobile_result = mobile_apis::Result::OUT_OF_MEMORY; + break; + } + case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: { + mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS; + break; + } + case hmi_apis::Common_Result::NO_APPS_REGISTERED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::WARNINGS: { + mobile_result = mobile_apis::Result::WARNINGS; + break; + } + case hmi_apis::Common_Result::GENERIC_ERROR: { + mobile_result = mobile_apis::Result::GENERIC_ERROR; + break; + } + case hmi_apis::Common_Result::USER_DISALLOWED: { + mobile_result = mobile_apis::Result::USER_DISALLOWED; + break; + } + case hmi_apis::Common_Result::SAVED: { + mobile_result = mobile_apis::Result::SAVED; + break; + } + case hmi_apis::Common_Result::READ_ONLY: { + mobile_result = mobile_apis::Result::READ_ONLY; + break; + } + default: { + SDL_LOG_ERROR("Unknown HMI result code " << hmi_code); + break; + } + } + + return mobile_result; +} + +bool RequestFromMobileImpl::CheckHMICapabilities( + const mobile_apis::ButtonName::eType button) const { + SDL_LOG_AUTO_TRACE(); + + using namespace smart_objects; + using namespace mobile_apis; + + if (!hmi_capabilities_.is_ui_cooperating()) { + SDL_LOG_ERROR("UI is not supported by HMI"); + return false; + } + + const auto button_capabilities_so = hmi_capabilities_.button_capabilities(); + if (!button_capabilities_so) { + SDL_LOG_ERROR("Invalid button capabilities object"); + return false; + } + + const SmartObject& button_capabilities = *button_capabilities_so; + for (size_t i = 0; i < button_capabilities.length(); ++i) { + const SmartObject& capabilities = button_capabilities[i]; + const ButtonName::eType current_button = static_cast<ButtonName::eType>( + capabilities.getElement(hmi_response::button_name).asInt()); + if (current_button == button) { + SDL_LOG_DEBUG("Button capabilities for " << button << " was found"); + return true; + } + } + + SDL_LOG_DEBUG("Button capabilities for " << button << " was not found"); + return false; +} + +void RequestFromMobileImpl::RemoveDisallowedParameters() { + SDL_LOG_AUTO_TRACE(); + + smart_objects::SmartObject& params = (*message_)[strings::msg_params]; + + // Remove from request all disallowed parameters + RPCParams::const_iterator it_disallowed = + parameters_permissions_.disallowed_params.begin(); + RPCParams::const_iterator it_disallowed_end = + parameters_permissions_.disallowed_params.end(); + for (; it_disallowed != it_disallowed_end; ++it_disallowed) { + if (params.keyExists(*it_disallowed)) { + const std::string key = *it_disallowed; + params.erase(key); + removed_parameters_permissions_.disallowed_params.insert(key); + SDL_LOG_INFO("Following parameter is disallowed by user: " << key); + } + } + + // Remove from request all undefined yet parameters + RPCParams::const_iterator it_undefined = + parameters_permissions_.undefined_params.begin(); + RPCParams::const_iterator it_undefined_end = + parameters_permissions_.undefined_params.end(); + for (; it_undefined != it_undefined_end; ++it_undefined) { + if (params.keyExists(*it_undefined)) { + const std::string key = *it_undefined; + params.erase(key); + removed_parameters_permissions_.undefined_params.insert(key); + SDL_LOG_INFO("Following parameter is disallowed by policy: " << key); + } + } + + // Remove from request all parameters missed in allowed + const VehicleData& vehicle_data = + application_manager::MessageHelper::vehicle_data(); + + VehicleData::const_iterator it_vehicle_data = vehicle_data.begin(); + VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end(); + for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) { + const std::string key = it_vehicle_data->first; + if (params.keyExists(key) && + parameters_permissions_.allowed_params.end() == + std::find(parameters_permissions_.allowed_params.begin(), + parameters_permissions_.allowed_params.end(), + key)) { + params.erase(key); + removed_parameters_permissions_.undefined_params.insert(key); + SDL_LOG_INFO("Following parameter is not found among allowed parameters '" + << key << "' and will be treated as disallowed."); + } + } +} + +bool RequestFromMobileImpl::HasDisallowedParams() const { + return ((!removed_parameters_permissions_.disallowed_params.empty()) || + (!removed_parameters_permissions_.undefined_params.empty())); +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const { + SDL_LOG_AUTO_TRACE(); + + return IsHMIResultSuccess(result_code, interface); +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + ResponseInfo& out_first, ResponseInfo& out_second) const { + SDL_LOG_AUTO_TRACE(); + bool result = CheckResultCode(out_first, out_second) || + CheckResultCode(out_second, out_first); + return result; +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + ResponseInfo& out_first, + ResponseInfo& out_second, + ResponseInfo& out_third) const { + SDL_LOG_AUTO_TRACE(); + bool result = (PrepareResultForMobileResponse(out_first, out_second) || + PrepareResultForMobileResponse(out_second, out_third)) && + PrepareResultForMobileResponse(out_first, out_third); + return result; +} + +void RequestFromMobileImpl::GetInfo( + const smart_objects::SmartObject& response_from_hmi, + std::string& out_info) const { + if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { + if (!response_from_hmi[strings::msg_params][strings::info].empty()) { + out_info = + response_from_hmi[strings::msg_params][strings::info].asString(); + } + } +} + +mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse( + const ResponseInfo& first, const ResponseInfo& second) { + SDL_LOG_AUTO_TRACE(); + if (IsResultCodeUnsupported(first, second) || + IsResultCodeUnsupported(second, first)) { + return mobile_apis::Result::UNSUPPORTED_RESOURCE; + } + if (IsResultCodeWarning(first, second) || + IsResultCodeWarning(second, first)) { + return mobile_apis::Result::WARNINGS; + } + // If response contains erroneous result code SDL need return erroneus + // result code. + hmi_apis::Common_Result::eType first_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType second_result = + hmi_apis::Common_Result::INVALID_ENUM; + if (!first.is_unsupported_resource) { + first_result = first.result_code; + } + if (!second.is_unsupported_resource) { + second_result = second.result_code; + } + mobile_apis::Result::eType result_code = + MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); + return result_code; +} + +mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse( + const ResponseInfo& first, + const ResponseInfo& second, + const ResponseInfo& third) { + SDL_LOG_AUTO_TRACE(); + + const auto first_comparison = PrepareResultCodeForResponse(first, second); + const auto second_comparison = PrepareResultCodeForResponse(second, third); + const auto third_comparison = PrepareResultCodeForResponse(first, third); + + return std::max({first_comparison, second_comparison, third_comparison}); +} + +const CommandParametersPermissions& +RequestFromMobileImpl::parameters_permissions() const { + return parameters_permissions_; +} + +void RequestFromMobileImpl::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) { + SDL_LOG_AUTO_TRACE(); + bool hmi_destination = false; + ApplicationSharedPtr app; + // Default error code and error message + std::string error_msg = "No app service provider available"; + mobile_apis::Result::eType error_code = + mobile_apis::Result::DATA_NOT_AVAILABLE; + + if ((*msg)[strings::msg_params].keyExists(strings::service_type)) { + std::string service_type = + (*msg)[strings::msg_params][strings::service_type].asString(); + application_manager_.GetAppServiceManager().GetProviderByType( + service_type, true, app, hmi_destination); + error_msg = "No app service provider with serviceType: " + service_type + + " is available"; + error_code = mobile_apis::Result::DATA_NOT_AVAILABLE; + } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) { + std::string service_id = + (*msg)[strings::msg_params][strings::service_id].asString(); + application_manager_.GetAppServiceManager().GetProviderByID( + service_id, true, app, hmi_destination); + error_msg = "No app service provider with serviceId: " + service_id + + " is available"; + error_code = mobile_apis::Result::INVALID_ID; + } + + if (hmi_destination) { + SDL_LOG_DEBUG("Sending Request to HMI Provider"); + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); + return; + } + + if (!app) { + SDL_LOG_DEBUG("Invalid App Provider pointer"); + SendResponse(false, error_code, error_msg.c_str()); + return; + } + + if (connection_key() == app->app_id()) { + SendResponse(false, + mobile_apis::Result::IGNORED, + "Consumer app is same as producer app"); + return; + } + + smart_objects::SmartObjectSPtr new_msg = + std::make_shared<smart_objects::SmartObject>(); + smart_objects::SmartObject& request = *new_msg; + + request[strings::params] = (*msg)[strings::params]; + request[strings::msg_params] = (*msg)[strings::msg_params]; + request[strings::params][strings::connection_key] = app->app_id(); + + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendMobileRequest(mobile_function_id, new_msg, use_events); +} + +bool RequestFromMobileImpl::IsResultCodeUnsupported( + const ResponseInfo& first, const ResponseInfo& second) const { + const bool first_ok_second_unsupported = + (first.is_ok || first.is_not_used) && second.is_unsupported_resource; + const bool both_unsupported = + first.is_unsupported_resource && second.is_unsupported_resource; + return first_ok_second_unsupported || both_unsupported; +} + +std::string GetComponentNameFromInterface( + const HmiInterfaces::InterfaceID& interface) { + switch (interface) { + case HmiInterfaces::HMI_INTERFACE_Buttons: + return hmi_interface::buttons; + case HmiInterfaces::HMI_INTERFACE_BasicCommunication: + return hmi_interface::basic_communication; + case HmiInterfaces::HMI_INTERFACE_VR: + return hmi_interface::vr; + case HmiInterfaces::HMI_INTERFACE_TTS: + return hmi_interface::tts; + case HmiInterfaces::HMI_INTERFACE_UI: + return hmi_interface::ui; + case HmiInterfaces::HMI_INTERFACE_Navigation: + return hmi_interface::navigation; + case HmiInterfaces::HMI_INTERFACE_VehicleInfo: + return hmi_interface::vehicle_info; + case HmiInterfaces::HMI_INTERFACE_SDL: + return hmi_interface::sdl; + case HmiInterfaces::HMI_INTERFACE_RC: + return hmi_interface::rc; + case HmiInterfaces::HMI_INTERFACE_AppService: + return hmi_interface::app_service; + default: + return "Unknown type"; + } +} + +const std::string InfoInterfaceSeparator( + const std::string& sum, const HmiInterfaces::InterfaceID container_value) { + return sum.empty() + ? GetComponentNameFromInterface(container_value) + : sum + ", " + GetComponentNameFromInterface(container_value); +} + +void RequestFromMobileImpl::AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const { + using ns_smart_device_link::ns_smart_objects::SmartObject; + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + if (awaiting_response_interfaces_.empty()) { + SDL_LOG_ERROR("No interfaces awaiting, info param is empty"); + return; + } + + const std::string not_responding_interfaces_string = + std::accumulate(awaiting_response_interfaces_.begin(), + awaiting_response_interfaces_.end(), + std::string(""), + InfoInterfaceSeparator); + SDL_LOG_DEBUG( + "Not responding interfaces string: " << not_responding_interfaces_string); + if (!not_responding_interfaces_string.empty()) { + const std::string component_info = + not_responding_interfaces_string + " component does not respond"; + response[strings::msg_params][strings::info] = component_info; + } +} + +void RequestFromMobileImpl::AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const { + auto function_id = static_cast<hmi_apis::FunctionID::eType>( + request_to_hmi[strings::params][strings::function_id].asUInt()); + // SDL must not apply "default timeout for RPCs processing" for + // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI + // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR + // to mobile app), so the OnResetTimeout logic is not applicable for + // DialNumber RPC + if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>( + function_id, + hmi_apis::FunctionID::BasicCommunication_DialNumber, + hmi_apis::FunctionID::INVALID_ENUM)) { + SDL_LOG_DEBUG( + "Current RPC is DialNumber or Invalid, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + + // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use + // timeout tracking for response, so the OnResetTimeout logic is not + // applicable in this case + if (helpers::Compare<hmi_apis::FunctionID::eType, helpers::EQ, helpers::ONE>( + function_id, + hmi_apis::FunctionID::UI_Alert, + hmi_apis::FunctionID::UI_SubtleAlert)) { + if (request_to_hmi.keyExists(strings::msg_params)) { + if (request_to_hmi[strings::msg_params].keyExists( + strings::soft_buttons)) { + SDL_LOG_DEBUG("Soft buttons are present in " + << EnumToString(function_id) + << " RPC, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + } + } + + const application_manager::request_controller::Request request{ + correlation_id(), connection_key(), static_cast<uint32_t>(function_id)}; + application_manager_.get_request_timeout_handler().AddRequest( + request_to_hmi[strings::params][strings::correlation_id].asUInt(), + request); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index 3c411b1605..ac6bda0557 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -123,11 +123,11 @@ RequestToHMI::RequestToHMI(const MessageSharedPtr& message, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} RequestToHMI::~RequestToHMI() {} 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 7392731d70..0d7dc9cfe0 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 @@ -66,7 +66,11 @@ void EventDispatcherImpl::raise_event(const Event& event) { EventObserver* temp = *observers.begin(); observers.erase(observers.begin()); AutoUnlock unlock_observer(observer_lock); - temp->on_event(event); + + if (temp->IncrementReferenceCount()) { + temp->HandleOnEvent(event); + temp->DecrementReferenceCount(); + } } } @@ -89,6 +93,15 @@ struct IdCheckFunctor { }; void EventDispatcherImpl::remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) { + AutoLock auto_lock(state_lock_); + auto& observers = observers_event_[event_id][hmi_correlation_id]; + for (auto observer : observers) { + remove_observer_from_vector(*observer); + } +} + +void EventDispatcherImpl::remove_observer(const Event::EventID& event_id, EventObserver& observer) { remove_observer_from_vector(observer); AutoLock auto_lock(state_lock_); @@ -148,7 +161,11 @@ void EventDispatcherImpl::raise_mobile_event(const MobileEvent& event) { EventObserver* temp = *mobile_observers_.begin(); mobile_observers_.erase(mobile_observers_.begin()); AutoUnlock unlock_observer(observer_lock); - temp->on_event(event); + + if (temp->IncrementReferenceCount()) { + temp->HandleOnEvent(event); + temp->DecrementReferenceCount(); + } } } diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc index e17203f2f2..6b6d6def35 100644 --- a/src/components/application_manager/src/event_engine/event_observer.cc +++ b/src/components/application_manager/src/event_engine/event_observer.cc @@ -75,7 +75,15 @@ void EventObserver::unsubscribe_from_all_mobile_events() { event_dispatcher_.remove_mobile_observer(*this); } -void EventObserver::on_event(const event_engine::MobileEvent& event) {} +void EventObserver::HandleOnEvent(const event_engine::MobileEvent& event) {} + +bool EventObserver::IncrementReferenceCount() const { + return true; +} + +bool EventObserver::DecrementReferenceCount() const { + return true; +} } // namespace event_engine } // namespace application_manager diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 2d9c7cb48a..776595a040 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -31,6 +31,7 @@ */ #include "application_manager/hmi_language_handler.h" + #include "application_manager/application_manager.h" #include "application_manager/hmi_capabilities.h" #include "application_manager/message_helper.h" @@ -119,7 +120,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( return Common_Language::INVALID_ENUM; } -void HMILanguageHandler::on_event(const event_engine::Event& event) { +void HMILanguageHandler::HandleOnEvent(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg = event.smart_object(); switch (event.id()) { diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index 75fa48b049..7b8deb5e8c 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -55,9 +55,10 @@ void PolicyEventObserver::set_policy_handler( policy_handler_ = policy_handler; } -void PolicyEventObserver::on_event(const event_engine::MobileEvent& event) {} +void PolicyEventObserver::HandleOnEvent( + const event_engine::MobileEvent& event) {} -void PolicyEventObserver::on_event(const event_engine::Event& event) { +void PolicyEventObserver::HandleOnEvent(const event_engine::Event& event) { sync_primitives::AutoLock auto_lock(policy_handler_lock_); if (!policy_handler_) { return; diff --git a/src/components/application_manager/src/request_controller_impl.cc b/src/components/application_manager/src/request_controller_impl.cc index 10f0f64b4e..76d4a70330 100644 --- a/src/components/application_manager/src/request_controller_impl.cc +++ b/src/components/application_manager/src/request_controller_impl.cc @@ -30,12 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "utils/logger.h" +#include "application_manager/request_controller.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/commands/request_to_hmi.h" #include "application_manager/request_controller_impl.h" - +#include "utils/logger.h" #include "utils/timer_task_impl.h" namespace application_manager { @@ -48,8 +49,10 @@ SDL_CREATE_LOG_VARIABLE("RequestController") RequestControllerImpl::RequestControllerImpl( const RequestControlerSettings& settings, - RequestTimeoutHandler& request_timeout_handler) - : pool_state_(TPoolState::UNDEFINED) + RequestTimeoutHandler& request_timeout_handler, + event_engine::EventDispatcher& event_dispatcher) + : threads::AsyncRunner("RequestController async runner") + , pool_state_(TPoolState::UNDEFINED) , pool_size_(settings.thread_pool_size()) , request_tracker_(settings) , duplicate_message_count_() @@ -59,7 +62,8 @@ RequestControllerImpl::RequestControllerImpl( , timer_stop_flag_(false) , is_low_voltage_(false) , settings_(settings) - , request_timeout_handler_(request_timeout_handler) { + , request_timeout_handler_(request_timeout_handler) + , event_dispatcher_(event_dispatcher) { SDL_LOG_AUTO_TRACE(); InitializeThreadpool(); timer_.Start(0, timer::kSingleShot); @@ -83,6 +87,9 @@ void RequestControllerImpl::Stop() { DestroyThreadpool(); } + SDL_LOG_DEBUG("Stopping async runner"); + AsyncRunner::Stop(); + SDL_LOG_DEBUG("Stopping timeout tracker"); timer_.Stop(); } @@ -248,6 +255,50 @@ void RequestControllerImpl::RemoveNotification( SDL_LOG_DEBUG("Cannot find notification"); } +bool RequestControllerImpl::RetainRequestInstance( + const uint32_t connection_key, const uint32_t correlation_id) { + SDL_LOG_AUTO_TRACE(); + auto request = waiting_for_response_.Find(connection_key, correlation_id); + if (request) { + retained_mobile_requests_.insert(request); + SDL_LOG_DEBUG("Request (" << connection_key << ", " << correlation_id + << ") has been retained"); + } + SDL_LOG_DEBUG( + "Total retained requests: " << retained_mobile_requests_.size()); + + return static_cast<bool>(request); +} + +bool RequestControllerImpl::RemoveRetainedRequest( + const uint32_t connection_key, const uint32_t correlation_id) { + SDL_LOG_AUTO_TRACE(); + for (auto it = retained_mobile_requests_.begin(); + it != retained_mobile_requests_.end(); + ++it) { + if ((*it)->request()->connection_key() == connection_key && + (*it)->request()->correlation_id() == correlation_id) { + SDL_LOG_DEBUG("Removing request (" << connection_key << ", " + << correlation_id << ")"); + retained_mobile_requests_.erase(it); + + SDL_LOG_DEBUG( + "Total retained requests: " << retained_mobile_requests_.size()); + return true; + } + } + + SDL_LOG_ERROR("Can't find request (" << connection_key << ", " + << correlation_id << ")"); + return false; +} + +bool RequestControllerImpl::IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const { + auto request = waiting_for_response_.Find(connection_key, correlation_id); + return static_cast<bool>(request); +} + void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id, const uint32_t connection_key, const int32_t function_id, @@ -284,13 +335,17 @@ void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id, return; } if (force_terminate || request->request()->AllowedToTerminate()) { + event_dispatcher_.remove_observer( + static_cast<hmi_apis::FunctionID::eType>(function_id), correlation_id); waiting_for_response_.RemoveRequest(request); if (RequestInfo::HMIRequest == request->request_type()) { request_timeout_handler_.RemoveRequest(request->requestId()); } } else { - SDL_LOG_WARN("Request was not terminated"); + SDL_LOG_WARN("Request was not terminated " + << "correlation_id = " << correlation_id + << " function_id = " << function_id); } NotifyTimer(); } @@ -327,12 +382,51 @@ void RequestControllerImpl::TerminateWaitingForExecutionAppRequests( SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size()); } +void RequestControllerImpl::scheduleRequestsCleanup( + const RequestInfoPtrs& requests) { + SDL_LOG_AUTO_TRACE(); + AsyncRun(new RequestCleanerDelegate(requests)); +} + void RequestControllerImpl::TerminateWaitingForResponseAppRequests( const uint32_t app_id) { SDL_LOG_AUTO_TRACE(); - waiting_for_response_.RemoveByConnectionKey(app_id); - SDL_LOG_DEBUG( - "Waiting for response count : " << waiting_for_response_.Size()); + SDL_LOG_DEBUG("Waiting for response count before cleanup: " + << waiting_for_response_.Size()); + + RequestInfoPtrs requests_to_terminate; + + auto pending_requests = + waiting_for_response_.GetRequestsByConnectionKey(app_id); + for (auto it = pending_requests.begin(); it != pending_requests.end(); ++it) { + auto request_ptr = (*it)->request(); + if (!request_ptr->CleanUp()) { + SDL_LOG_WARN("Request with corr_id: " + << request_ptr->correlation_id() + << " can't be terminated right now. Keep in the queue"); + continue; + } + + SDL_LOG_DEBUG( + "Removing request with corr_id: " << request_ptr->correlation_id()); + requests_to_terminate.push_back(*it); + waiting_for_response_.RemoveRequest(*it); + } + + SDL_LOG_DEBUG("Waiting for response count after cleanup: " + << waiting_for_response_.Size()); + + // It is necessary to release requests references after some short amount of + // time because here might be a possible data races in event dispatcher + // between GetNextObserver() and IncrementReferenceCount() when reference to + // corresponding request is destroyed by that function right after CleanUp() + // This micro delay gives a time to event dispatcher to figure out that + // request was finalized and event should not be handled + if (!requests_to_terminate.empty()) { + SDL_LOG_DEBUG("Scheduling cleanup for " << requests_to_terminate.size() + << " requests for app " << app_id); + scheduleRequestsCleanup(requests_to_terminate); + } } void RequestControllerImpl::TerminateAppRequests(const uint32_t app_id) { @@ -467,7 +561,8 @@ void RequestControllerImpl::TimeoutThread() { const uint32_t expired_request_id = probably_expired->requestId(); const uint32_t expired_app_id = probably_expired->app_id(); - probably_expired->request()->onTimeOut(); + probably_expired->request()->HandleTimeOut(); + if (RequestInfo::kHmiConnectionKey == probably_expired->app_id()) { SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId()); waiting_for_response_.RemoveRequest(probably_expired); @@ -530,8 +625,8 @@ void RequestControllerImpl::Worker::threadMain() { std::make_shared<MobileRequestInfo>(request_ptr, timeout_in_mseconds); if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { - commands::CommandRequestImpl* cmd_request = - dynamic_cast<commands::CommandRequestImpl*>(request_ptr.get()); + commands::RequestFromMobileImpl* cmd_request = + dynamic_cast<commands::RequestFromMobileImpl*>(request_ptr.get()); if (cmd_request != NULL) { uint32_t corr_id = cmd_request->correlation_id(); request_controller_->duplicate_message_count_lock_.Acquire(); @@ -577,6 +672,32 @@ void RequestControllerImpl::Worker::exitThreadMain() { // FIXME (dchmerev@luxoft.com): There is no waiting } +RequestControllerImpl::RequestCleanerDelegate::RequestCleanerDelegate( + const RequestInfoPtrs& requests) + : requests_(requests) {} + +RequestControllerImpl::RequestCleanerDelegate::~RequestCleanerDelegate() { + SDL_LOG_AUTO_TRACE(); +} + +void RequestControllerImpl::RequestCleanerDelegate::exitThreadMain() { + sync_primitives::AutoLock lock(state_lock_); + state_cond_.NotifyOne(); +} + +void RequestControllerImpl::RequestCleanerDelegate::threadMain() { + SDL_LOG_DEBUG("Prepare to cleanup of " << requests_.size() << " requests"); + + { + SDL_LOG_DEBUG("Waiting..."); + sync_primitives::AutoLock lock(state_lock_); + state_cond_.WaitFor(lock, 50); + } + + SDL_LOG_DEBUG("Releasing references"); + requests_.clear(); +} + void RequestControllerImpl::NotifyTimer() { SDL_LOG_AUTO_TRACE(); timer_condition_.NotifyOne(); diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 6770e839b3..60d00b65de 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -92,6 +92,7 @@ void application_manager::request_controller::RequestInfo::updateEndTime() { void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { timeout_msec_ = timeout_msec; updateEndTime(); + request_->OnUpdateTimeOut(); } bool RequestInfo::isExpired() { @@ -197,6 +198,22 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { return result; } +std::list<RequestInfoPtr> RequestInfoSet::GetRequestsByConnectionKey( + const uint32_t connection_key) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(pending_requests_lock_); + + std::list<RequestInfoPtr> output_list; + AppIdCompararator comparator(AppIdCompararator::Equal, connection_key); + + std::copy_if(hash_sorted_pending_requests_.begin(), + hash_sorted_pending_requests_.end(), + std::back_inserter(output_list), + comparator); + + return output_list; +} + bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { DCHECK(request_info); if (!request_info) { diff --git a/src/components/application_manager/src/request_timeout_handler_impl.cc b/src/components/application_manager/src/request_timeout_handler_impl.cc index f246693d56..1ac72393a0 100644 --- a/src/components/application_manager/src/request_timeout_handler_impl.cc +++ b/src/components/application_manager/src/request_timeout_handler_impl.cc @@ -80,7 +80,8 @@ bool RequestTimeoutHandlerImpl::IsTimeoutUpdateRequired( return true; } -void RequestTimeoutHandlerImpl::on_event(const event_engine::Event& event) { +void RequestTimeoutHandlerImpl::HandleOnEvent( + const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); const auto event_id = event.id(); if (hmi_apis::FunctionID::BasicCommunication_OnResetTimeout == event_id) { diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index 598b7a6ccb..b8462a533a 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -347,7 +347,8 @@ void ResumptionDataProcessorImpl::HandleOnTimeOut( ProcessResponseFromHMI(*error_response, function_id, corr_id); } -void ResumptionDataProcessorImpl::on_event(const event_engine::Event& event) { +void ResumptionDataProcessorImpl::HandleOnEvent( + const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); SDL_LOG_DEBUG( "Handling response message from HMI " diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index 89dac83165..b8dbb69f50 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -31,12 +31,13 @@ */ #include "application_manager/state_controller_impl.h" + #include <tuple> + #include "application_manager/rpc_service.h" #include "application_manager/usage_statistics.h" -#include "utils/helpers.h" - #include "connection_handler/connection_handler.h" +#include "utils/helpers.h" namespace application_manager { @@ -720,7 +721,8 @@ void StateControllerImpl::UpdateAppWindowsStreamingState( } } -void StateControllerImpl::on_event(const event_engine::MobileEvent& event) { +void StateControllerImpl::HandleOnEvent( + const event_engine::MobileEvent& event) { using namespace mobile_apis; SDL_LOG_AUTO_TRACE(); @@ -765,9 +767,9 @@ void StateControllerImpl::on_event(const event_engine::MobileEvent& event) { default: break; } -} +} // namespace application_manager -void StateControllerImpl::on_event(const event_engine::Event& event) { +void StateControllerImpl::HandleOnEvent(const event_engine::Event& event) { using event_engine::Event; using smart_objects::SmartObject; using namespace hmi_apis; diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc index 3aee6d7e21..d66c70478b 100644 --- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc +++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc @@ -121,7 +121,7 @@ void SystemTimeHandlerImpl::SendTimeRequest() { awaiting_get_system_time_ = true; } -void SystemTimeHandlerImpl::on_event( +void SystemTimeHandlerImpl::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); using namespace application_manager; diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index b7b0801167..b12e67ceba 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -157,7 +157,7 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) { EXPECT_EQ(kConnectionKey, command->connection_key()); EXPECT_EQ(kFunctionId, command->function_id()); EXPECT_NO_THROW(command->Run()); - EXPECT_NO_THROW(command->onTimeOut()); + EXPECT_NO_THROW(command->HandleTimeOut()); } TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_NoAppIdInMessage_UNSUCCESS) { diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc index 7beda06d8a..5129f09a96 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc @@ -35,9 +35,9 @@ #include <string> #include "application_manager/commands/command_impl.h" -#include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/command_request_test.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "gtest/gtest.h" #include "utils/lock.h" @@ -78,6 +78,7 @@ using am::RPCParams; using am::commands::CommandImpl; using am::commands::CommandRequestImpl; using am::commands::MessageSharedPtr; +using am::commands::RequestFromMobileImpl; using am::event_engine::EventObserver; using test::components::application_manager_test::MockAppServiceManager; @@ -101,32 +102,30 @@ const std::string kAppStorageFile = "./app_info.dat"; const std::string kAppInfoStorage = "app_info_storage"; } // namespace -class CommandRequestImplTest +class RequestFromMobileImplTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - CommandRequestImplTest() + RequestFromMobileImplTest() : app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {} - class UnwrappedCommandRequestImpl : public CommandRequestImpl { + class UnwrappedRequestFromMobileImpl + : public am::commands::RequestFromMobileImpl { public: - using CommandRequestImpl::AddDisallowedParameters; - using CommandRequestImpl::CheckAllowedParameters; - using CommandRequestImpl::HasDisallowedParams; - using CommandRequestImpl::RemoveDisallowedParameters; - - UnwrappedCommandRequestImpl(const MessageSharedPtr& message, - ApplicationManager& am, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl( - message, am, rpc_service, hmi_capabilities, policy_handler) {} - - const RequestState current_state() const { - return current_state_; + UnwrappedRequestFromMobileImpl( + const MessageSharedPtr& message, + ApplicationManager& ap_man, + am::rpc_service::RPCService& rpc_service, + am::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : am::commands::RequestFromMobileImpl( + message, ap_man, rpc_service, hmi_capabilities, policy_handler) {} + + const RequestState get_current_state() const { + return am::commands::CommandRequestImpl::current_state(); } - void set_current_state(const RequestState state) { - current_state_ = state; + + void change_current_state(const RequestState state) { + am::commands::CommandRequestImpl::set_current_state(state); } CommandParametersPermissions& parameters_permissions() { @@ -137,9 +136,21 @@ class CommandRequestImplTest return removed_parameters_permissions_; } - void SetHashUpdateMode(HashUpdateMode mode) { + void SetHashUpdateMode(RequestFromMobileImpl::HashUpdateMode mode) { hash_update_mode_ = mode; } + + void RemoveDisallowedParameters() { + am::commands::RequestFromMobileImpl::RemoveDisallowedParameters(); + } + + bool HasDisallowedParams() { + return am::commands::RequestFromMobileImpl::HasDisallowedParams(); + } + + void AddDisallowedParameters(smart_objects::SmartObject& response) { + am::commands::RequestFromMobileImpl::AddDisallowedParameters(response); + } }; MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) { @@ -155,41 +166,24 @@ class CommandRequestImplTest std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_; }; -typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl; -typedef std::shared_ptr<UCommandRequestImpl> CommandPtr; +typedef RequestFromMobileImplTest::UnwrappedRequestFromMobileImpl + URequestFromMobileImpl; +typedef std::shared_ptr<URequestFromMobileImpl> CommandPtr; -TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) { +TEST_F(RequestFromMobileImplTest, WindowID_ExpectDefaultWindowID) { auto msg = CreateMessage(); - const auto command = CreateCommand<UCommandRequestImpl>(msg); + const auto command = CreateCommand<URequestFromMobileImpl>(msg); EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, command->window_id()); } -TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); - - // Should be called twice: - // First -- on `onTimeOut` method call - // Second -- on destruction; - EXPECT_CALL(event_dispatcher_, remove_observer(_)).Times(2); - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - - // If `command` already done, then state should change to `kCompleted`. - command->set_current_state(RequestState::kCompleted); - - command->onTimeOut(); - - EXPECT_EQ(RequestState::kCompleted, command->current_state()); -} - -TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { +TEST_F(RequestFromMobileImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[strings::params][strings::correlation_id] = kCorrelationId; (*msg)[strings::params][strings::function_id] = kInvalidFunctionId; (*msg)[strings::params][strings::connection_key] = kConnectionKey; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); MessageSharedPtr dummy_msg(CreateMessage()); EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) @@ -199,15 +193,15 @@ TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { mock_rpc_service_, ManageMobileCommand(dummy_msg, Command::CommandSource::SOURCE_SDL)); - command->onTimeOut(); + command->HandleTimeOut(); // If `command` not done till now, then state should change to `kTimedOut` // and sent it to application manager to deal with it. - EXPECT_EQ(RequestState::kTimedOut, command->current_state()); + EXPECT_EQ(RequestState::kTimedOut, command->get_current_state()); } -TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); +TEST_F(RequestFromMobileImplTest, CheckSyntax_SUCCESS) { + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); // Checking message syntax. const std::string str1("\t\n"); @@ -221,14 +215,14 @@ TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) { EXPECT_TRUE(command->CheckSyntax(str4, true)); } -TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) { +TEST_F(RequestFromMobileImplTest, GetMobileResultCode_SUCCESS) { union ResultU { int32_t value_; hmi_apis::Common_Result::eType hmi_; mobile_apis::Result::eType mobile_; }; - CommandPtr command = CreateCommand<UCommandRequestImpl>(); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); // Run thru all possible accordance // of HMI and Mobile result codes. @@ -253,8 +247,8 @@ TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) { command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA)); } -TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); +TEST_F(RequestFromMobileImplTest, BasicMethodsOverloads_SUCCESS) { + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); // Current implementation always return `true` EXPECT_TRUE(command->Init()); @@ -264,8 +258,8 @@ TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) { EXPECT_NO_THROW(command->on_event(event)); } -TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); +TEST_F(RequestFromMobileImplTest, CreateHMINotification_SUCCESS) { + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); const std::string kTestParamsKey = "test_msg_params"; @@ -284,8 +278,8 @@ TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) { EXPECT_TRUE((*result)[strings::msg_params].keyExists(kTestParamsKey)); } -TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); +TEST_F(RequestFromMobileImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); @@ -302,8 +296,8 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { command->SendHMIRequest(kInvalidFunctionId, NULL, false)); } -TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); +TEST_F(RequestFromMobileImplTest, SendHMIRequest_UseEvent_SUCCESS) { + CommandPtr command = CreateCommand<URequestFromMobileImpl>(); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); @@ -321,7 +315,14 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) { command->SendHMIRequest(kInvalidFunctionId, NULL, true)); } -TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { +TEST_F(RequestFromMobileImplTest, RemoveDisallowedParameters_SUCCESS) { + am::VehicleData vehicle_data; + vehicle_data.insert(am::VehicleData::value_type( + kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); + + EXPECT_CALL(mock_message_helper_, vehicle_data()) + .WillOnce(ReturnRef(vehicle_data)); + MessageSharedPtr msg = CreateMessage(); (*msg)[strings::msg_params][kDisallowedParam1] = 0u; (*msg)[strings::msg_params][kDisallowedParam2] = 0u; @@ -329,7 +330,8 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { (*msg)[strings::msg_params][kUndefinedParam] = 0u; (*msg)[strings::msg_params][kMissedParam] = 0u; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); + CommandParametersPermissions& permission = command->parameters_permissions(); permission.disallowed_params.insert(kDisallowedParam1); permission.disallowed_params.insert(kDisallowedParam2); @@ -346,22 +348,22 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { EXPECT_TRUE(command->HasDisallowedParams()); } -TEST_F(CommandRequestImplTest, +TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_RegisterAppInterface_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::function_id] = mobile_apis::FunctionID::RegisterAppInterfaceID; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); EXPECT_CALL(app_mngr_, applications()).Times(0); EXPECT_TRUE(command->CheckPermissions()); } -TEST_F(CommandRequestImplTest, +TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_NoAppWithSameConnectionKey_UNSUCCESS) { MessageSharedPtr message = CreateMessage(); - CommandPtr command = CreateCommand<UCommandRequestImpl>(message); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(message); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); MessageSharedPtr dummy_msg(CreateMessage()); EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) @@ -369,7 +371,8 @@ TEST_F(CommandRequestImplTest, EXPECT_FALSE(command->CheckPermissions()); } -TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { +TEST_F(RequestFromMobileImplTest, + CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { MockAppPtr mock_app = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); ON_CALL(*mock_app, GetWindowIds()) @@ -383,7 +386,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { (*message)[strings::msg_params] = smart_objects::SmartObject(smart_objects::SmartType_Map); - CommandPtr command = CreateCommand<UCommandRequestImpl>(message); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(message); EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) .WillOnce(Return(kMobResultSuccess)); @@ -391,7 +394,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { EXPECT_TRUE(command->CheckPermissions()); } -TEST_F(CommandRequestImplTest, +TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) { MockAppPtr mock_app = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); @@ -408,7 +411,7 @@ TEST_F(CommandRequestImplTest, (*message)[strings::params][strings::message_type] = mobile_apis::messageType::request; - CommandPtr command = CreateCommand<UCommandRequestImpl>(message); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(message); EXPECT_CALL(*mock_app, app_id()) .Times(1) @@ -428,12 +431,12 @@ ACTION_P(GetArg3, output) { *output = arg3; } -TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { +TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::connection_key] = kConnectionKey; (*msg)[strings::msg_params][kPolicyAppId] = true; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); MockAppPtr app = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); @@ -452,7 +455,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { std::find(params.begin(), params.end(), kPolicyAppId)); } -TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { +TEST_F(RequestFromMobileImplTest, AddDisallowedParameters_SUCCESS) { am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type( kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); @@ -461,7 +464,7 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { (*msg)[strings::params][strings::function_id] = mobile_apis::FunctionID::SubscribeVehicleDataID; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); ON_CALL(mock_message_helper_, vehicle_data()) .WillByDefault(ReturnRef(vehicle_data)); @@ -474,22 +477,9 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kDisallowedParam1)); } -TEST_F(CommandRequestImplTest, SendResponse_TimedOut_UNSUCCESS) { - CommandPtr command = CreateCommand<UCommandRequestImpl>(); - - command->set_current_state(RequestState::kTimedOut); - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - - // Args do not affect on anything in this case; - command->SendResponse(true, kMobResultSuccess, NULL, NULL); - - EXPECT_EQ(RequestState::kTimedOut, command->current_state()); -} - -TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) { +TEST_F(RequestFromMobileImplTest, SendResponse_SUCCESS) { MessageSharedPtr msg; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); EXPECT_TRUE(smart_objects::SmartType_Null == (*msg).getType()); @@ -501,12 +491,10 @@ TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) { // Args do not affect on anything in this case; command->SendResponse(true, kMobResultSuccess, NULL, NULL); - EXPECT_EQ(RequestState::kCompleted, command->current_state()); - EXPECT_TRUE(smart_objects::SmartType_Map == (*msg).getType()); } -TEST_F(CommandRequestImplTest, +TEST_F(RequestFromMobileImplTest, SendResponse_AddDisallowedParametersToInfo_SUCCESS) { am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type( @@ -516,7 +504,7 @@ TEST_F(CommandRequestImplTest, (*msg)[strings::params][strings::function_id] = mobile_apis::FunctionID::SubscribeVehicleDataID; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); command->removed_parameters_permissions().disallowed_params.insert( kDisallowedParam1); @@ -531,17 +519,16 @@ TEST_F(CommandRequestImplTest, command->SendResponse(true, kMobResultSuccess, NULL, NULL); - EXPECT_EQ(RequestState::kCompleted, command->current_state()); - EXPECT_TRUE((*result)[strings::msg_params].keyExists(strings::info)); EXPECT_FALSE( (*result)[strings::msg_params][strings::info].asString().empty()); } -TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) { +TEST_F(RequestFromMobileImplTest, HashUpdateAllowed_UpdateExpected) { MessageSharedPtr msg; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); MessageSharedPtr result; @@ -558,11 +545,11 @@ TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) { command.reset(); } -TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { +TEST_F(RequestFromMobileImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { MessageSharedPtr msg; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); command->SetHashUpdateMode( - CommandRequestImpl::HashUpdateMode::kSkipHashUpdate); + RequestFromMobileImpl::HashUpdateMode::kSkipHashUpdate); MessageSharedPtr result; @@ -578,10 +565,11 @@ TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { command.reset(); } -TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) { +TEST_F(RequestFromMobileImplTest, RequestFailed_HashUpdateNotExpected) { MessageSharedPtr msg; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); MessageSharedPtr result; @@ -597,10 +585,11 @@ TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) { command.reset(); } -TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) { +TEST_F(RequestFromMobileImplTest, AppNotFound_HashUpdateNotExpected) { MessageSharedPtr msg; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); MessageSharedPtr result; @@ -617,7 +606,7 @@ TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) { command.reset(); } -TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) { +TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByServiceType) { auto last_state = std::make_shared<resumption::LastStateWrapperImpl>( std::make_shared<resumption::LastStateImpl>(kAppStorageFolder, kAppInfoStorage)); @@ -638,7 +627,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) { mobile_apis::FunctionID::GetAppServiceDataID; (*msg)[strings::msg_params][strings::service_type] = "MEDIA"; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); command->SendProviderRequest( mobile_apis::FunctionID::GetAppServiceDataID, hmi_apis::FunctionID::AppService_GetAppServiceData, @@ -646,7 +635,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) { true); } -TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) { +TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByProviderID) { auto last_state = std::make_shared<resumption::LastStateWrapperImpl>( std::make_shared<resumption::LastStateImpl>(kAppStorageFolder, kAppInfoStorage)); @@ -667,7 +656,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) { mobile_apis::FunctionID::GetAppServiceDataID; (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); command->SendProviderRequest( mobile_apis::FunctionID::GetAppServiceDataID, hmi_apis::FunctionID::AppService_GetAppServiceData, @@ -675,7 +664,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) { true); } -TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) { +TEST_F(RequestFromMobileImplTest, SendProviderRequestToHMI_ByProviderID) { auto last_state = std::make_shared<resumption::LastStateWrapperImpl>( std::make_shared<resumption::LastStateImpl>(kAppStorageFolder, kAppInfoStorage)); @@ -696,7 +685,7 @@ TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) { mobile_apis::FunctionID::GetAppServiceDataID; (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; - CommandPtr command = CreateCommand<UCommandRequestImpl>(msg); + CommandPtr command = CreateCommand<URequestFromMobileImpl>(msg); command->SendProviderRequest( mobile_apis::FunctionID::GetAppServiceDataID, hmi_apis::FunctionID::AppService_GetAppServiceData, diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc index 6746e0d5ec..506eed1870 100644 --- a/src/components/application_manager/test/event_engine_test.cc +++ b/src/components/application_manager/test/event_engine_test.cc @@ -125,7 +125,7 @@ class EventEngineTest : public testing::Test { event_id, correlation_id, event_observer_mock_); event_->set_smart_object(so); - EXPECT_CALL(event_observer_mock_, on_event(An<const Event&>())) + EXPECT_CALL(event_observer_mock_, HandleOnEvent(An<const Event&>())) .Times(calls_number); event_dispatcher_instance_->raise_event(*event_); } diff --git a/src/components/application_manager/test/hmi_language_handler_test.cc b/src/components/application_manager/test/hmi_language_handler_test.cc index 59913b19be..368f77ce8a 100644 --- a/src/components/application_manager/test/hmi_language_handler_test.cc +++ b/src/components/application_manager/test/hmi_language_handler_test.cc @@ -143,10 +143,10 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) { // Repeatedly add events to set `is_*_language_received_` flags up Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); // After last flag gets up, `VerifyWithPersistedLanguages` // method been called to and then will call `hmi_capabilities` @@ -173,14 +173,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) { Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); ON_CALL(app_manager_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); @@ -212,14 +212,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) { EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) { Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); ON_CALL(app_manager_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); @@ -242,7 +242,7 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) { ON_CALL(app_manager_, applications()).WillByDefault(Return(data_accessor)); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, @@ -299,7 +299,7 @@ TEST_F(HmiLanguageHandlerTest, event.set_smart_object(msg); EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); EXPECT_CALL(app_manager_, hmi_capabilities()) .WillOnce(ReturnRef(hmi_capabilities_)); @@ -327,7 +327,7 @@ TEST_F(HmiLanguageHandlerTest, .WillRepeatedly(ReturnRef(mock_rpc_service_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(2); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(1); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); } TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { @@ -339,7 +339,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { event.set_smart_object(msg); EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); hmi_language_handler_->OnUnregisterApplication(app_id); @@ -356,7 +356,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { EXPECT_CALL(app_manager_, GetRPCService()).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); } } // namespace hmi_language_handler } // namespace components diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h index 2087ef8f28..b7d4608a25 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -41,6 +41,7 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_rpc_service.h" #include "application_manager/policies/mock_policy_handler_interface.h" @@ -69,6 +70,7 @@ using ::test::components::application_manager_test::MockApplication; using ::test::components::application_manager_test::MockApplicationManager; using ::test::components::application_manager_test:: MockApplicationManagerSettings; +using ::test::components::event_engine_test::MockEventDispatcher; // Depending on the value type will be selected template <const bool kIf, class ThenT, class ElseT> @@ -146,6 +148,23 @@ class CommandsTest : public ::testing::Test { mock_policy_handler_); } + void InitEventDispatcher() { + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + } + + void InitNegativeResponse() { + MessageSharedPtr timeout_response = + CommandsTest<kIsNice>::CreateMessage(smart_objects::SmartType_Map); + (*timeout_response)[am::strings::msg_params][am::strings::result_code] = + am::mobile_api::Result::GENERIC_ERROR; + (*timeout_response)[am::strings::msg_params][am::strings::success] = false; + + ON_CALL(mock_message_helper_, + CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) + .WillByDefault(Return(timeout_response)); + } + enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 }; MockAppManager app_mngr_; @@ -155,6 +174,7 @@ class CommandsTest : public ::testing::Test { testing::NiceMock<policy_test::MockPolicyHandlerInterface> mock_policy_handler_; MockAppManagerSettings app_mngr_settings_; + MockEventDispatcher event_dispatcher_; MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; am::MockMessageHelper& mock_message_helper_; diff --git a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h index b345f53c1c..f0f8bd8dd1 100644 --- a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h +++ b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h @@ -57,6 +57,10 @@ class MockEventDispatcher remove_observer, void(const ::application_manager::event_engine::Event::EventID& event_id, ::application_manager::event_engine::EventObserver& observer)); + MOCK_METHOD2( + remove_observer, + void(const ::application_manager::event_engine::Event::EventID& event_id, + int32_t hmi_correlation_id)); MOCK_METHOD1( remove_observer, void(::application_manager::event_engine::EventObserver& observer)); diff --git a/src/components/application_manager/test/include/application_manager/mock_event_observer.h b/src/components/application_manager/test/include/application_manager/mock_event_observer.h index 1357d67a65..7ac9223e41 100644 --- a/src/components/application_manager/test/include/application_manager/mock_event_observer.h +++ b/src/components/application_manager/test/include/application_manager/mock_event_observer.h @@ -50,8 +50,10 @@ class MockEventObserver MOCK_METHOD1(on_event, void(const application_manager::event_engine::Event& event)); MOCK_METHOD1( - on_event, + HandleOnEvent, void(const application_manager::event_engine::MobileEvent& event)); + MOCK_METHOD1(HandleOnEvent, + void(const application_manager::event_engine::Event& event)); }; } // namespace event_engine_test diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h index c1cc7f601f..4348e39020 100644 --- a/src/components/application_manager/test/include/application_manager/mock_request.h +++ b/src/components/application_manager/test/include/application_manager/mock_request.h @@ -56,9 +56,10 @@ class MockRequest : public application_manager::commands::Command { MOCK_CONST_METHOD0(default_timeout, uint32_t()); MOCK_CONST_METHOD0(function_id, int32_t()); MOCK_CONST_METHOD0(window_id, application_manager::WindowID()); + MOCK_METHOD0(HandleTimeOut, void()); + MOCK_METHOD0(OnUpdateTimeOut, void()); MOCK_METHOD1(set_warning_info, void(const std::string info)); MOCK_CONST_METHOD0(warning_info, std::string()); - MOCK_METHOD0(onTimeOut, void()); MOCK_METHOD0(AllowedToTerminate, bool()); MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed)); diff --git a/src/components/application_manager/test/mobile_event_engine_test.cc b/src/components/application_manager/test/mobile_event_engine_test.cc index cad1ff14ff..56824b7020 100644 --- a/src/components/application_manager/test/mobile_event_engine_test.cc +++ b/src/components/application_manager/test/mobile_event_engine_test.cc @@ -116,7 +116,7 @@ class MobileEventEngineTest : public testing::Test { event_dispatcher_instance_->add_mobile_observer( event_id, correlation_id, event_observer_mock_); event_->set_smart_object(so); - EXPECT_CALL(event_observer_mock_, on_event(An<const MobileEvent&>())) + EXPECT_CALL(event_observer_mock_, HandleOnEvent(An<const MobileEvent&>())) .Times(calls_number); event_dispatcher_instance_->raise_mobile_event(*event_); } diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc index 22d7a8cfa0..e42c7648b9 100644 --- a/src/components/application_manager/test/policy_event_observer_test.cc +++ b/src/components/application_manager/test/policy_event_observer_test.cc @@ -89,7 +89,7 @@ class PolicyEventObserverTest : public ::testing::Test { EXPECT_CALL(policy_handler_mock_, PTUpdatedAt(Counters::KILOMETERS, field_value)) .Times(pt_updated_calls_number); - policy_event_observer_->on_event(*event_); + policy_event_observer_->HandleOnEvent(*event_); } void DeleteEvent() { diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 1836e2e87f..353f3f05b7 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -199,7 +199,9 @@ class PolicyHandlerTest : public ::testing::Test { virtual void TearDown() OVERRIDE { Mock::VerifyAndClearExpectations(&mock_message_helper_); - ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); + ON_CALL( + mock_event_dispatcher_, + remove_observer(_, testing::Matcher<event_engine::EventObserver&>(_))); } void ChangePolicyManagerToMock() { diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc index ccb7788b3d..2de2a69cf7 100644 --- a/src/components/application_manager/test/request_controller/request_controller_test.cc +++ b/src/components/application_manager/test/request_controller/request_controller_test.cc @@ -51,6 +51,7 @@ #include "application_manager/policies/policy_handler.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/state_controller.h" +#include "application_manager/test/include/application_manager/mock_event_dispatcher.h" #include "resumption/last_state.h" #include "utils/test_async_waiter.h" @@ -63,6 +64,7 @@ using ::application_manager::request_controller::RequestControllerImpl; using ::application_manager::request_controller::RequestInfo; using test::components::application_manager_test::MockRequestTimeoutHandler; +using ::test::components::event_engine_test::MockEventDispatcher; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; @@ -109,7 +111,9 @@ class RequestControllerTestClass : public ::testing::Test { ON_CALL(mock_request_controller_settings_, thread_pool_size()) .WillByDefault(Return(kThreadPoolSize)); request_ctrl_ = std::make_shared<RequestControllerImpl>( - mock_request_controller_settings_, mock_request_timeout_handler_); + mock_request_controller_settings_, + mock_request_timeout_handler_, + mock_event_dispatcher_); } RequestPtr GetMockRequest( @@ -159,6 +163,7 @@ class RequestControllerTestClass : public ::testing::Test { NiceMock<application_manager_test::MockRequestControlerSettings> mock_request_controller_settings_; + NiceMock<MockEventDispatcher> mock_event_dispatcher_; MockRequestTimeoutHandler mock_request_timeout_handler_; RequestControllerSPtr request_ctrl_; RequestPtr empty_mock_request_; @@ -294,7 +299,7 @@ TEST_F(RequestControllerTestClass, OnTimer_SUCCESS) { mock_request, RequestInfo::RequestType::MobileRequest)); - EXPECT_CALL(*mock_request, onTimeOut()) + EXPECT_CALL(*mock_request, HandleTimeOut()) .WillOnce(NotifyTestAsyncWaiter(waiter)); // Waiting for call of `onTimeOut` for `kTimeScale` seconds diff --git a/src/components/application_manager/test/request_timeout_handler_test.cc b/src/components/application_manager/test/request_timeout_handler_test.cc index c045a653aa..b1acec5eb3 100644 --- a/src/components/application_manager/test/request_timeout_handler_test.cc +++ b/src/components/application_manager/test/request_timeout_handler_test.cc @@ -173,7 +173,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_SUCCESS) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) { @@ -221,7 +221,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) { @@ -260,7 +260,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) { @@ -299,7 +299,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } } // namespace request_timeout_handler_test } // namespace components diff --git a/src/components/application_manager/test/rpc_service_impl_test.cc b/src/components/application_manager/test/rpc_service_impl_test.cc index 76f1f05342..cdfc6114e9 100644 --- a/src/components/application_manager/test/rpc_service_impl_test.cc +++ b/src/components/application_manager/test/rpc_service_impl_test.cc @@ -43,6 +43,7 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/mock_command_factory.h" #include "application_manager/mock_command_holder.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_message_helper.h" #include "application_manager/mock_request.h" #include "application_manager/mock_request_controller_settings.h" @@ -69,6 +70,7 @@ typedef smart_objects::SmartObjectSPtr MessageSharedPtr; typedef utils::Optional<am::plugin_manager::RPCPlugin> PluginOpt; using test::components::application_manager_test::MockAppServiceManager; using test::components::application_manager_test::MockRequestTimeoutHandler; +using test::components::event_engine_test::MockEventDispatcher; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; @@ -90,7 +92,8 @@ class RPCServiceImplTest : public ::testing::Test { public: RPCServiceImplTest() : request_controller_(mock_request_controler_, - mock_request_timeout_handler_) + mock_request_timeout_handler_, + mock_event_dispatcher_) , mock_rpc_protection_manager_( std::make_shared< testing::NiceMock<am::MockRPCProtectionManager> >()) @@ -151,6 +154,7 @@ class RPCServiceImplTest : public ::testing::Test { testing::NiceMock<MockProtocolHandler> mock_protocol_handler_; am::request_controller::RequestControllerImpl request_controller_; testing::NiceMock<MockHMIMessageHandler> mock_hmi_handler_; + MockEventDispatcher mock_event_dispatcher_; testing::NiceMock<MockCommandHolder> mock_command_holder_; std::shared_ptr<am::MockRPCProtectionManager> mock_rpc_protection_manager_; std::shared_ptr<rpc_service::RPCService> rpc_service_; diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index fa301e73ca..b6ec4fc8ef 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -1303,12 +1303,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_start_event(FunctionID::VR_Started); - state_ctrl_->on_event(vr_start_event); + state_ctrl_->HandleOnEvent(vr_start_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_start_event(FunctionID::TTS_Started); - state_ctrl_->on_event(tts_start_event); + state_ctrl_->HandleOnEvent(tts_start_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1319,7 +1319,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1330,7 +1330,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -1374,12 +1374,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_start_event(FunctionID::VR_Started); - state_ctrl_->on_event(vr_start_event); + state_ctrl_->HandleOnEvent(vr_start_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_start_event(FunctionID::TTS_Started); - state_ctrl_->on_event(tts_start_event); + state_ctrl_->HandleOnEvent(tts_start_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1390,7 +1390,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1401,7 +1401,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -1427,12 +1427,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_stop_event(FunctionID::VR_Stopped); - state_ctrl_->on_event(vr_stop_event); + state_ctrl_->HandleOnEvent(vr_stop_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_stop_event(FunctionID::TTS_Stopped); - state_ctrl_->on_event(tts_stop_event); + state_ctrl_->HandleOnEvent(tts_stop_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1443,7 +1443,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1454,7 +1454,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -2295,7 +2295,7 @@ TEST_F(StateControllerImplTest, ActivateAppSuccessReceivedFromHMI) { am::event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -2357,7 +2357,7 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) { message[am::strings::params][am::strings::correlation_id] = corr_id; am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -2381,7 +2381,7 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) { message[am::strings::params][am::strings::correlation_id] = corr_id; am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, ApplyTempStatesForSimpleApp) { @@ -2875,7 +2875,7 @@ TEST_F(StateControllerImplTest, // Precondition am::event_engine::Event event(hmi_apis::FunctionID::VR_Started); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); HmiStatePtr check_state = FullNotAudibleState(); @@ -2909,10 +2909,10 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) { // Precondition am::event_engine::Event prev_event(hmi_apis::FunctionID::VR_Started); - state_ctrl_->on_event(prev_event); + state_ctrl_->HandleOnEvent(prev_event); am::event_engine::Event next_event(hmi_apis::FunctionID::VR_Stopped); - state_ctrl_->on_event(next_event); + state_ctrl_->HandleOnEvent(next_event); // Set state of non-media app after vr has stopped HmiStatePtr check_state = FullNotAudibleState(); @@ -2973,7 +2973,7 @@ TEST_F(StateControllerImplTest, Common_EventTypes::EMERGENCY_EVENT; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); // Non-media app can't have LIMITED-AUDIO state HmiStatePtr check_state = FullNotAudibleState(); @@ -3021,7 +3021,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr check_state = FullAudibleState(); @@ -3057,7 +3057,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3091,7 +3091,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3128,7 +3128,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3165,7 +3165,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3220,7 +3220,7 @@ TEST_F(StateControllerImplTest, am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_FULL); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3255,7 +3255,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_BACKGROUND); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3287,7 +3287,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceNavAppToLimited) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*navi_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_LIMITED); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3308,12 +3308,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) { .WillOnce(Return(simple_app_)); EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); + EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0); am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) { @@ -3327,7 +3328,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) { EXPECT_CALL(app_manager_mock_, application(_)) .WillOnce(Return(incorrect_app)); EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) { @@ -3361,7 +3362,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) { @@ -3396,7 +3397,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) { @@ -3411,7 +3412,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) { EXPECT_CALL(app_manager_mock_, application(_)) .WillOnce(Return(incorrect_app)); EXPECT_CALL(*simple_app_ptr_, app_id()).Times(0); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppActivated) { @@ -3449,7 +3450,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivated) { std::make_shared<smart_objects::SmartObject>(); (*activate_app)[am::strings::params][am::strings::correlation_id] = kCorrID; SetBCActivateAppRequestToHMI(hmi_apis::Common_HMILevel::FULL, kCorrID); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -3485,7 +3486,7 @@ TEST_F(StateControllerImplTest, IsStateActiveApplyNotCorrectTempStates) { const hmi_apis::FunctionID::eType event_id = hmi_apis::FunctionID::VR_Started; am::event_engine::Event event(event_id); event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_FALSE(state_ctrl_->IsStateActive(HmiState::STATE_ID_AUDIO_SOURCE)); } @@ -3502,19 +3503,19 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) { msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::DEACTIVATE_HMI; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMBEDDED_NAVI; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType<am::HmiState>( mobile_apis::HMILevel::HMI_FULL, @@ -3565,11 +3566,11 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) { msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType<am::HmiState>( mobile_apis::HMILevel::HMI_FULL, @@ -3612,7 +3613,7 @@ TEST_F( message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; audio_source_event.set_smart_object(message); - state_ctrl_->on_event(audio_source_event); + state_ctrl_->HandleOnEvent(audio_source_event); EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true)); EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0); @@ -3633,7 +3634,7 @@ TEST_F( message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMBEDDED_NAVI; embedded_navi_event.set_smart_object(message); - state_ctrl_->on_event(embedded_navi_event); + state_ctrl_->HandleOnEvent(embedded_navi_event); EXPECT_CALL(*media_wep_app_ptr_, is_resuming()) .Times(2) @@ -3733,7 +3734,7 @@ TEST_F(StateControllerImplTest, ExpectAppWontChangeHmiStateDueToConflictResolving( simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState()); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } TEST_F(StateControllerImplTest, @@ -3774,7 +3775,7 @@ TEST_F(StateControllerImplTest, GetBCActivateAppRequestToHMI(_, _, _, _, _)) .Times(0); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } } @@ -3795,7 +3796,7 @@ TEST_F(StateControllerImplTest, ExpectAppWontChangeHmiStateDueToConflictResolving( simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState()); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } TEST_F(StateControllerImplTest, @@ -3836,7 +3837,7 @@ TEST_F(StateControllerImplTest, GetBCActivateAppRequestToHMI(_, _, _, _, _)) .Times(0); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } } @@ -3920,7 +3921,7 @@ TEST_F(StateControllerImplTest, message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; audio_source_event.set_smart_object(message); - state_ctrl_->on_event(audio_source_event); + state_ctrl_->HandleOnEvent(audio_source_event); HmiStatePtr initial_state = createHmiState(mobile_apis::HMILevel::INVALID_ENUM, diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 72a322f336..ba58fd203c 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -709,6 +709,36 @@ class ApplicationManager { const uint32_t corr_id, const int32_t function_id) = 0; + /** + * @brief RetainRequestInstance retains request instance by its + * connection+correlation key + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request was rerained. false if the request with such + * connection+correlation key was not found + */ + virtual bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief RemoveRetainedRequest removes request instance retained before + * @param connection_key connection key of application + * @param correlation_id correlation id of request + */ + virtual bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief IsStillWaitingForResponse check if request is still waiting for + * response + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request is still waiting for response, otherwise returns + * false + */ + virtual bool IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const = 0; + /* * @brief Closes application by id * diff --git a/src/components/include/application_manager/request_controller.h b/src/components/include/application_manager/request_controller.h index 287493926b..e892762312 100644 --- a/src/components/include/application_manager/request_controller.h +++ b/src/components/include/application_manager/request_controller.h @@ -111,6 +111,36 @@ class RequestController { virtual void AddNotification(const RequestPtr ptr) = 0; /** + * @brief RetainRequestInstance retains request instance by its + * connection+correlation key + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request was rerained. false if the request with such + * connection+correlation key was not found + */ + virtual bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief RemoveRetainedRequest removes request instance retained before + * @param connection_key connection key of application + * @param correlation_id correlation id of request + */ + virtual bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief IsStillWaitingForResponse check if request is still waiting for + * response + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request is still waiting for response, otherwise returns + * false + */ + virtual bool IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const = 0; + + /** * @brief Removes request from queue * @param correlation_id Active request correlation ID, * @param connection_key Active request connection key (0 for HMI requests) diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 116d758ec4..8d1835a67e 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -396,6 +396,15 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD0(GetCommandFactory, application_manager::CommandFactory&()); MOCK_CONST_METHOD0(get_current_audio_source, uint32_t()); MOCK_METHOD1(set_current_audio_source, void(const uint32_t)); + MOCK_METHOD2(RetainRequestInstance, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_METHOD2(RemoveRetainedRequest, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_CONST_METHOD2(IsStillWaitingForResponse, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); MOCK_METHOD3(AddExpiredButtonRequest, void(const uint32_t app_id, const int32_t corr_id, diff --git a/src/components/include/test/application_manager/mock_request_controller.h b/src/components/include/test/application_manager/mock_request_controller.h index 5ed726b301..a4a7cbc1e2 100644 --- a/src/components/include/test/application_manager/mock_request_controller.h +++ b/src/components/include/test/application_manager/mock_request_controller.h @@ -55,6 +55,15 @@ class MockRequestController MOCK_METHOD1( AddNotification, void(const application_manager::request_controller::RequestPtr request)); + MOCK_METHOD2(RetainRequestInstance, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_METHOD2(RemoveRetainedRequest, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_CONST_METHOD2(IsStillWaitingForResponse, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); MOCK_METHOD4(TerminateRequest, void(const uint32_t correlation_id, const uint32_t connection_key, |