diff options
author | Ira Lytvynenko <ILytvynenko@luxoft.com> | 2018-02-09 15:26:05 +0200 |
---|---|---|
committer | Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2018-06-26 12:01:45 +0300 |
commit | 87abaf17c2f8a7e5b5153b0db3f7c1d03c6d5b5a (patch) | |
tree | 26019df5d99063c20e6cad43c367a636343f0c77 /src/components/application_manager/rpc_plugins/rc_rpc_plugin/src | |
parent | c8e706b2b9613dbe5b8250635d7418596007f75e (diff) | |
download | sdl_core-87abaf17c2f8a7e5b5153b0db3f7c1d03c6d5b5a.tar.gz |
Add initial impl for rc command factory and fix some rc commands
Add app extension
Add reaction on App registraion
fix notofying plugins about app registrtion
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/src')
19 files changed, 283 insertions, 32 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc index bc164c61ca..d59f12a6df 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCButtonPressRequest::Init() { - return true; + return true; } void RCButtonPressRequest::Run() {} -void RCButtonPressRequest::on_event(const application_manager::event_engine::Event& event) {} +void RCButtonPressRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc index 1a7eca3408..7765de7534 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCButtonPressResponse::Init() { - return true; + return true; } void RCButtonPressResponse::Run() {} -void RCButtonPressResponse::on_event(const application_manager::event_engine::Event& event) {} +void RCButtonPressResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc index c3cc73fd5f..11c3569a1e 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCGetInteriorVehicleDataRequest::Init() { - return true; + return true; } void RCGetInteriorVehicleDataRequest::Run() {} -void RCGetInteriorVehicleDataRequest::on_event(const application_manager::event_engine::Event& event) {} +void RCGetInteriorVehicleDataRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc index 7099e31885..53c19dcad7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCGetInteriorVehicleDataResponse::Init() { - return true; + return true; } void RCGetInteriorVehicleDataResponse::Run() {} -void RCGetInteriorVehicleDataResponse::on_event(const application_manager::event_engine::Event& event) {} +void RCGetInteriorVehicleDataResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc index c933e7799d..8109a4cdb3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCOnInteriorVehicleDataNotification::Init() { - return true; + return true; } void RCOnInteriorVehicleDataNotification::Run() {} -void RCOnInteriorVehicleDataNotification::on_event(const application_manager::event_engine::Event& event) {} +void RCOnInteriorVehicleDataNotification::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc index 9b2945a52a..cb1d066e0f 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCOnRemoteControlSettingsNotification::Init() { - return true; + return true; } void RCOnRemoteControlSettingsNotification::Run() {} -void RCOnRemoteControlSettingsNotification::on_event(const application_manager::event_engine::Event& event) {} +void RCOnRemoteControlSettingsNotification::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc index 23a1983abd..25645308d2 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCSetInteriorVehicleDataRequest::Init() { - return true; + return true; } void RCSetInteriorVehicleDataRequest::Run() {} -void RCSetInteriorVehicleDataRequest::on_event(const application_manager::event_engine::Event& event) {} +void RCSetInteriorVehicleDataRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc index e4185cc357..0f54cc2c81 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool RCSetInteriorVehicleDataResponse::Init() { - return true; + return true; } void RCSetInteriorVehicleDataResponse::Run() {} -void RCSetInteriorVehicleDataResponse::on_event(const application_manager::event_engine::Event& event) {} +void RCSetInteriorVehicleDataResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc index 70456631a0..d3c328b43a 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc @@ -4,11 +4,17 @@ namespace rc_rpc_plugin { namespace commands { +ButtonPressRequest::ButtonPressRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager) + : app_mngr::commands::CommandRequestImpl(message, application_manager) {} + bool ButtonPressRequest::Init() { - return true; + return true; } void ButtonPressRequest::Run() {} -void ButtonPressRequest::on_event(const application_manager::event_engine::Event& event) {} +void ButtonPressRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc index f42f1d3ed2..37e7029e9d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc @@ -4,11 +4,17 @@ namespace rc_rpc_plugin { namespace commands { +ButtonPressResponse::ButtonPressResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager) + : app_mngr::commands::CommandResponseImpl(message, application_manager) {} + bool ButtonPressResponse::Init() { - return true; + return true; } void ButtonPressResponse::Run() {} -void ButtonPressResponse::on_event(const application_manager::event_engine::Event& event) {} +void ButtonPressResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index 4f6cbd311e..3c8e4d2f4b 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -4,11 +4,17 @@ namespace rc_rpc_plugin { namespace commands { +GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager) + : app_mngr::commands::CommandRequestImpl(message, application_manager) {} + bool GetInteriorVehicleDataRequest::Init() { - return true; + return true; } void GetInteriorVehicleDataRequest::Run() {} -void GetInteriorVehicleDataRequest::on_event(const application_manager::event_engine::Event& event) {} +void GetInteriorVehicleDataRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc index bf425276cc..c8c8a56675 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc @@ -4,11 +4,17 @@ namespace rc_rpc_plugin { namespace commands { +GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager) + : app_mngr::commands::CommandResponseImpl(message, application_manager) {} + bool GetInteriorVehicleDataResponse::Init() { - return true; + return true; } void GetInteriorVehicleDataResponse::Run() {} -void GetInteriorVehicleDataResponse::on_event(const application_manager::event_engine::Event& event) {} +void GetInteriorVehicleDataResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index ae8e587923..88e73fa83d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool OnInteriorVehicleDataNotification::Init() { - return true; + return true; } void OnInteriorVehicleDataNotification::Run() {} -void OnInteriorVehicleDataNotification::on_event(const application_manager::event_engine::Event& event) {} +void OnInteriorVehicleDataNotification::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_remote_control_settings_notification.cc index 3b8b91639f..5229e9e172 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_remote_control_settings_notification.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool OnRemoveControlSettingsNotification::Init() { - return true; + return true; } void OnRemoveControlSettingsNotification::Run() {} -void OnRemoveControlSettingsNotification::on_event(const application_manager::event_engine::Event& event) {} +void OnRemoveControlSettingsNotification::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index 7fd4b4dfdf..10bfcbd104 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool SetInteriorVehicleDataRequest::Init() { - return true; + return true; } void SetInteriorVehicleDataRequest::Run() {} -void SetInteriorVehicleDataRequest::on_event(const application_manager::event_engine::Event& event) {} +void SetInteriorVehicleDataRequest::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc index df8725c485..802866e334 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc @@ -5,10 +5,11 @@ namespace rc_rpc_plugin { namespace commands { bool SetInteriorVehicleDataResponse::Init() { - return true; + return true; } void SetInteriorVehicleDataResponse::Run() {} -void SetInteriorVehicleDataResponse::on_event(const application_manager::event_engine::Event& event) {} +void SetInteriorVehicleDataResponse::on_event( + const application_manager::event_engine::Event& event) {} } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc new file mode 100644 index 0000000000..8a4ad3c331 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc @@ -0,0 +1,62 @@ +/* + 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 "rc_rpc_plugin/rc_app_extension.h" + +namespace rc_rpc_plugin { +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 rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc index e69de29bb2..4e9e81bf45 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc @@ -0,0 +1,106 @@ +/* + Copyright (c) 2018, Ford Motor Company + All rights reserved. + + Copyright (c) 2017 Xevo Inc. + 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 copyright holders nor the names of their 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 "rc_rpc_plugin/rc_command_factory.h" +#include "rc_rpc_plugin/commands/mobile/button_press_request.h" +#include "rc_rpc_plugin/commands/mobile/button_press_response.h" +#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h" +#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h" +#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h" +#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h" +#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h" +#include "rc_rpc_plugin/commands/mobile/on_remote_control_settings_notification.h" + +#include "interfaces/MOBILE_API.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "RCCommandFactory") + +namespace rc_rpc_plugin { +using namespace application_manager; + +RCCommandFactory::RCCommandFactory( + app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : app_manager_(app_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} + +CommandSharedPtr RCCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + if (app_mngr::commands::Command::SOURCE_HMI == source) { + return CreateHMICommand(message, source); + } else { + return CreateMobileCommand(message, source); + } +} + +CommandSharedPtr RCCommandFactory::CreateMobileCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + CommandSharedPtr command; + const int function_id = + (*message)[strings::params][strings::function_id].asInt(); + LOG4CXX_DEBUG( + logger_, + "MobileCommandFactory::CreateCommand function_id: " << function_id); + switch (function_id) { + case mobile_apis::FunctionID::ButtonPressID: { + if ((*message)[strings::params][strings::message_type] == + static_cast<int>(application_manager::MessageType::kRequest)) { + command.reset(new commands::ButtonPressRequest(message, app_manager_)); + } else { + command.reset(new commands::ButtonPressRequest(message, app_manager_)); + } + } + + break; + default: + break; + } + return command; +} + +CommandSharedPtr RCCommandFactory::CreateHMICommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + CommandSharedPtr command; + return command; +} + +} // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index e69de29bb2..2d5baba139 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -0,0 +1,47 @@ +#include "rc_rpc_plugin/rc_rpc_plugin.h" +#include "rc_rpc_plugin/rc_command_factory.h" +#include "rc_rpc_plugin/rc_app_extension.h" + +namespace rc_rpc_plugin { +namespace plugins = application_manager::plugin_manager; + +bool RCRPCPlugin::Init( + application_manager::ApplicationManager& app_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) { + return true; +} + +bool RCRPCPlugin::IsAbleToProcess( + const int32_t function_id, + const application_manager::commands::Command::CommandSource + message_source) { + return true; +} + +std::string RCRPCPlugin::PluginName() { + return "RC RPC Plugin"; +} + +application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() { + return *command_factory_; +} + +void RCRPCPlugin::OnPolicyEvent( + application_manager::plugin_manager::PolicyEvent event) {} + +void RCRPCPlugin::OnApplicationEvent( + application_manager::plugin_manager::ApplicationEvent event, + application_manager::ApplicationSharedPtr application) { + switch (event) { + case plugins::kApplicationRegistered: { + application->AddExtension(new RCAppExtension(kRCPluginID)); + break; + } + default: + break; + } +} + +} // namespace rc_rpc_plugin |