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/include | |
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/include')
7 files changed, 116 insertions, 12 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h index 78f552aa50..7c88cea5a7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h @@ -5,10 +5,13 @@ #include "utils/macro.h" namespace rc_rpc_plugin { +namespace app_mngr = application_manager; + namespace commands { -class ButtonPressRequest - : public application_manager::commands::CommandRequestImpl { +class ButtonPressRequest : public app_mngr::commands::CommandRequestImpl { public: + ButtonPressRequest(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager); bool Init() OVERRIDE; void Run() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h index 27c32e9e59..165124cdfe 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h @@ -5,10 +5,14 @@ #include "utils/macro.h" namespace rc_rpc_plugin { +namespace app_mngr = application_manager; + namespace commands { class ButtonPressResponse : public application_manager::commands::CommandResponseImpl { public: + ButtonPressResponse(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager); bool Init() OVERRIDE; void Run() OVERRIDE; void on_event(const application_manager::event_engine::Event& event); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h index 8130611ce2..7b1128b103 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h @@ -5,10 +5,15 @@ #include "utils/macro.h" namespace rc_rpc_plugin { +namespace app_mngr = application_manager; + namespace commands { class GetInteriorVehicleDataRequest : public application_manager::commands::CommandRequestImpl { public: + GetInteriorVehicleDataRequest( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager); bool Init() OVERRIDE; void Run() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h index 246e7eb27f..07df368e85 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h @@ -5,10 +5,15 @@ #include "utils/macro.h" namespace rc_rpc_plugin { +namespace app_mngr = application_manager; + namespace commands { class GetInteriorVehicleDataResponse : public application_manager::commands::CommandResponseImpl { public: + GetInteriorVehicleDataResponse( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager); bool Init() OVERRIDE; void Run() OVERRIDE; void on_event(const application_manager::event_engine::Event& event); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h new file mode 100644 index 0000000000..f3f8535486 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h @@ -0,0 +1,79 @@ +/* + * 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/app_extension.h" +#include "json/json.h" + +namespace rc_rpc_plugin { +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 rc_rpc_plugin + +#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h index e54d3bd5a3..fc4ba13b85 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h @@ -1,37 +1,40 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H -#include "application_manager/command_factory.h" #include <memory> +#include "application_manager/command_factory.h" #include "application_manager/application_manager.h" #include "application_manager/command_factory.h" -#include "sdl_rpc_plugin/hmi_command_factory.h" -#include "sdl_rpc_plugin/mobile_command_factory.h" #include "application_manager/rpc_service.h" #include "application_manager/hmi_capabilities.h" #include "application_manager/policies/policy_handler_interface.h" +#include "utils/macro.h" namespace rc_rpc_plugin { +namespace app_mngr = application_manager; class RCCommandFactory : public application_manager::CommandFactory { - namespace commands = application_manager::commands; - namespace app_mngr = application_manager; - public: RCCommandFactory(app_mngr::ApplicationManager& app_manager, app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); application_manager::CommandSharedPtr CreateCommand( - const commands::MessageSharedPtr& message, - commands::Command::CommandSource source) OVERRIDE; + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; private: + application_manager::CommandSharedPtr CreateMobileCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source); + + application_manager::CommandSharedPtr CreateHMICommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source); + app_mngr::ApplicationManager& app_manager_; app_mngr::rpc_service::RPCService& rpc_service_; app_mngr::HMICapabilities& hmi_capabilities_; policy::PolicyHandlerInterface& policy_handler_; - std::unique_ptr<HMICommandFactory> hmi_command_factory_; - std::unique_ptr<MobileCommandFactory> mobile_command_factory_; }; } // namespace rc_rpc_plugin #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h index 8afea2f75c..faa82ebae3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h @@ -52,6 +52,11 @@ class RCRPCPlugin : public plugins::RPCPlugin { void OnPolicyEvent(app_mngr::plugin_manager::PolicyEvent event) OVERRIDE; void OnApplicationEvent(plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) OVERRIDE; + + static const uint32_t kRCPluginID = 153; + + private: + std::unique_ptr<application_manager::CommandFactory> command_factory_; }; } // namespace rc_rpc_plugin #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_PLUGIN_H |