From f8865f545e6b7831cf8365f19043627e2be51bbf Mon Sep 17 00:00:00 2001 From: Ira Lytvynenko Date: Wed, 14 Feb 2018 17:13:16 +0200 Subject: GetInteriorVehicleData implementation and some fixes --- .../hmi/rc_get_interior_vehicle_data_request.h | 6 ++- .../hmi/rc_get_interior_vehicle_data_response.h | 9 ++-- .../mobile/get_interior_vehicle_data_request.h | 52 ++++++++++++++++++---- .../mobile/get_interior_vehicle_data_response.h | 5 ++- .../include/rc_rpc_plugin/rc_app_extension.h | 9 ++-- 5 files changed, 60 insertions(+), 21 deletions(-) (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/include') diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h index 0266305d50..ccc3859d8b 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h @@ -14,9 +14,11 @@ class RCGetInteriorVehicleDataRequest RCGetInteriorVehicleDataRequest( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager); - bool Init() OVERRIDE; + /** + * @brief Execute command + */ void Run() OVERRIDE; - void on_event(const application_manager::event_engine::Event& event); + virtual ~RCGetInteriorVehicleDataRequest(); }; } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h index a746306dcf..fcf1e04d18 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h @@ -1,7 +1,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H -#include "application_manager/commands/response_to_hmi.h" +#include "application_manager/commands/response_from_hmi.h" #include "utils/macro.h" namespace rc_rpc_plugin { @@ -9,14 +9,15 @@ namespace app_mngr = application_manager; namespace commands { class RCGetInteriorVehicleDataResponse - : public application_manager::commands::ResponseToHMI { + : public application_manager::commands::ResponseFromHMI { public: RCGetInteriorVehicleDataResponse( 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); + + virtual ~RCGetInteriorVehicleDataResponse(); }; } // namespace commands } // namespace rc_rpc_plugin 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 7b1128b103..078d3b2ff1 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 @@ -1,22 +1,58 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H -#include "application_manager/commands/command_request_impl.h" -#include "utils/macro.h" +#include "rc_rpc_plugin/commands/rc_command_request.h" namespace rc_rpc_plugin { namespace app_mngr = application_manager; namespace commands { -class GetInteriorVehicleDataRequest - : public application_manager::commands::CommandRequestImpl { +class GetInteriorVehicleDataRequest : public RCCommandRequest { 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; + app_mngr::ApplicationManager& application_manager, + rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager); + + /** + * @brief Execute command + */ + void Execute() FINAL; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + /** + * @brief 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(); + + /** + * @brief GetInteriorVehicleDataRequest class destructor + */ + virtual ~GetInteriorVehicleDataRequest(); + + private: + /** + * @brief Handle subscription to vehicle data + * @param hmi_response json message with response from HMI + */ + void ProccessSubscription( + const NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_response); + + /** + * @brief Cuts off subscribe parameter + * @param request_params request parameters to handle + */ + void RemoveExcessiveSubscription(); }; } // namespace commands } // namespace rc_rpc_plugin 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 07df368e85..b967cea71b 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 @@ -14,9 +14,10 @@ class GetInteriorVehicleDataResponse 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); + + virtual ~GetInteriorVehicleDataResponse(); }; } // namespace commands } // namespace rc_rpc_plugin 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 index f3f8535486..5597c1bf17 100644 --- 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 @@ -36,7 +36,6 @@ #include #include #include "application_manager/app_extension.h" -#include "json/json.h" namespace rc_rpc_plugin { class RCAppExtension : public application_manager::AppExtension { @@ -48,13 +47,13 @@ class RCAppExtension : public application_manager::AppExtension { * @brief Subscribe to OnInteriorVehicleDataNotification * @param module interior data specification(zone, data type) */ - void SubscribeToInteriorVehicleData(const Json::Value& module_type); + void SubscribeToInteriorVehicleData(const std::string& module_type); /** * @brief Unsubscribe from OnInteriorVehicleDataNotification * @param module interior data specification(zone, data type) */ - void UnsubscribeFromInteriorVehicleData(const Json::Value& module_type); + void UnsubscribeFromInteriorVehicleData(const std::string& module_type); /** * @brief UnsubscribeFromInteriorVehicleData removes all subscriptions for @@ -66,10 +65,10 @@ class RCAppExtension : public application_manager::AppExtension { * @brief Check if application subscribed to OnInteriorVehicleDataNotification * @param module interior data specification(zone, data type) */ - bool IsSubscibedToInteriorVehicleData(const Json::Value& module_type); + bool IsSubscibedToInteriorVehicleData(const std::string& module_type); private: - std::set subscribed_interior_vehicle_data_; + std::set subscribed_interior_vehicle_data_; }; typedef utils::SharedPtr RCAppExtensionPtr; -- cgit v1.2.1