summaryrefslogtreecommitdiff
path: root/src/components/remote_control
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/remote_control')
-rw-r--r--src/components/remote_control/CMakeLists.txt83
-rw-r--r--src/components/remote_control/include/remote_control/commands/base_command_notification.h110
-rw-r--r--src/components/remote_control/include/remote_control/commands/base_command_request.h293
-rw-r--r--src/components/remote_control/include/remote_control/commands/button_press_request.h104
-rw-r--r--src/components/remote_control/include/remote_control/commands/command.h84
-rw-r--r--src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h101
-rw-r--r--src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h75
-rw-r--r--src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h79
-rw-r--r--src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h127
-rw-r--r--src/components/remote_control/include/remote_control/event_engine/event.h127
-rw-r--r--src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h203
-rw-r--r--src/components/remote_control/include/remote_control/event_engine/event_observer.h96
-rw-r--r--src/components/remote_control/include/remote_control/message_helper.h122
-rw-r--r--src/components/remote_control/include/remote_control/module_helper.h0
-rw-r--r--src/components/remote_control/include/remote_control/rc_app_extension.h82
-rw-r--r--src/components/remote_control/include/remote_control/rc_command_factory.h66
-rw-r--r--src/components/remote_control/include/remote_control/rc_module_constants.h233
-rw-r--r--src/components/remote_control/include/remote_control/rc_module_timer.h70
-rw-r--r--src/components/remote_control/include/remote_control/remote_control_event.h82
-rw-r--r--src/components/remote_control/include/remote_control/remote_control_plugin.h164
-rw-r--r--src/components/remote_control/include/remote_control/remote_plugin_interface.h118
-rw-r--r--src/components/remote_control/include/remote_control/request_controller.h110
-rw-r--r--src/components/remote_control/include/remote_control/resource_allocation_manager.h115
-rw-r--r--src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h137
-rw-r--r--src/components/remote_control/src/commands/base_command_notification.cc154
-rw-r--r--src/components/remote_control/src/commands/base_command_request.cc564
-rw-r--r--src/components/remote_control/src/commands/button_press_request.cc264
-rw-r--r--src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc224
-rw-r--r--src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc103
-rw-r--r--src/components/remote_control/src/commands/on_remote_control_settings_notification.cc122
-rw-r--r--src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc350
-rw-r--r--src/components/remote_control/src/message_helper.cc154
-rw-r--r--src/components/remote_control/src/module_helper.cc0
-rw-r--r--src/components/remote_control/src/rc_app_extension.cc62
-rw-r--r--src/components/remote_control/src/rc_command_factory.cc86
-rw-r--r--src/components/remote_control/src/remote_control_event.cc56
-rw-r--r--src/components/remote_control/src/remote_control_plugin.cc341
-rw-r--r--src/components/remote_control/src/request_controller.cc96
-rw-r--r--src/components/remote_control/src/resource_allocation_manager_impl.cc377
-rw-r--r--src/components/remote_control/test/CMakeLists.txt67
-rw-r--r--src/components/remote_control/test/commands/CMakeLists.txt62
-rw-r--r--src/components/remote_control/test/commands/button_press_request_test.cc344
-rw-r--r--src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc291
-rw-r--r--src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc182
-rw-r--r--src/components/remote_control/test/commands/on_remote_control_settings_test.cc326
-rw-r--r--src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc433
-rw-r--r--src/components/remote_control/test/include/mock_application.h352
-rw-r--r--src/components/remote_control/test/include/mock_remote_control_plugin.h54
-rw-r--r--src/components/remote_control/test/include/mock_resource_allocation_manager.h40
-rw-r--r--src/components/remote_control/test/src/rc_app_extension_test.cc43
-rw-r--r--src/components/remote_control/test/src/rc_library_test.cc92
-rw-r--r--src/components/remote_control/test/src/rc_module_test.cc263
-rw-r--r--src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc481
53 files changed, 0 insertions, 8764 deletions
diff --git a/src/components/remote_control/CMakeLists.txt b/src/components/remote_control/CMakeLists.txt
deleted file mode 100644
index a320273a1e..0000000000
--- a/src/components/remote_control/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-set(target "RemoteControlModule")
-set(install_destination ${CMAKE_BINARY_DIR}/bin/plugins)
-if (ENABLE_GCOV)
- set(GCOV_FLAGS "-ftest-coverage -fprofile-arcs")
-else()
- set(GCOV_FLAGS "")
-endif()
-
-if (CMAKE_BUILD_TYPE)
- if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
- set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
- set(CMAKE_CXX_FLAGS_DEBUG "")
- else ()
- set(CMAKE_CXX_FLAGS_RELEASE "")
- set(CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG")
- endif()
-endif()
-
-include_directories (
- ${COMPONENTS_DIR}/include/
- ${COMPONENTS_DIR}/application_manager/include
- ${COMPONENTS_DIR}/remote_control/include/
- ${COMPONENTS_DIR}/connection_handler/include/
- ${COMPONENTS_DIR}/protocol_handler/include/
- ${COMPONENTS_DIR}/functional_module/include/
- ${COMPONENTS_DIR}/config_profile/include/
-
- ${COMPONENTS_DIR}/hmi_message_handler/include/
- ${COMPONENTS_DIR}/formatters/include/
- ${POLICY_PATH}/include/
- ${POLICY_GLOBAL_INCLUDE_PATH}/
- ${COMPONENTS_DIR}/rpc_base/include/
- ${COMPONENTS_DIR}/application_manager/test/include/
-
- ${COMPONENTS_DIR}/smart_objects/include/
- ${COMPONENTS_DIR}/utils/include/
- ${JSONCPP_INCLUDE_DIRECTORY}
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${CMAKE_BINARY_DIR}/src/components/
-)
-
-set (RC_SOURCE_DIR ${COMPONENTS_DIR}/remote_control/src)
-set (RC_TEST_DIR ${COMPONENTS_DIR}/remote_control/test)
-set (RC_COMMANDS_DIR ${RC_SOURCE_DIR}/commands)
-
-collect_sources(RC_SOURCES "${RC_SOURCE_DIR}")
-collect_sources(RC_COMMANDS_SOURCES "${RC_COMMANDS_DIR}")
-
-set (SOURCES
- ${RC_SOURCES}
- ${RC_COMMANDS_SOURCES}
-)
-
-set (LIBRARIES
- jsoncpp
- FunctionalModule
- Utils
- ConfigProfile
-)
-
-add_library(${target} SHARED ${SOURCES})
-target_link_libraries(${target} ${LIBRARIES} )
-
-if(ENABLE_LOG)
- target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
-endif()
-
-
-install(TARGETS ${target}
- DESTINATION ${install_destination}
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
-)
-
-install(
- FILES ${FILES_FOR_COPY}
- DESTINATION ${install_destination}
-)
-
-if(BUILD_TESTS)
- add_subdirectory(test)
-endif()
diff --git a/src/components/remote_control/include/remote_control/commands/base_command_notification.h b/src/components/remote_control/include/remote_control/commands/base_command_notification.h
deleted file mode 100644
index 578afad67b..0000000000
--- a/src/components/remote_control/include/remote_control/commands/base_command_notification.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_
-
-#include "remote_control/commands/command.h"
-#include "application_manager/message.h"
-#include "application_manager/service.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_plugin_interface.h"
-#include "utils/logger.h"
-
-namespace Json {
-class Value;
-}
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief Base command class for notifications
- */
-class BaseCommandNotification : public Command {
- public:
- /**
- * @brief BaseCommandNotification class constructor
- *
- * @param message Message from mobile
- **/
- BaseCommandNotification(const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief BaseCommandNotification class destructor
- */
- virtual ~BaseCommandNotification();
-
- /**
- * \brief BaseCommandNotification on timeout reaction
- */
- virtual void OnTimeout() {}
-
- void Run();
-
- protected:
- application_manager::MessagePtr message() {
- return message_;
- }
- application_manager::ServicePtr service_;
-
- RCAppExtensionPtr GetAppExtension(
- application_manager::ApplicationSharedPtr app) const;
-
- /**
- * @brief executes specific logic of children classes
- */
- virtual void Execute() = 0;
-
- /**
- * @brief Validates notification by xml schema
- */
- virtual bool Validate();
-
- virtual std::string ModuleType(const Json::Value& message);
- virtual std::vector<std::string> ControlData(const Json::Value& message);
-
- void NotifyOneApplication(application_manager::MessagePtr message);
-
- private:
- void NotifyApplications();
- bool CheckPolicy(application_manager::MessagePtr message);
- application_manager::MessagePtr message_;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_
diff --git a/src/components/remote_control/include/remote_control/commands/base_command_request.h b/src/components/remote_control/include/remote_control/commands/base_command_request.h
deleted file mode 100644
index 64128b971e..0000000000
--- a/src/components/remote_control/include/remote_control/commands/base_command_request.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_
-
-#include "remote_control/commands/command.h"
-#include "remote_control/event_engine/event_observer.h"
-#include "application_manager/message.h"
-#include "application_manager/service.h"
-#include "utils/logger.h"
-#include "interfaces/HMI_API.h"
-#include "remote_control/rc_app_extension.h"
-#include "json/json.h"
-#include "remote_control/remote_plugin_interface.h"
-
-namespace remote_control {
-
-namespace commands {
-
-// Forward declaration to make this struct friend to BaseCommandRequest
-struct OnDriverAnswerCallback;
-
-/**
- * @brief Base command class for requests
- */
-class BaseCommandRequest
- : public Command,
- public rc_event_engine::EventObserver<application_manager::MessagePtr,
- std::string> {
- public:
- /**
- * @brief BaseCommandRequest class constructor
- *
- * @param message Message from mobile
- **/
- BaseCommandRequest(const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief BaseCommandRequest class destructor
- */
- virtual ~BaseCommandRequest();
-
- /**
- * @brief BaseCommandRequest on timeout reaction
- */
- virtual void OnTimeout();
-
- void Run();
- void on_event(const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event);
-
- /**
- * @brief Generates correct request to HMI
- * @param function_id request ID
- * @param msg_params json with message params
- * @return generated request shared ptr
- */
- application_manager::MessagePtr CreateHmiRequest(
- const char* function_id, const Json::Value& message_params);
-
- /**
- * @brief Prepares response for sending to mobile
- * Adds necessary fields to message
- * @param success true if successful; false, if failed
- * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA",
- * e.t.c)
- * @param info Provides additional human readable info regarding the
- *result(may be empty)
- */
- void PrepareResponse(const bool success,
- const char* result_code,
- const std::string& info);
-
- protected:
- application_manager::MessagePtr message_;
- Json::Value response_params_;
-
- /**
- * @brief AcquireResource try to allocate resource for application
- * In case if allocation of resource is not required, return ALLOWED by
- * default.
- * This method should be overrided in RPCs that requires resource allocation
- * @return result of resource allocation, in case if allocation os not
- * required, return ALLOWED
- */
- virtual AcquireResult::eType AcquireResource(const Json::Value&) {
- return AcquireResult::ALLOWED;
- }
-
- /**
- * @brief IsResourceFree check resource state
- * This is default implementation which has to be redefined for RPCs which
- * need to manage the resources
- * @param module_type Resource name
- * @return True if free, otherwise - false
- */
- virtual bool IsResourceFree(const std::string& module_type) const {
- UNUSED(module_type);
- return true;
- }
-
- /**
- * @brief SetResourceState changes state of resource
- * This is default implementation which has to be redefined for RPCs which
- * need to manage the resources
- * @param Message containing type of module to extract
- * @param State to set for resource
- */
- virtual void SetResourceState(const Json::Value&,
- const ResourceState::eType) {}
-
- /**
- * @brief Get extension for specified application. If extension doesn't exist,
- * it will be created
- * @param app pointer to application
- * @return pointer to extension
- */
- RCAppExtensionPtr GetAppExtension(
- application_manager::ApplicationSharedPtr app) const;
-
- /**
- * @brief Converts HMI result code to string with mobile result code
- *
- * @param hmi_code HMI result code
- * @return String with mobile result code
- */
- const char* GetMobileResultCode(
- const hmi_apis::Common_Result::eType& hmi_code) const;
-
- /**
- * @brief Sends Mobile response
- * @param success true if successful; false, if failed
- * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA",
- *e.t.c)
- * @param info Provides additional human readable info regarding the
- *result(may be empty)
- */
- void SendResponse(const bool success,
- const char* result_code,
- const std::string& info);
-
- /**
- * @brief Parse result code from response
- *
- * @param message Response from HMI or Can
- * @param result_code Outgoing param with mobile result code in string
- *("SUCCESS", "INVALID_DATA", e.t.c)
- * @param info Outgoing param with additional human readable info regarding
- *the result(may be empty)
- * @return true if it is success response? otherwise false
- */
- bool ParseResultCode(const Json::Value& value,
- std::string& result_code,
- std::string& info);
-
- /**
- * @brief Sends request to HMI
- * @param message_to_send to send
- */
- void SendMessageToHMI(const application_manager::MessagePtr& message_to_send);
-
- /**
- * @brief Sends request to CAN or HMI
- * @param function_id request ID
- * @param msg_params json with message params
- */
- void SendRequest(const char* function_id, const Json::Value& message_params);
-
- application_manager::ApplicationSharedPtr app() {
- DCHECK(app_);
- return app_;
- }
-
- /**
- * @brief executes specific logic of children classes
- */
- void virtual Execute() = 0;
-
- /**
- * @brief Validates request by xml schema
- */
- bool Validate();
-
- /*
- * @brief Parses incoming string into Json
- * @param parsed_mgs Resulting json object (must be valid pointer)
- * @returns True if json string was valid false otherwise.
- */
- virtual bool ParseJsonString(Json::Value* parsed_msg);
-
- /**
- * @brief Interface method that is called whenever new event received
- * @param event The received event
- */
- void virtual OnEvent(
- const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event) = 0;
-
- virtual std::string ModuleType(const Json::Value& message);
- virtual std::vector<std::string> ControlData(const Json::Value& message);
- virtual application_manager::TypeAccess CheckModule(
- const Json::Value& message);
-
- bool auto_allowed() const {
- return auto_allowed_;
- }
-
- void set_auto_allowed(bool value) {
- auto_allowed_ = value;
- }
-
- application_manager::ServicePtr service() {
- return service_;
- }
-
- void set_disallowed_info(const std::string& info) {
- disallowed_info_ = info;
- }
-
- private:
- /**
- * @brief CheckPolicyPermissions checks RPC permissions defined in policy
- * table
- * @return True if RPC is allowed, otherwise - false
- */
- bool CheckPolicyPermissions();
-
- /**
- * @brief CheckDriverConsent checks driver consent defined in policy table
- * @return True if no consent is required, otherwise - false
- */
- bool CheckDriverConsent();
-
- /**
- * @brief AcquireResources checks whether resource status is busy or not and
- * then tries to acquire this resource. In case driver consent is required -
- * sends consent request to HMI.
- * @return True in case of resource is free and successfully acquired,
- * otherwise false
- */
- bool AcquireResources();
- inline bool IsAutoAllowed(application_manager::TypeAccess access) const;
- void SendDisallowed(application_manager::TypeAccess access);
- void SendGetUserConsent(const Json::Value& value);
- void ProcessAccessResponse(
- const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event);
-
- const Json::Value msg_json_;
- application_manager::ApplicationSharedPtr app_;
- application_manager::ServicePtr service_;
- bool auto_allowed_;
- std::string disallowed_info_;
-
- friend struct OnDriverAnswerCallback;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_
diff --git a/src/components/remote_control/include/remote_control/commands/button_press_request.h b/src/components/remote_control/include/remote_control/commands/button_press_request.h
deleted file mode 100644
index 945f98bdc8..0000000000
--- a/src/components/remote_control/include/remote_control/commands/button_press_request.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_
-
-#include "remote_control/commands/base_command_request.h"
-#include "remote_control/event_engine/event.h"
-#include "utils/macro.h"
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief ButtonPressRequest command class
- */
-class ButtonPressRequest : public BaseCommandRequest {
- public:
- /**
- * @brief ButtonPressRequest class constructor
- *
- * @param message Message from mobile
- **/
- ButtonPressRequest(const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
- /**
- * @brief Execute command
- */
- void Execute() FINAL;
-
- /**
- * @brief AcquireResource Tries to acquire specific resource
- * @param message Incoming message containg the resource name
- * @return Acquire result
- */
- AcquireResult::eType AcquireResource(
- const Json::Value& message) OVERRIDE FINAL;
-
- /**
- * @brief IsResourceFree check resource state
- * @param module_type Resource name
- * @return True if free, otherwise - false
- */
- bool IsResourceFree(const std::string& module_type) const FINAL;
-
- /**
- * @brief SetResourceState changes state of resource
- * @param state State to set for resource
- */
- void SetResourceState(const Json::Value& message,
- const ResourceState::eType state) FINAL;
-
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event);
-
- /**
- * @brief ButtonPressRequest class destructor
- */
- virtual ~ButtonPressRequest();
-
- protected:
- std::string ModuleType(const Json::Value& message) FINAL;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_
diff --git a/src/components/remote_control/include/remote_control/commands/command.h b/src/components/remote_control/include/remote_control/commands/command.h
deleted file mode 100644
index 0e03f8b330..0000000000
--- a/src/components/remote_control/include/remote_control/commands/command.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_
-
-#include "utils/shared_ptr.h"
-#include "remote_control/remote_plugin_interface.h"
-#include "remote_control/event_engine/event.h"
-
-namespace remote_control {
-
-class RemotePluginInterface;
-
-namespace commands {
-
-/**
- * @brief Command interface
- **/
-class Command {
- public:
- /**
- * @brief Execute command
- */
- virtual void Run() = 0;
-
- /**
- * \brief Command class destructor
- */
- virtual ~Command() {}
-
- /**
- * \brief Command on timeout reaction
- */
- virtual void OnTimeout() = 0;
-
- /**
- * @brief Interface method that is called whenever new event received
- * @param event The received event
- */
- virtual void on_event(
- const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event) {}
-
- protected:
- Command(RemotePluginInterface& rc_module) : rc_module_(rc_module) {}
-
- RemotePluginInterface& rc_module_;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_
diff --git a/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h
deleted file mode 100644
index 220f7da979..0000000000
--- a/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
-
-#include "remote_control/commands/base_command_request.h"
-#include "remote_control/event_engine/event.h"
-#include "utils/macro.h"
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief GetInteriorVehicleDataRequest command class
- */
-class GetInteriorVehicleDataRequest : public BaseCommandRequest {
- public:
- /**
- * @brief GetInteriorVehicleDataRequest class constructor
- *
- * @param message Message from mobile
- **/
- explicit GetInteriorVehicleDataRequest(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief Execute command
- */
- void Execute() FINAL;
-
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event);
-
- /**
- * @brief Check if app wants to proceed with already setup subscription
- * @param request_params request parameters to check
- * @return true if app already subscribed(unsubsribed) for module type but
- * wants to subscribe(unsubscribe) for the same module again
- * otherwise - false
- */
- bool HasRequestExcessiveSubscription(const Json::Value& request_params);
-
- protected:
- virtual std::string ModuleType(const Json::Value& message);
-
- private:
- /**
- * @brief Handle subscription to vehicle data
- * @param hmi_response json message with response from HMI
- */
- void ProccessSubscription(const Json::Value& hmi_response);
-
- /**
- * @brief Cuts off subscribe parameter
- * @param request_params request parameters to handle
- */
- void RemoveExcessiveSubscription(Json::Value& request_params);
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h b/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h
deleted file mode 100644
index 4ee9ce4709..0000000000
--- a/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
-
-#include "utils/macro.h"
-#include "remote_control/commands/base_command_notification.h"
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief OnInteriorVehicleDataNotification command class
- */
-class OnInteriorVehicleDataNotification : public BaseCommandNotification {
- public:
- /**
- * @brief OnInteriorVehicleDataNotification class constructor
- *
- * @param message Message with notification
- **/
- OnInteriorVehicleDataNotification(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief Execute command
- */
- void Execute() FINAL;
-
- /**
- * @brief OnInteriorVehicleDataNotification class destructor
- */
- virtual ~OnInteriorVehicleDataNotification();
-
- protected:
- std::string ModuleType(const Json::Value& message) FINAL;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
diff --git a/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h b/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h
deleted file mode 100644
index ef248a2b38..0000000000
--- a/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
-
-#include "utils/macro.h"
-#include "remote_control/commands/base_command_notification.h"
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief OnRemoteControlSettingsNotification command class
- */
-class OnRemoteControlSettingsNotification : public BaseCommandNotification {
- public:
- /**
- * @brief OnRemoteControlSettingsNotification class constructor
- *
- * @param message Message with notification
- * @param rc_module Module used for handling RC functionality
- **/
- OnRemoteControlSettingsNotification(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief Execute command
- */
- void Execute() FINAL;
-
- private:
- /**
- * @brief Disalows RC functionality for all RC apps
- * All registered apps with appHMIType REMOTE_CONTROL will be put to NONE hmi
- * level
- * OnHMIStatus (NONE) will be send to such apps
- * All registered apps will be unsubsribed from OnInteriorVehicleData
- * notifications
- */
- void DisallowRCFunctionality();
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
diff --git a/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h
deleted file mode 100644
index bc1e3942e5..0000000000
--- a/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
-
-#include "remote_control/commands/base_command_request.h"
-#include "remote_control/event_engine/event.h"
-#include "utils/macro.h"
-
-namespace remote_control {
-
-namespace commands {
-
-/**
- * @brief SetInteriorVehicleDataRequest command class
- */
-class SetInteriorVehicleDataRequest : public BaseCommandRequest {
- public:
- /**
- * @brief SetInteriorVehicleDataRequest class constructor
- *
- * @param message Message from mobile
- * @param rc_module Module used for handling RC functionality
- **/
- SetInteriorVehicleDataRequest(const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module);
-
- /**
- * @brief Execute command
- */
- void Execute() FINAL;
-
- /**
- * @brief AcquireResource proxy AcquireResource to Resource allocation manager
- * @param message message of requires contatin module types
- * @return result of acauiring resources
- */
- AcquireResult::eType AcquireResource(
- const Json::Value& message) OVERRIDE FINAL;
-
- /**
- * @brief IsResourceFree check resource state
- * @param module_type Resource name
- * @return True if free, otherwise - false
- */
- bool IsResourceFree(const std::string& module_type) const FINAL;
-
- /**
- * @brief SetResourceState changes state of resource
- * @param state State to set for resource
- */
- void SetResourceState(const Json::Value& message,
- const ResourceState::eType state) FINAL;
-
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr,
- std::string>& event) OVERRIDE;
- /**
- * @brief Method that check if READ_ONLY parameters present
- * @param request_params params from received message
- * @return true if present , false - otherwise
- */
- bool AreReadOnlyParamsPresent(const Json::Value& request_params);
-
- /**
- * @brief Method that check if all request parameters are READ_ONLY
- * @param request_params params from received message
- * @return true if all are read only , false - otherwise
- */
- bool AreAllParamsReadOnly(const Json::Value& request_params);
-
- /**
- * @brief Method that cuts-off READ_ONLY parameters
- * @param request_params params to handle
- */
- void CutOffReadOnlyParams(Json::Value& request_params);
-
- /**
- * @brief SetInteriorVehicleDataRequest class destructor
- */
- virtual ~SetInteriorVehicleDataRequest();
-
- protected:
- virtual std::string ModuleType(const Json::Value& message) FINAL;
- virtual std::vector<std::string> ControlData(
- const Json::Value& message) FINAL;
-};
-
-} // namespace commands
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/remote_control/include/remote_control/event_engine/event.h b/src/components/remote_control/include/remote_control/event_engine/event.h
deleted file mode 100644
index 0da248e5a7..0000000000
--- a/src/components/remote_control/include/remote_control/event_engine/event.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_
-
-#include <string>
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "utils/shared_ptr.h"
-#include "application_manager/message.h"
-
-namespace rc_event_engine {
-
-template <typename EventMessage, typename EventID>
-class EventDispatcher;
-
-template <typename EventMessage, typename EventID>
-class Event {
- public:
- /*
- * @brief Constructor with parameters
- *
- * @param id Event ID.
- * @param message Message received in event
- */
- Event(EventMessage& message, const EventID& id);
-
- /*
- * @brief Destructor
- */
- virtual ~Event() {}
-
- /*
- * @brief Provides event ID
- */
- inline const EventID& id() const;
-
- /*
- * @brief Sets event message
- *
- * @param message The message received in event
- */
- void set_event_message(EventMessage& message);
-
- /*
- * @brief Retrieves event message
- *
- * @return The message received in event
- */
- inline const EventMessage& event_message() const;
-
- /*
- * @brief Retrieves event message request ID
- */
- virtual int32_t event_message_function_id() const = 0;
-
- /*
- * @brief Retrieves event message correlation ID
- */
- virtual int32_t event_message_correlation_id() const = 0;
-
- /*
- * @brief Retrieves event message response type
- */
- virtual int32_t event_message_type() const = 0;
-
- void raise(EventDispatcher<EventMessage, EventID>& event_dispatcher);
-
- protected:
- EventMessage event_message_;
-
- private:
- EventID id_;
-};
-
-template <typename EventMessage, typename EventID>
-const EventID& Event<EventMessage, EventID>::id() const {
- return id_;
-}
-
-template <typename EventMessage, typename EventID>
-const EventMessage& Event<EventMessage, EventID>::event_message() const {
- return event_message_;
-}
-
-template <typename EventMessage, typename EventID>
-Event<EventMessage, EventID>::Event(EventMessage& message, const EventID& id)
- : event_message_(message), id_(id) {}
-
-template <typename EventMessage, typename EventID>
-void Event<EventMessage, EventID>::raise(
- EventDispatcher<EventMessage, EventID>& event_dispatcher) {
- event_dispatcher.raise_event(*this);
-}
-
-} // namespace event_engine
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_
diff --git a/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h b/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h
deleted file mode 100644
index ddee6caccc..0000000000
--- a/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_
-
-#include <list>
-#include <map>
-
-#include "utils/lock.h"
-
-#include "remote_control/event_engine/event.h"
-#include "remote_control/event_engine/event_observer.h"
-
-#include "interfaces/HMI_API.h"
-
-namespace rc_event_engine {
-
-template <typename EventMessage, typename EventID>
-class Event;
-
-template <typename EventMessage, typename EventID>
-class EventObserver;
-
-template <typename EventMessage, typename EventID>
-class EventDispatcher {
- public:
- /**
- * @brief Default constructor
- */
- EventDispatcher();
-
- /**
- * @brief Destructor
- */
- virtual ~EventDispatcher();
-
- /*
- * @brief Delivers the event to all subscribers
- *
- * @param event Received event
- */
- void raise_event(const Event<EventMessage, EventID>& event);
-
- /*
- * @brief Subscribe the observer to event
- *
- * @param event_id The event ID to subscribe for
- * @param hmi_correlation_id The event HMI correlation ID
- * @param observer The observer to subscribe for event
- */
- void add_observer(const EventID& event_id,
- int32_t hmi_correlation_id,
- EventObserver<EventMessage, EventID>* const observer);
-
- /*
- * @brief Unsubscribes the observer from specific event
- *
- * @param event_id The event ID to unsubscribe from
- * @param observer The observer to be unsubscribed
- */
- void remove_observer(
- const EventID& event_id,
- const EventObserver<EventMessage, EventID>* const observer);
-
- /*
- * @brief Unsubscribes the observer from all events
- *
- * @param observer The observer to be unsubscribed
- */
- void remove_observer(
- const EventObserver<EventMessage, EventID>* const observer);
-
- protected:
- private:
- DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
-
- // Data types section
- typedef std::list<EventObserver<EventMessage, EventID>*> ObserverList;
- typedef std::map<int32_t, ObserverList> ObserversMap;
- typedef std::map<EventID, ObserversMap> EventObserverMap;
-
- // Members section
- sync_primitives::Lock state_lock_;
- EventObserverMap observers_;
-};
-
-template <typename EventMessage, typename EventID>
-EventDispatcher<EventMessage, EventID>::EventDispatcher()
- : observers_() {}
-
-template <typename EventMessage, typename EventID>
-EventDispatcher<EventMessage, EventID>::~EventDispatcher() {}
-
-template <typename EventMessage, typename EventID>
-void EventDispatcher<EventMessage, EventID>::raise_event(
- const Event<EventMessage, EventID>& event) {
- // create local list
- ObserverList list;
- {
- sync_primitives::AutoLock auto_lock(state_lock_);
- // check if event is notification
- if (hmi_apis::messageType::notification == event.event_message_type()) {
- // ObserversMap iterator
- typename ObserversMap::iterator it = observers_[event.id()].begin();
- for (; observers_[event.id()].end() != it; ++it) {
- list = it->second;
- }
- }
-
- if ((hmi_apis::messageType::response == event.event_message_type()) ||
- (hmi_apis::messageType::error_response == event.event_message_type())) {
- list = observers_[event.id()][event.event_message_correlation_id()];
- }
- }
-
- // Call observers
- typename ObserverList::iterator observers = list.begin();
- for (; list.end() != observers; ++observers) {
- (*observers)->on_event(event);
- }
-}
-
-template <typename EventMessage, typename EventID>
-void EventDispatcher<EventMessage, EventID>::add_observer(
- const EventID& event_id,
- int32_t hmi_correlation_id,
- EventObserver<EventMessage, EventID>* const observer) {
- sync_primitives::AutoLock auto_lock(state_lock_);
- observers_[event_id][hmi_correlation_id].push_back(observer);
-}
-
-template <typename EventMessage, typename EventID>
-void EventDispatcher<EventMessage, EventID>::remove_observer(
- const EventID& event_id,
- const EventObserver<EventMessage, EventID>* const observer) {
- sync_primitives::AutoLock auto_lock(state_lock_);
- typename ObserversMap::iterator it = observers_[event_id].begin();
- for (; observers_[event_id].end() != it; ++it) {
- // ObserverList iterator
- typename ObserverList::iterator observer_it = it->second.begin();
- while (it->second.end() != observer_it) {
- if (observer->id() == (*observer_it)->id()) {
- observer_it = it->second.erase(observer_it);
- } else {
- ++observer_it;
- }
- }
- }
-}
-
-template <typename EventMessage, typename EventID>
-void EventDispatcher<EventMessage, EventID>::remove_observer(
- const EventObserver<EventMessage, EventID>* const observer) {
- sync_primitives::AutoLock auto_lock(state_lock_);
- typename EventObserverMap::iterator event_map = observers_.begin();
- for (; observers_.end() != event_map; ++event_map) {
- typename ObserversMap::iterator it = event_map->second.begin();
- for (; event_map->second.end() != it; ++it) {
- // ObserverList iterator
- typename ObserverList::iterator observer_it = it->second.begin();
- while (it->second.end() != observer_it) {
- if (observer->id() == (*observer_it)->id()) {
- observer_it = it->second.erase(observer_it);
- } else {
- ++observer_it;
- }
- }
- }
- }
-}
-}
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_
diff --git a/src/components/remote_control/include/remote_control/event_engine/event_observer.h b/src/components/remote_control/include/remote_control/event_engine/event_observer.h
deleted file mode 100644
index 66a38da88b..0000000000
--- a/src/components/remote_control/include/remote_control/event_engine/event_observer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_
-
-#include <string>
-#include "remote_control/event_engine/event.h"
-
-namespace rc_event_engine {
-
-template <typename EventMessage, typename EventID>
-class Event;
-
-template <typename EventMessage, typename EventID>
-class EventObserver {
- public:
- // Typedef for possible Observer ID's from mobile_apis functionID enum
- typedef unsigned long ObserverID;
-
- /*
- * @brief Constructor
- *
- */
- EventObserver();
-
- /*
- * @brief Destructor
- */
- virtual ~EventObserver();
-
- /**
- * @brief Retrieves observer unique id
- *
- * @return Unique Observer id
- */
- const ObserverID& id() const {
- return id_;
- }
-
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- virtual void on_event(const Event<EventMessage, EventID>& event) = 0;
-
- private:
- ObserverID id_;
-
- DISALLOW_COPY_AND_ASSIGN(EventObserver);
-};
-
-template <typename EventMessage, typename EventID>
-EventObserver<EventMessage, EventID>::EventObserver()
- : id_(0) {
- // Get unique id based on this
- id_ = reinterpret_cast<unsigned long>(this);
-}
-
-template <typename EventMessage, typename EventID>
-EventObserver<EventMessage, EventID>::~EventObserver() {
- // unsubscribe_from_all_events();
-}
-}
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_
diff --git a/src/components/remote_control/include/remote_control/message_helper.h b/src/components/remote_control/include/remote_control/message_helper.h
deleted file mode 100644
index 6358459da7..0000000000
--- a/src/components/remote_control/include/remote_control/message_helper.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_
-
-#include <stdint.h>
-#include <string>
-#include <map>
-
-#include "utils/macro.h"
-#include "json/json.h"
-#include "interfaces/HMI_API.h"
-#include "functional_module/function_ids.h"
-#include "remote_control/remote_plugin_interface.h"
-#include "application_manager/message.h"
-
-namespace remote_control {
-
-/**
- * @brief MessageHelper class
- **/
-class MessageHelper {
- public:
- static const std::string GetMobileAPIName(
- functional_modules::RCFunctionID func_id);
-
- /**
- * @brief Convert Json::Value to std::string
- *
- * @param value Value with json
- *
- * @return string with json
- */
- static std::string ValueToString(const Json::Value& value);
-
- /**
- * @brief Convert std::string to Json::Value
- *
- * @param string string with json
- *
- * @return Value created from string with json
- */
- static Json::Value StringToValue(const std::string& string);
-
- /**
- * Creates hmi request
- * @param function_id - API function we create request for
- * @param message_params - params in request
- * @param rc_module - used module for requests handling
- * @param hmi_app_id - app is used between SDL & HMI
- * @return creted request - reqdy to be sent to hmi
- */
- static application_manager::MessagePtr CreateHmiRequest(
- const char* function_id,
- const uint32_t hmi_app_id,
- const Json::Value& message_params,
- RemotePluginInterface& rc_module);
-
- /** @brief Converts string to hmi AccessMode enum value
- * @param access_mode stringified value
- * @return hmi AccessMode enum value if succedeed, otherwise - INVALID_ENUM
- * value
- */
- static hmi_apis::Common_RCAccessMode::eType AccessModeFromString(
- const std::string& access_mode);
-
- /**
- * @brief AccessModeToString converts enum values to string
- * @param access_mode Access mode enum value
- * @return Appropriate string value
- */
- static std::string AccessModeToString(
- const hmi_apis::Common_RCAccessMode::eType access_mode);
-
- private:
- MessageHelper();
-
- static const std::map<functional_modules::RCFunctionID, std::string>
- kMobileAPINames;
- DISALLOW_COPY_AND_ASSIGN(MessageHelper);
-};
-
-/** @brief Check for existence of specified key in Json::Value
- * @param value Value with json
- * @param key string with key name
- * @return true if key exist
- */
-bool IsMember(const Json::Value& value, const std::string& key);
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_
diff --git a/src/components/remote_control/include/remote_control/module_helper.h b/src/components/remote_control/include/remote_control/module_helper.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/src/components/remote_control/include/remote_control/module_helper.h
+++ /dev/null
diff --git a/src/components/remote_control/include/remote_control/rc_app_extension.h b/src/components/remote_control/include/remote_control/rc_app_extension.h
deleted file mode 100644
index 485514faba..0000000000
--- a/src/components/remote_control/include/remote_control/rc_app_extension.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
-
-#include <string>
-#include <set>
-#include "application_manager/service.h"
-#include "application_manager/app_extension.h"
-#include "remote_control/remote_control_plugin.h"
-#include "json/json.h"
-
-namespace remote_control {
-
-class RCAppExtension : public application_manager::AppExtension {
- public:
- explicit RCAppExtension(application_manager::AppExtensionUID uid);
- ~RCAppExtension();
-
- /**
- * @brief Subscribe to OnInteriorVehicleDataNotification
- * @param module interior data specification(zone, data type)
- */
- void SubscribeToInteriorVehicleData(const Json::Value& module_type);
-
- /**
- * @brief Unsubscribe from OnInteriorVehicleDataNotification
- * @param module interior data specification(zone, data type)
- */
- void UnsubscribeFromInteriorVehicleData(const Json::Value& module_type);
-
- /**
- * @brief UnsubscribeFromInteriorVehicleData removes all subscriptions for
- * interior data
- */
- void UnsubscribeFromInteriorVehicleData();
-
- /**
- * @brief Check if application subscribed to OnInteriorVehicleDataNotification
- * @param module interior data specification(zone, data type)
- */
- bool IsSubscibedToInteriorVehicleData(const Json::Value& module_type);
-
- private:
- std::set<Json::Value> subscribed_interior_vehicle_data_;
-};
-
-typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr;
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
diff --git a/src/components/remote_control/include/remote_control/rc_command_factory.h b/src/components/remote_control/include/remote_control/rc_command_factory.h
deleted file mode 100644
index 9463c4b1ef..0000000000
--- a/src/components/remote_control/include/remote_control/rc_command_factory.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_
-
-#include "utils/shared_ptr.h"
-#include "remote_control/commands/command.h"
-#include "remote_control/remote_control_plugin.h"
-#include "application_manager/message.h"
-#include "utils/macro.h"
-
-namespace remote_control {
-
-/**
- * @brief Factory class for command creation
- **/
-class RCCommandFactory {
- public:
- /**
- * @brief Create command object and return pointer to it
- *
- * @param message Message shared pointer.
- * @return Pointer to created command object.
- **/
- static utils::SharedPtr<commands::Command> CreateCommand(
- const application_manager::MessagePtr& msg,
- RemotePluginInterface& rc_module);
-
- private:
- RCCommandFactory();
- DISALLOW_COPY_AND_ASSIGN(RCCommandFactory);
-};
-
-} // namespace can_cooperaion
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_
diff --git a/src/components/remote_control/include/remote_control/rc_module_constants.h b/src/components/remote_control/include/remote_control/rc_module_constants.h
deleted file mode 100644
index 021e3cd6f0..0000000000
--- a/src/components/remote_control/include/remote_control/rc_module_constants.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
-
-namespace remote_control {
-
-namespace strings {
-// RemoteControlCapabilities constants
-const char kclimateControlCapabilities[] = "climateControlCapabilities";
-const char kradioControlCapabilities[] = "radioControlCapabilities";
-const char kbuttonCapabilities[] = "buttonCapabilities";
-// RemoteControlCapabilities constants
-
-const char kRadioControlData[] = "radioControlData";
-const char kClimateControlData[] = "climateControlData";
-} // strings
-
-namespace result_codes {
-const char kSuccess[] = "SUCCESS";
-const char kUnsupportedRequest[] = "UNSUPPORTED_REQUEST";
-const char kUnsupportedResource[] = "UNSUPPORTED_RESOURCE";
-const char kDisallowed[] = "DISALLOWED";
-const char kRejected[] = "REJECTED";
-const char kAborted[] = "ABORTED";
-const char kIgnored[] = "IGNORED";
-const char kRetry[] = "RETRY";
-const char kInUse[] = "IN_USE";
-const char kVehicleDataNotAvailable[] = "VEHICLE_DATA_NOT_AVAILABLE";
-const char kTimedOut[] = "TIMED_OUT";
-const char kInvalidData[] = "INVALID_DATA";
-const char kCharLimitExceeded[] = "CHAR_LIMIT_EXCEEDED";
-const char kInvalidId[] = "INVALID_ID";
-const char kDuplicateName[] = "DUPLICATE_NAME";
-const char kApplicationNotRegistered[] = "APPLICATION_NOT_REGISTERED";
-const char kOutOfMemory[] = "OUT_OF_MEMORY";
-const char kTooManyPendingRequests[] = "TOO_MANY_PENDING_REQUESTS";
-const char kWarnings[] = "WARNINGS";
-const char kWrongLanguage[] = "WRONG_LANGUAGE";
-const char kGenericError[] = "GENERIC_ERROR";
-const char kUserDisallowed[] = "USER_DISALLOWED";
-const char kReadOnly[] = "READ_ONLY";
-} // result_codes
-
-namespace json_keys {
-const char kParams[] = "params";
-const char kSuccess[] = "success";
-const char kResultCode[] = "resultCode";
-const char kResult[] = "result";
-const char kInfo[] = "info";
-const char kId[] = "id";
-const char kJsonrpc[] = "jsonrpc";
-const char kMethod[] = "method";
-const char kError[] = "error";
-const char kMessage[] = "message";
-const char kData[] = "data";
-const char kAppId[] = "appID";
-const char kCode[] = "code";
-} // json_keys
-
-namespace message_params {
-const char kName[] = "name";
-
-// SetInteriorVehicleData request
-const char kModuleData[] = "moduleData";
-// SetInteriorVehicleData request
-
-// GetInteriorVehicleData request
-const char kSubscribe[] = "subscribe";
-// GetInteriorVehicleData request
-
-// GetInteriorVehicleData response
-const char kIsSubscribed[] = "isSubscribed";
-// GetInteriorVehicleData response
-
-// OnRemoteControlSettings notification
-const char kAccessMode[] = "accessMode";
-const char kAllowed[] = "allowed";
-// OnRemoteControlSettings notification
-
-// ButtonPress request
-const char kModuleType[] = "moduleType";
-const char kButtonName[] = "buttonName";
-const char kButtonPressMode[] = "buttonPressMode";
-// ButtonPress request
-
-// RdsData struct
-const char kPS[] = "PS";
-const char kRT[] = "RT";
-const char kCT[] = "CT";
-const char kPI[] = "PI";
-const char kPTY[] = "PTY";
-const char kTA[] = "TA";
-const char kTP[] = "TP";
-const char kREG[] = "REG";
-// RdsData struct
-
-// RadioControlData struct
-const char kFrequencyInteger[] = "frequencyInteger";
-const char kFrequencyFraction[] = "frequencyFraction";
-const char kBand[] = "band";
-const char kRdsData[] = "rdsData";
-const char kAvailableHDs[] = "availableHDs";
-const char kHdChannel[] = "hdChannel";
-const char kSignalStrength[] = "signalStrength";
-const char kSignalChangeThreshold[] = "signalChangeThreshold";
-const char kRadioEnable[] = "radioEnable";
-const char kState[] = "state";
-// RadioControlData struct
-
-// ClimateControlData struct
-const char kFanSpeed[] = "fanSpeed";
-const char kCurrentTemperature[] = "currentTemperature";
-const char kDesiredTemperature[] = "desiredTemperature";
-const char kTemperatureUnit[] = "temperatureUnit";
-const char kACEnable[] = "acEnable";
-const char kCirculateAirEnable[] = "circulateAirEnable";
-const char kAutoModeEnable[] = "autoModeEnable";
-const char kDefrostZone[] = "defrostZone";
-const char kDualModeEnable[] = "dualModeEnable";
-const char kACMaxEnable[] = "acMaxEnable";
-const char kVentilationMode[] = "ventilationMode";
-// ClimateControlData struct
-
-// ModuleData struct
-const char kRadioControlData[] = "radioControlData";
-const char kClimateControlData[] = "climateControlData";
-// ModuleData struct
-
-const char kHMIAppID[] = "appID";
-const char kHmiLevel[] = "hmiLevel";
-const char kSysContext[] = "systemContext";
-const char kAudioState[] = "audioStreamingState";
-} // namespace message_params
-
-namespace enums_value {
-
-// ModuleType enum
-const char kClimate[] = "CLIMATE";
-const char kRadio[] = "RADIO";
-// ModuleType enum
-
-// RadioBand enum
-const char kAM[] = "AM";
-const char kFM[] = "FM";
-const char kXM[] = "XM";
-// RadioBand enum
-
-// RadioState enum
-const char kAcquiring[] = "ACQUIRING";
-const char kAcquired[] = "ACQUIRED";
-const char kMulticast[] = "MULTICAST";
-const char kNotFound[] = "NOT_FOUND";
-// RadioState enum
-
-// DefrostZone enum
-const char kFront[] = "FRONT";
-const char kRear[] = "REAR";
-const char kAll[] = "ALL";
-// DefrostZone enum
-
-// TemperatureUnit enum
-const char kFahrenheit[] = "FAHRENHEIT";
-const char kCelsius[] = "CELSIUS";
-// TemperatureUnit enum
-
-// ButtonName enum
-const char kACMax[] = "AC_MAX";
-const char kAC[] = "AC";
-const char kRecirculate[] = "RECIRCULATE";
-const char kFanUp[] = "FAN_UP";
-const char kFanDown[] = "FAN_DOWN";
-const char kTempUp[] = "TEMP_UP";
-const char kTempDown[] = "TEMP_DOWN";
-const char kDefrostMax[] = "DEFROST_MAX";
-const char kDefrost[] = "DEFROST";
-const char kDefrostRear[] = "DEFROST_REAR";
-const char kUpperVent[] = "UPPER_VENT";
-const char kLowerVent[] = "LOWER_VENT";
-const char kVolumeUp[] = "VOLUME_UP";
-const char kVolumeDown[] = "VOLUME_DOWN";
-const char kEject[] = "EJECT";
-const char kSource[] = "SOURCE";
-const char kShuffle[] = "SHUFFLE";
-const char kRepeat[] = "REPEAT";
-// ButtonName enum
-
-// ButtonPressMode enum
-const char kLong[] = "LONG";
-const char kShort[] = "SHORT";
-// ButtonPressMode enum
-
-// Access mode enum
-const char kAutoAllow[] = "AUTO_ALLOW";
-const char kAutoDeny[] = "AUTO_DENY";
-const char kAskDriver[] = "ASK_DRIVER";
-// Access mode enum
-
-} // namespace enums_value
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
diff --git a/src/components/remote_control/include/remote_control/rc_module_timer.h b/src/components/remote_control/include/remote_control/rc_module_timer.h
deleted file mode 100644
index 813f26a885..0000000000
--- a/src/components/remote_control/include/remote_control/rc_module_timer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_
-
-#include "functional_module/timer/module_timer.h"
-
-namespace remote_control {
-
-class TrackableMessage : public functional_modules::Trackable {
- public:
- TrackableMessage(uint32_t app_id, uint32_t correlation_id)
- : custom_interval_(0), app_id_(app_id), correlation_id_(correlation_id) {}
-
- functional_modules::TimeUnit custom_interval() const {
- return custom_interval_;
- }
-
- uint32_t app_id() const {
- return app_id_;
- }
-
- uint32_t correlation_id() const {
- return correlation_id_;
- }
-
- bool operator==(const TrackableMessage& other) const {
- return (other.app_id_ == app_id_ &&
- other.correlation_id_ == correlation_id_);
- }
-
- private:
- functional_modules::TimeUnit custom_interval_;
- uint32_t app_id_;
- uint32_t correlation_id_;
-};
-
-} // namesapce remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_
diff --git a/src/components/remote_control/include/remote_control/remote_control_event.h b/src/components/remote_control/include/remote_control/remote_control_event.h
deleted file mode 100644
index 3c98f971ac..0000000000
--- a/src/components/remote_control/include/remote_control/remote_control_event.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_
-
-#include <string>
-
-#include "application_manager/message.h"
-
-#include "remote_control/event_engine/event.h"
-
-namespace remote_control {
-
-class RCPluginEvent
- : public rc_event_engine::Event<application_manager::MessagePtr,
- std::string> {
- public:
- /*
- * @brief Constructor with parameters
- *
- * @param id Event ID. (HMI or CAN function name)
- * @param message Message received in HMI or CAN response
- */
- RCPluginEvent(application_manager::MessagePtr& message,
- const std::string& id);
-
- /*
- * @brief Destructor
- */
- virtual ~RCPluginEvent();
-
- /*
- * @brief Retrieves event message request ID
- */
- virtual int32_t event_message_function_id() const;
-
- /*
- * @brief Retrieves event message correlation ID
- */
- virtual int32_t event_message_correlation_id() const;
-
- /*
- * @brief Retrieves event message response type
- */
- virtual int32_t event_message_type() const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RCPluginEvent);
-};
-}
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_
diff --git a/src/components/remote_control/include/remote_control/remote_control_plugin.h b/src/components/remote_control/include/remote_control/remote_control_plugin.h
deleted file mode 100644
index 1e7d49c18e..0000000000
--- a/src/components/remote_control/include/remote_control/remote_control_plugin.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_
-
-#include <queue>
-#include <string>
-
-#include "remote_control/remote_plugin_interface.h"
-#include "functional_module/generic_module.h"
-#include "remote_control/request_controller.h"
-#include "utils/threads/message_loop_thread.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "remote_control/resource_allocation_manager_impl.h"
-
-namespace remote_control {
-typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr,
- std::string> RCEventDispatcher;
-
-class RemoteControlPlugin : public RemotePluginInterface {
- public:
- RemoteControlPlugin();
- ~RemoteControlPlugin();
-
- functional_modules::PluginInfo GetPluginInfo() const;
- virtual functional_modules::ProcessResult ProcessMessage(
- application_manager::MessagePtr msg);
- virtual functional_modules::ProcessResult ProcessHMIMessage(
- application_manager::MessagePtr msg);
-
- /**
- * @brief Sends response to mobile application
- * @param msg response mesage
- */
- void SendResponseToMobile(application_manager::MessagePtr msg);
-
- /**
- * @brief Sends timeout response to mobile application
- * @param msg response mesage
- */
- void SendTimeoutResponseToMobile(application_manager::MessagePtr msg);
-
- /**
- * @brief Remove extension created for specified application
- * @param app_id application id
- */
- virtual void RemoveAppExtension(uint32_t app_id);
-
- /**
- * @brief Check registering app can be handled by plugin
- * @param msg Registration message
- * @param app Application basis already create by Core
- */
- bool IsAppForPlugin(application_manager::ApplicationSharedPtr app);
-
- /**
- * @brief Notify about change of HMILevel of plugin's app
- * @param app App with new HMILevel
- * @param old_level Old HMILevel of app
- */
- void OnAppHMILevelChanged(application_manager::ApplicationSharedPtr app,
- mobile_apis::HMILevel::eType old_level);
-
- /**
- * @brief Sends HMI status notification to mobile
- * @param app application with changed HMI status
- **/
- void SendHmiStatusNotification(
- application_manager::ApplicationSharedPtr app) OVERRIDE;
-
- /**
- * @brief Getter for event_dispatcher
- * @return reference to RCEventDispatcher instance
- */
- RCEventDispatcher& event_dispatcher() OVERRIDE;
-
- /**
- * @brief Getter for resource_allocation_manager
- * @return reference to ResourceAllocationManager instance
- */
- ResourceAllocationManager& resource_allocation_manager() OVERRIDE;
-
- /**
- * @brief Overriden setter for service
- * @param service pointer to new service instance
- */
- void set_service(application_manager::ServicePtr service) OVERRIDE;
-
- /**
- * @brief OnApplicationEvent Processes application related events
- * @param event Event
- * @param application Pointer to application struct
- */
- void OnApplicationEvent(
- functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) OVERRIDE;
-
- /**
- * @brief OnPolicyEvent Processes policy related events
- * @param event Policy event
- */
- void OnPolicyEvent(functional_modules::PolicyEvent event) OVERRIDE;
-
- protected:
- /**
- * @brief Remove extension for all applications
- */
- virtual void RemoveAppExtensions() OVERRIDE;
-
- private:
- /**
- * @brief Trigger actions which should be done after plugin service instance
- * have been changed
- */
- void OnPluginServiceChanged();
-
- /**
- * @brief Subscribes on all RC related functions
- */
- void SubscribeOnFunctions();
-
- functional_modules::PluginInfo plugin_info_;
- bool is_scan_started_;
- request_controller::RequestController request_controller_;
-
- RCEventDispatcher event_dispatcher_;
-
- ResourceAllocationManagerImpl resource_allocation_manager_;
- DISALLOW_COPY_AND_ASSIGN(RemoteControlPlugin);
-};
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_
diff --git a/src/components/remote_control/include/remote_control/remote_plugin_interface.h b/src/components/remote_control/include/remote_control/remote_plugin_interface.h
deleted file mode 100644
index 51135d8a8a..0000000000
--- a/src/components/remote_control/include/remote_control/remote_plugin_interface.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_
-
-#include <queue>
-#include <string>
-#include "functional_module/generic_module.h"
-#include "remote_control/request_controller.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "utils/threads/message_loop_thread.h"
-#include "utils/shared_ptr.h"
-
-namespace remote_control {
-
-class RCAppExtension;
-class ResourceAllocationManager;
-
-typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr;
-
-class RemotePluginInterface : public functional_modules::GenericModule {
- public:
- RemotePluginInterface() : GenericModule(kCANModuleID) {}
- virtual ~RemotePluginInterface() {}
- virtual functional_modules::PluginInfo GetPluginInfo() const = 0;
- virtual functional_modules::ProcessResult ProcessMessage(
- application_manager::MessagePtr msg) = 0;
- virtual functional_modules::ProcessResult ProcessHMIMessage(
- application_manager::MessagePtr msg) = 0;
-
- /**
- * @brief Sends response to mobile application
- * @param msg response mesage
- */
- virtual void SendResponseToMobile(application_manager::MessagePtr msg) = 0;
-
- /**
- * @brief Sends timeout response to mobile application
- * @param msg response mesage
- */
- virtual void SendTimeoutResponseToMobile(
- application_manager::MessagePtr msg) = 0;
-
- /**
- * @brief Remove extension created for specified application
- * @param app_id application id
- */
- virtual void RemoveAppExtension(uint32_t app_id) = 0;
-
- /**
- * @brief Check registering app can be handled by plugin
- * @param msg Registration message
- * @param app Application basis already create by Core
- */
- virtual bool IsAppForPlugin(
- application_manager::ApplicationSharedPtr app) = 0;
-
- /**
- * @brief Notify about change of HMILevel of plugin's app
- * @param app App with new HMILevel
- * @param old_level Old HMILevel of app
- */
- virtual void OnAppHMILevelChanged(
- application_manager::ApplicationSharedPtr app,
- mobile_apis::HMILevel::eType old_level) = 0;
-
- virtual void SendHmiStatusNotification(
- application_manager::ApplicationSharedPtr app) = 0;
-
- typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr,
- std::string> RCPluginEventDispatcher;
-
- virtual RCPluginEventDispatcher& event_dispatcher() = 0;
-
- virtual ResourceAllocationManager& resource_allocation_manager() = 0;
-
- protected:
- /**
- * @brief Remove extension for all applications
- */
- virtual void RemoveAppExtensions() = 0;
-
- static const functional_modules::ModuleID kCANModuleID = 153;
-};
-
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_
diff --git a/src/components/remote_control/include/remote_control/request_controller.h b/src/components/remote_control/include/remote_control/request_controller.h
deleted file mode 100644
index 8a79d9ebc4..0000000000
--- a/src/components/remote_control/include/remote_control/request_controller.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_
-
-#include <map>
-
-#include "remote_control/commands/command.h"
-#include "remote_control/rc_module_timer.h"
-#include "functional_module/timer/timer_director.h"
-#include "utils/lock.h"
-
-namespace remote_control {
-
-namespace commands {
-class Command;
-}
-
-namespace request_controller {
-
-typedef utils::SharedPtr<commands::Command> MobileRequestPtr;
-typedef uint32_t correlation_id;
-
-/**
- * @brief RequestController class is used to manage mobile requests lifetime.
- */
-class RequestController
- : public functional_modules::TimerObserver<TrackableMessage> {
- public:
- /**
- * @brief Class constructor
- *
- */
- RequestController();
-
- /**
- * @brief Class destructor
- *
- */
- virtual ~RequestController();
-
- /**
- * @brief Adds pointer to request.
- * @param mobile_correlation_id mobile request correlation id
- * @param command pointer to request created in mobile factory
- */
- void AddRequest(const uint32_t mobile_correlation_id,
- MobileRequestPtr request);
-
- /**
- * @brief Removes request
- * @param mobile_corellation_id mobile request correlation id
- */
- void DeleteRequest(const uint32_t& mobile_correlation_id);
-
- /**
- * @brief Sets timeout value for RC requests
- * @param timeout_seconds new timeout value in seconds
- */
- void SetRequestTimeout(const functional_modules::TimeUnit timeout_seconds);
-
- /**
- * @brief Triggers actions when timeout for some request is expired
- * @param expired reference to request which timeout was expired
- */
- void OnTimeoutTriggered(const TrackableMessage& expired) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RequestController);
-
- std::map<correlation_id, MobileRequestPtr> mobile_request_list_;
- functional_modules::ModuleTimer<TrackableMessage> timer_;
- functional_modules::TimerDirector time_director_;
- sync_primitives::Lock mobile_request_lock_;
-};
-
-} // namespace request_controller
-} // namespace remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_
diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager.h b/src/components/remote_control/include/remote_control/resource_allocation_manager.h
deleted file mode 100644
index f789fe4af9..0000000000
--- a/src/components/remote_control/include/remote_control/resource_allocation_manager.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
-#include <string>
-#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-#include "interfaces/HMI_API.h"
-#include "remote_control/event_engine/event.h"
-#include "functional_module/generic_module.h"
-
-namespace remote_control {
-
-/**
- * Enum for list of results of allocation resources
- */
-namespace AcquireResult {
-enum eType { ALLOWED = 0, IN_USE, ASK_DRIVER, REJECTED };
-}
-
-/**
- * Defines states of acquired resource
- */
-namespace ResourceState {
-enum eType { FREE = 0, BUSY };
-}
-
-/**
- * @brief Resources defines list of resources
- */
-typedef std::vector<std::string> Resources;
-
-class ResourceAllocationManager {
- public:
- /**
- * @brief AcquireResource acquires resource by application
- * @param module_type resource to acquire
- * @param app_id application that acquire resource
- * @return ALLOWED if resource acquired \
- * IN_USE if subscription is not allowed
- * ASK_DRIVER if driver confirmation is required
- */
- virtual AcquireResult::eType AcquireResource(const std::string& module_type,
- const uint32_t app_id) = 0;
-
- /**
- * @brief SetResourceState changes resource state. Resource must be acquired
- * beforehand.
- * @param module_type Resource to change its state
- * @param app_id Application aquired resource before
- * @param state State to set for resource
- */
- virtual void SetResourceState(const std::string& module_type,
- const uint32_t app_id,
- const ResourceState::eType state) = 0;
-
- /**
- * @brief IsResourceFree check resource state
- * @param module_type Resource name
- * @return True if free, otherwise - false
- */
- virtual bool IsResourceFree(const std::string& module_type) const = 0;
-
- /**
- * @brief AcquireResource forces acquiring resource by application
- * @param module_type resource to acquire
- * @param app_id application that acquire resource
- */
- virtual void ForceAcquireResource(const std::string& module_type,
- const uint32_t app_id) = 0;
-
- /**
- * @brief OnDriverDisallowed callback for rejecting acquiring resource
- * @param module_type resource type
- * @param app_id application id
- */
- virtual void OnDriverDisallowed(const std::string& module_type,
- const uint32_t app_id) = 0;
-
- /**
- * @brief OnApplicationEvent Processes application related events
- * @param event Event
- * @param application Pointer to application struct
- */
- virtual void OnApplicationEvent(
- functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) = 0;
-
- /**
- * @brief OnPolicyEvent Processes policy related events
- * @param event Policy event
- */
- virtual void OnPolicyEvent(functional_modules::PolicyEvent event) = 0;
-
- /**
- * @brief Set current access mode for acquiring resource
- * @param access_mode
- */
- virtual void SetAccessMode(
- const hmi_apis::Common_RCAccessMode::eType access_mode) = 0;
-
- /**
- * @brief Get last set access mode for acquiring resource
- * @param access_mode
- */
- virtual hmi_apis::Common_RCAccessMode::eType GetAccessMode() const = 0;
-
- /**
- * @brief Remove all information about all allocations
- */
- virtual void ResetAllAllocations() = 0;
-
- virtual ~ResourceAllocationManager() {}
-};
-
-} // namespace remote_control
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h b/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h
deleted file mode 100644
index 57c2a8f360..0000000000
--- a/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
-#include "remote_control/resource_allocation_manager.h"
-#include "remote_control/remote_plugin_interface.h"
-#include "utils/macro.h"
-#include "utils/lock.h"
-
-namespace remote_control {
-
-typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr,
- std::string> RCEventDispatcher;
-
-class ResourceAllocationManagerImpl : public ResourceAllocationManager {
- public:
- ResourceAllocationManagerImpl(RemotePluginInterface& rc_plugin);
-
- ~ResourceAllocationManagerImpl();
-
- AcquireResult::eType AcquireResource(const std::string& module_type,
- const uint32_t app_id) OVERRIDE FINAL;
-
- void SetResourceState(const std::string& module_type,
- const uint32_t app_id,
- const ResourceState::eType state) FINAL;
-
- bool IsResourceFree(const std::string& module_type) const FINAL;
-
- void SetAccessMode(
- const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL;
-
- hmi_apis::Common_RCAccessMode::eType GetAccessMode() const FINAL;
-
- void ForceAcquireResource(const std::string& module_type,
- const uint32_t app_id) FINAL;
-
- void OnDriverDisallowed(const std::string& module_type,
- const uint32_t app_id) FINAL;
-
- /**
- * @brief OnApplicationEvent Notifies modules on certain application events
- * @param event Event
- * @param application Pointer to application struct
- */
- void OnApplicationEvent(
- functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) FINAL;
-
- /**
- * @brief OnPolicyEvent Processes policy related events
- * @param event Policy event
- */
- void OnPolicyEvent(functional_modules::PolicyEvent event) FINAL;
-
- void ResetAllAllocations() FINAL;
-
- private:
- typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
-
- /**
- * @brief IsModuleTypeRejected check if current resource was rejected by
- * driver for current application
- * @param module_type resource to check
- * @param app_id application id
- * @return true if current resource was rejected by driver for current
- * application, otherwise - false
- */
- bool IsModuleTypeRejected(const std::string& module_type,
- const uint32_t app_id);
-
- /**
- * @brief ReleaseResource Releases resource acquired by application
- * @param module_type Module name
- * @param application_id Application id
- */
- void ReleaseResource(const std::string& module_type,
- const uint32_t application_id);
-
- /**
- * @brief GetAcquiredResources Provides resources acquired by particular
- * application currently
- * @param application_id Application id
- * @return List of acquired resources by specific application
- */
- Resources GetAcquiredResources(const uint32_t application_id) const;
-
- /**
- * @brief ProcessApplicationPolicyUpdate Checks if allowed modules list is
- * changed for registered RC applications and releases in case some modules
- * now out of the list
- */
- void ProcessApplicationPolicyUpdate();
-
- /**
- * @brief GetApplicationExtention Provides access to application RC extention
- * @param application Application
- * @return Pointer to RC extention of application or NULL if not available
- */
- RCAppExtensionPtr GetApplicationExtention(
- application_manager::ApplicationSharedPtr application);
-
- /**
- * @brief RemoveAppsSubscriptions Removes subscriptions for interior data for
- * applications in the list
- * @param apps Application list
- */
- void RemoveAppsSubscriptions(const Apps& apps);
-
- /**
- * @brief AllocatedResources contains link between resource and application
- * owning that resource
- */
- typedef std::map<std::string, uint32_t> AllocatedResources;
- AllocatedResources allocated_resources_;
- mutable sync_primitives::Lock allocated_resources_lock_;
-
- /**
- * @brief ResourcesState contains states of ALLOCATED resources
- */
- typedef std::map<std::string, ResourceState::eType> ResourcesState;
- ResourcesState resources_state_;
- mutable sync_primitives::Lock resources_state_lock_;
-
- /**
- * @brief RejectedResources type for connecting list of resources rejected by
- * driver for application
- * application_id : [vector of rejected resources]
- */
- typedef std::map<uint32_t, std::vector<std::string> > RejectedResources;
- RejectedResources rejected_resources_for_application_;
- mutable sync_primitives::Lock rejected_resources_for_application_lock_;
-
- hmi_apis::Common_RCAccessMode::eType current_access_mode_;
- RemotePluginInterface& rc_plugin_;
-};
-} // remote_control
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
diff --git a/src/components/remote_control/src/commands/base_command_notification.cc b/src/components/remote_control/src/commands/base_command_notification.cc
deleted file mode 100644
index 2de82abdef..0000000000
--- a/src/components/remote_control/src/commands/base_command_notification.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/base_command_notification.h"
-#include "json/json.h"
-#include "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_module_constants.h"
-#include "application_manager/application_manager.h"
-
-namespace remote_control {
-
-namespace commands {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
-
-BaseCommandNotification::BaseCommandNotification(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : Command(rc_module), service_(rc_module_.service()), message_(message) {
- Json::Value value;
- Json::Reader reader;
- reader.parse(message_->json_message(), value);
- if (value.isMember(json_keys::kParams)) {
- Json::FastWriter writer;
- message_->set_json_message(writer.write(value[json_keys::kParams]));
- } else {
- message_->set_json_message("");
- }
-}
-
-BaseCommandNotification::~BaseCommandNotification() {}
-
-RCAppExtensionPtr BaseCommandNotification::GetAppExtension(
- application_manager::ApplicationSharedPtr app) const {
- if (!app) {
- return NULL;
- }
-
- functional_modules::ModuleID id = rc_module_.GetModuleID();
-
- RCAppExtensionPtr rc_app_extension;
- application_manager::AppExtensionPtr app_extension = app->QueryInterface(id);
- if (!app_extension) {
- return NULL;
- }
-
- rc_app_extension =
- application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>(
- app_extension);
-
- return rc_app_extension;
-}
-
-void BaseCommandNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- Execute();
-}
-
-void BaseCommandNotification::NotifyApplications() {
- LOG4CXX_AUTO_TRACE(logger_);
- typedef std::vector<application_manager::ApplicationSharedPtr> AppList;
- AppList applications = service_->GetApplications(rc_module_.GetModuleID());
- for (AppList::iterator i = applications.begin(); i != applications.end();
- ++i) {
- application_manager::MessagePtr message(
- new application_manager::Message(*message_));
- message->set_connection_key((*i)->app_id());
- NotifyOneApplication(message);
- }
-}
-
-void BaseCommandNotification::NotifyOneApplication(
- application_manager::MessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (CheckPolicy(message)) {
- service_->SendMessageToMobile(message);
- } else {
- LOG4CXX_WARN(logger_,
- "Function \"" << message->function_name() << "\" (#"
- << message->function_id()
- << ") not allowed by policy");
- }
-}
-
-bool BaseCommandNotification::CheckPolicy(
- application_manager::MessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
- application_manager::ApplicationSharedPtr app =
- service_->GetApplication(message->connection_key());
-
- if (!app) {
- LOG4CXX_WARN(logger_,
- "Application " << message->connection_key()
- << "isn't registered");
- return false;
- }
-
- mobile_apis::Result::eType permission =
- service_->CheckPolicyPermissions(message);
-
- Json::Value value;
- Json::Reader reader;
- LOG4CXX_DEBUG(logger_, "Notification: " << message->json_message());
- reader.parse(message->json_message(), value);
-
- return permission == mobile_apis::Result::eType::SUCCESS &&
- service_->CheckModule(app->app_id(), ModuleType(value));
-}
-
-std::string BaseCommandNotification::ModuleType(const Json::Value& message) {
- return "";
-}
-
-bool BaseCommandNotification::Validate() {
- return true;
-}
-
-std::vector<std::string> BaseCommandNotification::ControlData(
- const Json::Value& message) {
- return std::vector<std::string>();
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/base_command_request.cc b/src/components/remote_control/src/commands/base_command_request.cc
deleted file mode 100644
index bc6202d2a8..0000000000
--- a/src/components/remote_control/src/commands/base_command_request.cc
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/base_command_request.h"
-#include <cstring>
-#include "utils/make_shared.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_module_constants.h"
-#include "application_manager/application_manager_impl.h"
-
-namespace remote_control {
-
-namespace commands {
-
-using rc_event_engine::EventDispatcher;
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
-
-BaseCommandRequest::BaseCommandRequest(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : Command(rc_module)
- , message_(message)
- , msg_json_(MessageHelper::StringToValue(message->json_message()))
- , auto_allowed_(false) {
- service_ = rc_module_.service();
- app_ = service_->GetApplication(message_->connection_key());
-}
-
-BaseCommandRequest::~BaseCommandRequest() {
- rc_module_.event_dispatcher().remove_observer(this);
-}
-
-void BaseCommandRequest::OnTimeout() {
- LOG4CXX_AUTO_TRACE(logger_);
- SetResourceState(msg_json_, ResourceState::FREE);
-
- PrepareResponse(
- false, result_codes::kGenericError, "Request timeout expired.");
- rc_module_.SendTimeoutResponseToMobile(message_);
-}
-
-void BaseCommandRequest::PrepareResponse(const bool success,
- const char* result_code,
- const std::string& info) {
- message_->set_message_type(application_manager::MessageType::kResponse);
- Json::Value msg_params;
-
- if (!response_params_.isNull()) {
- msg_params = response_params_;
- }
-
- msg_params[json_keys::kSuccess] = success;
- msg_params[json_keys::kResultCode] = result_code;
- if (!info.empty()) {
- msg_params[json_keys::kInfo] = info;
- }
-
- Json::FastWriter writer;
- std::string params = writer.write(msg_params);
- message_->set_json_message(params);
-}
-
-void BaseCommandRequest::SendResponse(const bool success,
- const char* result_code,
- const std::string& info) {
- LOG4CXX_AUTO_TRACE(logger_);
- SetResourceState(msg_json_, ResourceState::FREE);
- PrepareResponse(success, result_code, info);
- rc_module_.SendResponseToMobile(message_);
-}
-
-void BaseCommandRequest::SendMessageToHMI(
- const application_manager::MessagePtr& message_to_send) {
- LOG4CXX_AUTO_TRACE(logger_);
- using application_manager::HmiInterfaces;
-
- const bool is_rc_available =
- service_->IsInterfaceAvailable(HmiInterfaces::HMI_INTERFACE_RC);
- LOG4CXX_DEBUG(logger_, "HMI interface RC is available: " << is_rc_available);
- if (!is_rc_available) {
- const bool success = false;
- const char* result_code = result_codes::kUnsupportedResource;
- const std::string info = "Remote control is not supported by system";
-
- SendResponse(success, result_code, info);
- return;
- }
-
- const std::string function_name = message_to_send->function_name();
- const int32_t correlation_id = message_to_send->correlation_id();
- LOG4CXX_DEBUG(logger_,
- "Subsribing to response for function: "
- << function_name
- << " and correlation id: " << correlation_id);
-
- rc_module_.event_dispatcher().add_observer(
- function_name, correlation_id, this);
-
- LOG4CXX_DEBUG(logger_, "HMI Request:\n " << message_to_send->json_message());
-
- service_->SendMessageToHMI(message_to_send);
-}
-
-void BaseCommandRequest::SendRequest(const char* function_id,
- const Json::Value& message_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- application_manager::MessagePtr message_to_send =
- CreateHmiRequest(function_id, message_params);
- SendMessageToHMI(message_to_send);
-}
-
-application_manager::MessagePtr BaseCommandRequest::CreateHmiRequest(
- const char* function_id, const Json::Value& message_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- const uint32_t hmi_app_id = app_->hmi_app_id();
- return MessageHelper::CreateHmiRequest(
- function_id, hmi_app_id, message_params, rc_module_);
-}
-
-bool BaseCommandRequest::Validate() {
- return application_manager::MessageValidationResult::SUCCESS ==
- service_->ValidateMessageBySchema(*message_);
-}
-
-bool BaseCommandRequest::ParseJsonString(Json::Value* parsed_msg) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(parsed_msg);
- if (!parsed_msg)
- return false;
-
- (*parsed_msg) = MessageHelper::StringToValue(message_->json_message());
- if (Json::ValueType::nullValue == parsed_msg->type()) {
- LOG4CXX_ERROR(logger_,
- "Invalid JSON received in " << message_->json_message());
- SendResponse(
- false, result_codes::kInvalidData, "Mobile request validation failed!");
- return false;
- }
- return true;
-}
-
-const char* BaseCommandRequest::GetMobileResultCode(
- const hmi_apis::Common_Result::eType& hmi_code) const {
- LOG4CXX_AUTO_TRACE(logger_);
- switch (hmi_code) {
- case hmi_apis::Common_Result::SUCCESS: {
- return result_codes::kSuccess;
- }
- case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: {
- return result_codes::kUnsupportedRequest;
- }
- case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: {
- return result_codes::kUnsupportedResource;
- }
- case hmi_apis::Common_Result::DISALLOWED: {
- return result_codes::kDisallowed;
- }
- case hmi_apis::Common_Result::REJECTED: {
- return result_codes::kRejected;
- }
- case hmi_apis::Common_Result::ABORTED: {
- return result_codes::kAborted;
- }
- case hmi_apis::Common_Result::IGNORED: {
- return result_codes::kIgnored;
- }
- case hmi_apis::Common_Result::RETRY: {
- return result_codes::kRetry;
- }
- case hmi_apis::Common_Result::IN_USE: {
- return result_codes::kInUse;
- }
- case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: {
- return result_codes::kVehicleDataNotAvailable;
- }
- case hmi_apis::Common_Result::TIMED_OUT: {
- return result_codes::kTimedOut;
- }
- case hmi_apis::Common_Result::INVALID_DATA: {
- return result_codes::kInvalidData;
- }
- case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: {
- return result_codes::kCharLimitExceeded;
- }
- case hmi_apis::Common_Result::INVALID_ID: {
- return result_codes::kInvalidId;
- }
- case hmi_apis::Common_Result::DUPLICATE_NAME: {
- return result_codes::kDuplicateName;
- }
- case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: {
- return result_codes::kApplicationNotRegistered;
- }
- case hmi_apis::Common_Result::WRONG_LANGUAGE: {
- return result_codes::kWrongLanguage;
- }
- case hmi_apis::Common_Result::OUT_OF_MEMORY: {
- return result_codes::kOutOfMemory;
- }
- case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: {
- return result_codes::kTooManyPendingRequests;
- }
- case hmi_apis::Common_Result::NO_APPS_REGISTERED: {
- return result_codes::kApplicationNotRegistered;
- }
- case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: {
- return result_codes::kApplicationNotRegistered;
- }
- case hmi_apis::Common_Result::WARNINGS: {
- return result_codes::kWarnings;
- }
- case hmi_apis::Common_Result::GENERIC_ERROR: {
- return result_codes::kGenericError;
- }
- case hmi_apis::Common_Result::USER_DISALLOWED: {
- return result_codes::kUserDisallowed;
- }
- case hmi_apis::Common_Result::READ_ONLY: {
- return result_codes::kReadOnly;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
- return result_codes::kGenericError;
- }
- }
-}
-
-RCAppExtensionPtr BaseCommandRequest::GetAppExtension(
- application_manager::ApplicationSharedPtr app) const {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!app) {
- return NULL;
- }
-
- functional_modules::ModuleID id = rc_module_.GetModuleID();
-
- RCAppExtensionPtr rc_app_extension;
- application_manager::AppExtensionPtr app_extension = app->QueryInterface(id);
- if (!app_extension) {
- LOG4CXX_DEBUG(logger_, "New app extension will be created");
- app_extension = new RCAppExtension(id);
- app->AddExtension(app_extension);
- }
-
- rc_app_extension =
- application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>(
- app_extension);
-
- return rc_app_extension;
-}
-
-bool BaseCommandRequest::ParseResultCode(const Json::Value& value,
- std::string& result_code,
- std::string& info) {
- LOG4CXX_AUTO_TRACE(logger_);
- result_code = result_codes::kInvalidData;
- info = "";
-
- if (IsMember(value, json_keys::kResult) &&
- IsMember(value[json_keys::kResult], json_keys::kCode)) {
- result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- value[json_keys::kResult][json_keys::kCode].asInt()));
- } else if (IsMember(value, json_keys::kError) &&
- IsMember(value[json_keys::kError], json_keys::kCode)) {
- result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- value[json_keys::kError][json_keys::kCode].asInt()));
-
- if (IsMember(value[json_keys::kError], json_keys::kMessage)) {
- info = value[json_keys::kError][json_keys::kMessage].asCString();
- }
- }
-
- if ((result_codes::kSuccess == result_code) ||
- (result_codes::kWarnings == result_code)) {
- return true;
- }
-
- return false;
-}
-
-void BaseCommandRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!Validate()) {
- LOG4CXX_WARN(logger_, "Request message validation failed !");
- SendResponse(
- false, result_codes::kInvalidData, "Validation by schema failed");
- return;
- }
- LOG4CXX_TRACE(logger_, "Request message validated successfully!");
- using application_manager::HmiInterfaces;
- if (!service_->IsInterfaceAvailable(HmiInterfaces::HMI_INTERFACE_RC)) {
- LOG4CXX_WARN(logger_, "HMI interface RC is not available");
- SendResponse(false,
- result_codes::kUnsupportedResource,
- "Remote control is not supported by system");
- return;
- }
- LOG4CXX_TRACE(logger_, "RC interface is available!");
- if (CheckPolicyPermissions() && CheckDriverConsent()) {
- if (AcquireResources()) {
- Execute(); // run child's logic
- }
- // If resource is not aqcuired, AcquireResources method will either
- // send response to mobile or
- // send additional request to HMI to ask driver consent
- }
-}
-
-bool BaseCommandRequest::CheckPolicyPermissions() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!app_) {
- LOG4CXX_ERROR(logger_, "Application doesn't registered!");
- SendResponse(false, result_codes::kApplicationNotRegistered, "");
- return false;
- }
-
- if (!service_->IsRemoteControlApplication(app_)) {
- LOG4CXX_WARN(logger_, "Application has no remote control functions");
- SendResponse(false, result_codes::kDisallowed, "");
- return false;
- }
-
- mobile_apis::Result::eType ret = service_->CheckPolicyPermissions(message_);
- if (ret != mobile_apis::Result::eType::SUCCESS) {
- LOG4CXX_WARN(logger_,
- "Function \"" << message_->function_name() << "\" (#"
- << message_->function_id()
- << ") not allowed by policy");
-
- SendResponse(false, result_codes::kDisallowed, "");
- return false;
- }
-
- return true;
-}
-
-application_manager::TypeAccess BaseCommandRequest::CheckModule(
- const Json::Value& message) {
- const std::string& module = ModuleType(message);
- return service_->CheckModule(app_->app_id(), module)
- ? application_manager::TypeAccess::kAllowed
- : application_manager::TypeAccess::kDisallowed;
-}
-
-bool BaseCommandRequest::CheckDriverConsent() {
- LOG4CXX_AUTO_TRACE(logger_);
- RCAppExtensionPtr extension = GetAppExtension(app_);
- if (!extension) {
- return false;
- }
- Json::Value value;
- Json::Reader reader;
- LOG4CXX_DEBUG(logger_, "Request: " << message_->json_message());
- reader.parse(message_->json_message(), value);
-
- application_manager::TypeAccess access = CheckModule(value);
-
- if (IsAutoAllowed(access)) {
- set_auto_allowed(true);
- return true;
- } else {
- SendDisallowed(access);
- }
- return false;
-}
-
-bool BaseCommandRequest::AcquireResources() {
- LOG4CXX_AUTO_TRACE(logger_);
- const Json::Value message_params =
- MessageHelper::StringToValue(message_->json_message());
-
- if (!IsResourceFree(ModuleType(message_params))) {
- LOG4CXX_WARN(logger_, "Resource is busy.");
- SendResponse(false, result_codes::kInUse, "");
- return false;
- }
-
- AcquireResult::eType acquire_result = AcquireResource(message_params);
- switch (acquire_result) {
- case AcquireResult::ALLOWED: {
- SetResourceState(msg_json_, ResourceState::BUSY);
- return true;
- }
- case AcquireResult::IN_USE: {
- SendResponse(false, result_codes::kInUse, "");
- return false;
- }
- case AcquireResult::ASK_DRIVER: {
- SetResourceState(msg_json_, ResourceState::BUSY);
-
- Json::Value value;
- Json::Reader reader;
- LOG4CXX_DEBUG(logger_, "Request: " << message_->json_message());
- reader.parse(message_->json_message(), value);
-
- SendGetUserConsent(value);
-
- return false;
- }
- case AcquireResult::REJECTED: {
- SendResponse(false, result_codes::kRejected, "");
- return false;
- }
- }
-
- return false;
-}
-
-bool BaseCommandRequest::IsAutoAllowed(
- application_manager::TypeAccess access) const {
- return access == application_manager::kAllowed;
-}
-
-void BaseCommandRequest::SendDisallowed(
- application_manager::TypeAccess access) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::string info;
- switch (access) {
- case application_manager::kAllowed:
- return;
- case application_manager::kDisallowed:
- info = disallowed_info_.empty()
- ? "The RPC is disallowed by vehicle settings"
- : disallowed_info_;
- break;
- default:
- info = "Unknown issue";
- }
- LOG4CXX_ERROR(logger_, info);
- SendResponse(false, result_codes::kDisallowed, info);
-}
-
-void BaseCommandRequest::SendGetUserConsent(const Json::Value& value) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(app_);
- Json::Value params;
- params[json_keys::kAppId] = app_->hmi_app_id();
- params[message_params::kModuleType] = ModuleType(value);
- SendRequest(functional_modules::hmi_api::get_user_consent, params);
-}
-
-std::string BaseCommandRequest::ModuleType(const Json::Value& message) {
- return "";
-}
-
-std::vector<std::string> BaseCommandRequest::ControlData(
- const Json::Value& message) {
- return std::vector<std::string>();
-}
-
-void BaseCommandRequest::on_event(
- const rc_event_engine::Event<application_manager::MessagePtr, std::string>&
- event) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- SetResourceState(msg_json_, ResourceState::FREE);
-
- if (event.id() == functional_modules::hmi_api::get_user_consent) {
- ProcessAccessResponse(event);
- } else {
- OnEvent(event); // run child's logic
- }
-}
-
-void BaseCommandRequest::ProcessAccessResponse(
- const rc_event_engine::Event<application_manager::MessagePtr, std::string>&
- event) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!app_) {
- LOG4CXX_ERROR(logger_, "Application doesn't registered!");
- SendResponse(false, result_codes::kApplicationNotRegistered, "");
- return;
- }
-
- application_manager::Message& hmi_response = *(event.event_message());
- const application_manager::MessageValidationResult validate_result =
- service_->ValidateMessageBySchema(hmi_response);
- LOG4CXX_DEBUG(logger_,
- "HMI response validation result is " << validate_result);
-
- if (validate_result !=
- application_manager::MessageValidationResult::SUCCESS) {
- SendResponse(
- false, result_codes::kGenericError, "HMI has sent invalid parameters");
- return;
- }
-
- Json::Value value;
- Json::Reader reader;
- reader.parse(event.event_message()->json_message(), value);
-
- std::string result_code;
- std::string info;
- const bool is_succeeded = ParseResultCode(value, result_code, info);
-
- bool is_allowed = false;
- if (is_succeeded) {
- if (IsMember(value[json_keys::kResult], message_params::kAllowed) &&
- value[json_keys::kResult][message_params::kAllowed].isBool()) {
- is_allowed = value[json_keys::kResult][message_params::kAllowed].asBool();
- }
-
- const std::string module = ModuleType(msg_json_);
-
- // Check the actual User's answer.
- LOG4CXX_DEBUG(logger_,
- "Setting allowed access for " << app_->app_id() << " for "
- << module);
- if (is_allowed) {
- rc_module_.resource_allocation_manager().ForceAcquireResource(
- module, app_->app_id());
-
- Execute(); // run child's logic
- } else {
- rc_module_.resource_allocation_manager().OnDriverDisallowed(
- module, app_->app_id());
-
- SendResponse(
- false,
- result_codes::kRejected,
- "The resource is in use and the driver disallows this remote "
- "control RPC");
- }
- } else {
- SendResponse(false, result_code.c_str(), info);
- }
-}
-
-} // namespace commands
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/button_press_request.cc b/src/components/remote_control/src/commands/button_press_request.cc
deleted file mode 100644
index 1e5eef1e64..0000000000
--- a/src/components/remote_control/src/commands/button_press_request.cc
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/button_press_request.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_module_constants.h"
-#include "functional_module/function_ids.h"
-#include "json/json.h"
-#include "utils/helpers.h"
-#include "interfaces/MOBILE_API.h"
-
-namespace remote_control {
-
-namespace commands {
-
-using namespace json_keys;
-using namespace message_params;
-
-typedef std::map<std::string, mobile_apis::ButtonName::eType> ButtonsMap;
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "ButtonPressRequest")
-
-ButtonPressRequest::ButtonPressRequest(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : BaseCommandRequest(message, rc_module) {}
-
-ButtonPressRequest::~ButtonPressRequest() {}
-
-const std::vector<std::string> buttons_climate() {
- std::vector<std::string> data;
- data.push_back(enums_value::kACMax);
- data.push_back(enums_value::kAC);
- data.push_back(enums_value::kRecirculate);
- data.push_back(enums_value::kFanUp);
- data.push_back(enums_value::kFanDown);
- data.push_back(enums_value::kTempUp);
- data.push_back(enums_value::kTempDown);
- data.push_back(enums_value::kDefrostMax);
- data.push_back(enums_value::kDefrost);
- data.push_back(enums_value::kDefrostRear);
- data.push_back(enums_value::kUpperVent);
- data.push_back(enums_value::kLowerVent);
- return data;
-}
-
-const std::vector<std::string> buttons_radio() {
- std::vector<std::string> data;
- data.push_back(enums_value::kVolumeUp);
- data.push_back(enums_value::kVolumeDown);
- data.push_back(enums_value::kEject);
- data.push_back(enums_value::kSource);
- data.push_back(enums_value::kShuffle);
- data.push_back(enums_value::kRepeat);
- return data;
-}
-
-const ButtonsMap buttons_map() {
- using namespace mobile_apis;
-
- ButtonsMap buttons_map;
- buttons_map[enums_value::kACMax] = ButtonName::AC_MAX;
- buttons_map[enums_value::kAC] = ButtonName::AC;
- buttons_map[enums_value::kRecirculate] = ButtonName::RECIRCULATE;
- buttons_map[enums_value::kFanUp] = ButtonName::FAN_UP;
- buttons_map[enums_value::kFanDown] = ButtonName::FAN_DOWN;
- buttons_map[enums_value::kTempUp] = ButtonName::TEMP_UP;
- buttons_map[enums_value::kTempDown] = ButtonName::TEMP_DOWN;
- buttons_map[enums_value::kDefrostMax] = ButtonName::DEFROST_MAX;
- buttons_map[enums_value::kDefrost] = ButtonName::DEFROST;
- buttons_map[enums_value::kDefrostRear] = ButtonName::DEFROST_REAR;
- buttons_map[enums_value::kUpperVent] = ButtonName::UPPER_VENT;
- buttons_map[enums_value::kLowerVent] = ButtonName::LOWER_VENT;
- buttons_map[enums_value::kVolumeUp] = ButtonName::VOLUME_UP;
- buttons_map[enums_value::kVolumeDown] = ButtonName::VOLUME_DOWN;
- buttons_map[enums_value::kEject] = ButtonName::EJECT;
- buttons_map[enums_value::kSource] = ButtonName::SOURCE;
- buttons_map[enums_value::kShuffle] = ButtonName::SHUFFLE;
- buttons_map[enums_value::kRepeat] = ButtonName::REPEAT;
-
- return buttons_map;
-}
-
-bool CheckIfButtonExistInRCCaps(
- const smart_objects::SmartObject& rc_capabilities,
- const mobile_apis::ButtonName::eType button) {
- if (rc_capabilities.keyExists(strings::kbuttonCapabilities)) {
- const smart_objects::SmartObject& button_caps =
- rc_capabilities[strings::kbuttonCapabilities];
- smart_objects::SmartArray::iterator it = button_caps.asArray()->begin();
- for (; it != button_caps.asArray()->end(); ++it) {
- smart_objects::SmartObject& so = *it;
- int64_t current_id = so[message_params::kName].asInt();
- if (-1 == current_id) {
- // capabilities received from HMI contains enum values
- // capabilities loaded from file contains string values
- // TODO : unificate capabilities storing
- const std::string& bt_name = so[message_params::kName].asString();
- static ButtonsMap btn_map = buttons_map();
- current_id = btn_map[bt_name];
- }
- const mobile_apis::ButtonName::eType current_button =
- static_cast<mobile_apis::ButtonName::eType>(current_id);
- if (current_button == button) {
- LOG4CXX_TRACE(logger_,
- "Button id " << current_button
- << " exist in capabilities");
- return true;
- }
- }
- }
- LOG4CXX_TRACE(logger_,
- "Button id " << button << " do not exist in capabilities");
- return false;
-}
-
-bool CheckButtonName(const std::string& module_type,
- const std::string& button_name,
- const smart_objects::SmartObject* rc_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (rc_capabilities == NULL) {
- LOG4CXX_ERROR(logger_, "No remote controll capabilities available");
- return false;
- }
-
- if (enums_value::kRadio == module_type) {
- if (!helpers::in_range(buttons_radio(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess climate button with module type radio");
- return false;
- }
- }
-
- if (enums_value::kClimate == module_type) {
- if (!helpers::in_range(buttons_climate(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess radio button with module type climate");
- return false;
- }
- }
- return true;
-}
-
-void ButtonPressRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- const Json::Value request_params =
- MessageHelper::StringToValue(message_->json_message());
-
- const std::string button_name = request_params[kButtonName].asString();
- const std::string module_type = request_params[kModuleType].asString();
-
- static ButtonsMap btn_map = buttons_map();
- mobile_apis::ButtonName::eType button_id =
- mobile_apis::ButtonName::INVALID_ENUM;
- if (btn_map.end() != btn_map.find(button_name)) {
- button_id = btn_map[button_name];
- }
-
- const smart_objects::SmartObject* rc_capabilities =
- service()->GetRCCapabilities();
- const bool button_name_matches_module_type =
- CheckButtonName(module_type, button_name, rc_capabilities);
- const bool button_id_exist_in_caps =
- rc_capabilities &&
- CheckIfButtonExistInRCCaps(*rc_capabilities, button_id);
-
- if (button_name_matches_module_type && button_id_exist_in_caps) {
- SendRequest(functional_modules::hmi_api::button_press, request_params);
- } else if (!button_name_matches_module_type) {
- LOG4CXX_WARN(logger_, "Request module type and button name mismatch!");
- SendResponse(false,
- result_codes::kInvalidData,
- "Request module type and button name mismatch!");
- } else {
- LOG4CXX_WARN(logger_, "Requested button is not exists in capabilities!");
- SendResponse(false,
- result_codes::kUnsupportedResource,
- "Requested button is not exists in capabilities!");
- }
-}
-
-AcquireResult::eType ButtonPressRequest::AcquireResource(
- const Json::Value& message) {
- ResourceAllocationManager& allocation_manager =
- rc_module_.resource_allocation_manager();
- const std::string& module_type = ModuleType(message);
- const uint32_t app_id = app()->app_id();
- return allocation_manager.AcquireResource(module_type, app_id);
-}
-
-bool ButtonPressRequest::IsResourceFree(const std::string& module_type) const {
- return rc_module_.resource_allocation_manager().IsResourceFree(module_type);
-}
-
-void ButtonPressRequest::SetResourceState(const Json::Value& message,
- const ResourceState::eType state) {
- const std::string& module_type = ModuleType(message);
- const uint32_t app_id = app()->app_id();
-
- ResourceAllocationManager& allocation_manager =
- rc_module_.resource_allocation_manager();
- allocation_manager.SetResourceState(module_type, app_id, state);
-}
-
-void ButtonPressRequest::OnEvent(
- const rc_event_engine::Event<application_manager::MessagePtr, std::string>&
- event) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(
- (functional_modules::hmi_api::button_press == event.id()));
-
- application_manager::Message& hmi_response = *(event.event_message());
- const Json::Value value =
- MessageHelper::StringToValue(hmi_response.json_message());
-
- std::string result_code;
- std::string info;
-
- bool is_response_successful = ParseResultCode(value, result_code, info);
-
- if (remote_control::result_codes::kReadOnly == result_code) {
- is_response_successful = false;
- result_code = result_codes::kGenericError;
- }
- SendResponse(is_response_successful, result_code.c_str(), info);
-}
-
-std::string ButtonPressRequest::ModuleType(const Json::Value& message) {
- return message.get(message_params::kModuleType, Json::Value("")).asString();
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc b/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc
deleted file mode 100644
index 6a7e746aa5..0000000000
--- a/src/components/remote_control/src/commands/get_interior_vehicle_data_request.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- Copyright (c) 2017, 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 <map>
-
-#include "remote_control/commands/get_interior_vehicle_data_request.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/remote_control_plugin.h"
-#include "functional_module/function_ids.h"
-#include "json/json.h"
-
-namespace remote_control {
-
-namespace commands {
-
-using namespace enums_value;
-using namespace json_keys;
-using namespace message_params;
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "GetInteriorVehicleDataRequest")
-
-GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : BaseCommandRequest(message, rc_module) {}
-
-bool CheckIfModuleTypeExistInCapabilities(
- const smart_objects::SmartObject& rc_capabilities,
- const std::string& module_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (enums_value::kRadio == module_type &&
- !rc_capabilities.keyExists(strings::kradioControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Radio control capabilities not present");
- return false;
- }
- if (enums_value::kClimate == module_type &&
- !rc_capabilities.keyExists(strings::kclimateControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Climate control capabilities not present");
- return false;
- }
-
- return true;
-}
-
-void GetInteriorVehicleDataRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value request_params =
- MessageHelper::StringToValue(message_->json_message());
-
- const smart_objects::SmartObject* capabilities =
- service()->GetRCCapabilities();
- if (capabilities &&
- !CheckIfModuleTypeExistInCapabilities(*capabilities,
- ModuleType(request_params))) {
- LOG4CXX_WARN(logger_, "Accessing not supported module data");
- SendResponse(false,
- result_codes::kUnsupportedResource,
- "Accessing not supported module data");
- return;
- }
- if (HasRequestExcessiveSubscription(request_params)) {
- RemoveExcessiveSubscription(request_params);
- }
-
- SendRequest(functional_modules::hmi_api::get_interior_vehicle_data,
- request_params);
-}
-
-void GetInteriorVehicleDataRequest::OnEvent(
- const rc_event_engine::Event<application_manager::MessagePtr, std::string>&
- event) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(
- (functional_modules::hmi_api::get_interior_vehicle_data == event.id()));
-
- application_manager::Message& hmi_response = *(event.event_message());
- const bool validate_result =
- application_manager::MessageValidationResult::SUCCESS ==
- service()->ValidateMessageBySchema(hmi_response);
- LOG4CXX_DEBUG(logger_,
- "HMI response validation result is " << validate_result);
- const Json::Value value =
- MessageHelper::StringToValue(hmi_response.json_message());
- std::string result_code;
- std::string info;
- bool success = validate_result && ParseResultCode(value, result_code, info);
-
- if (!validate_result ||
- remote_control::result_codes::kReadOnly == result_code) {
- success = false;
- result_code = result_codes::kGenericError;
- }
-
- if (success) {
- ProccessSubscription(value);
- response_params_[kModuleData] =
- value[json_keys::kResult][message_params::kModuleData];
- }
- SendResponse(success, result_code.c_str(), info);
-}
-
-void GetInteriorVehicleDataRequest::ProccessSubscription(
- const Json::Value& hmi_response) {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value request_params;
- Json::Reader reader;
- reader.parse(message_->json_message(), request_params);
-
- const bool is_subscribe_present_in_request =
- IsMember(request_params, kSubscribe);
- const bool isSubscribed_present_in_response =
- IsMember(hmi_response[json_keys::kResult], message_params::kIsSubscribed);
-
- if (!is_subscribe_present_in_request && !isSubscribed_present_in_response) {
- return;
- }
-
- RCAppExtensionPtr extension = GetAppExtension(app());
- if (is_subscribe_present_in_request && !isSubscribed_present_in_response) {
- LOG4CXX_WARN(logger_,
- "conditional mandatory parameter "
- << kIsSubscribed << " missed in hmi response");
- response_params_[kIsSubscribed] =
- extension->IsSubscibedToInteriorVehicleData(
- request_params[kModuleType]);
- return;
- }
-
- if (!is_subscribe_present_in_request && isSubscribed_present_in_response) {
- LOG4CXX_WARN(logger_,
- "Parameter " << message_params::kIsSubscribed
- << " is ignored due to absence '"
- << message_params::kSubscribe
- << "' parameter in request");
- return;
- }
-
- const bool request_subscribe = request_params[kSubscribe].asBool();
- const bool response_subscribe =
- hmi_response[json_keys::kResult][message_params::kIsSubscribed].asBool();
- response_params_[message_params::kIsSubscribed] = response_subscribe;
- LOG4CXX_TRACE(logger_, "request_subscribe = " << request_subscribe);
- LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe);
- if (request_subscribe == response_subscribe) {
- if (response_subscribe) {
- LOG4CXX_DEBUG(logger_,
- "SubscribeToInteriorVehicleData "
- << app()->app_id() << " "
- << request_params[kModuleType].asString());
- extension->SubscribeToInteriorVehicleData(request_params[kModuleType]);
- } else {
- LOG4CXX_DEBUG(logger_,
- "UnsubscribeFromInteriorVehicleData "
- << app()->app_id() << " "
- << request_params[kModuleType].asString());
- extension->UnsubscribeFromInteriorVehicleData(
- request_params[kModuleType]);
- }
- }
-}
-
-bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription(
- const Json::Value& request_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- const bool is_subscribe_present_in_request =
- IsMember(request_params, kSubscribe);
- if (is_subscribe_present_in_request) {
- RCAppExtensionPtr extension = GetAppExtension(app());
- const bool is_app_already_subscribed =
- extension->IsSubscibedToInteriorVehicleData(
- request_params[kModuleType]);
- const bool app_wants_to_subscribe = request_params[kSubscribe].asBool();
- if (!app_wants_to_subscribe && !is_app_already_subscribed) {
- return true;
- }
- return app_wants_to_subscribe && is_app_already_subscribed;
- }
- return false;
-}
-
-void GetInteriorVehicleDataRequest::RemoveExcessiveSubscription(
- Json::Value& request_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- request_params.removeMember(kSubscribe);
-}
-
-std::string GetInteriorVehicleDataRequest::ModuleType(
- const Json::Value& message) {
- return message.get(message_params::kModuleType, "").asString();
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc b/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc
deleted file mode 100644
index fccd8392c7..0000000000
--- a/src/components/remote_control/src/commands/on_interior_vehicle_data_notification.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/on_interior_vehicle_data_notification.h"
-#include <algorithm>
-#include <vector>
-#include "json/json.h"
-#include "utils/make_shared.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_app_extension.h"
-
-namespace remote_control {
-
-namespace commands {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "OnInteriorVehicleDataNotification")
-
-OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : BaseCommandNotification(message, rc_module) {}
-
-OnInteriorVehicleDataNotification::~OnInteriorVehicleDataNotification() {}
-
-void OnInteriorVehicleDataNotification::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- Json::Value json;
-
- application_manager::MessagePtr msg = message();
-
- json = MessageHelper::StringToValue(msg->json_message());
-
- Json::Value module_type = ModuleType(json);
-
- typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs;
- AppPtrs apps = service_->GetApplications(rc_module_.GetModuleID());
-
- for (AppPtrs::iterator it = apps.begin(); it != apps.end(); ++it) {
- DCHECK(*it);
- application_manager::Application& app = **it;
-
- RCAppExtensionPtr extension =
- application_manager::AppExtensionPtr::static_pointer_cast<
- RCAppExtension>(app.QueryInterface(rc_module_.GetModuleID()));
- DCHECK(extension);
- LOG4CXX_TRACE(logger_, "Check subscription for " << app.app_id());
- if (extension->IsSubscibedToInteriorVehicleData(module_type)) {
- application_manager::MessagePtr message =
- utils::MakeShared<application_manager::Message>(*msg);
- message->set_message_type(
- application_manager::MessageType::kNotification);
- message->set_protocol_version(app.protocol_version());
- message->set_function_id(functional_modules::ON_INTERIOR_VEHICLE_DATA);
- message->set_function_name(MessageHelper::GetMobileAPIName(
- functional_modules::ON_INTERIOR_VEHICLE_DATA));
- message->set_connection_key(app.app_id());
- NotifyOneApplication(message);
- }
- }
-}
-
-std::string OnInteriorVehicleDataNotification::ModuleType(
- const Json::Value& message) {
- const Json::Value& module_data =
- message.get(message_params::kModuleData, Json::Value(Json::objectValue));
- return module_data.get(message_params::kModuleType, "").asString();
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc b/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc
deleted file mode 100644
index f18180aa21..0000000000
--- a/src/components/remote_control/src/commands/on_remote_control_settings_notification.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/on_remote_control_settings_notification.h"
-#include <algorithm>
-#include <vector>
-#include "json/json.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_app_extension.h"
-#include "functional_module/function_ids.h"
-
-namespace remote_control {
-
-namespace commands {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "OnRemoteControlSettingsNotification");
-
-OnRemoteControlSettingsNotification::OnRemoteControlSettingsNotification(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : BaseCommandNotification(message, rc_module) {}
-
-void UnsubscribeFromInteriorVehicleDataForAllModules(
- RCAppExtensionPtr extension) {
- LOG4CXX_AUTO_TRACE(logger_);
- const Json::Value climate(enums_value::kClimate);
- extension->UnsubscribeFromInteriorVehicleData(climate);
- const Json::Value radio(enums_value::kRadio);
- extension->UnsubscribeFromInteriorVehicleData(radio);
-}
-
-void OnRemoteControlSettingsNotification::DisallowRCFunctionality() {
- LOG4CXX_AUTO_TRACE(logger_);
- typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
- Apps apps = service_->GetApplications(rc_module_.GetModuleID());
- for (Apps::iterator it = apps.begin(); it != apps.end(); ++it) {
- application_manager::ApplicationSharedPtr app = *it;
- DCHECK(app);
- service_->ChangeNotifyHMILevel(app, mobile_apis::HMILevel::eType::HMI_NONE);
-
- const RCAppExtensionPtr extension =
- application_manager::AppExtensionPtr::static_pointer_cast<
- RCAppExtension>(app->QueryInterface(rc_module_.GetModuleID()));
- if (extension) {
- UnsubscribeFromInteriorVehicleDataForAllModules(extension);
- }
- }
-}
-
-void OnRemoteControlSettingsNotification::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
- const Json::Value value =
- MessageHelper::StringToValue(message()->json_message());
-
- if (!value.isMember(message_params::kAllowed)) {
- LOG4CXX_DEBUG(logger_,
- "Notification is ignored due to \"allow\" parameter absense");
- LOG4CXX_DEBUG(logger_, "RC Functionality remains unchanged");
- return;
- }
- ResourceAllocationManager& allocation_manager =
- rc_module_.resource_allocation_manager();
- const bool is_allowed = value[message_params::kAllowed].asBool();
- if (is_allowed) {
- hmi_apis::Common_RCAccessMode::eType access_mode =
- hmi_apis::Common_RCAccessMode::INVALID_ENUM;
- LOG4CXX_DEBUG(logger_, "Allowing RC Functionality");
- if (value.isMember(message_params::kAccessMode)) {
- const std::string access_mode_str =
- value.get(message_params::kAccessMode, enums_value::kAutoAllow)
- .asString();
-
- access_mode = MessageHelper::AccessModeFromString(access_mode_str);
- LOG4CXX_DEBUG(logger_, "Setting up access mode : " << access_mode_str);
- } else {
- access_mode = allocation_manager.GetAccessMode();
- LOG4CXX_DEBUG(logger_,
- "No access mode received. Using last known: "
- << MessageHelper::AccessModeToString(access_mode));
- }
- allocation_manager.SetAccessMode(access_mode);
- } else {
- LOG4CXX_DEBUG(logger_, "Disallowing RC Functionality");
- DisallowRCFunctionality();
- allocation_manager.ResetAllAllocations();
- }
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc b/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc
deleted file mode 100644
index 70fbd9280e..0000000000
--- a/src/components/remote_control/src/commands/set_interior_vehicle_data_request.cc
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/commands/set_interior_vehicle_data_request.h"
-#include <algorithm>
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "functional_module/function_ids.h"
-#include "json/json.h"
-#include "utils/helpers.h"
-
-namespace remote_control {
-
-namespace commands {
-
-using namespace json_keys;
-using namespace message_params;
-
-namespace {
-std::vector<std::string> GetModuleReadOnlyParams(
- const std::string& module_type) {
- std::vector<std::string> module_ro_params;
- if (enums_value::kClimate == module_type) {
- module_ro_params.push_back(kCurrentTemperature);
- } else if (enums_value::kRadio == module_type) {
- module_ro_params.push_back(kRdsData);
- module_ro_params.push_back(kAvailableHDs);
- module_ro_params.push_back(kSignalStrength);
- module_ro_params.push_back(kSignalChangeThreshold);
- module_ro_params.push_back(kState);
- }
- return module_ro_params;
-}
-
-const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
- std::map<std::string, std::string> mapping;
- // climate
- mapping["fanSpeed"] = "fanSpeedAvailable";
- mapping["currentTemperature"] = "currentTemperatureAvailable";
- mapping["desiredTemperature"] = "desiredTemperatureAvailable";
- mapping["acEnable"] = "acEnableAvailable";
- mapping["circulateAirEnable"] = "circulateAirEnableAvailable";
- mapping["autoModeEnable"] = "autoModeEnableAvailable";
- mapping["defrostZone"] = "defrostZoneAvailable";
- mapping["dualModeEnable"] = "dualModeEnableAvailable";
- mapping["acMaxEnable"] = "acMaxEnableAvailable";
- mapping["ventilationMode"] = "ventilationModeAvailable";
-
- // radio
- mapping["band"] = "radioBandAvailable";
- mapping["frequencyInteger"] = "radioFrequencyAvailable";
- mapping["frequencyFraction"] = "radioFrequencyAvailable";
- mapping["rdsData"] = "rdsDataAvailable";
- mapping["availableHDs"] = "availableHDsAvailable";
- mapping["hdChannel"] = "availableHDsAvailable";
- mapping["signalStrength"] = "signalStrengthAvailable";
- mapping["signalChangeThreshold"] = "signalChangeThresholdAvailable";
- mapping["radioEnable"] = "radioEnableAvailable";
- mapping["state"] = "stateAvailable";
-
- return mapping;
-}
-} // namespace
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "SetInteriorVehicleDataRequest")
-
-SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest(
- const application_manager::MessagePtr& message,
- RemotePluginInterface& rc_module)
- : BaseCommandRequest(message, rc_module) {}
-
-SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {}
-
-bool CheckControlDataByCapabilities(
- const smart_objects::SmartObject& module_caps,
- const Json::Value& control_data) {
- std::map<std::string, std::string> mapping =
- GetModuleDataToCapabilitiesMapping();
- Json::Value::Members control_data_keys = control_data.getMemberNames();
-
- Json::Value::Members::const_iterator it = control_data_keys.begin();
- for (; it != control_data_keys.end(); ++it) {
- const std::string& request_parameter = *it;
- const std::string& caps_key = mapping[request_parameter];
- const smart_objects::SmartObject& capabilities_status = module_caps[0];
- LOG4CXX_DEBUG(logger_,
- "Checking request parameter "
- << request_parameter
- << " with capabilities. Appropriate key is " << caps_key);
- if (!capabilities_status.keyExists(caps_key)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is missed in RemoteControl capabilities");
- return false;
- }
- if (!capabilities_status[caps_key].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is switched off in RemoteControl capabilities");
- return false;
- }
- }
- return true;
-}
-
-bool CheckIfModuleDataExistInCapabilities(
- const smart_objects::SmartObject& rc_capabilities,
- const Json::Value& module_data) {
- LOG4CXX_AUTO_TRACE(logger_);
- bool is_radio_data_valid = true;
- bool is_climate_data_valid = true;
- if (IsMember(module_data, kRadioControlData)) {
- if (!rc_capabilities.keyExists(strings::kradioControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Radio control capabilities not present");
- return false;
- }
- const smart_objects::SmartObject& radio_caps =
- rc_capabilities[strings::kradioControlCapabilities];
- is_radio_data_valid = CheckControlDataByCapabilities(
- radio_caps, module_data[strings::kRadioControlData]);
- }
- if (IsMember(module_data, kClimateControlData)) {
- if (!rc_capabilities.keyExists(strings::kclimateControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Climate control capabilities not present");
- return false;
- }
- const smart_objects::SmartObject& climate_caps =
- rc_capabilities[strings::kclimateControlCapabilities];
- is_climate_data_valid = CheckControlDataByCapabilities(
- climate_caps, module_data[strings::kClimateControlData]);
- }
-
- return is_radio_data_valid && is_climate_data_valid;
-}
-
-void SetInteriorVehicleDataRequest::Execute() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- Json::Value request_params =
- MessageHelper::StringToValue(message_->json_message());
- const Json::Value module_data = request_params[kModuleData];
- const std::string module_type = module_data[kModuleType].asString();
- bool module_type_and_data_match = true;
-
- if (enums_value::kRadio == module_type) {
- module_type_and_data_match = !IsMember(module_data, kClimateControlData);
- }
-
- if (enums_value::kClimate == module_type) {
- module_type_and_data_match = !IsMember(module_data, kRadioControlData);
- }
-
- if (module_type_and_data_match) {
- const smart_objects::SmartObject* capabilities =
- service()->GetRCCapabilities();
- if (capabilities &&
- !CheckIfModuleDataExistInCapabilities(*capabilities, module_data)) {
- LOG4CXX_WARN(logger_, "Accessing not supported module data");
- SendResponse(false,
- result_codes::kUnsupportedResource,
- "Accessing not supported module data");
- return;
- }
- if (AreAllParamsReadOnly(request_params)) {
- LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!");
- SendResponse(false,
- result_codes::kReadOnly,
- "All request params in module type are READ ONLY!");
- return;
- }
- if (AreReadOnlyParamsPresent(request_params)) {
- LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters");
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... ");
- CutOffReadOnlyParams(request_params);
- }
- application_manager::MessagePtr hmi_request = CreateHmiRequest(
- functional_modules::hmi_api::set_interior_vehicle_data, request_params);
- service()->RemoveHMIFakeParameters(hmi_request);
- SendMessageToHMI(hmi_request);
- } else {
- LOG4CXX_WARN(logger_, "Request module type & data mismatch!");
- SendResponse(false,
- result_codes::kInvalidData,
- "Request module type & data mismatch!");
- }
-}
-
-AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource(
- const Json::Value& message) {
- return rc_module_.resource_allocation_manager().AcquireResource(
- ModuleType(message), app()->app_id());
-}
-
-bool SetInteriorVehicleDataRequest::IsResourceFree(
- const std::string& module_type) const {
- return rc_module_.resource_allocation_manager().IsResourceFree(module_type);
-}
-
-void SetInteriorVehicleDataRequest::SetResourceState(
- const Json::Value& message, const ResourceState::eType state) {
- const std::string& module_type = ModuleType(message);
- const uint32_t app_id = app()->app_id();
-
- ResourceAllocationManager& allocation_manager =
- rc_module_.resource_allocation_manager();
-
- allocation_manager.SetResourceState(module_type, app_id, state);
-}
-
-bool SetInteriorVehicleDataRequest::AreReadOnlyParamsPresent(
- const Json::Value& request_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::vector<std::string> module_type_params = ControlData(request_params);
- std::vector<std::string>::iterator it = module_type_params.begin();
- std::vector<std::string> ro_params =
- GetModuleReadOnlyParams(ModuleType(request_params));
- for (; it != module_type_params.end(); ++it) {
- if (helpers::in_range(ro_params, *it)) {
- return true;
- }
- }
- return false;
-}
-
-void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
- Json::Value& request_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::vector<std::string> module_type_params = ControlData(request_params);
- std::vector<std::string>::iterator it = module_type_params.begin();
- const std::string module_type = ModuleType(request_params);
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type);
- for (; it != module_type_params.end(); ++it) {
- if (helpers::in_range(ro_params, *it)) {
- if (enums_value::kClimate == module_type) {
- request_params[message_params::kModuleData]
- [message_params::kClimateControlData].removeMember(*it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << *it);
- } else if (enums_value::kRadio == module_type) {
- request_params[message_params::kModuleData]
- [message_params::kRadioControlData].removeMember(*it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << *it);
- }
- }
- }
-}
-
-bool SetInteriorVehicleDataRequest::AreAllParamsReadOnly(
- const Json::Value& request_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::vector<std::string> module_type_params = ControlData(request_params);
- std::vector<std::string>::iterator it = module_type_params.begin();
- std::vector<std::string> ro_params =
- GetModuleReadOnlyParams(ModuleType(request_params));
- for (; it != module_type_params.end(); ++it) {
- if (!helpers::in_range(ro_params, *it)) {
- return false;
- }
- }
- return true;
-}
-
-void SetInteriorVehicleDataRequest::OnEvent(
- const rc_event_engine::Event<application_manager::MessagePtr, std::string>&
- event) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(
- (functional_modules::hmi_api::set_interior_vehicle_data == event.id()));
-
- application_manager::Message& hmi_response = *(event.event_message());
- if (application_manager::MessageValidationResult::SUCCESS !=
- service()->ValidateMessageBySchema(hmi_response)) {
- SendResponse(false, result_codes::kGenericError, "");
- return;
- }
-
- LOG4CXX_DEBUG(logger_, "HMI response is valid");
- const Json::Value value =
- MessageHelper::StringToValue(hmi_response.json_message());
-
- std::string result_code;
- std::string info;
-
- const bool is_response_successful = ParseResultCode(value, result_code, info);
-
- if (is_response_successful) {
- response_params_[message_params::kModuleData] =
- value[json_keys::kResult][message_params::kModuleData];
- }
-
- SendResponse(is_response_successful, result_code.c_str(), info);
-}
-
-std::string SetInteriorVehicleDataRequest::ModuleType(
- const Json::Value& message) {
- const Json::Value& module_data =
- message.get(message_params::kModuleData, Json::Value(Json::objectValue));
- return module_data.get(message_params::kModuleType, "").asString();
-}
-
-std::vector<std::string> SetInteriorVehicleDataRequest::ControlData(
- const Json::Value& message) {
- Json::Value data =
- message.get(message_params::kModuleData, Json::Value(Json::objectValue));
- std::string module = ModuleType(message);
- Json::Value params;
- if (module == enums_value::kRadio) {
- params = data.get(message_params::kRadioControlData,
- Json::Value(Json::objectValue));
- }
- if (module == enums_value::kClimate) {
- params = data.get(message_params::kClimateControlData,
- Json::Value(Json::objectValue));
- }
- return params.getMemberNames();
-}
-
-} // namespace commands
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/message_helper.cc b/src/components/remote_control/src/message_helper.cc
deleted file mode 100644
index 140e0a977a..0000000000
--- a/src/components/remote_control/src/message_helper.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- Copyright (c) 2017, 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 <string>
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_module_constants.h"
-#include "utils/make_shared.h"
-
-namespace remote_control {
-using functional_modules::RCFunctionID;
-namespace {
-std::map<RCFunctionID, std::string> GenerateAPINames() {
- std::map<RCFunctionID, std::string> result;
- result.insert(std::make_pair<RCFunctionID, std::string>(
- RCFunctionID::BUTTON_PRESS, "ButtonPress"));
- result.insert(std::make_pair<RCFunctionID, std::string>(
- RCFunctionID::GET_INTERIOR_VEHICLE_DATA, "GetInteriorVehicleData"));
- result.insert(std::make_pair<RCFunctionID, std::string>(
- RCFunctionID::SET_INTERIOR_VEHICLE_DATA, "SetInteriorVehicleData"));
- result.insert(std::make_pair<RCFunctionID, std::string>(
- RCFunctionID::ON_INTERIOR_VEHICLE_DATA, "OnInteriorVehicleData"));
- result.insert(std::make_pair<RCFunctionID, std::string>(
- RCFunctionID::ON_REMOTE_CONTROL_SETTINGS, "OnRemoteControlSettings"));
- return result;
-}
-
-std::map<std::string, hmi_apis::Common_RCAccessMode::eType> access_modes{
- {enums_value::kAutoAllow, hmi_apis::Common_RCAccessMode::AUTO_ALLOW},
- {enums_value::kAutoDeny, hmi_apis::Common_RCAccessMode::AUTO_DENY},
- {enums_value::kAskDriver, hmi_apis::Common_RCAccessMode::ASK_DRIVER}};
-}
-
-const std::map<RCFunctionID, std::string> MessageHelper::kMobileAPINames =
- GenerateAPINames();
-
-const std::string MessageHelper::GetMobileAPIName(RCFunctionID func_id) {
- std::map<RCFunctionID, std::string>::const_iterator it =
- kMobileAPINames.find(func_id);
- if (kMobileAPINames.end() != it) {
- return it->second;
- } else {
- return "";
- }
-}
-
-std::string MessageHelper::ValueToString(const Json::Value& value) {
- Json::FastWriter writer;
-
- return writer.write(value);
-}
-
-Json::Value MessageHelper::StringToValue(const std::string& string) {
- Json::Reader reader;
- Json::Value json;
-
- return reader.parse(string, json) ? json
- : Json::Value(Json::ValueType::nullValue);
-}
-
-bool IsMember(const Json::Value& value, const std::string& key) {
- if (!value.isObject()) {
- return false;
- }
-
- return value.isMember(key);
-}
-
-application_manager::MessagePtr MessageHelper::CreateHmiRequest(
- const char* function_id,
- const uint32_t hmi_app_id,
- const Json::Value& message_params,
- RemotePluginInterface& rc_module) {
- using namespace json_keys;
- Json::Value msg;
-
- msg[json_keys::kId] = rc_module.service()->GetNextCorrelationID();
-
- msg[json_keys::kJsonrpc] = "2.0";
- msg[json_keys::kMethod] = function_id;
- if (!message_params.isNull()) {
- msg[json_keys::kParams] = message_params;
- }
-
- msg[json_keys::kParams][json_keys::kAppId] = hmi_app_id;
-
- Json::FastWriter writer;
- application_manager::MessagePtr message_to_send =
- utils::MakeShared<application_manager::Message>(
- application_manager::Message(
- protocol_handler::MessagePriority::kDefault));
- message_to_send->set_protocol_version(
- protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
- message_to_send->set_correlation_id(msg[json_keys::kId].asInt());
- message_to_send->set_function_name(msg[json_keys::kMethod].asString());
- std::string json_msg = writer.write(msg);
- message_to_send->set_json_message(json_msg);
- message_to_send->set_message_type(application_manager::MessageType::kRequest);
-
- return message_to_send;
-}
-
-hmi_apis::Common_RCAccessMode::eType MessageHelper::AccessModeFromString(
- const std::string& access_mode) {
- std::map<std::string, hmi_apis::Common_RCAccessMode::eType>::const_iterator
- mode = access_modes.find(access_mode);
- return access_modes.end() != mode
- ? mode->second
- : hmi_apis::Common_RCAccessMode::INVALID_ENUM;
-}
-
-std::string MessageHelper::AccessModeToString(
- const hmi_apis::Common_RCAccessMode::eType access_mode) {
- std::map<std::string, hmi_apis::Common_RCAccessMode::eType>::const_iterator
- it = access_modes.begin();
- for (; access_modes.end() != it; ++it) {
- if (access_mode == it->second) {
- return it->first;
- }
- }
- const std::string error = "UNKNOW_ACCESS_MODE";
- DCHECK_OR_RETURN(false, error);
- return error;
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/module_helper.cc b/src/components/remote_control/src/module_helper.cc
deleted file mode 100644
index e69de29bb2..0000000000
--- a/src/components/remote_control/src/module_helper.cc
+++ /dev/null
diff --git a/src/components/remote_control/src/rc_app_extension.cc b/src/components/remote_control/src/rc_app_extension.cc
deleted file mode 100644
index 3431a713f9..0000000000
--- a/src/components/remote_control/src/rc_app_extension.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/rc_app_extension.h"
-
-namespace remote_control {
-RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid)
- : AppExtension(uid) {}
-
-void RCAppExtension::SubscribeToInteriorVehicleData(
- const Json::Value& module_type) {
- subscribed_interior_vehicle_data_.insert(module_type);
-}
-
-void RCAppExtension::UnsubscribeFromInteriorVehicleData(
- const Json::Value& module_type) {
- subscribed_interior_vehicle_data_.erase(module_type);
-}
-
-void RCAppExtension::UnsubscribeFromInteriorVehicleData() {
- subscribed_interior_vehicle_data_.clear();
-}
-
-bool RCAppExtension::IsSubscibedToInteriorVehicleData(
- const Json::Value& module_type) {
- std::set<Json::Value>::iterator it =
- subscribed_interior_vehicle_data_.find(module_type);
-
- return (it != subscribed_interior_vehicle_data_.end());
-}
-
-RCAppExtension::~RCAppExtension() {}
-} // namespace remote_control
diff --git a/src/components/remote_control/src/rc_command_factory.cc b/src/components/remote_control/src/rc_command_factory.cc
deleted file mode 100644
index 93b90b64ac..0000000000
--- a/src/components/remote_control/src/rc_command_factory.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- Copyright (c) 2017, 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 "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "remote_control/rc_command_factory.h"
-#include "functional_module/function_ids.h"
-#include "remote_control/commands/get_interior_vehicle_data_request.h"
-#include "remote_control/commands/set_interior_vehicle_data_request.h"
-#include "remote_control/commands/button_press_request.h"
-#include "remote_control/commands/on_interior_vehicle_data_notification.h"
-#include "remote_control/commands/on_remote_control_settings_notification.h"
-
-namespace remote_control {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControl")
-
-using functional_modules::RCFunctionID;
-
-utils::SharedPtr<commands::Command> RCCommandFactory::CreateCommand(
- const application_manager::MessagePtr& msg,
- RemotePluginInterface& rc_module) {
- switch (msg->function_id()) {
- case RCFunctionID::GET_INTERIOR_VEHICLE_DATA: {
- return utils::MakeShared<commands::GetInteriorVehicleDataRequest>(
- msg, rc_module);
- break;
- }
- case RCFunctionID::SET_INTERIOR_VEHICLE_DATA: {
- return utils::MakeShared<commands::SetInteriorVehicleDataRequest>(
- msg, rc_module);
- break;
- }
- case RCFunctionID::BUTTON_PRESS: {
- return utils::MakeShared<commands::ButtonPressRequest>(msg, rc_module);
- break;
- }
- case RCFunctionID::ON_INTERIOR_VEHICLE_DATA: {
- return utils::MakeShared<commands::OnInteriorVehicleDataNotification>(
- msg, rc_module);
- break;
- }
- case RCFunctionID::ON_REMOTE_CONTROL_SETTINGS: {
- return utils::MakeShared<commands::OnRemoteControlSettingsNotification>(
- msg, rc_module);
- break;
- }
- default: {
- utils::SharedPtr<commands::Command> invalid_command;
- LOG4CXX_DEBUG(logger_,
- "RSDL unable to proces function " << msg->function_id());
- return invalid_command;
- }
- }
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/remote_control_event.cc b/src/components/remote_control/src/remote_control_event.cc
deleted file mode 100644
index e4f887ffc6..0000000000
--- a/src/components/remote_control/src/remote_control_event.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/remote_control_event.h"
-
-namespace remote_control {
-
-RCPluginEvent::RCPluginEvent(application_manager::MessagePtr& message,
- const std::string& id)
- : rc_event_engine::Event<application_manager::MessagePtr, std::string>(
- message, id) {}
-
-RCPluginEvent::~RCPluginEvent() {}
-
-int32_t RCPluginEvent::event_message_function_id() const {
- return event_message_->function_id();
-}
-
-int32_t RCPluginEvent::event_message_correlation_id() const {
- return event_message_->correlation_id();
-}
-
-int32_t RCPluginEvent::event_message_type() const {
- return event_message_->type();
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/remote_control_plugin.cc b/src/components/remote_control/src/remote_control_plugin.cc
deleted file mode 100644
index c885d724ad..0000000000
--- a/src/components/remote_control/src/remote_control_plugin.cc
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- Copyright (c) 2017, 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 "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/message_helper.h"
-#include "utils/logger.h"
-#include "interfaces/MOBILE_API.h"
-#include "utils/macro.h"
-#include "utils/make_shared.h"
-#include "application_manager/smart_object_keys.h"
-
-namespace remote_control {
-
-using functional_modules::ProcessResult;
-using functional_modules::GenericModule;
-using functional_modules::PluginInfo;
-using functional_modules::RCFunctionID;
-namespace hmi_api = functional_modules::hmi_api;
-
-using namespace json_keys;
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControl");
-
-EXPORT_FUNCTION_IMPL(remote_control::RemoteControlPlugin);
-
-RemoteControlPlugin::RemoteControlPlugin()
- : is_scan_started_(false), resource_allocation_manager_(*this) {
- plugin_info_.name = "RemoteControlPlugin";
- plugin_info_.version = 1;
- SubscribeOnFunctions();
-}
-
-void RemoteControlPlugin::SubscribeOnFunctions() {
- plugin_info_.rc_function_list.push_back(RCFunctionID::BUTTON_PRESS);
- plugin_info_.rc_function_list.push_back(
- RCFunctionID::GET_INTERIOR_VEHICLE_DATA);
- plugin_info_.rc_function_list.push_back(
- RCFunctionID::SET_INTERIOR_VEHICLE_DATA);
- plugin_info_.rc_function_list.push_back(
- RCFunctionID::ON_INTERIOR_VEHICLE_DATA);
-
- plugin_info_.hmi_function_list.push_back(hmi_api::get_interior_vehicle_data);
- plugin_info_.hmi_function_list.push_back(hmi_api::set_interior_vehicle_data);
- plugin_info_.hmi_function_list.push_back(hmi_api::on_interior_vehicle_data);
- plugin_info_.hmi_function_list.push_back(hmi_api::button_press);
- plugin_info_.hmi_function_list.push_back(hmi_api::get_user_consent);
- plugin_info_.hmi_function_list.push_back(hmi_api::on_remote_control_settings);
-}
-
-RemoteControlPlugin::~RemoteControlPlugin() {
- RemoveAppExtensions();
-}
-
-functional_modules::PluginInfo RemoteControlPlugin::GetPluginInfo() const {
- return plugin_info_;
-}
-
-const std::string ExtractFunctionAndAddMetadata(
- const Json::Value& value, application_manager::Message& out_msg) {
- if (value.isMember(json_keys::kMethod)) {
- const std::string& function_name =
- value.get(json_keys::kMethod, "").asCString();
-
- // Existence of method name must be guaranteed by plugin manager
- DCHECK_OR_RETURN(!function_name.empty(), "");
-
- if (value.isMember(json_keys::kId)) {
- out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt());
- out_msg.set_message_type(application_manager::MessageType::kRequest);
- } else {
- out_msg.set_message_type(application_manager::MessageType::kNotification);
- }
- return function_name;
- }
-
- if (value.isMember(json_keys::kResult)) {
- const Json::Value& result = value.get(json_keys::kResult, Json::Value());
- const std::string& function_name =
- result.get(json_keys::kMethod, "").asCString();
- out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt());
-
- // Existence of method name must be guaranteed by plugin manager
- DCHECK_OR_RETURN(!function_name.empty(), "");
-
- out_msg.set_message_type(application_manager::MessageType::kResponse);
- return function_name;
- }
-
- if (value.isMember(json_keys::kError)) {
- const Json::Value& error = value.get(json_keys::kError, Json::Value());
- const Json::Value& data = error.get(json_keys::kData, Json::Value());
- const std::string& function_name =
- data.get(json_keys::kMethod, "").asCString();
-
- // Existence of method name must be guaranteed by plugin manager
- DCHECK_OR_RETURN(!function_name.empty(), "");
-
- out_msg.set_message_type(application_manager::MessageType::kErrorResponse);
- out_msg.set_correlation_id(value.get(json_keys::kId, "").asInt());
- return function_name;
- }
- return std::string();
-}
-
-ProcessResult RemoteControlPlugin::ProcessMessage(
- application_manager::MessagePtr msg) {
- DCHECK_OR_RETURN(msg, ProcessResult::FAILED);
-
- const std::string& function_name = MessageHelper::GetMobileAPIName(
- static_cast<functional_modules::RCFunctionID>(msg->function_id()));
-
- LOG4CXX_DEBUG(logger_, "Function name to set : " << function_name);
- msg->set_function_name(function_name);
-
- LOG4CXX_DEBUG(logger_, "Mobile message: " << msg->json_message());
-
- request_controller::MobileRequestPtr command(
- RCCommandFactory::CreateCommand(msg, *this));
- if (command) {
- request_controller_.AddRequest(msg->correlation_id(), command);
- command->Run();
- } else {
- return ProcessResult::CANNOT_PROCESS;
- }
-
- return ProcessResult::PROCESSED;
-}
-
-ProcessResult RemoteControlPlugin::ProcessHMIMessage(
- application_manager::MessagePtr msg) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- Json::Value value;
- Json::Reader reader;
- reader.parse(msg->json_message(), value);
- LOG4CXX_TRACE(logger_, "Process " << msg->json_message());
- const std::string& function_name = ExtractFunctionAndAddMetadata(value, *msg);
-
- // Existence of method name must be guaranteed by plugin manager
- DCHECK_OR_RETURN(!function_name.empty(), ProcessResult::FAILED);
-
- LOG4CXX_DEBUG(logger_, "Process " << function_name);
-
- switch (msg->type()) {
- case application_manager::MessageType::kResponse:
- case application_manager::MessageType::kErrorResponse: {
- RCPluginEvent event(msg, function_name);
- LOG4CXX_DEBUG(logger_, "Response received");
- event_dispatcher_.raise_event(event);
- return ProcessResult::PROCESSED;
- }
- case application_manager::MessageType::kRequest:
- case application_manager::MessageType::kNotification: {
- if (hmi_api::on_interior_vehicle_data == function_name) {
- msg->set_function_id(functional_modules::ON_INTERIOR_VEHICLE_DATA);
- }
- if (hmi_api::on_remote_control_settings == function_name) {
- msg->set_function_id(functional_modules::ON_REMOTE_CONTROL_SETTINGS);
- }
- const application_manager::MessageValidationResult validation_result =
- service()->ValidateMessageBySchema(*msg);
- utils::SharedPtr<commands::Command> command =
- RCCommandFactory::CreateCommand(msg, *this);
- if ((validation_result ==
- application_manager::MessageValidationResult::SUCCESS) &&
- command) {
- command->Run();
- return ProcessResult::PROCESSED;
- }
- LOG4CXX_DEBUG(logger_, "Message validation failed");
- break;
- }
- default: { LOG4CXX_DEBUG(logger_, "Unknown message type"); }
- }
- return ProcessResult::CANNOT_PROCESS;
-}
-
-void RemoteControlPlugin::SendHmiStatusNotification(
- application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
- application_manager::MessagePtr msg = new application_manager::Message(
- protocol_handler::MessagePriority::kDefault);
- Json::Value msg_params;
-
- msg->set_function_id(mobile_apis::FunctionID::OnHMIStatusID);
- msg->set_message_type(application_manager::MessageType::kNotification);
-
- msg->set_connection_key(app->app_id());
- msg->set_protocol_version(app->protocol_version());
-
- msg_params["hmiLevel"] = static_cast<uint32_t>(app->hmi_level());
-
- msg_params["audioStreamingState"] =
- static_cast<uint32_t>(app->audio_streaming_state());
-
- msg_params["systemContext"] = static_cast<uint32_t>(app->system_context());
-
- msg->set_json_message(MessageHelper::ValueToString(msg_params));
-
- service()->SendMessageToMobile(msg);
-}
-
-void RemoteControlPlugin::SendResponseToMobile(
- application_manager::MessagePtr msg) {
- LOG4CXX_DEBUG(logger_, "Response to mobile: " << msg->json_message());
- service()->SendMessageToMobile(msg);
- request_controller_.DeleteRequest(msg->correlation_id());
-}
-
-void RemoteControlPlugin::SendTimeoutResponseToMobile(
- application_manager::MessagePtr msg) {
- LOG4CXX_DEBUG(
- logger_,
- "Timeout is expired. Response to mobile: " << msg->json_message());
- service()->SendMessageToMobile(msg);
-}
-
-void RemoteControlPlugin::RemoveAppExtensions() {
- std::vector<application_manager::ApplicationSharedPtr> applications =
- service()->GetApplications(GetModuleID());
-
- std::vector<application_manager::ApplicationSharedPtr>::iterator it =
- applications.begin();
-
- for (; it != applications.end(); ++it) {
- application_manager::ApplicationSharedPtr app = *it;
- if (app) {
- app->RemoveExtension(GetModuleID());
- }
- }
-}
-
-void RemoteControlPlugin::RemoveAppExtension(uint32_t app_id) {
- application_manager::ApplicationSharedPtr app =
- service()->GetApplication(app_id);
-
- if (app) {
- app->RemoveExtension(GetModuleID());
- }
-}
-
-bool RemoteControlPlugin::IsAppForPlugin(
- application_manager::ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
- application_manager::AppExtensionPtr app_extension =
- app->QueryInterface(GetModuleID());
- if (app_extension) {
- return true;
- }
-
- if (service()->IsRemoteControlApplication(app)) {
- RCAppExtensionPtr rc_app_extension = new RCAppExtension(GetModuleID());
- app->AddExtension(rc_app_extension);
- return true;
- }
- return false;
-}
-
-void RemoteControlPlugin::OnAppHMILevelChanged(
- application_manager::ApplicationSharedPtr app,
- mobile_apis::HMILevel::eType) {
- LOG4CXX_DEBUG(logger_,
- "RSDL application " << app->name().AsMBString()
- << " has changed hmi level to "
- << app->hmi_level());
- service()->NotifyHMIAboutHMILevel(app, app->hmi_level());
-}
-
-void RemoteControlPlugin::OnPluginServiceChanged() {
- LOG4CXX_AUTO_TRACE(logger_);
- const functional_modules::TimeUnit timeout_msec =
- service()->GetSettings().default_timeout();
- request_controller_.SetRequestTimeout(timeout_msec / 1000);
-}
-
-void RemoteControlPlugin::set_service(application_manager::ServicePtr service) {
- RemotePluginInterface::set_service(service);
- OnPluginServiceChanged();
-}
-
-RCEventDispatcher& RemoteControlPlugin::event_dispatcher() {
- return event_dispatcher_;
-}
-
-ResourceAllocationManager& RemoteControlPlugin::resource_allocation_manager() {
- return resource_allocation_manager_;
-}
-
-void RemoteControlPlugin::OnApplicationEvent(
- functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (false == service()->IsRemoteControlApplication(application)) {
- LOG4CXX_DEBUG(logger_,
- "Application " << application->app_id()
- << " has no remote control functionality."
- << " Event will be ignored for RC plugin");
- return;
- }
- resource_allocation_manager_.OnApplicationEvent(event, application);
-}
-
-void RemoteControlPlugin::OnPolicyEvent(functional_modules::PolicyEvent event) {
- LOG4CXX_AUTO_TRACE(logger_);
- resource_allocation_manager_.OnPolicyEvent(event);
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/src/request_controller.cc b/src/components/remote_control/src/request_controller.cc
deleted file mode 100644
index 9ffc639898..0000000000
--- a/src/components/remote_control/src/request_controller.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/request_controller.h"
-#include "json/json.h"
-#include "utils/logger.h"
-
-namespace remote_control {
-namespace request_controller {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RCRequestController")
-
-RequestController::RequestController() {
- timer_.AddObserver(this);
- time_director_.RegisterTimer(timer_);
-}
-
-RequestController::~RequestController() {
- time_director_.UnregisterTimer(timer_);
- timer_.RemoveObserver(this);
-}
-
-void RequestController::AddRequest(const uint32_t mobile_correlation_id,
- MobileRequestPtr request) {
- // TODO(VS) Research and fix be problem with overlap correlation ids from two
- // different apllications(on two different mobile devices)
- sync_primitives::AutoLock lock(mobile_request_lock_);
- LOG4CXX_DEBUG(logger_,
- "Add request with correlation_id: " << mobile_correlation_id);
- mobile_request_list_[mobile_correlation_id] = request;
- // TODO(VS): add app id
- timer_.AddTrackable(TrackableMessage(0, mobile_correlation_id));
- time_director_.ResetTimer(timer_);
-}
-
-void RequestController::DeleteRequest(const uint32_t& mobile_correlation_id) {
- sync_primitives::AutoLock lock(mobile_request_lock_);
- LOG4CXX_DEBUG(
- logger_, "Delete request with correlation_id: " << mobile_correlation_id);
- mobile_request_list_.erase(mobile_correlation_id);
- // TODO(VS): add app id
- timer_.RemoveTrackable(TrackableMessage(0, mobile_correlation_id));
-}
-
-void RequestController::OnTimeoutTriggered(const TrackableMessage& expired) {
- sync_primitives::AutoLock lock(mobile_request_lock_);
- LOG4CXX_DEBUG(logger_,
- "Timeout is expired for request with correlation_id: "
- << expired.correlation_id());
- std::map<correlation_id, MobileRequestPtr>::iterator it =
- mobile_request_list_.find(expired.correlation_id());
- if (mobile_request_list_.end() == it) {
- // no corresponding request found, error.
- return;
- }
- it->second->OnTimeout();
- mobile_request_list_.erase(it);
-}
-
-void RequestController::SetRequestTimeout(
- const functional_modules::TimeUnit timeout_seconds) {
- LOG4CXX_DEBUG(logger_, "RC request timeout is set to " << timeout_seconds);
- timer_.set_period(timeout_seconds);
-}
-
-} // namespace request_controller
-} // namespace remote_control
diff --git a/src/components/remote_control/src/resource_allocation_manager_impl.cc b/src/components/remote_control/src/resource_allocation_manager_impl.cc
deleted file mode 100644
index 233cc79764..0000000000
--- a/src/components/remote_control/src/resource_allocation_manager_impl.cc
+++ /dev/null
@@ -1,377 +0,0 @@
-#include "remote_control/resource_allocation_manager_impl.h"
-#include "application_manager/application.h"
-#include "application_manager/message_helper.h"
-#include "remote_control/rc_module_constants.h"
-#include "json/json.h"
-#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_app_extension.h"
-
-namespace remote_control {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
-
-ResourceAllocationManagerImpl::ResourceAllocationManagerImpl(
- RemotePluginInterface& rc_plugin)
- : current_access_mode_(hmi_apis::Common_RCAccessMode::AUTO_ALLOW)
- , rc_plugin_(rc_plugin) {}
-
-ResourceAllocationManagerImpl::~ResourceAllocationManagerImpl() {}
-
-AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
- const std::string& module_type, const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- const application_manager::ApplicationSharedPtr acquiring_app =
- rc_plugin_.service()->GetApplication(app_id);
- if (!acquiring_app) {
- LOG4CXX_WARN(logger_, "App with app_id: " << app_id << "does not exist!");
- return AcquireResult::IN_USE;
- }
-
- sync_primitives::AutoLock lock(allocated_resources_lock_);
- const AllocatedResources::const_iterator allocated_it =
- allocated_resources_.find(module_type);
- if (allocated_resources_.end() == allocated_it) {
- allocated_resources_[module_type] = app_id;
- LOG4CXX_DEBUG(logger_,
- "Resource is not acquired yet. "
- << "App: " << app_id << " is allowed to acquire "
- << module_type);
- return AcquireResult::ALLOWED;
- }
-
- if (app_id == allocated_resources_[module_type]) {
- LOG4CXX_DEBUG(logger_,
- "App: " << app_id << " is already acquired resource "
- << module_type);
- return AcquireResult::ALLOWED;
- }
-
- if (IsModuleTypeRejected(module_type, app_id)) {
- LOG4CXX_DEBUG(logger_,
- "Driver disallowed app: " << app_id << " to acquire "
- << module_type);
- return AcquireResult::REJECTED;
- }
-
- const mobile_apis::HMILevel::eType acquiring_app_hmi_level =
- acquiring_app->hmi_level();
-
- if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) {
- LOG4CXX_DEBUG(
- logger_,
- "Aquiring resources is not allowed in HMI level: "
- << application_manager::MessageHelper::StringifiedHMILevel(
- acquiring_app_hmi_level) << ". App: " << app_id
- << " is disallowed to acquire " << module_type);
- return AcquireResult::REJECTED;
- }
-
- switch (current_access_mode_) {
- case hmi_apis::Common_RCAccessMode::AUTO_DENY: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is AUTO_DENY. "
- << "App: " << app_id << " is disallowed to acquire "
- << module_type);
- return AcquireResult::IN_USE;
- }
- case hmi_apis::Common_RCAccessMode::ASK_DRIVER: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is ASK_DRIVER. "
- "Driver confirmation is required for app: "
- << app_id << " to acquire " << module_type);
- return AcquireResult::ASK_DRIVER;
- }
- case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: {
- LOG4CXX_DEBUG(logger_,
- "Current access_mode is AUTO_ALLOW. "
- << "App: " << app_id << " is allowed to acquire "
- << module_type);
-
- allocated_resources_[module_type] = app_id;
- return AcquireResult::ALLOWED;
- }
- default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); }
- }
-}
-
-void ResourceAllocationManagerImpl::ReleaseResource(
- const std::string& module_type, const uint32_t application_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Release " << module_type << " by " << application_id);
- AllocatedResources::const_iterator allocation =
- allocated_resources_.find(module_type);
- if (allocated_resources_.end() == allocation) {
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is not allocated.");
- return;
- }
-
- if (application_id != allocation->second) {
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type
- << " is allocated by different application "
- << allocation->second);
- return;
- }
-
- allocated_resources_.erase(allocation);
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is released.");
- return;
-}
-
-void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
- typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
- Apps app_list =
- rc_plugin_.service()->GetApplications(rc_plugin_.GetModuleID());
- Apps::const_iterator app = app_list.begin();
- for (; app_list.end() != app; ++app) {
- application_manager::ApplicationSharedPtr app_ptr = *app;
- const uint32_t application_id = app_ptr->app_id();
- Resources acquired_modules = GetAcquiredResources(application_id);
- std::sort(acquired_modules.begin(), acquired_modules.end());
-
- Resources allowed_modules;
- rc_plugin_.service()->GetModuleTypes((*app)->policy_app_id(),
- &allowed_modules);
- std::sort(allowed_modules.begin(), allowed_modules.end());
-
- LOG4CXX_DEBUG(logger_,
- "Acquired modules: " << acquired_modules.size()
- << " , allowed modules: "
- << allowed_modules.size());
-
- Resources disallowed_modules;
- std::set_difference(acquired_modules.begin(),
- acquired_modules.end(),
- allowed_modules.begin(),
- allowed_modules.end(),
- std::back_inserter(disallowed_modules));
-
- RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr);
- Resources::const_iterator module = disallowed_modules.begin();
- for (; disallowed_modules.end() != module; ++module) {
- ReleaseResource(*module, application_id);
- if (rc_extention) {
- rc_extention->UnsubscribeFromInteriorVehicleData(Json::Value(*module));
- }
- }
- }
-}
-
-RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention(
- application_manager::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- RCAppExtensionPtr rc_app_extension;
- if (!application) {
- return rc_app_extension;
- }
-
- application_manager::AppExtensionPtr app_extension =
- application->QueryInterface(rc_plugin_.GetModuleID());
- if (!app_extension) {
- return rc_app_extension;
- }
-
- rc_app_extension =
- application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>(
- app_extension);
-
- return rc_app_extension;
-}
-
-void ResourceAllocationManagerImpl::RemoveAppsSubscriptions(const Apps& apps) {
- LOG4CXX_AUTO_TRACE(logger_);
- Apps::const_iterator app = apps.begin();
- for (; apps.end() != app; ++app) {
- application_manager::ApplicationSharedPtr app_ptr = *app;
- if (!app_ptr) {
- continue;
- }
- RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr);
- if (rc_extention) {
- rc_extention->UnsubscribeFromInteriorVehicleData();
- }
- }
-}
-
-std::vector<std::string> ResourceAllocationManagerImpl::GetAcquiredResources(
- const uint32_t application_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
- Resources allocated_resources;
- AllocatedResources::const_iterator allocation = allocated_resources_.begin();
- for (; allocated_resources_.end() != allocation; ++allocation) {
- if (application_id == allocation->second) {
- allocated_resources.push_back(allocation->first);
- }
- }
-
- LOG4CXX_DEBUG(logger_,
- "Application " << application_id << " acquired "
- << allocated_resources.size()
- << " resource(s).");
-
- return allocated_resources;
-}
-
-void ResourceAllocationManagerImpl::SetResourceState(
- const std::string& module_type,
- const uint32_t app_id,
- const ResourceState::eType state) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Setting state for " << module_type << " by app_id " << app_id
- << " to state " << state);
- {
- sync_primitives::AutoLock lock(allocated_resources_lock_);
- const AllocatedResources::const_iterator allocated_it =
- allocated_resources_.find(module_type);
-
- const bool acquired = allocated_resources_.end() != allocated_it;
- if (acquired) {
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " is already acquired."
- << " Owner application id is "
- << allocated_it->second
- << " Changing application id is " << app_id);
- } else {
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " is not acquired yet");
- }
- }
-
- sync_primitives::AutoLock lock(resources_state_lock_);
- resources_state_[module_type] = state;
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " got state " << state);
-}
-
-bool ResourceAllocationManagerImpl::IsResourceFree(
- const std::string& module_type) const {
- LOG4CXX_AUTO_TRACE(logger_);
-
- sync_primitives::AutoLock lock(resources_state_lock_);
- const ResourcesState::const_iterator resource =
- resources_state_.find(module_type);
-
- if (resources_state_.end() == resource) {
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is free.");
- return true;
- }
-
- LOG4CXX_DEBUG(logger_,
- "Resource " << module_type << " state is " << resource->second);
-
- return ResourceState::FREE == resource->second;
-}
-
-void ResourceAllocationManagerImpl::SetAccessMode(
- const hmi_apis::Common_RCAccessMode::eType access_mode) {
- if (hmi_apis::Common_RCAccessMode::ASK_DRIVER != access_mode) {
- sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
- rejected_resources_for_application_.clear();
- }
- current_access_mode_ = access_mode;
-}
-
-hmi_apis::Common_RCAccessMode::eType
-ResourceAllocationManagerImpl::GetAccessMode() const {
- return current_access_mode_;
-}
-
-void ResourceAllocationManagerImpl::ForceAcquireResource(
- const std::string& module_type, const uint32_t app_id) {
- LOG4CXX_DEBUG(logger_, "Force " << app_id << " acquiring " << module_type);
- sync_primitives::AutoLock lock(allocated_resources_lock_);
- allocated_resources_[module_type] = app_id;
-}
-
-bool ResourceAllocationManagerImpl::IsModuleTypeRejected(
- const std::string& module_type, const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
- RejectedResources::iterator it =
- rejected_resources_for_application_.find(app_id);
-
- if (rejected_resources_for_application_.end() == it) {
- return false;
- }
-
- const std::vector<std::string>& list_of_rejected_resources =
- rejected_resources_for_application_[app_id];
-
- return helpers::in_range(list_of_rejected_resources, module_type);
-}
-
-void ResourceAllocationManagerImpl::OnDriverDisallowed(
- const std::string& module_type, const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
- RejectedResources::iterator it =
- rejected_resources_for_application_.find(app_id);
-
- if (rejected_resources_for_application_.end() == it) {
- rejected_resources_for_application_[app_id] = std::vector<std::string>();
- }
- std::vector<std::string>& list_of_rejected_resources =
- rejected_resources_for_application_[app_id];
- list_of_rejected_resources.push_back(module_type);
-}
-
-void ResourceAllocationManagerImpl::OnApplicationEvent(
- functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "Event " << event << " came for " << application->app_id());
-
- if (functional_modules::ApplicationEvent::kApplicationExit == event ||
- functional_modules::ApplicationEvent::kApplicationUnregistered == event) {
- Resources acquired_modules = GetAcquiredResources(application->app_id());
- Resources::const_iterator module = acquired_modules.begin();
- for (; acquired_modules.end() != module; ++module) {
- ReleaseResource(*module, application->app_id());
- }
-
- Apps app_list;
- app_list.push_back(application);
- RemoveAppsSubscriptions(app_list);
- }
-}
-
-void ResourceAllocationManagerImpl::OnPolicyEvent(
- functional_modules::PolicyEvent event) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Event " << event);
-
- if (functional_modules::PolicyEvent::kApplicationPolicyUpdated == event) {
- ProcessApplicationPolicyUpdate();
- return;
- }
-
- if (functional_modules::PolicyEvent::kApplicationsDisabled == event) {
- ResetAllAllocations();
- application_manager::ServicePtr s = rc_plugin_.service();
- Apps app_list = s->GetApplications(rc_plugin_.GetModuleID());
- RemoveAppsSubscriptions(app_list);
- return;
- }
-}
-
-void ResourceAllocationManagerImpl::ResetAllAllocations() {
- LOG4CXX_AUTO_TRACE(logger_);
- {
- sync_primitives::AutoLock lock(resources_state_lock_);
- resources_state_.clear();
- }
- {
- sync_primitives::AutoLock lock(allocated_resources_lock_);
- allocated_resources_.clear();
- }
- {
- sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
- rejected_resources_for_application_.clear();
- }
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/test/CMakeLists.txt b/src/components/remote_control/test/CMakeLists.txt
deleted file mode 100644
index 6457b56397..0000000000
--- a/src/components/remote_control/test/CMakeLists.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-include_directories (
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${GMOCK_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/functional_module/include/
- ${CMAKE_SOURCE_DIR}/src/components/functional_module/test/
- ${CMAKE_SOURCE_DIR}/src/components/remote_control/include/
- ${CMAKE_SOURCE_DIR}/src/components/remote_control/test/include/
- ${CMAKE_SOURCE_DIR}/src/components/include/
- ${CMAKE_SOURCE_DIR}/src/components/application_manager/test/include/
- ${CMAKE_SOURCE_DIR}/src/components/connection_handler/include/
- ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include/
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/usage_statistics/include/
- ${JSONCPP_INCLUDE_DIRECTORY}
- ${CMAKE_BINARY_DIR}/src/components/
- include/
-)
-
-set (SOURCES
- src/rc_module_test.cc
- src/rc_app_extension_test.cc
- src/resource_allocation_manager_impl_test.cc
- ${CMAKE_SOURCE_DIR}/src/components/application_manager/test/mock_message_helper.cc
-)
-
-set (LIBRARIES
- gtest
- gmock
- gmock_main
- RemoteControlModule
- SmartObjects
- gcov
- Policy
-)
-
-if (ENABLE_TEST_COV_COUNT)
- set(GCOV_FLAGS "-ftest-coverage -fprofile-arcs")
-else()
- set(GCOV_FLAGS "")
-endif()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCOV_FLAGS}")
-
-# use, i.e. don't skip the full RPATH for the build tree
-#SET(CMAKE_SKIP_BUILD_RPATH FALSE)
-
-# when building, don't use the install RPATH already
-# (but later on when installing)
-#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-
-#SET(RPATH_DIRECTORIES
-# ${CMAKE_BINARY_DIR}/src/components/remote_control/
-# /usr/local/lib
-# /usr/local
-# ${CMAKE_BINARY_DIR}/src/components/utils
-#)
-
-#SET(CMAKE_INSTALL_RPATH "${RPATH_DIRECTORIES}")
-
-add_custom_command(
-OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so
- COMMAND ${CMAKE_COMMAND} -E
- copy ${COMPONENTS_DIR}/policy/libPolicy.so ${CMAKE_CURRENT_BINARY_DIR})
- set(CMAKE_EXE_LINKER_FLAGS
- "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}")
-
-create_test("remote_control_test" "${SOURCES}" "${LIBRARIES}")
-add_subdirectory(commands)
diff --git a/src/components/remote_control/test/commands/CMakeLists.txt b/src/components/remote_control/test/commands/CMakeLists.txt
deleted file mode 100644
index 09c706fc2f..0000000000
--- a/src/components/remote_control/test/commands/CMakeLists.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (c) 2017, 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(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
-
-include_directories(
- ${GMOCK_INCLUDE_DIRECTORY}
- ${COMPONENTS_DIR}/remote_control/include/
- ${COMPONENTS_DIR}/remote_control/include/remote_control/
- ${COMPONENTS_DIR}/remote_control/include/remote_control/commands/
- ${COMPONENTS_DIR}/remote_control/test/include
-)
-
-set(RC_COMMANDS_TEST_DIR ${RC_TEST_DIR}/commands)
-
-file(GLOB SOURCES
- ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
- ${RC_COMMANDS_TEST_DIR}/*
-)
-
-set(LIBRARIES
- gmock
- RemoteControlModule
- Utils
- SmartObjects
- jsoncpp
- HMI_API
- MOBILE_API
- ApplicationManager
- AMHMICommandsLibrary
- AMMobileCommandsLibrary
- connectionHandler
-)
-
-create_test("rc_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/remote_control/test/commands/button_press_request_test.cc b/src/components/remote_control/test/commands/button_press_request_test.cc
deleted file mode 100644
index 06a48fc077..0000000000
--- a/src/components/remote_control/test/commands/button_press_request_test.cc
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/commands/button_press_request.h"
-#include "gtest/gtest.h"
-#include "mock_remote_control_plugin.h"
-#include "mock_application.h"
-#include "mock_resource_allocation_manager.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "remote_control/rc_module_constants.h"
-#include "functional_module/function_ids.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using test::components::remote_control_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::protocol_handler::MessagePriority;
-using remote_control::RemotePluginInterface;
-using remote_control::MessageHelper;
-
-namespace {
-const int kModuleId = 153;
-
-const std::string kCorrectMobileRequest =
- "{\"moduleType\":\"CLIMATE\",\"buttonName\":\"AC\",\"buttonPressMode\":"
- "\"SHORT\"}";
-const std::string kWrongMobileRequest =
- "{\"moduleType\":\"RADIO\",\"buttonName\":\"AC\",\"buttonPressMode\":"
- "\"SHORT\"}";
-const std::string kValidHmiResponse =
- "{\"result\":{\"code\":0,\"method\":\"Buttons.ButtonPress\"},\"id\":31,"
- "\"jsonrpc\":\"2.0\"} ";
-const std::string KReadOnlyHmiResponse =
- "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":26,\"data\":{\"method\":"
- "\"Buttons.ButtonPress\"},\"message\":\"Read only parameters "
- "received\"},\"id\":31}";
-const uint32_t kAppId = 11u;
-}
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-namespace button_press_request_test {
-
-class ButtonPressRequestTest : public ::testing::Test {
- public:
- ButtonPressRequestTest()
- : rc_capabilities_(smart_objects::SmartType_Map)
- , mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) {
- ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_));
- ON_CALL(mock_module_, resource_allocation_manager())
- .WillByDefault(ReturnRef(mock_allocation_manager_));
- ON_CALL(*mock_service_, GetApplication(kAppId))
- .WillByDefault(Return(mock_app_));
- EXPECT_CALL(mock_module_, event_dispatcher())
- .WillRepeatedly(ReturnRef(event_dispatcher_));
- ServicePtr exp_service(mock_service_);
- mock_module_.set_service(exp_service);
- }
-
- smart_objects::SmartObject ButtonCapability(
- const mobile_apis::ButtonName::eType button_name) {
- smart_objects::SmartObject button(smart_objects::SmartType_Map);
- button["name"] = button_name;
- return button;
- }
-
- void SetUp() OVERRIDE {
- using namespace remote_control;
- using namespace mobile_apis;
-
- std::vector<ButtonName::eType> button_names;
- button_names.push_back(ButtonName::AC_MAX);
- button_names.push_back(ButtonName::AC);
- button_names.push_back(ButtonName::RECIRCULATE);
- button_names.push_back(ButtonName::FAN_UP);
- button_names.push_back(ButtonName::FAN_DOWN);
- button_names.push_back(ButtonName::TEMP_UP);
- button_names.push_back(ButtonName::TEMP_DOWN);
- button_names.push_back(ButtonName::DEFROST_MAX);
- button_names.push_back(ButtonName::DEFROST);
- button_names.push_back(ButtonName::DEFROST_REAR);
- button_names.push_back(ButtonName::UPPER_VENT);
- button_names.push_back(ButtonName::LOWER_VENT);
- button_names.push_back(ButtonName::VOLUME_UP);
- button_names.push_back(ButtonName::VOLUME_DOWN);
- button_names.push_back(ButtonName::EJECT);
- button_names.push_back(ButtonName::SOURCE);
- button_names.push_back(ButtonName::SHUFFLE);
- button_names.push_back(ButtonName::REPEAT);
-
- smart_objects::SmartObject button_caps(smart_objects::SmartType_Array);
- for (size_t i = 0; i < button_names.size(); i++) {
- button_caps[i] = ButtonCapability(button_names[i]);
- }
- rc_capabilities_[strings::kbuttonCapabilities] = button_caps;
- ON_CALL(*mock_service_, GetRCCapabilities())
- .WillByDefault(Return(&rc_capabilities_));
- ON_CALL(*mock_service_, IsInterfaceAvailable(_))
- .WillByDefault(Return(true));
- ON_CALL(*mock_service_, IsRemoteControlApplication(_))
- .WillByDefault(Return(true));
- }
-
- remote_control::request_controller::MobileRequestPtr CreateCommand(
- application_manager::MessagePtr msg) {
- return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_);
- }
-
- application_manager::MessagePtr CreateBasicMessage() {
- application_manager::MessagePtr message = utils::MakeShared<Message>(
- MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc));
- message->set_function_id(RCFunctionID::BUTTON_PRESS);
- message->set_function_name(
- MessageHelper::GetMobileAPIName(functional_modules::BUTTON_PRESS));
- message->set_connection_key(kAppId);
- return message;
- }
-
- protected:
- smart_objects::SmartObject rc_capabilities_;
- utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
- utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_;
- testing::NiceMock<remote_control_test::MockRemotePluginInterface>
- mock_module_;
- testing::NiceMock<remote_control_test::MockResourceAllocationManager>
- mock_allocation_manager_;
- RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_;
-};
-
-TEST_F(ButtonPressRequestTest,
- Execute_ButtonNameMatchesModuleType_ExpectCorrectMessageSentToHMI) {
- namespace json_keys = remote_control::json_keys;
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kCorrectMobileRequest);
- // Expectations
- ON_CALL(*mock_app_, app_id())
- .WillByDefault(Return(mobile_message->connection_key()));
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, GetNextCorrelationID()).WillOnce(Return(1));
-
- const std::string resource = "CLIMATE";
-
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId))
- .WillOnce(Return(remote_control::AcquireResult::ALLOWED));
- EXPECT_CALL(
- mock_allocation_manager_,
- SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY));
-
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
- // Assertions
- EXPECT_EQ(kModuleId, app_extension->uid());
- EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI,
- result_msg->protocol_version());
- EXPECT_EQ(1, result_msg->correlation_id());
- EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type());
- const Json::Value& hmi_request_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_EQ(functional_modules::hmi_api::button_press,
- hmi_request_params[json_keys::kMethod].asString());
-}
-
-TEST_F(
- ButtonPressRequestTest,
- Execute_ButtonNameDoesNotMatchModuleType_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
- namespace json_keys = remote_control::json_keys;
- namespace result_codes = remote_control::result_codes;
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kWrongMobileRequest);
- // Expectations
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(_))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _))
- .WillOnce(Return(::remote_control::AcquireResult::ALLOWED));
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0);
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
- // Assertions
- const Json::Value& response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[result_codes::kSuccess].asBool());
- EXPECT_EQ(result_codes::kInvalidData,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) {
- namespace json_keys = remote_control::json_keys;
- namespace result_codes = remote_control::result_codes;
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kCorrectMobileRequest);
-
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(kValidHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
- // Expectations
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::button_press);
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->on_event(event);
- // Assertions
- const Json::Value& response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_TRUE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kSuccess,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(ButtonPressRequestTest,
- OnEvent_ReadOnlyParamFromHMI_ExpectFalseSentToMobile) {
- namespace json_keys = remote_control::json_keys;
- namespace result_codes = remote_control::result_codes;
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kCorrectMobileRequest);
-
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(KReadOnlyHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
- // Expectations
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::button_press);
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->on_event(event);
- // Assertions
- const Json::Value& response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kGenericError,
- response_params[json_keys::kResultCode].asString());
-}
-
-} // namespace button_press_request_test
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
diff --git a/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc
deleted file mode 100644
index 4ad833aa60..0000000000
--- a/src/components/remote_control/test/commands/get_interior_vehicle_data_request_test.cc
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/commands/get_interior_vehicle_data_request.h"
-#include "gtest/gtest.h"
-#include "mock_remote_control_plugin.h"
-#include "mock_application.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "functional_module/function_ids.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using test::components::remote_control_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-using remote_control::RemotePluginInterface;
-using remote_control::MessageHelper;
-using namespace remote_control;
-
-namespace {
-const int32_t kConnectionKey = 5;
-const int kModuleId = 153;
-const std::string kInvalidMobileRequest = "{{\"moduleTip\":\"LUXOFT\"}}";
-const std::string kValidMobileRequest =
- "{\"subscribe\":true,\"moduleDescription\":{\"moduleType\":\"CLIMATE\"}}";
-const std::string kValidHmiResponse =
- "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":0,\"method\":\"RC."
- "GetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\","
- "\"climateControlData\":{\"fanSpeed\":0,\"currentTemperature\":{\"unit\":"
- "\"CELSIUS\",\"value\":20},\"desiredTemperature\":{\"unit\":\"CELSIUS\","
- "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true,"
- "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true,"
- "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":"
- "true}}";
-const std::string kInvalidHmiResponse =
- "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":21,\"method\":\"RC."
- "GetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\","
- "\"ControlData\":{\"Speed\":0,\"outsideTemperature\":{\"unit\":"
- "\"CELSIUS\",\"value\":\"high\"},\"desiredTemperature\":{\"unit\":"
- "\"CELSIUS\","
- "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true,"
- "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true,"
- "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":"
- "false}}";
-}
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-namespace get_interior_vehicle_data_request_test {
-
-class GetInteriorVehicleDataRequestTest : public ::testing::Test {
- public:
- typedef utils::SharedPtr<remote_control::commands::BaseCommandRequest>
- GIVDRequestPtr;
- typedef rc_event_engine::Event<application_manager::MessagePtr, std::string>
- GIVD_HMI_Response;
- GetInteriorVehicleDataRequestTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) {
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(app_id_));
- ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_));
- ON_CALL(*mock_service_, GetApplication(app_id_))
- .WillByDefault(Return(mock_app_));
- ON_CALL(*mock_service_, IsInterfaceAvailable(_))
- .WillByDefault(Return(true));
- ON_CALL(*mock_service_, IsRemoteControlApplication(_))
- .WillByDefault(Return(true));
- EXPECT_CALL(mock_module_, event_dispatcher())
- .WillRepeatedly(ReturnRef(event_dispatcher_));
- ServicePtr exp_service(mock_service_);
- mock_module_.set_service(exp_service);
- }
-
- remote_control::request_controller::MobileRequestPtr CreateCommand(
- application_manager::MessagePtr msg) {
- return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_);
- }
-
- application_manager::MessagePtr CreateBasicMessage() {
- application_manager::MessagePtr message = utils::MakeShared<Message>(
- MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc));
- message->set_connection_key(kConnectionKey);
- message->set_function_id(RCFunctionID::GET_INTERIOR_VEHICLE_DATA);
- message->set_function_name("GetInteriorVehicleData");
- return message;
- }
-
- protected:
- utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
- utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_;
- remote_control_test::MockRemotePluginInterface mock_module_;
- RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_;
- const uint32_t app_id_ = 11u;
-};
-
-TEST_F(GetInteriorVehicleDataRequestTest,
- Execute_MessageValidationOk_ExpectCorrectMessageSentToHMI) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequest);
- // Expectations
- EXPECT_CALL(mock_module_, service()).Times(2).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, GetNextCorrelationID()).WillOnce(Return(1));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
- // Assertions
- EXPECT_EQ(kModuleId, app_extension->uid());
- EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI,
- result_msg->protocol_version());
- EXPECT_EQ(1, result_msg->correlation_id());
- EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type());
- const Json::Value hmi_request_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_EQ(functional_modules::hmi_api::get_interior_vehicle_data,
- hmi_request_params[json_keys::kMethod].asString());
-}
-
-TEST_F(
- GetInteriorVehicleDataRequestTest,
- Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kInvalidMobileRequest);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(
- Return(application_manager::MessageValidationResult::INVALID_JSON));
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0);
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
- // Assertions
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[result_codes::kSuccess].asBool());
- EXPECT_EQ(result_codes::kInvalidData,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(GetInteriorVehicleDataRequestTest,
- OnEvent_ValidHmiResponse_ExpectSuccessfullResponseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequest);
-
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(kValidHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::get_interior_vehicle_data);
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->on_event(event);
- // Assertions
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_TRUE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kSuccess,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(GetInteriorVehicleDataRequestTest,
- OnEvent_InvalidHmiResponse_ExpectGenericErrorResponseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequest);
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(kInvalidHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplication(mobile_message->connection_key()))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message))
- .WillOnce(
- Return(application_manager::MessageValidationResult::INVALID_JSON));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::get_interior_vehicle_data);
- command->on_event(event);
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kGenericError,
- response_params[json_keys::kResultCode].asString());
- const Json::Value hmi_response =
- MessageHelper::StringToValue(hmi_message->json_message());
- EXPECT_EQ(hmi_response[json_keys::kInfo].asString(),
- response_params[json_keys::kInfo].asString());
-}
-
-} // namespace get_interior_vehicle_data_request_test
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
diff --git a/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc
deleted file mode 100644
index 7329890e94..0000000000
--- a/src/components/remote_control/test/commands/on_interior_vehicle_data_notification_test.cc
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/commands/on_interior_vehicle_data_notification.h"
-#include "gtest/gtest.h"
-#include "mock_remote_control_plugin.h"
-#include "mock_application.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "functional_module/function_ids.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using test::components::remote_control_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::Return;
-using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-using remote_control::RemotePluginInterface;
-using remote_control::MessageHelper;
-using namespace remote_control;
-
-namespace {
-const int kModuleId = 153;
-const std::string kJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnInteriorVehicleData\",\
- \"params\":{\"moduleData\":{\
- \"moduleType\": \"CLIMATE\",\"climateControlData\": {\"fanSpeed\": 100}}}}";
-const uint32_t kAppId_ = 11u;
-}
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-namespace on_interior_vehicle_data_notification_test {
-
-class OnInteriorVehicleDataNotificationTest : public ::testing::Test {
- public:
- OnInteriorVehicleDataNotificationTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) {
- ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_));
- ServicePtr exp_service(mock_service_);
- mock_module_.set_service(exp_service);
- }
-
- remote_control::request_controller::MobileRequestPtr CreateCommand(
- application_manager::MessagePtr msg) {
- return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_);
- }
-
- application_manager::MessagePtr CreateBasicMessage() {
- application_manager::MessagePtr message = utils::MakeShared<Message>(
- MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc));
- message->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA);
- message->set_function_name("OnInteriorVehicleData");
- message->set_json_message(kJson);
- return message;
- }
-
- protected:
- utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
- utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_;
- remote_control_test::MockRemotePluginInterface mock_module_;
- std::vector<ApplicationSharedPtr> apps_;
-};
-
-TEST_F(OnInteriorVehicleDataNotificationTest,
- Execute_SendMessageToMobile_IfAppIsSubscribed) {
- // Arrange
- application_manager::MessagePtr message = CreateBasicMessage();
- Json::Value json_value = MessageHelper::StringToValue(kJson);
- Json::Value module_type =
- json_value[json_keys::kParams][message_params::kModuleData]
- [message_params::kModuleType];
- rc_app_extention_->SubscribeToInteriorVehicleData(module_type);
- apps_.push_back(mock_app_);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId))
- .WillOnce(Return(apps_));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
-
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId_));
- EXPECT_CALL(*mock_app_, protocol_version())
- .WillRepeatedly(
- Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3));
- EXPECT_CALL(*mock_service_, GetApplication(kAppId_))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(_))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckModule(kAppId_, enums_value::kClimate))
- .WillOnce(Return(true));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(*mock_service_, SendMessageToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
- // Assertions
- EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3,
- result_msg->protocol_version());
- EXPECT_EQ(application_manager::MessageType::kNotification,
- result_msg->type());
- EXPECT_EQ(functional_modules::ON_INTERIOR_VEHICLE_DATA,
- result_msg->function_id());
- EXPECT_EQ(MessageHelper::GetMobileAPIName(
- functional_modules::ON_INTERIOR_VEHICLE_DATA),
- result_msg->function_name());
-}
-
-TEST_F(OnInteriorVehicleDataNotificationTest,
- Execute_NotSendMessageToMobile_IfAppUnsubscribed) {
- // Arrange
- application_manager::MessagePtr message = CreateBasicMessage();
- apps_.push_back(mock_app_);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId))
- .WillOnce(Return(apps_));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
-}
-
-} // namespace on_interior_vehicle_data_notification_test
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
diff --git a/src/components/remote_control/test/commands/on_remote_control_settings_test.cc b/src/components/remote_control/test/commands/on_remote_control_settings_test.cc
deleted file mode 100644
index 5c13ea63d5..0000000000
--- a/src/components/remote_control/test/commands/on_remote_control_settings_test.cc
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/commands/on_remote_control_settings_notification.h"
-#include "gtest/gtest.h"
-#include "mock_remote_control_plugin.h"
-#include "mock_application.h"
-#include "mock_resource_allocation_manager.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "functional_module/function_ids.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using test::components::remote_control_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-using remote_control::RemotePluginInterface;
-using remote_control::MessageHelper;
-using namespace remote_control;
-
-namespace {
-const int kModuleId = 153;
-const std::string kAllowedTrueAUTO_ALLOWJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"AUTO_ALLOW\", \"allowed\":true}}";
-const std::string kAllowedTrueASK_DRIVERJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"ASK_DRIVER\", \"allowed\":true}}";
-const std::string kAllowedTrueAUTO_DENYJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"AUTO_DENY\", \"allowed\":true}}";
-const std::string kAllowedFalseAUTO_ALLOWJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"AUTO_ALLOW\", \"allowed\":false}}";
-const std::string kAllowedFalseASK_DRIVERJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"ASK_DRIVER\", \"allowed\":false}}";
-const std::string kAllowedFalseAUTO_DENYJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\",\
- \"params\":{\"accessMode\": \"AUTO_DENY\", \"allowed\":false}}";
-const std::string kWithoutParamsJson =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnRemoteControlSettings\"}";
-}
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-namespace on_remote_control_settings_notification_test {
-
-class OnRemoteControlSettingsNotificationTest : public ::testing::Test {
- public:
- OnRemoteControlSettingsNotificationTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) {
- ON_CALL(mock_module_, resource_allocation_manager())
- .WillByDefault(ReturnRef(mock_allocation_manager_));
- ON_CALL(*mock_service_, IsInterfaceAvailable(_))
- .WillByDefault(Return(true));
- ON_CALL(*mock_service_, IsRemoteControlApplication(_))
- .WillByDefault(Return(true));
- apps_.push_back(mock_app_);
- }
-
- remote_control::request_controller::MobileRequestPtr CreateCommand(
- application_manager::MessagePtr msg) {
- return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_);
- }
-
- application_manager::MessagePtr CreateBasicMessage(
- const std::string& json_message) {
- application_manager::MessagePtr message = utils::MakeShared<Message>(
- MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc));
- message->set_function_id(RCFunctionID::ON_REMOTE_CONTROL_SETTINGS);
- message->set_function_name(
- MessageHelper::GetMobileAPIName(functional_modules::BUTTON_PRESS));
- message->set_json_message(json_message);
- return message;
- }
-
- protected:
- utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
- utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_;
- remote_control_test::MockRemotePluginInterface mock_module_;
- std::vector<ApplicationSharedPtr> apps_;
- testing::NiceMock<remote_control_test::MockResourceAllocationManager>
- mock_allocation_manager_;
-};
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_SetAccessModeAUTO_ALLOW_IfAllowedTrue) {
- // Arrange
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedTrueAUTO_ALLOWJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_));
-
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedTrueAUTO_ALLOWJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_SetAccessModeAUTO_DENY_IfAllowedTrue) {
- // Arrange
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedTrueAUTO_DENYJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_));
-
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedTrueAUTO_DENYJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_SetAccessModeASK_DRIVER_IfAllowedTrue) {
- // Arrange
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedTrueASK_DRIVERJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_));
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedTrueASK_DRIVERJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeAUTO_ALLOW) {
- // Arrange
- const Json::Value module_type(enums_value::kClimate);
- rc_app_extention_->SubscribeToInteriorVehicleData(module_type);
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedFalseAUTO_ALLOWJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0);
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId))
- .WillOnce(Return(apps_));
- EXPECT_CALL(
- *mock_service_,
- ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- true);
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedFalseAUTO_ALLOWJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
- // Assertions
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- false);
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeASK_DRIVER) {
- // Arrange
- const Json::Value module_type(enums_value::kRadio);
- rc_app_extention_->SubscribeToInteriorVehicleData(module_type);
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedFalseASK_DRIVERJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0);
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId))
- .WillOnce(Return(apps_));
- EXPECT_CALL(
- *mock_service_,
- ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- true);
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedFalseASK_DRIVERJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
- // Assertions
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- false);
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_DisallowRCFunctionality_IfAllowedFalseAccessModeAUTO_DENY) {
- // Arrange
- const Json::Value module_type(enums_value::kClimate);
- rc_app_extention_->SubscribeToInteriorVehicleData(module_type);
- const Json::Value value =
- MessageHelper::StringToValue(kAllowedFalseAUTO_DENYJson);
- const std::string access_mode =
- value[json_keys::kParams][message_params::kAccessMode].asString();
- const hmi_apis::Common_RCAccessMode::eType access_mode_ =
- MessageHelper::AccessModeFromString(access_mode);
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(access_mode_)).Times(0);
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId))
- .WillOnce(Return(apps_));
- EXPECT_CALL(
- *mock_service_,
- ChangeNotifyHMILevel(apps_[0], mobile_apis::HMILevel::eType::HMI_NONE));
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- true);
- application_manager::MessagePtr message =
- CreateBasicMessage(kAllowedFalseAUTO_DENYJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
- // Assertions
- EXPECT_EQ(rc_app_extention_->IsSubscibedToInteriorVehicleData(module_type),
- false);
-}
-
-TEST_F(OnRemoteControlSettingsNotificationTest,
- Execute_NothingHappens_IfParamsOmitted) {
- // Expectations
- EXPECT_CALL(mock_module_, service()).WillOnce(Return(mock_service_));
- EXPECT_CALL(mock_allocation_manager_, SetAccessMode(_)).Times(0);
- EXPECT_CALL(*mock_service_, GetApplications(kModuleId)).Times(0);
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId)).Times(0);
- EXPECT_CALL(*mock_service_,
- ChangeNotifyHMILevel(
- apps_[0], mobile_apis::HMILevel::eType::HMI_NONE)).Times(0);
-
- application_manager::MessagePtr message =
- CreateBasicMessage(kWithoutParamsJson);
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(message);
- command->Run();
-}
-
-} // namespace on_remote_control_settings_notification_test
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
diff --git a/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc
deleted file mode 100644
index a219bc086d..0000000000
--- a/src/components/remote_control/test/commands/set_interior_vehicle_data_request_test.cc
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "remote_control/commands/set_interior_vehicle_data_request.h"
-#include "gtest/gtest.h"
-#include "mock_remote_control_plugin.h"
-#include "mock_application.h"
-#include "mock_resource_allocation_manager.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/remote_control_event.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "remote_control/rc_command_factory.h"
-#include "remote_control/event_engine/event_dispatcher.h"
-#include "functional_module/function_ids.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using test::components::remote_control_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-using remote_control::RemotePluginInterface;
-using remote_control::MessageHelper;
-using namespace remote_control;
-
-namespace {
-const uint32_t kAppId = 11u;
-const int32_t kConnectionKey = 5;
-const int kModuleId = 153;
-const uint32_t kCorrelationId = 1u;
-const std::string kValidMobileRequestWithOnlySettableParams =
- "{\"moduleData\":{\"moduleType\":\"CLIMATE\", "
- "\"climateControlData\":{\"defrostZone\":"
- "\"FRONT\", \"fanSpeed\":10}}}";
-const std::string kValidMobileRequestWithSettableAndReadOnlyParams =
- "{\"moduleData\":{\"moduleType\":\"CLIMATE\", "
- "\"climateControlData\":{\"defrostZone\":"
- "\"FRONT\", \"fanSpeed\":10, \"currentTemperature\":{\"unit\":\"CELSIUS\", "
- "\"value\":17.5}}}}";
-const std::string kValidMobileRequestWithoutSettableAndWithReadOnlyParams =
- "{\"moduleData\":{\"moduleType\":\"CLIMATE\", \"climateControlData\":"
- "{\"currentTemperature\":{\"unit\":\"CELSIUS\", \"value\":17.5}}}}";
-const std::string kInvalidMobileRequest = "{{\"moduleTip\":\"LUXOFT\"}}";
-const std::string kValidHmiResponse =
- "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":0,\"method\":\"RC."
- "SetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\","
- "\"climateControlData\":{\"fanSpeed\":0,\"desiredTemperature\":{\"unit\":"
- "\"CELSIUS\","
- "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true,"
- "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true,"
- "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}}}}";
-const std::string kInvalidHmiResponse =
- "{\"jsonrpc\":\"2.0\",\"id\":51,\"result\":{\"code\":21,\"method\":\"RC."
- "SetInteriorVehicleData\",\"moduleData\":{\"moduleType\":\"CLIMATE\","
- "\"ControlData\":{\"Speed\":0,\"outsideTemperature\":{\"unit\":"
- "\"CELSIUS\",\"value\":\"high\"},\"desiredTemperature\":{\"unit\":"
- "\"CELSIUS\","
- "\"value\":25},\"acEnable\":true,\"circulateAirEnable\":true,"
- "\"autoModeEnable\":true,\"defrostZone\":\"ALL\",\"dualModeEnable\":true,"
- "\"acMaxEnable\":true,\"ventilationMode\":\"BOTH\"}},\"isSubscribed\":"
- "false}}";
-}
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-namespace set_interior_vehicle_data_request_test {
-
-class SetInteriorVehicleDataRequestTest : public ::testing::Test {
- public:
- SetInteriorVehicleDataRequestTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(
- utils::MakeShared<remote_control::RCAppExtension>(kModuleId)) {
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
- ON_CALL(mock_module_, resource_allocation_manager())
- .WillByDefault(ReturnRef(mock_allocation_manager_));
- ON_CALL(mock_module_, service()).WillByDefault(Return(mock_service_));
- ON_CALL(*mock_service_, GetApplication(_)).WillByDefault(Return(mock_app_));
- ON_CALL(*mock_service_, IsInterfaceAvailable(_))
- .WillByDefault(Return(true));
- ON_CALL(*mock_service_, IsRemoteControlApplication(_))
- .WillByDefault(Return(true));
- ON_CALL(mock_module_, event_dispatcher())
- .WillByDefault(ReturnRef(event_dispatcher_));
- ServicePtr exp_service(mock_service_);
- }
-
- remote_control::request_controller::MobileRequestPtr CreateCommand(
- application_manager::MessagePtr msg) {
- return remote_control::RCCommandFactory::CreateCommand(msg, mock_module_);
- }
-
- application_manager::MessagePtr CreateBasicMessage() {
- application_manager::MessagePtr message = utils::MakeShared<Message>(
- MessagePriority::FromServiceType(protocol_handler::ServiceType::kRpc));
- message->set_connection_key(kConnectionKey);
- message->set_function_id(RCFunctionID::SET_INTERIOR_VEHICLE_DATA);
- message->set_function_name(MessageHelper::GetMobileAPIName(
- functional_modules::SET_INTERIOR_VEHICLE_DATA));
- return message;
- }
-
- protected:
- utils::SharedPtr<NiceMock<application_manager::MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
- utils::SharedPtr<remote_control::RCAppExtension> rc_app_extention_;
- testing::NiceMock<remote_control_test::MockRemotePluginInterface>
- mock_module_;
- testing::NiceMock<remote_control_test::MockResourceAllocationManager>
- mock_allocation_manager_;
- RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_;
-};
-
-TEST_F(SetInteriorVehicleDataRequestTest,
- Execute_ValidWithoutReadOnlyParams_ExpectResendToHMI) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
-
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, GetNextCorrelationID())
- .WillOnce(Return(kCorrelationId));
-
- const std::string resource = "CLIMATE";
-
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId))
- .WillOnce(Return(remote_control::AcquireResult::ALLOWED));
- EXPECT_CALL(
- mock_allocation_manager_,
- SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY));
-
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
-
- // Assertions
- EXPECT_EQ(kModuleId, app_extension->uid());
- EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI,
- result_msg->protocol_version());
- EXPECT_EQ(1, result_msg->correlation_id());
- EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type());
- const Json::Value hmi_request_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_EQ(functional_modules::hmi_api::set_interior_vehicle_data,
- hmi_request_params[json_keys::kMethod].asString());
- const Json::Value hmi_request_climate_control_data =
- hmi_request_params[json_keys::kParams][message_params::kModuleData]
- [message_params::kClimateControlData];
- EXPECT_EQ(2u, hmi_request_climate_control_data.size());
- const Json::Value hmi_request_module_data_fan_speed =
- hmi_request_climate_control_data[message_params::kFanSpeed];
- const Json::Value hmi_request_module_data_defrost_zone =
- hmi_request_climate_control_data[message_params::kDefrostZone];
- EXPECT_EQ("FRONT", hmi_request_module_data_defrost_zone.asString());
- EXPECT_EQ(10, hmi_request_module_data_fan_speed.asInt());
-}
-
-TEST_F(
- SetInteriorVehicleDataRequestTest,
- Execute_ValidWithSettableAndReadOnlyParams_ExpectCutReadOnlyAndResendToHMI) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(
- kValidMobileRequestWithSettableAndReadOnlyParams);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
-
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
-
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, GetNextCorrelationID())
- .WillOnce(Return(kCorrelationId));
-
- const std::string resource = "CLIMATE";
-
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, kAppId))
- .WillOnce(Return(remote_control::AcquireResult::ALLOWED));
- EXPECT_CALL(
- mock_allocation_manager_,
- SetResourceState(resource, kAppId, remote_control::ResourceState::BUSY));
-
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
-
- // Assertions
- EXPECT_EQ(kModuleId, app_extension->uid());
- EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI,
- result_msg->protocol_version());
- EXPECT_EQ(1, result_msg->correlation_id());
- EXPECT_EQ(application_manager::MessageType::kRequest, result_msg->type());
- const Json::Value hmi_request_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_EQ(functional_modules::hmi_api::set_interior_vehicle_data,
- hmi_request_params[json_keys::kMethod].asString());
- const Json::Value hmi_request_climate_control_data =
- hmi_request_params[json_keys::kParams][message_params::kModuleData]
- [message_params::kClimateControlData];
- EXPECT_EQ(2u, hmi_request_climate_control_data.size());
- const Json::Value hmi_request_module_data_fan_speed =
- hmi_request_climate_control_data[message_params::kFanSpeed];
- const Json::Value hmi_request_module_data_defrost_zone =
- hmi_request_climate_control_data[message_params::kDefrostZone];
- EXPECT_EQ("FRONT", hmi_request_module_data_defrost_zone.asString());
- EXPECT_EQ(10, hmi_request_module_data_fan_speed.asInt());
-}
-
-TEST_F(SetInteriorVehicleDataRequestTest,
- Execute_ValidWithOnlyParamsReadOnly_ExpectResponseReadOnly) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(
- kValidMobileRequestWithoutSettableAndWithReadOnlyParams);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(mobile_message))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(_))
- .WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _))
- .WillOnce(Return(::remote_control::AcquireResult::ALLOWED));
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*mock_app_, QueryInterface(kModuleId))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
-
- application_manager::AppExtensionPtr app_extension;
- EXPECT_CALL(*mock_app_, AddExtension(_))
- .WillOnce(DoAll(SaveArg<0>(&app_extension), Return(true)));
- EXPECT_CALL(*mock_service_, CheckModule(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0);
-
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
-
- // Assertions
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[result_codes::kSuccess].asBool());
- EXPECT_EQ(result_codes::kReadOnly,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(
- SetInteriorVehicleDataRequestTest,
- Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kInvalidMobileRequest);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*mobile_message))
- .WillOnce(
- Return(application_manager::MessageValidationResult::INVALID_JSON));
- EXPECT_CALL(*mock_service_, SendMessageToHMI(_)).Times(0);
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->Run();
-
- // Assertions
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[result_codes::kSuccess].asBool());
- EXPECT_EQ(result_codes::kInvalidData,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(SetInteriorVehicleDataRequestTest,
- OnEvent_ValidHmiResponse_ExpectSuccessfulResponseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams);
-
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(kValidHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::set_interior_vehicle_data);
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- command->on_event(event);
-
- // Assertions
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_TRUE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kSuccess,
- response_params[json_keys::kResultCode].asString());
-}
-
-TEST_F(SetInteriorVehicleDataRequestTest,
- OnEvent_InvalidHmiResponse_ExpectGenericErrorResponseSentToMobile) {
- // Arrange
- application_manager::MessagePtr mobile_message = CreateBasicMessage();
- mobile_message->set_json_message(kValidMobileRequestWithOnlySettableParams);
- application_manager::MessagePtr hmi_message = CreateBasicMessage();
- hmi_message->set_json_message(kInvalidHmiResponse);
- hmi_message->set_message_type(application_manager::MessageType::kResponse);
-
- // Expectations
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(*hmi_message))
- .WillOnce(
- Return(application_manager::MessageValidationResult::INVALID_JSON));
- application_manager::MessagePtr result_msg;
- EXPECT_CALL(mock_module_, SendResponseToMobile(_))
- .WillOnce(SaveArg<0>(&result_msg));
-
- // Act
- remote_control::request_controller::MobileRequestPtr command =
- CreateCommand(mobile_message);
- remote_control::RCPluginEvent event(
- hmi_message, functional_modules::hmi_api::set_interior_vehicle_data);
- command->on_event(event);
- const Json::Value response_params =
- MessageHelper::StringToValue(result_msg->json_message());
- EXPECT_FALSE(response_params[json_keys::kSuccess].asBool());
- EXPECT_EQ(result_codes::kGenericError,
- response_params[json_keys::kResultCode].asString());
- const Json::Value hmi_response =
- MessageHelper::StringToValue(hmi_message->json_message());
- EXPECT_EQ(hmi_response[json_keys::kInfo].asString(),
- response_params[json_keys::kInfo].asString());
-}
-
-} // namespace set_interior_vehicle_data_request_test
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h
deleted file mode 100644
index ef7c1d63a7..0000000000
--- a/src/components/remote_control/test/include/mock_application.h
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 2017, 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_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_
-
-#include <string>
-
-#include <string>
-#include "gmock/gmock.h"
-#include "application_manager/application.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/app_extension.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
-#include "application_manager/usage_statistics.h"
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-
-namespace am = application_manager;
-namespace mobile_api = mobile_apis;
-namespace custom_str = utils::custom_string;
-
-namespace custom_str = utils::custom_string;
-class MockApplication : public ::application_manager::Application {
- public:
- MockApplication() {}
- MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(curHash, const std::string&());
- MOCK_METHOD0(UpdateHash, void());
- DEPRECATED MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
- DEPRECATED MOCK_METHOD1(set_flag_sending_hash_change_after_awake,
- void(bool flag));
- MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool());
- MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool state));
- MOCK_CONST_METHOD0(is_application_data_changed, bool());
- MOCK_METHOD1(set_is_application_data_changed,
- void(bool state_application_data));
- MOCK_METHOD0(CloseActiveMessage, void());
- MOCK_CONST_METHOD0(IsFullscreen, bool());
- MOCK_METHOD0(ChangeSupportingAppHMIType, void());
- MOCK_CONST_METHOD0(is_navi, bool());
- MOCK_METHOD1(set_is_navi, void(bool allow));
- MOCK_CONST_METHOD0(video_streaming_approved, bool());
- MOCK_METHOD1(set_video_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_approved, bool());
- MOCK_METHOD1(set_audio_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(video_streaming_allowed, bool());
- MOCK_METHOD1(set_video_streaming_allowed, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_allowed, bool());
- MOCK_METHOD1(set_audio_streaming_allowed, void(bool state));
- MOCK_CONST_METHOD0(is_audio, bool());
- MOCK_METHOD2(SetVideoConfig,
- bool(protocol_handler::ServiceType service_type,
- const smart_objects::SmartObject& params));
- MOCK_METHOD1(StartStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(StopStreamingForce,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(SuspendStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(WakeUpStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_CONST_METHOD0(is_voice_communication_supported, bool());
- MOCK_METHOD1(set_voice_communication_supported,
- void(bool is_voice_communication_supported));
- MOCK_CONST_METHOD0(app_allowed, bool());
- MOCK_CONST_METHOD0(has_been_activated, bool());
- MOCK_METHOD1(set_activated, bool(bool is_active));
- MOCK_CONST_METHOD0(version, const ::application_manager::Version&());
- MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id));
- MOCK_CONST_METHOD0(hmi_app_id, uint32_t());
- MOCK_CONST_METHOD0(name, const custom_str::CustomString&());
- MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
- MOCK_CONST_METHOD0(folder_name, const std::string());
- MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
- MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
- MOCK_CONST_METHOD0(audio_streaming_state,
- const mobile_apis::AudioStreamingState::eType());
- MOCK_CONST_METHOD0(app_icon_path, const std::string&());
- MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
- MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(PostponedHmiState,
- const application_manager::HmiStatePtr());
- MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
- MOCK_METHOD0(tts_properties_in_none, bool());
- MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
- MOCK_METHOD0(tts_properties_in_full, bool());
- MOCK_METHOD1(set_version,
- void(const ::application_manager::Version& version));
- MOCK_METHOD1(set_name, void(const custom_str::CustomString& name));
- MOCK_METHOD1(set_is_media_application, void(bool is_media));
- MOCK_METHOD0(increment_put_file_in_none_count, void());
- MOCK_METHOD0(increment_delete_file_in_none_count, void());
- MOCK_METHOD0(increment_list_files_in_none_count, void());
- MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name));
- MOCK_METHOD1(set_app_allowed, void(const bool allowed));
- MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device));
- MOCK_CONST_METHOD0(get_grammar_id, uint32_t());
- MOCK_METHOD1(set_grammar_id, void(uint32_t value));
- MOCK_METHOD1(
- set_protocol_version,
- void(const ::protocol_handler::MajorProtocolVersion& protocol_version));
- MOCK_CONST_METHOD0(protocol_version,
- ::protocol_handler::MajorProtocolVersion());
- MOCK_METHOD1(set_is_resuming, void(bool));
- MOCK_CONST_METHOD0(is_resuming, bool());
- MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file));
- MOCK_CONST_METHOD0(getAppFiles, const ::application_manager::AppFilesMap&());
- MOCK_METHOD1(UpdateFile, bool(const ::application_manager::AppFile& file));
- MOCK_METHOD1(DeleteFile, bool(const std::string& file_name));
- MOCK_METHOD1(
- GetFile,
- const ::application_manager::AppFile*(const std::string& file_name));
- MOCK_METHOD1(SubscribeToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(IsSubscribedToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(UnsubscribeFromButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type));
- MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD0(ResetDataInNone, void());
- MOCK_METHOD2(AreCommandLimitsExceeded,
- bool(mobile_apis::FunctionID::eType cmd_id,
- ::application_manager::TLimitSource source));
- MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&());
- MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState,
- void(::application_manager::HmiStatePtr state));
- MOCK_METHOD0(RemovePostponedState, void());
- MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState,
- void(::application_manager::HmiState::StateID state_id));
- MOCK_METHOD2(SubscribeToSoftButtons,
- void(int32_t cmd_id,
- const ::application_manager::SoftButtonID& softbuttons_id));
- MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id));
- MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id));
- MOCK_CONST_METHOD0(IsAudioApplication, bool());
- MOCK_METHOD0(LoadPersistentFiles, void());
- // InitialApplicationData methods
- MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_synonyms, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(policy_app_id, std::string());
- MOCK_CONST_METHOD0(tts_name, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(ngn_media_screen_name,
- const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&());
- MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&());
- MOCK_METHOD1(set_app_types,
- void(const smart_objects::SmartObject& app_types));
- MOCK_METHOD1(set_vr_synonyms,
- void(const smart_objects::SmartObject& vr_synonyms));
- MOCK_METHOD1(set_policy_app_id, void(const std::string& policy_app_id));
- MOCK_METHOD1(set_tts_name, void(const smart_objects::SmartObject& tts_name));
- MOCK_METHOD1(set_ngn_media_screen_name,
- void(const smart_objects::SmartObject& ngn_name));
- MOCK_METHOD1(set_language,
- void(const mobile_apis::Language::eType& language));
- MOCK_METHOD1(set_ui_language,
- void(const mobile_apis::Language::eType& ui_language));
- // DynamicApplicationData methods
- MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help_title, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_state, const mobile_apis::TBTState::eType&());
- MOCK_CONST_METHOD0(show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(
- SubscribedButtons,
- DataAccessor< ::application_manager::ButtonSubscriptions>());
- MOCK_CONST_METHOD0(
- SubscribedIVI,
- DataAccessor< ::application_manager::VehicleInfoSubscriptions>());
- MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(display_layout, const std::string&());
- MOCK_METHOD1(load_global_properties,
- void(const smart_objects::SmartObject& so));
- MOCK_METHOD1(set_help_prompt,
- void(const smart_objects::SmartObject& help_prompt));
- MOCK_METHOD1(set_timeout_prompt,
- void(const smart_objects::SmartObject& timeout_prompt));
- MOCK_METHOD1(set_vr_help_title,
- void(const smart_objects::SmartObject& vr_help_title));
- MOCK_METHOD0(reset_vr_help_title, void());
- MOCK_METHOD1(set_vr_help, void(const smart_objects::SmartObject& vr_help));
- MOCK_METHOD0(reset_vr_help, void());
- MOCK_METHOD1(set_tbt_state,
- void(const mobile_apis::TBTState::eType& tbt_state));
- MOCK_METHOD1(set_show_command,
- void(const smart_objects::SmartObject& show_command));
- MOCK_METHOD1(set_tbt_show_command,
- void(const smart_objects::SmartObject& tbt_show));
- MOCK_METHOD1(set_keyboard_props,
- void(const smart_objects::SmartObject& keyboard_props));
- MOCK_METHOD1(set_menu_title,
- void(const smart_objects::SmartObject& menu_title));
- MOCK_METHOD1(set_menu_icon,
- void(const smart_objects::SmartObject& menu_icon));
- MOCK_METHOD1(set_day_color_scheme,
- void(const smart_objects::SmartObject& color_scheme));
- MOCK_METHOD1(set_night_color_scheme,
- void(const smart_objects::SmartObject& color_scheme));
- MOCK_METHOD1(set_display_layout, void(const std::string& layout));
- MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_audio_stream_retry_number,
- void(const uint32_t& audio_stream_retry_number));
- MOCK_CONST_METHOD0(video_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_video_stream_retry_number,
- void(const uint32_t& video_stream_retry_number));
- MOCK_METHOD2(AddCommand,
- void(uint32_t cmd_id,
- const smart_objects::SmartObject& command));
- MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id));
- MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id));
- MOCK_METHOD2(AddSubMenu,
- void(uint32_t menu_id, const smart_objects::SmartObject& menu));
- MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id));
- MOCK_CONST_METHOD1(FindSubMenu,
- smart_objects::SmartObject*(uint32_t menu_id));
- MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name));
- MOCK_METHOD2(AddChoiceSet,
- void(uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id));
- MOCK_METHOD1(FindChoiceSet,
- smart_objects::SmartObject*(uint32_t choice_set_id));
- MOCK_METHOD3(AddPerformInteractionChoiceSet,
- void(uint32_t correlation_id,
- uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(DeletePerformInteractionChoiceSet,
- void(uint32_t correlation_id));
- MOCK_CONST_METHOD0(
- performinteraction_choice_set_map,
- DataAccessor< ::application_manager::PerformChoiceSetMap>());
- MOCK_CONST_METHOD0(commands_map,
- DataAccessor< ::application_manager::CommandsMap>());
- MOCK_CONST_METHOD0(sub_menu_map,
- DataAccessor< ::application_manager::SubMenuMap>());
- MOCK_CONST_METHOD0(choice_set_map,
- DataAccessor< ::application_manager::ChoiceSetMap>());
- MOCK_METHOD1(set_perform_interaction_active, void(uint32_t active));
- MOCK_CONST_METHOD0(is_perform_interaction_active, uint32_t());
- MOCK_METHOD1(set_perform_interaction_mode, void(int32_t mode));
- MOCK_CONST_METHOD0(perform_interaction_mode, int32_t());
- MOCK_METHOD1(set_perform_interaction_layout,
- void(mobile_apis::LayoutMode::eType mode));
- MOCK_CONST_METHOD0(perform_interaction_layout,
- mobile_apis::LayoutMode::eType());
- MOCK_METHOD1(set_reset_global_properties_active, void(bool active));
- MOCK_CONST_METHOD0(is_reset_global_properties_active, bool());
- MOCK_CONST_METHOD0(app_id, uint32_t());
- MOCK_CONST_METHOD0(mac_address, const std::string&());
- MOCK_CONST_METHOD0(bundle_id, const std::string&());
- MOCK_METHOD1(set_bundle_id, void(const std::string& bundle_id));
- MOCK_METHOD0(GetAvailableDiskSpace, uint32_t());
-
- MOCK_METHOD1(set_mobile_projection_enabled, void(bool));
- MOCK_CONST_METHOD0(mobile_projection_enabled, bool());
-
- MOCK_METHOD1(set_mobile_app_id, void(const std::string& policy_app_id));
- MOCK_CONST_METHOD0(is_foreground, bool());
- MOCK_METHOD1(set_foreground, void(bool is_foreground));
- MOCK_CONST_METHOD0(IsRegistered, bool());
- MOCK_CONST_METHOD0(SchemaUrl, std::string());
- MOCK_CONST_METHOD0(PackageName, std::string());
- MOCK_METHOD1(PushMobileMessage, void(smart_objects::SmartObjectSPtr message));
- MOCK_METHOD1(
- SwapMobileMessageQueue,
- void(::application_manager::MobileMessageQueue& mobile_messages));
-
-#ifdef SDL_REMOTE_CONTROL
- MOCK_METHOD1(
- set_system_context,
- void(const application_manager::mobile_api::SystemContext::eType&));
- MOCK_METHOD1(
- set_audio_streaming_state,
- void(const application_manager::mobile_api::AudioStreamingState::eType&
- state));
- MOCK_METHOD1(IsSubscribedToInteriorVehicleData,
- bool(smart_objects::SmartObject module));
- MOCK_METHOD1(SubscribeToInteriorVehicleData,
- bool(smart_objects::SmartObject module));
- MOCK_METHOD1(UnsubscribeFromInteriorVehicleData,
- bool(smart_objects::SmartObject module));
- MOCK_METHOD1(
- set_hmi_level,
- void(const application_manager::mobile_api::HMILevel::eType& hmi_level));
- MOCK_METHOD1(QueryInterface,
- application_manager::AppExtensionPtr(
- application_manager::AppExtensionUID uid));
- MOCK_METHOD1(AddExtension,
- bool(application_manager::AppExtensionPtr extention));
- MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid));
- MOCK_METHOD0(RemoveExtensions, void());
- MOCK_CONST_METHOD0(SubscribesIVI,
- const application_manager::VehicleInfoSubscriptions&());
-
-#endif // SDL_REMOTE_CONTROL
-};
-
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_APPLICATION_H_
diff --git a/src/components/remote_control/test/include/mock_remote_control_plugin.h b/src/components/remote_control/test/include/mock_remote_control_plugin.h
deleted file mode 100644
index a8143f448c..0000000000
--- a/src/components/remote_control/test/include/mock_remote_control_plugin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_
-
-#include <stdint.h>
-#include "remote_control/remote_plugin_interface.h"
-#include "remote_control/resource_allocation_manager.h"
-#include "application_manager/message.h"
-#include "mock_application.h"
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-
-class RCAppExtension;
-typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr;
-
-class MockRemotePluginInterface : public remote_control::RemotePluginInterface {
- public:
- MOCK_CONST_METHOD0(GetPluginInfo, functional_modules::PluginInfo());
- MOCK_METHOD1(
- ProcessMessage,
- functional_modules::ProcessResult(application_manager::MessagePtr msg));
- MOCK_METHOD1(
- ProcessHMIMessage,
- functional_modules::ProcessResult(application_manager::MessagePtr msg));
- MOCK_METHOD1(SendResponseToMobile, void(application_manager::MessagePtr msg));
- MOCK_METHOD1(SendTimeoutResponseToMobile,
- void(application_manager::MessagePtr msg));
- MOCK_METHOD1(RemoveAppExtension, void(uint32_t app_id));
- MOCK_METHOD1(IsAppForPlugin,
- bool(application_manager::ApplicationSharedPtr app));
- MOCK_METHOD2(OnAppHMILevelChanged,
- void(application_manager::ApplicationSharedPtr app,
- mobile_apis::HMILevel::eType old_level));
- MOCK_METHOD1(OnUnregisterApplication, void(const uint32_t app_id));
- MOCK_METHOD1(SendHmiStatusNotification,
- void(application_manager::ApplicationSharedPtr app));
- MOCK_METHOD0(event_dispatcher, RCPluginEventDispatcher&());
- MOCK_METHOD0(RemoveAppExtensions, void());
- MOCK_METHOD0(service, application_manager::ServicePtr());
- MOCK_CONST_METHOD0(GetModuleID, functional_modules::ModuleID());
- MOCK_METHOD0(resource_allocation_manager,
- remote_control::ResourceAllocationManager&());
- MOCK_METHOD2(OnApplicationEvent,
- void(functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application));
- MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event));
-};
-
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_REMOTE_CONTROL_PLUGIN_H_
diff --git a/src/components/remote_control/test/include/mock_resource_allocation_manager.h b/src/components/remote_control/test/include/mock_resource_allocation_manager.h
deleted file mode 100644
index 6337d8a32a..0000000000
--- a/src/components/remote_control/test/include/mock_resource_allocation_manager.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
-
-#include "gmock/gmock.h"
-#include "remote_control/resource_allocation_manager.h"
-
-namespace test {
-namespace components {
-namespace remote_control_test {
-
-class MockResourceAllocationManager
- : public remote_control::ResourceAllocationManager {
- public:
- MOCK_METHOD2(AcquireResource,
- remote_control::AcquireResult::eType(
- const std::string& module_type, const uint32_t app_id));
- MOCK_METHOD2(ForceAcquireResource,
- void(const std::string& module_type, const uint32_t app_id));
- MOCK_METHOD2(OnDriverDisallowed,
- void(const std::string& module_type, const uint32_t app_id));
- MOCK_METHOD2(OnApplicationEvent,
- void(functional_modules::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application));
- MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event));
- MOCK_METHOD1(SetAccessMode,
- void(const hmi_apis::Common_RCAccessMode::eType access_mode));
- MOCK_CONST_METHOD0(GetAccessMode, hmi_apis::Common_RCAccessMode::eType());
- MOCK_METHOD3(SetResourceState,
- void(const std::string& module_type,
- const uint32_t app_id,
- const remote_control::ResourceState::eType state));
- MOCK_CONST_METHOD1(IsResourceFree, bool(const std::string& module_type));
- MOCK_METHOD0(ResetAllAllocations, void());
-};
-
-} // namespace remote_control_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
diff --git a/src/components/remote_control/test/src/rc_app_extension_test.cc b/src/components/remote_control/test/src/rc_app_extension_test.cc
deleted file mode 100644
index 78388ccbf1..0000000000
--- a/src/components/remote_control/test/src/rc_app_extension_test.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2015, 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 "gtest/gtest.h"
-#include "remote_control/rc_app_extension.h"
-
-namespace remote_control {
-
-TEST(CanAppExtensionTest, Create) {
- RCAppExtension extension(7);
- ASSERT_TRUE(extension.uid() == 7);
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/test/src/rc_library_test.cc b/src/components/remote_control/test/src/rc_library_test.cc
deleted file mode 100644
index 77a57c4c3f..0000000000
--- a/src/components/remote_control/test/src/rc_library_test.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2015, 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 <dlfcn.h>
-#include "gtest/gtest.h"
-#include "remote_control/remote_control_plugin.h"
-#include "mock_service.h"
-
-using functional_modules::PluginInfo;
-using application_manager::MockService;
-
-using ::testing::Return;
-
-namespace remote_control {
-
-::testing::AssertionResult IsError(void* error) {
- if (error) {
- return ::testing::AssertionSuccess() << static_cast<const char*>(error);
- } else {
- return ::testing::AssertionFailure() << error;
- }
-}
-
-TEST(CanLibraryTest, Load) {
- const std::string kLibraryPath = "libRemoteControlModule.so";
-
- void* handle = dlopen(kLibraryPath.c_str(), RTLD_LAZY);
- EXPECT_FALSE(IsError(dlerror()));
- ASSERT_TRUE(handle != NULL);
-
- const std::string kSymbol = "Create";
- void* symbol = dlsym(handle, kSymbol.c_str());
- EXPECT_FALSE(IsError(dlerror()));
- ASSERT_TRUE(symbol != NULL);
-
- typedef CANModule* (*Create)();
- Create create_manager = reinterpret_cast<Create>(symbol);
- CANModule* module = create_manager();
- ASSERT_TRUE(module != NULL);
-
- PluginInfo plugin = module->GetPluginInfo();
- EXPECT_EQ(plugin.name, "RemoteControlPlugin");
- EXPECT_EQ(plugin.version, 1);
-
- MockService* service = new MockService();
- module->set_service(service);
- std::vector<application_manager::ApplicationSharedPtr> apps;
- EXPECT_CALL(*service, GetApplications(module->GetModuleID()))
- .Times(1)
- .WillOnce(Return(apps));
-
- // in order for all sub-threads to start before shutting them down
- // The logic conditions must be chosen to insure that the "signal" is
- // executed if the "wait" is ever processed.
- // (see http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html)
- sleep(3);
- // CANModule::destroy();
- int ret = dlclose(handle);
- EXPECT_FALSE(ret);
- EXPECT_FALSE(IsError(dlerror()));
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/test/src/rc_module_test.cc b/src/components/remote_control/test/src/rc_module_test.cc
deleted file mode 100644
index 7bdf9fb9dd..0000000000
--- a/src/components/remote_control/test/src/rc_module_test.cc
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2015, 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 "gtest/gtest.h"
-#include "remote_control/remote_control_plugin.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "functional_module/module_observer.h"
-#include "application_manager/mock_application.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager_settings.h"
-
-using functional_modules::PluginInfo;
-using functional_modules::ProcessResult;
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using application_manager::MockMessageHelper;
-using test::components::application_manager_test::MockApplication;
-using test::components::application_manager_test::
- MockApplicationManagerSettings;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::Eq;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-
-namespace {
-const bool kDeviceHandle = 1u;
-const std::string kDeviceId = "1";
-const std::string kDeviceName = "1";
-const uint32_t kDefaultTimeout = 10000;
-}
-
-namespace remote_control {
-
-class RCModuleTest : public ::testing::Test {
- public:
- RCModuleTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_settings_(
- utils::MakeShared<NiceMock<MockApplicationManagerSettings> >())
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , app0_(utils::MakeShared<NiceMock<MockApplication> >())
- , app1_(utils::MakeShared<NiceMock<MockApplication> >())
- , message_(utils::MakeShared<Message>(MessagePriority::FromServiceType(
- protocol_handler::ServiceType::kRpc)))
- , rc_app_extention_(
- utils::MakeShared<RCAppExtension>(module_.GetModuleID())) {}
-
- void HandleMessage() {
- module_.ProcessHMIMessage(message_);
- }
-
- protected:
- RemoteControlPlugin module_;
- utils::SharedPtr<NiceMock<MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplicationManagerSettings> > mock_settings_;
- MockMessageHelper& mock_message_helper_;
- std::vector<ApplicationSharedPtr> apps_;
- utils::SharedPtr<NiceMock<MockApplication> > app0_;
- utils::SharedPtr<NiceMock<MockApplication> > app1_;
- application_manager::MessagePtr message_;
- utils::SharedPtr<RCAppExtension> rc_app_extention_;
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- ON_CALL(*mock_service_, GetSettings())
- .WillByDefault(ReturnRef(*mock_settings_));
- ON_CALL(*mock_settings_, default_timeout())
- .WillByDefault(ReturnRef(kDefaultTimeout));
- ServicePtr exp_service(mock_service_);
- module_.set_service(exp_service);
- ServicePtr out_service = module_.service();
- EXPECT_EQ(exp_service.get(), out_service.get());
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- EXPECT_CALL(*mock_service_, GetApplications(module_.GetModuleID()))
- .WillOnce(Return(apps_));
- }
-};
-
-TEST_F(RCModuleTest, Create) {
- EXPECT_EQ(153, module_.GetModuleID());
- PluginInfo plugin = module_.GetPluginInfo();
- EXPECT_EQ(plugin.name, "RemoteControlPlugin");
- EXPECT_EQ(plugin.version, 1);
-}
-
-TEST_F(RCModuleTest, ProcessMessageWrongMessage) {
- message_->set_function_id(-1);
- EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0);
- EXPECT_EQ(ProcessResult::CANNOT_PROCESS, module_.ProcessMessage(message_));
-}
-
-TEST_F(RCModuleTest, ProcessMessageEmptyapps_List) {
- message_->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA);
- message_->set_function_name("OnInteriorVehicleData");
-
- std::string json =
- "{\"jsonrpc\": \"2.0\", \"method\": \"RC.OnInteriorVehicleData\",\
- \"params\": {\"moduleData\": {\"moduleType\": \"CLIMATE\",\
- \"climateControlData\": {\"fanSpeed\": 100} }}}";
- message_->set_json_message(json);
-
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(_))
- .WillOnce(Return(
- application_manager::MessageValidationResult::SCHEMA_MISMATCH));
- EXPECT_CALL(*mock_service_, SendMessageToMobile(_)).Times(0);
-
- // EXPECT_EQ(ProcessResult::PROCESSED, module_.ProcessMessage(message_));
- EXPECT_EQ(ProcessResult::CANNOT_PROCESS, module_.ProcessHMIMessage(message_));
-}
-
-TEST_F(RCModuleTest, ProcessMessagePass) {
- message_->set_function_id(RCFunctionID::ON_INTERIOR_VEHICLE_DATA);
-
- std::string json =
- "{ \"jsonrpc\": \"2.0\",\"method\": \"RC.OnInteriorVehicleData\",\
- \"params\":{\"moduleData\":{\
- \"moduleType\": \"CLIMATE\",\"climateControlData\": {\"fanSpeed\": 100}}}}";
-
- message_->set_json_message(json);
-
- application_manager::BinaryData buf;
- application_manager::BinaryData* data = &buf;
- data->push_back(1);
-
- message_->set_binary_data(
- static_cast<const application_manager::BinaryData*>(data));
-
- Json::Value json_value = MessageHelper::StringToValue(json);
- Json::Value module_type =
- json_value[json_keys::kParams][message_params::kModuleData]
- [message_params::kModuleType];
- apps_.push_back(app0_);
- rc_app_extention_->SubscribeToInteriorVehicleData(module_type);
- EXPECT_CALL(*mock_service_, ValidateMessageBySchema(_))
- .WillOnce(Return(application_manager::MessageValidationResult::SUCCESS));
- EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID()))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_CALL(*app0_, app_id()).WillRepeatedly(Return(1));
- EXPECT_CALL(*app0_, protocol_version())
- .WillRepeatedly(
- Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
- EXPECT_CALL(*mock_service_, GetApplications(module_.GetModuleID()))
- .WillOnce(Return(apps_));
- EXPECT_CALL(*mock_service_, GetApplication(1)).WillOnce(Return(app0_));
- EXPECT_CALL(*mock_service_, CheckPolicyPermissions(_))
- .WillOnce(Return(mobile_apis::Result::eType::SUCCESS));
- EXPECT_CALL(*mock_service_, CheckModule(1, "CLIMATE")).WillOnce(Return(true));
- EXPECT_CALL(*mock_service_, SendMessageToMobile(_));
-
- EXPECT_EQ(ProcessResult::PROCESSED, module_.ProcessHMIMessage(message_));
-}
-
-TEST_F(RCModuleTest, RemoveAppExtensionPassWay) {
- EXPECT_CALL(*mock_service_, GetApplication(1)).WillOnce(Return(app0_));
- EXPECT_CALL(*app0_, RemoveExtension(module_.GetModuleID()));
-
- module_.RemoveAppExtension(1);
-}
-
-TEST_F(RCModuleTest, RemoveAppExtensionIfAppNoExist) {
- ApplicationSharedPtr invalid_app;
-
- EXPECT_CALL(*mock_service_, GetApplication(_)).WillOnce(Return(invalid_app));
-
- module_.RemoveAppExtension(1);
-}
-
-TEST_F(RCModuleTest, SendResponseToMobile) {
- EXPECT_CALL(*mock_service_, SendMessageToMobile(message_));
-
- module_.SendResponseToMobile(message_);
-}
-
-TEST_F(RCModuleTest, IsAppForPluginSuccess) {
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID()))
- .WillOnce(Return(invalid_ext))
- .WillRepeatedly(Return(rc_app_extention_));
- EXPECT_CALL(*app0_, AddExtension(_)).WillOnce(Return(true));
- mobile_apis::HMILevel::eType hmi = mobile_apis::HMILevel::eType::HMI_FULL;
- EXPECT_CALL(*app0_, hmi_level()).WillRepeatedly(Return(hmi));
- ON_CALL(*app0_, device()).WillByDefault(Return(1));
- EXPECT_CALL(*mock_service_, IsRemoteControlApplication(Eq(app0_)))
- .WillOnce(Return(true));
- ASSERT_TRUE(module_.IsAppForPlugin(app0_));
-}
-
-TEST_F(RCModuleTest, IsAppForPluginNotNew) {
- EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID()))
- .WillOnce(Return(rc_app_extention_));
- EXPECT_CALL(*mock_service_, NotifyHMIAboutHMILevel(Eq(app0_), _)).Times(0);
- ASSERT_TRUE(module_.IsAppForPlugin(app0_));
-}
-
-TEST_F(RCModuleTest, IsAppForPluginFail) {
- application_manager::AppExtensionPtr invalid_ext;
- EXPECT_CALL(*app0_, QueryInterface(module_.GetModuleID()))
- .WillOnce(Return(invalid_ext));
- EXPECT_CALL(*mock_service_, IsRemoteControlApplication(Eq(app0_)))
- .Times(1)
- .WillOnce(Return(false));
- ASSERT_FALSE(module_.IsAppForPlugin(app0_));
-}
-
-TEST_F(RCModuleTest, OnAppHMILevelChanged) {
- const application_manager::custom_str::CustomString name("name");
- ON_CALL(*app0_, name()).WillByDefault(ReturnRef(name));
- mobile_apis::HMILevel::eType hmi = mobile_apis::HMILevel::eType::HMI_NONE;
- EXPECT_CALL(*app0_, hmi_level()).WillRepeatedly(Return(hmi));
- EXPECT_CALL(*mock_service_,
- NotifyHMIAboutHMILevel(Eq(app0_),
- mobile_apis::HMILevel::eType::HMI_NONE));
- module_.OnAppHMILevelChanged(app0_, mobile_apis::HMILevel::eType::HMI_FULL);
-}
-
-} // namespace remote_control
diff --git a/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc b/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc
deleted file mode 100644
index a69702d424..0000000000
--- a/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright (c) 2017, 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 "gtest/gtest.h"
-#include <algorithm>
-#include "remote_control/resource_allocation_manager_impl.h"
-#include "mock_resource_allocation_manager.h"
-#include "mock_remote_control_plugin.h"
-#include "remote_control/rc_app_extension.h"
-#include "remote_control/rc_module_constants.h"
-#include "remote_control/message_helper.h"
-#include "functional_module/module_observer.h"
-#include "application_manager/mock_application.h"
-#include "include/mock_service.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
-
-using functional_modules::PluginInfo;
-using functional_modules::ProcessResult;
-using functional_modules::RCFunctionID;
-using application_manager::ServicePtr;
-
-using application_manager::MockService;
-using namespace test::components;
-using application_manager_test::MockApplication;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::testing::Eq;
-using ::testing::DoAll;
-using ::testing::SetArgPointee;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-
-namespace {
-const bool kDeviceHandle = 1u;
-const std::string kModuleType1 = "CLIMATE";
-const std::string kModuleType2 = "RADIO";
-const int32_t kConnectionKey = 5;
-const int32_t kCorrelationId = 5;
-const uint32_t kAppId1 = 11u;
-const uint32_t kAppId2 = 22u;
-const std::string policy_app_id_1_ = "policy_id_1";
-const functional_modules::ModuleID kDefaultModuleID = 0;
-}
-
-namespace remote_control {
-
-class RAManagerTest : public ::testing::Test {
- public:
- RAManagerTest()
- : mock_service_(utils::MakeShared<NiceMock<MockService> >())
- , mock_app_1_(utils::MakeShared<NiceMock<MockApplication> >())
- , mock_app_2_(utils::MakeShared<NiceMock<MockApplication> >())
- , message_(utils::MakeShared<Message>(MessagePriority::FromServiceType(
- protocol_handler::ServiceType::kRpc))) {
- EXPECT_CALL(mock_module_, service()).WillRepeatedly(Return(mock_service_));
- EXPECT_CALL(mock_module_, GetModuleID())
- .WillRepeatedly(Return(kDefaultModuleID));
- }
-
- void CheckResultWithHMILevelAndAccessMode(
- ResourceAllocationManagerImpl& ra_manager,
- mobile_apis::HMILevel::eType app_level,
- const remote_control::AcquireResult::eType expected_result,
- const hmi_apis::Common_RCAccessMode::eType access_mode) {
- // Arrange
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ra_manager.SetAccessMode(access_mode);
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level));
- // Second app tries to get already acquired resource by 1st app
- EXPECT_EQ(expected_result,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
- }
-
- protected:
- utils::SharedPtr<NiceMock<MockService> > mock_service_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_1_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_2_;
- application_manager::MessagePtr message_;
- remote_control_test::MockRemotePluginInterface mock_module_;
- RemotePluginInterface::RCPluginEventDispatcher event_dispatcher_;
-};
-
-TEST_F(RAManagerTest, AcquireResource_NoAppRegistered_Expect_InUse) {
- // Arrange
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(ApplicationSharedPtr()));
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- // Act & Assert
- EXPECT_EQ(remote_control::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(RAManagerTest,
- AcquireResource_AppRegisteredAnyHmiLevelResourceFree_Expect_Allowed) {
- // Arrange
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- // Act & Assert
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_AppInAnyHmiLevelWantsToAcquireSameResourceTwice_Expect_Allowed) {
- // Arrange
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- // Same app tries to get already acquired resource
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_NotInFULLWantsToGetAcquiredResource_Expect_Rejected) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace remote_control;
- const HMILevel::eType app_level = HMILevel::eType::HMI_BACKGROUND;
- const AcquireResult::eType expected_result = AcquireResult::REJECTED;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_ALLOW;
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_DENY_Expect_InUse) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace remote_control;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::IN_USE;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_DENY;
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_ALLOW_Expect_Allowed) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace remote_control;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::ALLOWED;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_ALLOW;
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_ASK_DRIVER_Expect_AskDriver) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace remote_control;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::ASK_DRIVER;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::ASK_DRIVER;
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(RAManagerTest,
- AcquireResource_AcquiredModuleIsRejectedForApp2_ExpectApp2Rejected) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- EXPECT_EQ(AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- ra_manager.OnDriverDisallowed(kModuleType1, kAppId2);
-
- // Assert
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_EQ(AcquireResult::REJECTED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppExit_ReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
- EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
-
- ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationExit, app_ptr);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_2_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
- EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
- ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationExit, app_ptr);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(remote_control::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
- EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
-
- ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationUnregistered, app_ptr);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillOnce(Return(mock_app_2_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillOnce(Return(mock_app_1_));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_2_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
- EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
-
- ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationUnregistered, app_ptr);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(remote_control::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId1));
-
- std::vector<ApplicationSharedPtr> apps;
- apps.push_back(mock_app_1_);
- EXPECT_CALL(*mock_service_, GetApplications(_)).WillRepeatedly(Return(apps));
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- // Act
- ra_manager.OnPolicyEvent(
- functional_modules::PolicyEvent::kApplicationsDisabled);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_module_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- RCAppExtensionPtr rc_extention_ptr = utils::MakeShared<RCAppExtension>(
- application_manager::AppExtensionUID(kDefaultModuleID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
-
- EXPECT_CALL(*mock_app_1_, policy_app_id())
- .WillRepeatedly(Return(policy_app_id_1_));
-
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId1));
-
- std::vector<application_manager::ApplicationSharedPtr> apps;
- apps.push_back(mock_app_1_);
- EXPECT_CALL(*mock_service_, GetApplications(_)).WillOnce(Return(apps));
-
- Resources allowed_modules;
- allowed_modules.push_back(kModuleType1);
-
- EXPECT_CALL(*mock_service_, GetModuleTypes(policy_app_id_1_, _))
- .WillOnce(DoAll(SetArgPointee<1>(allowed_modules), Return(true)));
-
- // Act
- ra_manager.OnPolicyEvent(
- functional_modules::PolicyEvent::kApplicationPolicyUpdated);
-
- EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(remote_control::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
- EXPECT_EQ(remote_control::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId2));
-}
-
-TEST_F(RAManagerTest, GetAccessMode_ExpectedSameAsHadSet) {
- ResourceAllocationManagerImpl ra_manager(mock_module_);
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_DENY);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_DENY,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::ASK_DRIVER,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_ALLOW);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_ALLOW,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::INVALID_ENUM);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::INVALID_ENUM,
- ra_manager.GetAccessMode());
-}
-
-} // namespace remote_control