summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-11-16 16:25:39 -0500
committerjacobkeeler <jacob.keeler@livioradio.com>2018-11-16 16:25:39 -0500
commit551e5eeed41767ab11e677ce345c67b661b687c8 (patch)
tree3794c0153e930c791039ed6351b77b8904bcec23 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin
parentdc2dc33575394ae16d72a745e278279e0a2700a1 (diff)
parentd8ad4e0427b33087340aa34cf1e1d3954cdb793e (diff)
downloadsdl_core-551e5eeed41767ab11e677ce345c67b661b687c8.tar.gz
Merge remote-tracking branch 'origin/feature/cloud_app_connection_flow' into feature/cloud_app_connection_status
# Conflicts: # src/components/application_manager/include/application_manager/application.h # src/components/application_manager/include/application_manager/application_impl.h
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc81
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc8
5 files changed, 182 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h
new file mode 100644
index 0000000000..0c62b248b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ SetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~SetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest);
+}; // SetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h
new file mode 100644
index 0000000000..9037cb3b73
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ SetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~SetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesResponse);
+
+}; // SetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc
new file mode 100644
index 0000000000..ca5a46e3dc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc
@@ -0,0 +1,81 @@
+#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
+void SetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if ((*message_)[strings::msg_params].empty()) {
+ LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ smart_objects::SmartObject cloud_app_properties(smart_objects::SmartType_Map);
+
+ cloud_app_properties[strings::msg_params][strings::app_name] =
+ (*message_)[strings::msg_params][strings::app_name];
+ cloud_app_properties[strings::msg_params][strings::app_id] =
+ (*message_)[strings::msg_params][strings::app_id];
+
+ if ((*message_)[strings::msg_params].keyExists(strings::enabled)) {
+ smart_objects::SmartObject enabled =
+ (*message_)[strings::msg_params][strings::enabled];
+ cloud_app_properties[strings::msg_params][strings::enabled] = enabled;
+ }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::cloud_app_auth_token)) {
+ smart_objects::SmartObject auth_token =
+ (*message_)[strings::msg_params][strings::cloud_app_auth_token];
+ cloud_app_properties[strings::msg_params][strings::cloud_app_auth_token] =
+ auth_token;
+ }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::cloud_transport_type)) {
+ smart_objects::SmartObject transport_type =
+ (*message_)[strings::msg_params][strings::cloud_transport_type];
+ cloud_app_properties[strings::msg_params][strings::cloud_transport_type] =
+ transport_type;
+ }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::hybrid_app_preference)) {
+ smart_objects::SmartObject hybrid_app_preference =
+ (*message_)[strings::msg_params][strings::hybrid_app_preference];
+ cloud_app_properties[strings::msg_params][strings::hybrid_app_preference] =
+ hybrid_app_preference;
+ }
+
+ policy_handler_.OnSetCloudAppProperties(cloud_app_properties);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+}
+
+void SetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc
new file mode 100644
index 0000000000..6acfb2423d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc
@@ -0,0 +1,31 @@
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {}
+
+void SetCloudAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugins
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 5207c7e432..dc5298813b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -124,6 +124,8 @@
#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h"
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h"
#include "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -337,6 +339,12 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::SendHapticDataRequest>()
: factory.GetCreator<commands::SendHapticDataResponse>();
}
+ case mobile_apis::FunctionID::SetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::SetCloudAppPropertiesResponse>();
+ }
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}