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 +- .../hmi/rc_get_interior_vehicle_data_request.cc | 10 +- .../hmi/rc_get_interior_vehicle_data_response.cc | 17 +- .../mobile/get_interior_vehicle_data_request.cc | 174 ++++++++++++++++++++- .../mobile/get_interior_vehicle_data_response.cc | 10 +- .../src/commands/rc_command_request.cc | 4 +- .../rc_rpc_plugin/src/rc_app_extension.cc | 8 +- .../rc_rpc_plugin/src/rc_command_factory.cc | 2 +- .../src/resource_allocation_manager_impl.cc | 2 +- 13 files changed, 255 insertions(+), 53 deletions(-) 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; 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 ae8a314aac..c9bb54cafb 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 @@ -9,12 +9,12 @@ RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest( app_mngr::ApplicationManager& application_manager) : app_mngr::commands::RequestToHMI(message, application_manager) {} -bool RCGetInteriorVehicleDataRequest::Init() { - return true; +RCGetInteriorVehicleDataRequest::~RCGetInteriorVehicleDataRequest(){} + +void RCGetInteriorVehicleDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); } -void RCGetInteriorVehicleDataRequest::Run() {} -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 3a988d3469..3d77d0d28c 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 @@ -1,5 +1,5 @@ #include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h" -#include "utils/macro.h" +#include "application_manager/event_engine/event.h" namespace rc_rpc_plugin { namespace commands { @@ -7,14 +7,17 @@ namespace commands { RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager) - :app_mngr::commands::ResponseToHMI(message, application_manager) {} + :app_mngr::commands::ResponseFromHMI(message, application_manager) {} -bool RCGetInteriorVehicleDataResponse::Init() { - return true; +void RCGetInteriorVehicleDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + app_mngr::event_engine::Event event(hmi_apis::FunctionID::Buttons_ButtonPress); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); } -void RCGetInteriorVehicleDataResponse::Run() {} -void RCGetInteriorVehicleDataResponse::on_event( - const application_manager::event_engine::Event& event) {} + +RCGetInteriorVehicleDataResponse::~RCGetInteriorVehicleDataResponse(){} } // 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 3c8e4d2f4b..8d3190b0e9 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 @@ -1,20 +1,180 @@ #include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h" +#include "rc_rpc_plugin/rc_module_constants.h" #include "utils/macro.h" +#include "interfaces/MOBILE_API.h" namespace rc_rpc_plugin { namespace commands { +using namespace json_keys; +using namespace message_params; + +CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") + GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager) - : app_mngr::commands::CommandRequestImpl(message, application_manager) {} + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager) + : RCCommandRequest( + resource_allocation_manager, message, application_manager) {} + +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; + } -bool GetInteriorVehicleDataRequest::Init() { return true; } -void GetInteriorVehicleDataRequest::Run() {} -void GetInteriorVehicleDataRequest::on_event( - const application_manager::event_engine::Event& event) {} + +void GetInteriorVehicleDataRequest::Execute() { + LOG4CXX_AUTO_TRACE(logger_); + + const smart_objects::SmartObject* rc_capabilities = + application_manager_.hmi_capabilities().rc_capability(); + const std::string module_type = + (*message_)[app_mngr::strings::msg_params][message_params::kModuleType].asString(); + if (rc_capabilities && + !CheckIfModuleTypeExistInCapabilities(*rc_capabilities, + module_type)) { + LOG4CXX_WARN(logger_, "Accessing not supported module data"); + SendResponse(false, + mobile_apis::Result::UNSUPPORTED_RESOURCE, + "Accessing not supported module data"); + return; + } + if (HasRequestExcessiveSubscription()) { + RemoveExcessiveSubscription(); + } + + SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleData, + &(*message_)[app_mngr::strings::msg_params], true); +} + +void GetInteriorVehicleDataRequest::on_event(const app_mngr::event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + if (hmi_apis::FunctionID::RC_GetInteriorVehicleData != event.id()){ + return; + } + + const smart_objects::SmartObject& hmi_response = event.smart_object(); + + mobile_apis::Result::eType result_code = + GetMobileResultCode(static_cast( + hmi_response[app_mngr::strings::params][app_mngr::hmi_response::code] + .asUInt())); + + bool result = + helpers::Compare( + result_code, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS); + + if (mobile_apis::Result::READ_ONLY == result_code) { + result = false; + result_code = mobile_apis::Result::GENERIC_ERROR; + } + + if (result) { + ProccessSubscription(hmi_response); + } + std::string response_info; + GetInfo(hmi_response, response_info); + SendResponse(result, result_code, response_info.c_str()); +} + +void GetInteriorVehicleDataRequest::ProccessSubscription( + const NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_response) { + LOG4CXX_AUTO_TRACE(logger_); + + const bool is_subscribe_present_in_request = + (*message_)[app_mngr::strings::msg_params].keyExists(message_params::kSubscribe); + const bool isSubscribed_present_in_response = + hmi_response[json_keys::kResult].keyExists(message_params::kIsSubscribed); + + if (!is_subscribe_present_in_request && !isSubscribed_present_in_response) { + return; + } + app_mngr::ApplicationSharedPtr app = + application_manager_.application(CommandRequestImpl::connection_key()); + RCAppExtensionPtr extension = resource_allocation_manager_.GetApplicationExtention(app); + if (is_subscribe_present_in_request && !isSubscribed_present_in_response) { + LOG4CXX_WARN(logger_, + "conditional mandatory parameter " + << message_params::kIsSubscribed << " missed in hmi response"); + 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 = + (*message_)[app_mngr::strings::msg_params][message_params::kSubscribe].asBool(); + const bool response_subscribe = + hmi_response[json_keys::kResult][message_params::kIsSubscribed].asBool(); + LOG4CXX_TRACE(logger_, "request_subscribe = " << request_subscribe); + LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe); + if (request_subscribe == response_subscribe) { + const std::string module_type = + (*message_)[app_mngr::strings::msg_params][message_params::kModuleType].asString(); + if (response_subscribe) { + LOG4CXX_DEBUG(logger_, + "SubscribeToInteriorVehicleData " + << app->app_id() << " " + << module_type); + extension->SubscribeToInteriorVehicleData(module_type); + } else { + LOG4CXX_DEBUG(logger_, + "UnsubscribeFromInteriorVehicleData " + << app->app_id() << " " + << module_type); + extension->UnsubscribeFromInteriorVehicleData(module_type); + } + } +} + +bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() { + LOG4CXX_AUTO_TRACE(logger_); + const bool is_subscribe_present_in_request = + (*message_)[app_mngr::strings::msg_params].keyExists(message_params::kSubscribe); + + if (is_subscribe_present_in_request) { + app_mngr::ApplicationSharedPtr app = + application_manager_.application(CommandRequestImpl::connection_key()); + RCAppExtensionPtr extension = resource_allocation_manager_.GetApplicationExtention(app); + + const bool is_app_already_subscribed = + extension->IsSubscibedToInteriorVehicleData( + (*message_)[app_mngr::strings::msg_params][message_params::kModuleType].asString()); + const bool app_wants_to_subscribe = + (*message_)[app_mngr::strings::msg_params][message_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() { + LOG4CXX_AUTO_TRACE(logger_); + (*message_)[app_mngr::strings::msg_params].erase(message_params::kSubscribe); +} } // 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 c8c8a56675..795c9a8178 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 @@ -9,12 +9,12 @@ GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse( app_mngr::ApplicationManager& application_manager) : app_mngr::commands::CommandResponseImpl(message, application_manager) {} -bool GetInteriorVehicleDataResponse::Init() { - return true; +GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse(){} + +void GetInteriorVehicleDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + application_manager_.GetRPCService().SendMessageToMobile(message_); } -void GetInteriorVehicleDataResponse::Run() {} -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/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc index f39707c7d9..3fb8e45739 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc @@ -206,9 +206,9 @@ void RCCommandRequest::ProcessAccessResponse( bool is_allowed = false; if (result) { - if (message[app_mngr::strings::msg_params].keyExists(message_params::kAllowed)) { + if (message[json_keys::kResult].keyExists(message_params::kAllowed)) { is_allowed = - message[app_mngr::strings::msg_params][message_params::kAllowed].asBool(); + message[json_keys::kResult][message_params::kAllowed].asBool(); } if (is_allowed) { resource_allocation_manager_.ForceAcquireResource(module_type, 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 index 8a4ad3c331..65d78020bb 100644 --- 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 @@ -37,12 +37,12 @@ RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid) : AppExtension(uid) {} void RCAppExtension::SubscribeToInteriorVehicleData( - const Json::Value& module_type) { + const std::string& module_type) { subscribed_interior_vehicle_data_.insert(module_type); } void RCAppExtension::UnsubscribeFromInteriorVehicleData( - const Json::Value& module_type) { + const std::string& module_type) { subscribed_interior_vehicle_data_.erase(module_type); } @@ -51,8 +51,8 @@ void RCAppExtension::UnsubscribeFromInteriorVehicleData() { } bool RCAppExtension::IsSubscibedToInteriorVehicleData( - const Json::Value& module_type) { - std::set::iterator it = + const std::string& module_type) { + std::set::iterator it = subscribed_interior_vehicle_data_.find(module_type); return (it != subscribed_interior_vehicle_data_.end()); 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 57294b91a9..a7018987c4 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 @@ -102,7 +102,7 @@ CommandSharedPtr RCCommandFactory::CreateMobileCommand( if ((*message)[strings::params][strings::message_type] == static_cast(application_manager::MessageType::kRequest)) { command.reset( - new commands::GetInteriorVehicleDataRequest(message, app_manager_)); + new commands::GetInteriorVehicleDataRequest(message, app_manager_, allocation_manager_)); } else { command.reset(new commands::GetInteriorVehicleDataResponse( message, app_manager_)); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index 4344a3a9c5..7116ecd6a5 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -158,7 +158,7 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { for (; disallowed_modules.end() != module; ++module) { ReleaseResource(*module, application_id); if (rc_extention) { - rc_extention->UnsubscribeFromInteriorVehicleData(Json::Value(*module)); + rc_extention->UnsubscribeFromInteriorVehicleData(*module); } } } -- cgit v1.2.1