summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include
diff options
context:
space:
mode:
authorIra Lytvynenko <ILytvynenko@luxoft.com>2018-02-14 17:13:16 +0200
committerIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-06-26 12:01:45 +0300
commitf8865f545e6b7831cf8365f19043627e2be51bbf (patch)
tree70d5a798c76b5d3898edf0bda82e880267c28e06 /src/components/application_manager/rpc_plugins/rc_rpc_plugin/include
parentc8c8d7f4425e23fe1acaf8d7ff9828b60079ac4f (diff)
downloadsdl_core-f8865f545e6b7831cf8365f19043627e2be51bbf.tar.gz
GetInteriorVehicleData implementation and some fixes
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/include')
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h52
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h9
5 files changed, 60 insertions, 21 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 <string>
#include <set>
#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<Json::Value> subscribed_interior_vehicle_data_;
+ std::set<std::string> subscribed_interior_vehicle_data_;
};
typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr;