From 21cfc65da3b1a9e0d66a13884a6b2e067e0e590b Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Tue, 13 Nov 2018 10:36:42 -0500 Subject: Implement SetCloudAppProperties RPC in core --- .../mobile/set_cloudapp_properties_request.h | 28 +++++++++ .../mobile/set_cloudapp_properties_response.h | 28 +++++++++ .../mobile/set_cloudapp_properties_request.cc | 71 ++++++++++++++++++++++ .../mobile/set_cloudapp_properties_response.cc | 32 ++++++++++ .../sdl_rpc_plugin/src/mobile_command_factory.cc | 7 +++ 5 files changed, 166 insertions(+) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc (limited to 'src/components/application_manager/rpc_plugins') 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..fc131020a8 --- /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,28 @@ +#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..aae45c52ce --- /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,28 @@ +#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..b5c66e4400 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc @@ -0,0 +1,71 @@ +#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 cloudapp_properties(smart_objects::SmartType_Map); + + cloudapp_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; + } + + policy_handler_.OnSetCloudAppProperties(cloudapp_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..b113f84131 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc @@ -0,0 +1,32 @@ +#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..a5b3bf71fe 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,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory( ? factory.GetCreator() : factory.GetCreator(); } + case mobile_apis::FunctionID::SetCloudAppPropertiesID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator(); } -- cgit v1.2.1 From a6912d91f20058789b21c38a0f57a3d9d28b6e57 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Tue, 13 Nov 2018 12:13:32 -0500 Subject: Style Fix --- .../mobile/set_cloudapp_properties_request.h | 37 ++++--- .../mobile/set_cloudapp_properties_response.h | 31 +++--- .../mobile/set_cloudapp_properties_request.cc | 120 +++++++++++---------- .../mobile/set_cloudapp_properties_response.cc | 31 +++--- .../sdl_rpc_plugin/src/mobile_command_factory.cc | 5 +- 5 files changed, 120 insertions(+), 104 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') 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 index fc131020a8..0c62b248b4 100644 --- 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 @@ -5,24 +5,27 @@ 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); +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 + DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest); +}; // SetCloudAppPropertiesRequest -} // namespace commands -} // namespace sdl_rpc_plugin +} // 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 +#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 index aae45c52ce..9037cb3b73 100644 --- 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 @@ -8,21 +8,24 @@ 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(); +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 +}; // 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 +#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 index b5c66e4400..49cb7029c7 100644 --- 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 @@ -5,67 +5,77 @@ 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( + 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()); +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 (!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; - } + 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 cloudapp_properties(smart_objects::SmartType_Map); + smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); - cloudapp_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; - cloudapp_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]; - cloudapp_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]; - cloudapp_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]; - cloudapp_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]; - cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; - } - - policy_handler_.OnSetCloudAppProperties(cloudapp_properties); - SendResponse(true, mobile_apis::Result::SUCCESS); + cloudapp_properties[strings::msg_params][strings::app_name] = + (*message_)[strings::msg_params][strings::app_name]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = + hybrid_app_preference; + } - } + policy_handler_.OnSetCloudAppProperties(cloudapp_properties); + SendResponse(true, mobile_apis::Result::SUCCESS); +} +void SetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); +} - 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 +} // 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 index b113f84131..6acfb2423d 100644 --- 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 @@ -2,31 +2,30 @@ #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, +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){} + policy_handler) {} +SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {} - SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse(){} +void SetCloudAppPropertiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); - void SetCloudAppPropertiesResponse::Run(){ - LOG4CXX_AUTO_TRACE(logger_); - - rpc_service_.SendMessageToMobile(message_); - } + rpc_service_.SendMessageToMobile(message_); +} -} // namespace commands -} //namespace sdl_rpc_plugins +} // 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 a5b3bf71fe..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 @@ -341,8 +341,9 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } case mobile_apis::FunctionID::SetCloudAppPropertiesID: { return mobile_api::messageType::request == message_type - ? factory.GetCreator() - : factory.GetCreator(); + ? factory.GetCreator() + : factory + .GetCreator(); } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator(); -- cgit v1.2.1 From 07e2490fcec48c6e4937ed3f5c8db150f7327a51 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Wed, 14 Nov 2018 14:16:51 -0500 Subject: Made requested changes --- .../commands/mobile/set_cloudapp_properties_request.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') 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 index 49cb7029c7..ca5a46e3dc 100644 --- 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 @@ -34,41 +34,41 @@ void SetCloudAppPropertiesRequest::Run() { return; } - smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); + smart_objects::SmartObject cloud_app_properties(smart_objects::SmartType_Map); - cloudapp_properties[strings::msg_params][strings::app_name] = + cloud_app_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; - cloudapp_properties[strings::msg_params][strings::app_id] = + 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]; - cloudapp_properties[strings::msg_params][strings::enabled] = 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]; - cloudapp_properties[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]; - cloudapp_properties[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]; - cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = + cloud_app_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; } - policy_handler_.OnSetCloudAppProperties(cloudapp_properties); + policy_handler_.OnSetCloudAppProperties(cloud_app_properties); SendResponse(true, mobile_apis::Result::SUCCESS); } -- cgit v1.2.1 From 232f7f86c3d3e70df70aa14fb6817eb4c9e17c9d Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 14 Nov 2018 14:33:25 -0500 Subject: Add SDL.ActivateApp flow changes for cloud apps --- .../src/commands/hmi/sdl_activate_app_request.cc | 10 ++++++++++ .../src/commands/mobile/register_app_interface_request.cc | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index f89ae1f697..c81c53d5a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -124,6 +124,11 @@ void SDLActivateAppRequest::Run() { static_cast(function_id()), hmi_apis::Common_Result::REJECTED, "HMIDeactivate is active"); + } else if (!app_to_activate->IsRegistered() && + app_to_activate->is_cloud_app()) { + LOG4CXX_DEBUG(logger_, "Starting cloud application."); + application_manager_.connection_handler().ConnectToDevice( + app_to_activate->device()); } else { const uint32_t application_id = app_id(); policy_handler_.OnActivateApp(application_id, correlation_id()); @@ -181,6 +186,11 @@ void SDLActivateAppRequest::Run() { LOG4CXX_DEBUG(logger_, "Application is registered. Activating."); policy_handler_.OnActivateApp(application_id, correlation_id()); return; + } else if (app_to_activate->is_cloud_app()) { + LOG4CXX_DEBUG(logger_, "Starting cloud application."); + application_manager_.connection_handler().ConnectToDevice( + app_to_activate->device()); + return; } connection_handler::DeviceHandle device_handle = app_to_activate->device(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 7957d9e055..58ee598e02 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -842,6 +842,10 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( // By default app subscribed to CUSTOM_BUTTON SendSubscribeCustomButtonNotification(); SendChangeRegistrationOnHMI(application); + + if (application->is_cloud_app()) { + policy_handler_.OnActivateApp(connection_key(), correlation_id()); + } } void RegisterAppInterfaceRequest::SendChangeRegistration( -- cgit v1.2.1 From 1411b1b98c37ca6d483425562b01d9f40a20d52b Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 15 Nov 2018 14:17:30 -0500 Subject: Fix issues with ActivateApp flow --- .../src/commands/hmi/sdl_activate_app_request.cc | 14 ++++++++------ .../commands/mobile/register_app_interface_request.cc | 19 ++----------------- 2 files changed, 10 insertions(+), 23 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index c81c53d5a9..bfe7adec11 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -115,6 +115,8 @@ void SDLActivateAppRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace hmi_apis::FunctionID; + ApplicationConstSharedPtr app = + application_manager_.WaitingApplicationByID(app_id()); if (application_manager_.state_controller().IsStateActive( HmiState::STATE_ID_DEACTIVATE_HMI)) { LOG4CXX_DEBUG(logger_, @@ -124,11 +126,10 @@ void SDLActivateAppRequest::Run() { static_cast(function_id()), hmi_apis::Common_Result::REJECTED, "HMIDeactivate is active"); - } else if (!app_to_activate->IsRegistered() && - app_to_activate->is_cloud_app()) { + } else if (app && !app->IsRegistered() && app->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); - application_manager_.connection_handler().ConnectToDevice( - app_to_activate->device()); + subscribe_on_event(BasicCommunication_OnAppRegistered); + application_manager_.connection_handler().ConnectToDevice(app->device()); } else { const uint32_t application_id = app_id(); policy_handler_.OnActivateApp(application_id, correlation_id()); @@ -144,7 +145,7 @@ void SDLActivateAppRequest::Run() { const uint32_t application_id = app_id(); ApplicationConstSharedPtr app_to_activate = - application_manager_.application(application_id); + application_manager_.application_by_hmi_app(application_id); if (!app_to_activate) { LOG4CXX_WARN( @@ -188,6 +189,7 @@ void SDLActivateAppRequest::Run() { return; } else if (app_to_activate->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); + subscribe_on_event(BasicCommunication_OnAppRegistered); application_manager_.connection_handler().ConnectToDevice( app_to_activate->device()); return; @@ -272,7 +274,7 @@ uint32_t SDLActivateAppRequest::hmi_app_id( LOG4CXX_DEBUG(logger_, application << " section is absent in the message."); return 0; } - if (so[msg_params][application].keyExists(strings::app_id)) { + if (!so[msg_params][application].keyExists(strings::app_id)) { LOG4CXX_DEBUG(logger_, strings::app_id << " section is absent in the message."); return 0; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 58ee598e02..8f06e8c51a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -346,19 +346,6 @@ void RegisterAppInterfaceRequest::Run() { application->set_msg_version(module_version); } - // For resuming application need to restore hmi_app_id from resumeCtrl - resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); - const std::string& device_mac = application->mac_address(); - - // there is side affect with 2 mobile app with the same mobile app_id - if (resumer.IsApplicationSaved(policy_app_id, device_mac)) { - application->set_hmi_application_id( - resumer.GetHMIApplicationID(policy_app_id, device_mac)); - } else { - application->set_hmi_application_id( - application_manager_.GenerateNewHMIAppID()); - } - application->set_is_media_application( msg_params[strings::is_media_application].asBool()); @@ -451,6 +438,8 @@ void RegisterAppInterfaceRequest::Run() { FillDeviceInfo(&device_info); } + const std::string& device_mac = application->mac_address(); + GetPolicyHandler().SetDeviceInfo(device_mac, device_info); SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); @@ -842,10 +831,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( // By default app subscribed to CUSTOM_BUTTON SendSubscribeCustomButtonNotification(); SendChangeRegistrationOnHMI(application); - - if (application->is_cloud_app()) { - policy_handler_.OnActivateApp(connection_key(), correlation_id()); - } } void RegisterAppInterfaceRequest::SendChangeRegistration( -- cgit v1.2.1 From dc2dc33575394ae16d72a745e278279e0a2700a1 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 16 Nov 2018 15:19:58 -0500 Subject: Add cloud connection status Also required some refactoring regarding the retry process for cloud apps, as well as how the HMIApplication struct was filled. --- .../mobile/register_app_interface_request.h | 2 +- .../mobile/register_app_interface_request.cc | 113 +++------------------ 2 files changed, 13 insertions(+), 102 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index 542fdac5f8..d0e70e906a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -128,7 +128,7 @@ class RegisterAppInterfaceRequest * **/ void SendOnAppRegisteredNotificationToHMI( - const app_mngr::Application& application_impl, + app_mngr::ApplicationConstSharedPtr app, bool resumption = false, bool need_restore_vr = false); /* diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 8f06e8c51a..f8d3267441 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -806,7 +806,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( SendResponse(true, result_code, add_info.c_str(), &response_params); SendOnAppRegisteredNotificationToHMI( - *(application.get()), resumption, need_restore_vr); + application, resumption, need_restore_vr); if (msg_params.keyExists(strings::app_hmi_type)) { GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), &(msg_params[strings::app_hmi_type])); @@ -866,9 +866,7 @@ void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI( } void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( - const app_mngr::Application& application_impl, - bool resumption, - bool need_restore_vr) { + ApplicationConstSharedPtr app, bool resumption, bool need_restore_vr) { using namespace smart_objects; SmartObjectSPtr notification = std::make_shared(SmartType_Map); if (!notification) { @@ -892,15 +890,15 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( msg_params[strings::resume_vr_grammars] = need_restore_vr; } - if (application_impl.vr_synonyms()) { - msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms()); + if (app->vr_synonyms()) { + msg_params[strings::vr_synonyms] = *(app->vr_synonyms()); } - if (application_impl.tts_name()) { - msg_params[strings::tts_name] = *(application_impl.tts_name()); + if (app->tts_name()) { + msg_params[strings::tts_name] = *(app->tts_name()); } - const std::string policy_app_id = application_impl.policy_app_id(); + const std::string policy_app_id = app->policy_app_id(); std::string priority; GetPolicyHandler().GetPriority(policy_app_id, &priority); @@ -910,100 +908,13 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( msg_params[strings::msg_params] = SmartObject(SmartType_Map); smart_objects::SmartObject& application = msg_params[strings::application]; - application[strings::app_name] = application_impl.name(); - application[strings::app_id] = application_impl.app_id(); - application[hmi_response::policy_app_id] = policy_app_id; - if (file_system::FileExists(application_impl.app_icon_path())) { - application[strings::icon] = application_impl.app_icon_path(); - } - - const smart_objects::SmartObject* ngn_media_screen_name = - application_impl.ngn_media_screen_name(); - if (ngn_media_screen_name) { - application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name; - } - - application[strings::hmi_display_language_desired] = - static_cast(application_impl.ui_language()); - - application[strings::is_media_application] = - application_impl.is_media_application(); - - const smart_objects::SmartObject* app_type = application_impl.app_types(); - if (app_type) { - application[strings::app_type] = *app_type; - } - - const policy::RequestType::State app_request_types_state = - GetPolicyHandler().GetAppRequestTypeState(policy_app_id); - if (policy::RequestType::State::AVAILABLE == app_request_types_state) { - const auto request_types = - GetPolicyHandler().GetAppRequestTypes(policy_app_id); - application[strings::request_type] = SmartObject(SmartType_Array); - smart_objects::SmartObject& request_types_array = - application[strings::request_type]; - - size_t index = 0; - for (auto it : request_types) { - request_types_array[index] = it; - ++index; - } - } else if (policy::RequestType::State::EMPTY == app_request_types_state) { - application[strings::request_type] = SmartObject(SmartType_Array); - } - - const policy::RequestSubType::State app_request_subtypes_state = - GetPolicyHandler().GetAppRequestSubTypeState(policy_app_id); - if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) { - const auto request_subtypes = - GetPolicyHandler().GetAppRequestSubTypes(policy_app_id); - application[strings::request_subtype] = SmartObject(SmartType_Array); - smart_objects::SmartObject& request_subtypes_array = - application[strings::request_subtype]; - - size_t index = 0; - for (auto it : request_subtypes) { - request_subtypes_array[index] = it; - ++index; - } - } else if (policy::RequestSubType::State::EMPTY == - app_request_subtypes_state) { - application[strings::request_subtype] = SmartObject(SmartType_Array); - } - const protocol_handler::SessionObserver& session_observer = application_manager_.connection_handler().get_session_observer(); - - application[strings::device_info] = SmartObject(SmartType_Map); - smart_objects::SmartObject& device_info = application[strings::device_info]; - MessageHelper::CreateDeviceInfo(application_impl.device(), - session_observer, - GetPolicyHandler(), - application_manager_, - &device_info); - - if (application_impl.secondary_device() != 0) { - application[strings::secondary_device_info] = SmartObject(SmartType_Map); - smart_objects::SmartObject& secondary_device_info = - application[strings::secondary_device_info]; - MessageHelper::CreateDeviceInfo(application_impl.secondary_device(), - session_observer, - GetPolicyHandler(), - application_manager_, - &secondary_device_info); - } - - const smart_objects::SmartObject* day_color_scheme = - application_impl.day_color_scheme(); - if (day_color_scheme) { - application[strings::day_color_scheme] = *day_color_scheme; - } - - const smart_objects::SmartObject* night_color_scheme = - application_impl.night_color_scheme(); - if (night_color_scheme) { - application[strings::night_color_scheme] = *night_color_scheme; - } + MessageHelper::CreateHMIApplicationStruct(app, + session_observer, + GetPolicyHandler(), + &application, + application_manager_); DCHECK(rpc_service_.ManageHMICommand(notification)); } -- cgit v1.2.1 From 1669b8e19869bbdcee2702a13c9e04ff94e649b5 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Tue, 13 Nov 2018 10:36:42 -0500 Subject: Implement SetCloudAppProperties RPC in core --- .../mobile/set_cloudapp_properties_request.h | 28 +++++++++ .../mobile/set_cloudapp_properties_response.h | 28 +++++++++ .../mobile/set_cloudapp_properties_request.cc | 71 ++++++++++++++++++++++ .../mobile/set_cloudapp_properties_response.cc | 32 ++++++++++ .../sdl_rpc_plugin/src/mobile_command_factory.cc | 7 +++ 5 files changed, 166 insertions(+) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc (limited to 'src/components/application_manager/rpc_plugins') 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..fc131020a8 --- /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,28 @@ +#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..aae45c52ce --- /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,28 @@ +#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..b5c66e4400 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc @@ -0,0 +1,71 @@ +#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 cloudapp_properties(smart_objects::SmartType_Map); + + cloudapp_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; + } + + policy_handler_.OnSetCloudAppProperties(cloudapp_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..b113f84131 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc @@ -0,0 +1,32 @@ +#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..a5b3bf71fe 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,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory( ? factory.GetCreator() : factory.GetCreator(); } + case mobile_apis::FunctionID::SetCloudAppPropertiesID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator(); } -- cgit v1.2.1 From ef15358324149bb3c1d278524f9690ce572336c7 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Tue, 13 Nov 2018 12:13:32 -0500 Subject: Style Fix --- .../mobile/set_cloudapp_properties_request.h | 37 ++++--- .../mobile/set_cloudapp_properties_response.h | 31 +++--- .../mobile/set_cloudapp_properties_request.cc | 120 +++++++++++---------- .../mobile/set_cloudapp_properties_response.cc | 31 +++--- .../sdl_rpc_plugin/src/mobile_command_factory.cc | 5 +- 5 files changed, 120 insertions(+), 104 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') 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 index fc131020a8..0c62b248b4 100644 --- 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 @@ -5,24 +5,27 @@ 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); +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 + DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest); +}; // SetCloudAppPropertiesRequest -} // namespace commands -} // namespace sdl_rpc_plugin +} // 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 +#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 index aae45c52ce..9037cb3b73 100644 --- 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 @@ -8,21 +8,24 @@ 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(); +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 +}; // 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 +#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 index b5c66e4400..49cb7029c7 100644 --- 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 @@ -5,67 +5,77 @@ 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( + 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()); +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 (!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; - } + 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 cloudapp_properties(smart_objects::SmartType_Map); + smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); - cloudapp_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; - cloudapp_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]; - cloudapp_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]; - cloudapp_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]; - cloudapp_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]; - cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; - } - - policy_handler_.OnSetCloudAppProperties(cloudapp_properties); - SendResponse(true, mobile_apis::Result::SUCCESS); + cloudapp_properties[strings::msg_params][strings::app_name] = + (*message_)[strings::msg_params][strings::app_name]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_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]; + cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = + hybrid_app_preference; + } - } + policy_handler_.OnSetCloudAppProperties(cloudapp_properties); + SendResponse(true, mobile_apis::Result::SUCCESS); +} +void SetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); +} - 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 +} // 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 index b113f84131..6acfb2423d 100644 --- 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 @@ -2,31 +2,30 @@ #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, +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){} + policy_handler) {} +SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {} - SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse(){} +void SetCloudAppPropertiesResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); - void SetCloudAppPropertiesResponse::Run(){ - LOG4CXX_AUTO_TRACE(logger_); - - rpc_service_.SendMessageToMobile(message_); - } + rpc_service_.SendMessageToMobile(message_); +} -} // namespace commands -} //namespace sdl_rpc_plugins +} // 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 a5b3bf71fe..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 @@ -341,8 +341,9 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } case mobile_apis::FunctionID::SetCloudAppPropertiesID: { return mobile_api::messageType::request == message_type - ? factory.GetCreator() - : factory.GetCreator(); + ? factory.GetCreator() + : factory + .GetCreator(); } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator(); -- cgit v1.2.1 From e07013316897e2a7e9b0a12809ac084755a73d99 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Wed, 14 Nov 2018 14:16:51 -0500 Subject: Made requested changes --- .../commands/mobile/set_cloudapp_properties_request.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') 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 index 49cb7029c7..ca5a46e3dc 100644 --- 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 @@ -34,41 +34,41 @@ void SetCloudAppPropertiesRequest::Run() { return; } - smart_objects::SmartObject cloudapp_properties(smart_objects::SmartType_Map); + smart_objects::SmartObject cloud_app_properties(smart_objects::SmartType_Map); - cloudapp_properties[strings::msg_params][strings::app_name] = + cloud_app_properties[strings::msg_params][strings::app_name] = (*message_)[strings::msg_params][strings::app_name]; - cloudapp_properties[strings::msg_params][strings::app_id] = + 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]; - cloudapp_properties[strings::msg_params][strings::enabled] = 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]; - cloudapp_properties[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]; - cloudapp_properties[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]; - cloudapp_properties[strings::msg_params][strings::hybrid_app_preference] = + cloud_app_properties[strings::msg_params][strings::hybrid_app_preference] = hybrid_app_preference; } - policy_handler_.OnSetCloudAppProperties(cloudapp_properties); + policy_handler_.OnSetCloudAppProperties(cloud_app_properties); SendResponse(true, mobile_apis::Result::SUCCESS); } -- cgit v1.2.1 From ce76a8b072f3c11386534d823df530a6a826b514 Mon Sep 17 00:00:00 2001 From: ShobhitAd Date: Fri, 16 Nov 2018 16:35:50 -0500 Subject: Removed redundant smart object --- .../mobile/set_cloudapp_properties_request.cc | 37 ++-------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') 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 index ca5a46e3dc..d92f458587 100644 --- 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 @@ -18,6 +18,7 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( policy_handler) {} SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} + void SetCloudAppPropertiesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application_manager_.application(connection_key()); @@ -34,41 +35,7 @@ void SetCloudAppPropertiesRequest::Run() { 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); + policy_handler_.OnSetCloudAppProperties(*message_); SendResponse(true, mobile_apis::Result::SUCCESS); } -- cgit v1.2.1 From 095f9ce3a935ed3a43041b44bf443da8047b1757 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Mon, 26 Nov 2018 15:23:24 -0500 Subject: Fix issues with retry sequence Also address review comments and fix build issues. --- .../sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index bfe7adec11..1704251c17 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -145,7 +145,7 @@ void SDLActivateAppRequest::Run() { const uint32_t application_id = app_id(); ApplicationConstSharedPtr app_to_activate = - application_manager_.application_by_hmi_app(application_id); + application_manager_.application(application_id); if (!app_to_activate) { LOG4CXX_WARN( -- cgit v1.2.1 From d157a8bef4619b845febc953f18fd3b0af2d3b7f Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 27 Nov 2018 15:07:26 -0500 Subject: Update ActivateApp timeout for cloud apps --- .../src/commands/hmi/sdl_activate_app_request.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 1704251c17..12f595e64e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -128,6 +128,11 @@ void SDLActivateAppRequest::Run() { "HMIDeactivate is active"); } else if (app && !app->IsRegistered() && app->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); + const ApplicationManagerSettings& settings = application_manager_.get_settings(); + uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * + settings.cloud_app_max_retry_attempts()); + application_manager_.updateRequestTimeout( + 0, correlation_id(), default_timeout_ + total_retry_timeout); subscribe_on_event(BasicCommunication_OnAppRegistered); application_manager_.connection_handler().ConnectToDevice(app->device()); } else { @@ -189,6 +194,11 @@ void SDLActivateAppRequest::Run() { return; } else if (app_to_activate->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); + const ApplicationManagerSettings& settings = application_manager_.get_settings(); + uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * + settings.cloud_app_max_retry_attempts()); + application_manager_.updateRequestTimeout( + 0, correlation_id(), default_timeout_ + total_retry_timeout); subscribe_on_event(BasicCommunication_OnAppRegistered); application_manager_.connection_handler().ConnectToDevice( app_to_activate->device()); -- cgit v1.2.1 From 7b8febf95531d5a576332e9c347eb1aa73d0077b Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 27 Nov 2018 17:43:12 -0500 Subject: Add method headers and fix style Also fix issues with retry timer management --- .../commands/mobile/register_app_interface_request.h | 7 +++++-- .../sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index d0e70e906a..f8be896996 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -124,8 +124,11 @@ class RegisterAppInterfaceRequest /** * @brief Sends OnAppRegistered notification to HMI * - *@param application_impl application with changed HMI status - * + * @param app application with changed HMI status + * @param resumption If true, resumption-related parameters will be sent to + *the HMI + * @param need_restore_vr If resumption is true, whether or not VR commands + *should be resumed **/ void SendOnAppRegisteredNotificationToHMI( app_mngr::ApplicationConstSharedPtr app, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 12f595e64e..4a1fddc508 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -128,7 +128,8 @@ void SDLActivateAppRequest::Run() { "HMIDeactivate is active"); } else if (app && !app->IsRegistered() && app->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); - const ApplicationManagerSettings& settings = application_manager_.get_settings(); + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * settings.cloud_app_max_retry_attempts()); application_manager_.updateRequestTimeout( @@ -194,7 +195,8 @@ void SDLActivateAppRequest::Run() { return; } else if (app_to_activate->is_cloud_app()) { LOG4CXX_DEBUG(logger_, "Starting cloud application."); - const ApplicationManagerSettings& settings = application_manager_.get_settings(); + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * settings.cloud_app_max_retry_attempts()); application_manager_.updateRequestTimeout( -- cgit v1.2.1 From 3838e16a6fe357f77370fa8bac644a4ec227690a Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 30 Nov 2018 11:44:08 -0500 Subject: Fix incorrect HMI state after cloud app registration --- .../src/commands/mobile/register_app_interface_request.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index f8d3267441..b346ee5798 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -805,8 +805,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( file_system::FileExists(application->app_icon_path()); SendResponse(true, result_code, add_info.c_str(), &response_params); - SendOnAppRegisteredNotificationToHMI( - application, resumption, need_restore_vr); if (msg_params.keyExists(strings::app_hmi_type)) { GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), &(msg_params[strings::app_hmi_type])); @@ -815,6 +813,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( // Default HMI level should be set before any permissions validation, since it // relies on HMI level. application_manager_.OnApplicationRegistered(application); + SendOnAppRegisteredNotificationToHMI( + application, resumption, need_restore_vr); (*notify_upd_manager)(); // Start PTU after successfull registration -- cgit v1.2.1 From 712440a5b5592ff447e8f9107d7c749e02b52cd4 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 30 Nov 2018 11:48:10 -0500 Subject: Add ActivateApp test cases for cloud apps --- .../src/commands/hmi/sdl_activate_app_request.cc | 6 ++- .../commands/hmi/sdl_activate_app_request_test.cc | 54 +++++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 4a1fddc508..92a7020208 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -249,8 +249,10 @@ void SDLActivateAppRequest::onTimeOut() { using namespace hmi_apis::Common_Result; using namespace application_manager; unsubscribe_from_event(BasicCommunication_OnAppRegistered); - SendErrorResponse( - correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, ""); + SendErrorResponse(correlation_id(), + SDL_ActivateApp, + APPLICATION_NOT_REGISTERED, + "App registration timed out"); } void SDLActivateAppRequest::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 38cbc7b069..ea345e3b83 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -61,8 +61,10 @@ using testing::Mock; using testing::Return; using testing::ReturnRef; using testing::Mock; +using testing::Gt; using ::testing::NiceMock; using policy_test::MockPolicyHandlerInterface; +using connection_handler_test::MockConnectionHandler; using am::event_engine::Event; namespace { @@ -148,7 +150,7 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { command->Run(); } -TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) { +TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_REJECTED) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); (*msg)[strings::msg_params][strings::function_id] = @@ -189,6 +191,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); MockAppPtr mock_app_first(CreateMockApp()); @@ -250,6 +253,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); DataAccessor accessor(app_list_, lock_); @@ -336,6 +340,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, @@ -427,6 +432,53 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { } #endif +TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { + MessageSharedPtr msg = CreateMessage(); + SetCorrelationAndAppID(msg); + + std::shared_ptr command( + CreateCommand(msg)); + + MockAppPtr mock_app(CreateMockApp()); + + EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); + EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); + EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true)); + + EXPECT_CALL(app_mngr_, application(kAppID)) + .WillOnce(Return(ApplicationSharedPtr())); + EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID)) + .WillOnce(Return(mock_app)); + + EXPECT_CALL(app_mngr_, state_controller()) + .WillOnce(ReturnRef(mock_state_controller_)); + EXPECT_CALL(mock_state_controller_, + IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) + .WillOnce(Return(false)); + + const uint16_t kRetries = 3; + const uint32_t kRetryTimeout = 2000; + const uint32_t kMinimumTimeout = kRetries * kRetryTimeout; + + MockApplicationManagerSettings settings; + EXPECT_CALL(settings, cloud_app_max_retry_attempts()) + .WillOnce(Return(kRetries)); + EXPECT_CALL(settings, cloud_app_retry_timeout()) + .WillOnce(Return(kRetryTimeout)); + EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings)); + + EXPECT_CALL( + app_mngr_, + updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); + + MockConnectionHandler connection_handler; + EXPECT_CALL(connection_handler, ConnectToDevice(kHandle)); + + EXPECT_CALL(app_mngr_, connection_handler()).WillOnce(ReturnRef(connection_handler)); + + command->Run(); +} + TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); -- cgit v1.2.1 From a512a58e12dae0f38ad72a157b867d71977654f1 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 4 Dec 2018 09:45:43 -0500 Subject: Fix style and update app list after PTU --- .../test/commands/hmi/sdl_activate_app_request_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index ea345e3b83..f040128097 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -459,7 +459,7 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { const uint16_t kRetries = 3; const uint32_t kRetryTimeout = 2000; const uint32_t kMinimumTimeout = kRetries * kRetryTimeout; - + MockApplicationManagerSettings settings; EXPECT_CALL(settings, cloud_app_max_retry_attempts()) .WillOnce(Return(kRetries)); @@ -467,14 +467,14 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { .WillOnce(Return(kRetryTimeout)); EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings)); - EXPECT_CALL( - app_mngr_, - updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); + EXPECT_CALL(app_mngr_, + updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); MockConnectionHandler connection_handler; EXPECT_CALL(connection_handler, ConnectToDevice(kHandle)); - EXPECT_CALL(app_mngr_, connection_handler()).WillOnce(ReturnRef(connection_handler)); + EXPECT_CALL(app_mngr_, connection_handler()) + .WillOnce(ReturnRef(connection_handler)); command->Run(); } -- cgit v1.2.1 From 3a2b833dd56ccad4917d6d2d3f88dfe27feca6e9 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 5 Dec 2018 10:28:07 -0500 Subject: Update ConnectionStatusUpdated method + tests --- .../sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index f040128097..8543a201bf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -44,6 +44,7 @@ #include "application_manager/event_engine/event.h" #include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_state_controller.h" +#include "connection_handler/mock_connection_handler.h" namespace test { namespace components { -- cgit v1.2.1 From 64047e5f7fbd07a2a332246dcf07a10f39361561 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 12 Dec 2018 16:39:14 -0500 Subject: Refresh app list when an app is enabled or disabled --- .../mobile/set_cloud_app_properties_request.h | 31 ++++++++ .../mobile/set_cloud_app_properties_response.h | 31 ++++++++ .../mobile/set_cloudapp_properties_request.h | 31 -------- .../mobile/set_cloudapp_properties_response.h | 31 -------- .../mobile/set_cloud_app_properties_request.cc | 49 +++++++++++++ .../mobile/set_cloud_app_properties_response.cc | 31 ++++++++ .../mobile/set_cloudapp_properties_request.cc | 83 ---------------------- .../mobile/set_cloudapp_properties_response.cc | 31 -------- .../sdl_rpc_plugin/src/mobile_command_factory.cc | 4 +- 9 files changed, 144 insertions(+), 178 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h new file mode 100644 index 0000000000..a3a3ea12f9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_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_CLOUD_APP_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_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h new file mode 100644 index 0000000000..df71a2aaf5 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_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_CLOUD_APP_PROPERTIES_RESPONSE_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_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h deleted file mode 100644 index 0c62b248b4..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h +++ /dev/null @@ -1,31 +0,0 @@ -#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 deleted file mode 100644 index 9037cb3b73..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h +++ /dev/null @@ -1,31 +0,0 @@ -#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_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc new file mode 100644 index 0000000000..663881a2ea --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -0,0 +1,49 @@ +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_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; + } + + policy_handler_.OnSetCloudAppProperties(*message_); + + 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_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc new file mode 100644 index 0000000000..6d27ce8b3e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_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_cloud_app_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/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 deleted file mode 100644 index 0beb7631c7..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc +++ /dev/null @@ -1,83 +0,0 @@ -#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 deleted file mode 100644 index 6acfb2423d..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc +++ /dev/null @@ -1,31 +0,0 @@ -#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 dc5298813b..8eab054be3 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,8 +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 "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" +#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" #include "interfaces/MOBILE_API.h" CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") -- cgit v1.2.1 From 18c1984eb33d846b7cdb1ee0a5d79fdfd0d2fb78 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sun, 20 Jan 2019 15:24:15 -0500 Subject: Add basic handling of app service producer RPCs --- .../application_manager/rpc_plugins/CMakeLists.txt | 1 + .../app_service_rpc_plugin/CMakeLists.txt | 80 ++++++++++++++ .../app_service_command_factory.h | 66 ++++++++++++ .../app_service_hmi_command_factory.h | 75 +++++++++++++ .../app_service_mobile_command_factory.h | 75 +++++++++++++ .../app_service_rpc_plugin.h | 81 ++++++++++++++ .../commands/hmi/as_publish_app_service_request.h | 78 ++++++++++++++ .../commands/hmi/as_publish_app_service_response.h | 78 ++++++++++++++ .../hmi/on_as_app_service_data_notification.h | 79 ++++++++++++++ .../on_as_app_service_data_notification_from_hmi.h | 78 ++++++++++++++ .../mobile/on_app_service_data_notification.h | 79 ++++++++++++++ .../on_app_service_data_notification_from_mobile.h | 79 ++++++++++++++ .../commands/mobile/publish_app_service_request.h | 79 ++++++++++++++ .../commands/mobile/publish_app_service_response.h | 79 ++++++++++++++ .../src/app_service_command_factory.cc | 72 +++++++++++++ .../src/app_service_hmi_command_factory.cc | 119 +++++++++++++++++++++ .../src/app_service_mobile_command_factory.cc | 118 ++++++++++++++++++++ .../src/app_service_rpc_plugin.cc | 85 +++++++++++++++ .../commands/hmi/as_publish_app_service_request.cc | 65 +++++++++++ .../hmi/as_publish_app_service_response.cc | 60 +++++++++++ .../hmi/on_as_app_service_data_notification.cc | 62 +++++++++++ ...on_as_app_service_data_notification_from_hmi.cc | 61 +++++++++++ .../mobile/on_app_service_data_notification.cc | 65 +++++++++++ ...on_app_service_data_notification_from_mobile.cc | 65 +++++++++++ .../commands/mobile/publish_app_service_request.cc | 65 +++++++++++ .../mobile/publish_app_service_response.cc | 63 +++++++++++ 26 files changed, 1907 insertions(+) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/CMakeLists.txt b/src/components/application_manager/rpc_plugins/CMakeLists.txt index c9ef282c12..e4f0051738 100644 --- a/src/components/application_manager/rpc_plugins/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/CMakeLists.txt @@ -32,3 +32,4 @@ add_subdirectory(vehicle_info_plugin) add_subdirectory(sdl_rpc_plugin) add_subdirectory(rc_rpc_plugin) +add_subdirectory(app_service_rpc_plugin) \ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt new file mode 100644 index 0000000000..e254c36587 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -0,0 +1,80 @@ +# Copyright (c) 2019, Ford Motor Company, Livio +# 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 copyright holders nor the names of their 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. + +include_directories(include) + +set (COMMANDS_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src/commands +) + +set (MOBILE_COMMANDS_SOURCE_DIR + ${COMMANDS_SOURCE_DIR}/mobile +) + +set (HMI_COMMANDS_SOURCE_DIR + ${COMMANDS_SOURCE_DIR}/hmi +) + +collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}") +collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}") +collect_sources(PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src") +collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands") + +set(LIBRARIES + HMI_API + MOBILE_API + ApplicationManager + v4_protocol_v1_2_no_extra + SmartObjects + Utils +) + +if(ENABLE_LOG) + list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) +endif() + +add_library("app_service_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES}) +target_link_libraries("app_service_rpc_plugin" ${LIBRARIES}) + +add_library("AppServiceRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS}) +target_link_libraries("AppServiceRpcPluginStaticLib" ${LIBRARIES}) + +set(INSTALL_DESTINATION bin) + +install(TARGETS app_service_rpc_plugin + DESTINATION ${INSTALL_DESTINATION} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE +) + +if(BUILD_TESTS) + # add_subdirectory(test) +endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h new file mode 100644 index 0000000000..193b79e26f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h @@ -0,0 +1,66 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H + +#include "app_service_rpc_plugin/app_service_hmi_command_factory.h" +#include "app_service_rpc_plugin/app_service_mobile_command_factory.h" +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace commands = application_manager::commands; +namespace app_mngr = application_manager; + +class AppServiceCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceCommandFactory(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + virtual ~AppServiceCommandFactory(); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t, + const application_manager::commands::Command::CommandSource) + const OVERRIDE; + + private: + std::unique_ptr hmi_command_factory_; + std::unique_ptr mobile_command_factory_; +}; +} // namespace app_service_rpc_plugin +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h new file mode 100644 index 0000000000..dfe333b881 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h @@ -0,0 +1,75 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H + +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +/** + * @brief The vehicle info hmi command factory. + */ +class AppServiceHmiCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceHmiCommandFactory( + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const OVERRIDE; + + private: + app_mngr::ApplicationManager& application_manager_; + app_mngr::rpc_service::RPCService& rpc_service_; + app_mngr::HMICapabilities& hmi_capabilities_; + policy::PolicyHandlerInterface& policy_handler_; + + app_mngr::CommandCreator& buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const; + + DISALLOW_COPY_AND_ASSIGN(AppServiceHmiCommandFactory); +}; +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h new file mode 100644 index 0000000000..bd1e10f267 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h @@ -0,0 +1,75 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H + +#include "application_manager/application_manager.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +/** + * @brief The vehicle info mobile command factory. + */ +class AppServiceMobileCommandFactory : public app_mngr::CommandFactory { + public: + AppServiceMobileCommandFactory( + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + app_mngr::CommandSharedPtr CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const OVERRIDE; + + private: + app_mngr::ApplicationManager& application_manager_; + app_mngr::rpc_service::RPCService& rpc_service_; + app_mngr::HMICapabilities& hmi_capabilities_; + policy::PolicyHandlerInterface& policy_handler_; + + app_mngr::CommandCreator& buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const; + + DISALLOW_COPY_AND_ASSIGN(AppServiceMobileCommandFactory); +}; +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h new file mode 100644 index 0000000000..398711b7a7 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -0,0 +1,81 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H + +#include "application_manager/command_factory.h" + +namespace app_service_rpc_plugin { +//class AppServiceAppExtension; +namespace app_mngr = application_manager; +namespace plugins = application_manager::plugin_manager; + +class AppServiceRpcPlugin : public plugins::RPCPlugin { + public: + AppServiceRpcPlugin(); + + bool Init(app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) OVERRIDE; + + bool IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) OVERRIDE; + + std::string PluginName() OVERRIDE; + app_mngr::CommandFactory& GetCommandFactory() OVERRIDE; + + void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE; + void OnApplicationEvent(plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) OVERRIDE; + + /** + * @brief ProcessResumptionSubscription send Subscribe vehicle data requests + * to HMI + * @param app application for subscription + * @param ext application extension + */ + // TODO + //void ProcessResumptionSubscription(app_mngr::Application& app, + // AppServiceAppExtension& ext); + + private: + std::unique_ptr command_factory_; + app_mngr::ApplicationManager* application_manager_; +}; +} // namespace app_service_rpc_plugin + +extern "C" application_manager::plugin_manager::RPCPlugin* Create(); + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h new file mode 100644 index 0000000000..75e6343c9e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -0,0 +1,78 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ + +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPublishAppServiceRequest command class + **/ +class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASPublishAppServiceRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASPublishAppServiceRequest( + 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_handle); + + /** + * @brief ASPublishAppServiceRequest class destructor + **/ + virtual ~ASPublishAppServiceRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h new file mode 100644 index 0000000000..3943c5f293 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h @@ -0,0 +1,78 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ + +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPublishAppServiceResponse command class + **/ +class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASPublishAppServiceResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASPublishAppServiceResponse( + 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_handle); + + /** + * @brief ASPublishAppServiceResponse class destructor + **/ + virtual ~ASPublishAppServiceResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h new file mode 100644 index 0000000000..5b2c40b26b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ + +#include "application_manager/commands/notification_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASAppServiceDataNotification command class + **/ +class OnASAppServiceDataNotification + : public app_mngr::commands::NotificationToHMI { + public: + /** + * @brief OnASAppServiceDataNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnASAppServiceDataNotification( + 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_handle); + + /** + * @brief OnASAppServiceDataNotification class destructor + **/ + virtual ~OnASAppServiceDataNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h new file mode 100644 index 0000000000..9a7072590b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -0,0 +1,78 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ + +#include "application_manager/commands/notification_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASAppServiceDataNotificationFromHMI command class + **/ +class OnASAppServiceDataNotificationFromHMI : public app_mngr::commands::NotificationFromHMI { + public: + /** + * @brief OnASAppServiceDataNotificationFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + OnASAppServiceDataNotificationFromHMI( + 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_handle); + + /** + * @brief OnASAppServiceDataNotificationFromHMI class destructor + **/ + virtual ~OnASAppServiceDataNotificationFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h new file mode 100644 index 0000000000..751fac7f94 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ + +#include "application_manager/commands/command_notification_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnAppServiceDataNotification command class + **/ +class OnAppServiceDataNotification + : public app_mngr::commands::CommandNotificationImpl { + public: + /** + * @brief OnAppServiceDataNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppServiceDataNotification( + 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_handle); + + /** + * @brief OnAppServiceDataNotification class destructor + **/ + virtual ~OnAppServiceDataNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h new file mode 100644 index 0000000000..1d1b2170c2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ + +#include "application_manager/commands/command_notification_from_mobile_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnAppServiceDataNotificationFromMobile command class + **/ +class OnAppServiceDataNotificationFromMobile + : public app_mngr::commands::CommandNotificationFromMobileImpl { + public: + /** + * @brief OnAppServiceDataNotificationFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + OnAppServiceDataNotificationFromMobile( + 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_handle); + + /** + * @brief OnAppServiceDataNotificationFromMobile class destructor + **/ + virtual ~OnAppServiceDataNotificationFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h new file mode 100644 index 0000000000..c6351b3b15 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PublishAppServiceRequest command class + **/ +class PublishAppServiceRequest + : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief PublishAppServiceRequest class constructor + * + * @param message Incoming SmartObject message + **/ + PublishAppServiceRequest( + 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_handle); + + /** + * @brief PublishAppServiceRequest class destructor + **/ + virtual ~PublishAppServiceRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h new file mode 100644 index 0000000000..694c2906fa --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PublishAppServiceResponse command class + **/ +class PublishAppServiceResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief PublishAppServiceResponse class constructor + * + * @param message Incoming SmartObject message + **/ + PublishAppServiceResponse( + 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_handle); + + /** + * @brief PublishAppServiceResponse class destructor + **/ + virtual ~PublishAppServiceResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc new file mode 100644 index 0000000000..0405bb3e7c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc @@ -0,0 +1,72 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/app_service_command_factory.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { + +AppServiceCommandFactory::AppServiceCommandFactory( + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : hmi_command_factory_(new AppServiceHmiCommandFactory( + application_manager, rpc_service, hmi_capabilities, policy_handler)) + , mobile_command_factory_(new AppServiceMobileCommandFactory( + application_manager, rpc_service, hmi_capabilities, policy_handler)) { + LOG4CXX_AUTO_TRACE(logger_); +} + +AppServiceCommandFactory::~AppServiceCommandFactory() { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + if (app_mngr::commands::Command::SOURCE_HMI == source) { + return hmi_command_factory_->CreateCommand(message, source); + } else { + return mobile_command_factory_->CreateCommand(message, source); + } +} + +bool AppServiceCommandFactory::IsAbleToProcess( + const int32_t function_id, + const commands::Command::CommandSource source) const { + return commands::Command::SOURCE_HMI == source + ? hmi_command_factory_->IsAbleToProcess(function_id, source) + : mobile_command_factory_->IsAbleToProcess(function_id, source); +} +} // namespace service_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc new file mode 100644 index 0000000000..746636aff0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -0,0 +1,119 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/app_service_hmi_command_factory.h" +#include "application_manager/message.h" +#include "interfaces/HMI_API.h" + +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { +namespace strings = app_mngr::strings; + +AppServiceHmiCommandFactory::AppServiceHmiCommandFactory( + application_manager::ApplicationManager& application_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + UNUSED(source); + + const hmi_apis::FunctionID::eType function_id = + static_cast( + (*message)[strings::params][strings::function_id].asInt()); + + const hmi_apis::messageType::eType message_type = + static_cast( + (*message)[strings::params][strings::message_type].asInt()); + + auto message_type_str = "request"; + if (hmi_apis::messageType::response == message_type) { + message_type_str = "response"; + } else if (hmi_apis::messageType::error_response == message_type) { + message_type_str = "error response"; + } + + UNUSED(message_type_str); + LOG4CXX_DEBUG(logger_, + "HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); + + return buildCommandCreator(function_id, message_type, source).create(message); +} + +bool AppServiceHmiCommandFactory::IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const { + UNUSED(source); + return buildCommandCreator( + function_id, hmi_apis::messageType::INVALID_ENUM, source) + .CanBeCreated(); +} + +app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const { + auto factory = app_mngr::CommandCreatorFactory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + + switch (function_id) { + case hmi_apis::FunctionID::AppService_PublishAppService: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + case hmi_apis::FunctionID::AppService_OnAppServiceData: + return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source + ? factory.GetCreator< + commands::OnASAppServiceDataNotificationFromHMI>() + : factory + .GetCreator(); + default: + LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + return factory.GetCreator(); + } +} +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc new file mode 100644 index 0000000000..3b4e3490f6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -0,0 +1,118 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/app_service_mobile_command_factory.h" + +#include "application_manager/message.h" +#include "interfaces/MOBILE_API.h" + +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { +namespace strings = app_mngr::strings; + +AppServiceMobileCommandFactory::AppServiceMobileCommandFactory( + application_manager::ApplicationManager& application_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) { + LOG4CXX_AUTO_TRACE(logger_); +} + +app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::commands::Command::CommandSource source) { + UNUSED(source); + + const mobile_apis::FunctionID::eType function_id = + static_cast( + (*message)[strings::params][strings::function_id].asInt()); + + const mobile_apis::messageType::eType message_type = + static_cast( + (*message)[strings::params][strings::message_type].asInt()); + + auto message_type_str = "request"; + if (mobile_apis::messageType::response == message_type) { + message_type_str = "response"; + } else if (mobile_apis::messageType::notification == message_type) { + message_type_str = "notification"; + } + + UNUSED(message_type_str); + LOG4CXX_DEBUG(logger_, + "HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); + + return buildCommandCreator(function_id, message_type, source).create(message); +} + +bool AppServiceMobileCommandFactory::IsAbleToProcess( + const int32_t function_id, + const app_mngr::commands::Command::CommandSource source) const { + UNUSED(source); + return buildCommandCreator( + function_id, mobile_apis::messageType::INVALID_ENUM, source) + .CanBeCreated(); +} + +app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( + const int32_t function_id, + const int32_t message_type, + const app_mngr::commands::Command::CommandSource source) const { + auto factory = app_mngr::CommandCreatorFactory( + application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + + switch (function_id) { + case mobile_apis::FunctionID::PublishAppServiceID: + return mobile_apis::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + case mobile_apis::FunctionID::OnAppServiceDataID: + return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source + ? factory.GetCreator() + : factory.GetCreator(); + default: + LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + return factory.GetCreator(); + } +} +} // namespace vehicle_info_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc new file mode 100644 index 0000000000..739d8bb0e2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -0,0 +1,85 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "application_manager/message_helper.h" +#include "application_manager/smart_object_keys.h" +//#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "app_service_rpc_plugin/app_service_command_factory.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" + +namespace app_service_rpc_plugin { +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace strings = application_manager::strings; + +AppServiceRpcPlugin::AppServiceRpcPlugin() : application_manager_(nullptr) {} + +bool AppServiceRpcPlugin::Init( + application_manager::ApplicationManager& app_manager, + application_manager::rpc_service::RPCService& rpc_service, + application_manager::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) { + application_manager_ = &app_manager; + command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory( + app_manager, rpc_service, hmi_capabilities, policy_handler)); + return true; +} + +bool AppServiceRpcPlugin::IsAbleToProcess( + const int32_t function_id, const commands::Command::CommandSource source) { + return command_factory_->IsAbleToProcess(function_id, source); +} + +std::string AppServiceRpcPlugin::PluginName() { + return "App Service RPC Plugin"; +} + +app_mngr::CommandFactory& AppServiceRpcPlugin::GetCommandFactory() { + return *command_factory_; +} + +void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} + +void AppServiceRpcPlugin::OnApplicationEvent( + plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) {} + +/*void AppServiceRpcPlugin::ProcessResumptionSubscription( + application_manager::Application& app, AppServiceAppExtension& ext) { + LOG4CXX_AUTO_TRACE(logger_); + // TODO +}*/ +} // namespace app_service_rpc_plugin + +extern "C" application_manager::plugin_manager::RPCPlugin* Create() { + return new app_service_rpc_plugin::AppServiceRpcPlugin(); +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc new file mode 100644 index 0000000000..41729cfe5a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPublishAppServiceRequest::ASPublishAppServiceRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} + +void ASPublishAppServiceRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + (*message_)[strings::params][strings::message_type] = MessageType::kResponse; + (*message_)[strings::params][hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + // TODO: Add AppServiceRecord to response + rpc_service_.ManageHMICommand(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc new file mode 100644 index 0000000000..c143315b8c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc @@ -0,0 +1,60 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPublishAppServiceResponse::ASPublishAppServiceResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {} + +void ASPublishAppServiceResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc new file mode 100644 index 0000000000..0da2ba6784 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnASAppServiceDataNotification::OnASAppServiceDataNotification( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : NotificationToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnASAppServiceDataNotification:: + ~OnASAppServiceDataNotification() {} + +void OnASAppServiceDataNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); + MessageHelper::PrintSmartObject(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc new file mode 100644 index 0000000000..3d5bc81c72 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : NotificationFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnASAppServiceDataNotificationFromHMI::~OnASAppServiceDataNotificationFromHMI() {} + +void OnASAppServiceDataNotificationFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); + MessageHelper::PrintSmartObject(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc new file mode 100644 index 0000000000..6962e80567 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnAppServiceDataNotification::OnAppServiceDataNotification( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandNotificationImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnAppServiceDataNotification::~OnAppServiceDataNotification() {} + +void OnAppServiceDataNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); + MessageHelper::PrintSmartObject(message_); + SendNotification(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc new file mode 100644 index 0000000000..168ddaed23 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandNotificationFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnAppServiceDataNotificationFromMobile:: + ~OnAppServiceDataNotificationFromMobile() {} + +void OnAppServiceDataNotificationFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); + MessageHelper::PrintSmartObject(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc new file mode 100644 index 0000000000..ddde156a44 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -0,0 +1,65 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PublishAppServiceRequest::PublishAppServiceRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +PublishAppServiceRequest::~PublishAppServiceRequest() {} + +void PublishAppServiceRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received a PublishAppService"); + MessageHelper::PrintSmartObject(message_); + SendResponse(true, mobile_apis::Result::SUCCESS); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc new file mode 100644 index 0000000000..b1136c79d0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -0,0 +1,63 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PublishAppServiceResponse::PublishAppServiceResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +PublishAppServiceResponse::~PublishAppServiceResponse() {} + +void PublishAppServiceResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin -- cgit v1.2.1 From 73336d81747ab60e38496f2e7416b2388480573d Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 22 Jan 2019 13:40:04 -0500 Subject: Add dummy response for PublishAppService --- .../commands/hmi/as_publish_app_service_request.cc | 20 +++++++++++++++----- .../commands/mobile/publish_app_service_request.cc | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 41729cfe5a..a11e4e8a22 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -53,12 +53,22 @@ ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::message_type] = MessageType::kResponse; - (*message_)[strings::params][hmi_response::code] = - hmi_apis::Common_Result::SUCCESS; + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject service_record = + smart_objects::SmartObject(smart_objects::SmartType_Map); + service_record[strings::service_manifest] = + (*message_)[strings::msg_params][strings::app_service_manifest]; + service_record[strings::service_id] = "This is a service ID"; + service_record[strings::service_published] = true; + service_record[strings::service_active] = true; + response_params[strings::app_service_record] = service_record; // TODO: Add AppServiceRecord to response - rpc_service_.ManageHMICommand(message_); + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_PublishAppService, + hmi_apis::Common_Result::SUCCESS, + &response_params); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index ddde156a44..a133695f60 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -58,7 +58,21 @@ void PublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received a PublishAppService"); MessageHelper::PrintSmartObject(message_); - SendResponse(true, mobile_apis::Result::SUCCESS); + + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + smart_objects::SmartObject service_record = + smart_objects::SmartObject(smart_objects::SmartType_Map); + service_record[strings::service_manifest] = + (*message_)[strings::msg_params][strings::app_service_manifest]; + service_record[strings::service_id] = "This is a service ID"; + service_record[strings::service_published] = true; + service_record[strings::service_active] = true; + + response_params[strings::app_service_record] = service_record; + + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); } } // namespace commands -- cgit v1.2.1 From fc2c76d23dcd8f4016edff90d215940a810d9f86 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 22 Jan 2019 15:29:14 -0500 Subject: Fix PrintSmartObject calls --- .../src/commands/hmi/on_as_app_service_data_notification.cc | 2 +- .../src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc | 2 +- .../src/commands/mobile/on_app_service_data_notification.cc | 2 +- .../commands/mobile/on_app_service_data_notification_from_mobile.cc | 2 +- .../src/commands/mobile/publish_app_service_request.cc | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index 0da2ba6784..d242ea1161 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -55,7 +55,7 @@ OnASAppServiceDataNotification:: void OnASAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); - MessageHelper::PrintSmartObject(message_); + MessageHelper::PrintSmartObject(*message_); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 3d5bc81c72..8e8c81b1f1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -54,7 +54,7 @@ OnASAppServiceDataNotificationFromHMI::~OnASAppServiceDataNotificationFromHMI() void OnASAppServiceDataNotificationFromHMI::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); - MessageHelper::PrintSmartObject(message_); + MessageHelper::PrintSmartObject(*message_); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 6962e80567..6a6a50dc86 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -57,7 +57,7 @@ OnAppServiceDataNotification::~OnAppServiceDataNotification() {} void OnAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); - MessageHelper::PrintSmartObject(message_); + MessageHelper::PrintSmartObject(*message_); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 168ddaed23..b46bc7934e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -58,7 +58,7 @@ OnAppServiceDataNotificationFromMobile:: void OnAppServiceDataNotificationFromMobile::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); - MessageHelper::PrintSmartObject(message_); + MessageHelper::PrintSmartObject(*message_); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index a133695f60..beb5fdc696 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -57,7 +57,7 @@ PublishAppServiceRequest::~PublishAppServiceRequest() {} void PublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received a PublishAppService"); - MessageHelper::PrintSmartObject(message_); + MessageHelper::PrintSmartObject(*message_); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -69,7 +69,7 @@ void PublishAppServiceRequest::Run() { service_record[strings::service_id] = "This is a service ID"; service_record[strings::service_published] = true; service_record[strings::service_active] = true; - + response_params[strings::app_service_record] = service_record; SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); -- cgit v1.2.1 From ea3832dc24e1502858020cd5774bfd1305725f21 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 22 Jan 2019 17:57:34 -0500 Subject: Add AppServiceRPCPlugin to app service commands --- .../commands/hmi/as_publish_app_service_request.h | 2 ++ .../commands/hmi/as_publish_app_service_response.h | 2 ++ .../commands/hmi/on_as_app_service_data_notification.h | 2 ++ .../hmi/on_as_app_service_data_notification_from_hmi.h | 2 ++ .../commands/mobile/on_app_service_data_notification.h | 2 ++ .../on_app_service_data_notification_from_mobile.h | 2 ++ .../commands/mobile/publish_app_service_request.h | 2 ++ .../commands/mobile/publish_app_service_response.h | 2 ++ .../src/commands/hmi/as_publish_app_service_request.cc | 10 +++++++++- .../src/commands/hmi/as_publish_app_service_response.cc | 10 +++++++++- .../commands/hmi/on_as_app_service_data_notification.cc | 16 ++++++++++++---- .../hmi/on_as_app_service_data_notification_from_hmi.cc | 10 +++++++++- .../commands/mobile/on_app_service_data_notification.cc | 10 +++++++++- .../on_app_service_data_notification_from_mobile.cc | 10 +++++++++- .../src/commands/mobile/publish_app_service_request.cc | 10 +++++++++- .../src/commands/mobile/publish_app_service_response.cc | 10 +++++++++- 16 files changed, 91 insertions(+), 11 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h index 75e6343c9e..b21f99885a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/request_from_hmi.h" namespace app_service_rpc_plugin { @@ -68,6 +69,7 @@ class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h index 3943c5f293..c532225632 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/response_to_hmi.h" namespace app_service_rpc_plugin { @@ -68,6 +69,7 @@ class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI { virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h index 5b2c40b26b..44d6d09fd3 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/notification_to_hmi.h" namespace app_service_rpc_plugin { @@ -69,6 +70,7 @@ class OnASAppServiceDataNotification virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h index 9a7072590b..df4cec9287 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/notification_from_hmi.h" namespace app_service_rpc_plugin { @@ -68,6 +69,7 @@ class OnASAppServiceDataNotificationFromHMI : public app_mngr::commands::Notific virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h index 751fac7f94..4bc818f9be 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/command_notification_impl.h" namespace app_service_rpc_plugin { @@ -69,6 +70,7 @@ class OnAppServiceDataNotification virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h index 1d1b2170c2..f163e5848b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/command_notification_from_mobile_impl.h" namespace app_service_rpc_plugin { @@ -69,6 +70,7 @@ class OnAppServiceDataNotificationFromMobile virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index c6351b3b15..a798bed613 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/command_request_impl.h" namespace app_service_rpc_plugin { @@ -69,6 +70,7 @@ class PublishAppServiceRequest virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h index 694c2906fa..27b4d6ad2f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_ +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" #include "application_manager/commands/command_response_impl.h" namespace app_service_rpc_plugin { @@ -69,6 +70,7 @@ class PublishAppServiceResponse virtual void Run(); private: + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index a11e4e8a22..9acc8c3146 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -47,7 +47,15 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + hmi_apis::FunctionID::AppService_PublishAppService, + app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc index c143315b8c..2513a92f15 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc @@ -47,7 +47,15 @@ ASPublishAppServiceResponse::ASPublishAppServiceResponse( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + hmi_apis::FunctionID::AppService_PublishAppService, + app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index d242ea1161..e590d63a05 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -44,10 +44,18 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification( app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) : NotificationToHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + hmi_apis::FunctionID::AppService_OnAppServiceData, + app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} OnASAppServiceDataNotification:: ~OnASAppServiceDataNotification() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 8e8c81b1f1..3dea2a6a12 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -47,7 +47,15 @@ OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + hmi_apis::FunctionID::AppService_OnAppServiceData, + app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} OnASAppServiceDataNotificationFromHMI::~OnASAppServiceDataNotificationFromHMI() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 6a6a50dc86..33ab1a7246 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -50,7 +50,15 @@ OnAppServiceDataNotification::OnAppServiceDataNotification( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::OnAppServiceDataID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} OnAppServiceDataNotification::~OnAppServiceDataNotification() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index b46bc7934e..a7a8042fee 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -50,7 +50,15 @@ OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::OnAppServiceDataID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} OnAppServiceDataNotificationFromMobile:: ~OnAppServiceDataNotificationFromMobile() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index beb5fdc696..e5f7c40471 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -50,7 +50,15 @@ PublishAppServiceRequest::PublishAppServiceRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::PublishAppServiceID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} PublishAppServiceRequest::~PublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc index b1136c79d0..6c3e9344bf 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -50,7 +50,15 @@ PublishAppServiceResponse::PublishAppServiceResponse( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::PublishAppServiceID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} PublishAppServiceResponse::~PublishAppServiceResponse() {} -- cgit v1.2.1 From 91fc054c1f3de59944c4d7030f68a7640a34316f Mon Sep 17 00:00:00 2001 From: JackLivio Date: Tue, 22 Jan 2019 22:14:09 -0500 Subject: Initial regular policy implementation --- .../app_service_hmi_command_factory.h | 9 +++--- .../app_service_rpc_plugin.h | 4 +-- .../on_as_app_service_data_notification_from_hmi.h | 3 +- .../commands/mobile/publish_app_service_request.h | 14 ++++----- .../commands/mobile/publish_app_service_response.h | 11 +++---- .../src/app_service_hmi_command_factory.cc | 6 ++-- .../src/app_service_mobile_command_factory.cc | 9 +++--- .../hmi/on_as_app_service_data_notification.cc | 3 +- ...on_as_app_service_data_notification_from_hmi.cc | 3 +- .../commands/mobile/publish_app_service_request.cc | 36 ++++++++++++++++++++++ 10 files changed, 66 insertions(+), 32 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h index dfe333b881..c42b64f559 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h @@ -43,11 +43,10 @@ namespace app_mngr = application_manager; */ class AppServiceHmiCommandFactory : public app_mngr::CommandFactory { public: - AppServiceHmiCommandFactory( - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler); + AppServiceHmiCommandFactory(app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); app_mngr::CommandSharedPtr CreateCommand( const app_mngr::commands::MessageSharedPtr& message, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h index 398711b7a7..1113911a22 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -36,7 +36,7 @@ #include "application_manager/command_factory.h" namespace app_service_rpc_plugin { -//class AppServiceAppExtension; +// class AppServiceAppExtension; namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; @@ -67,7 +67,7 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { * @param ext application extension */ // TODO - //void ProcessResumptionSubscription(app_mngr::Application& app, + // void ProcessResumptionSubscription(app_mngr::Application& app, // AppServiceAppExtension& ext); private: diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h index df4cec9287..7ca20d692a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -44,7 +44,8 @@ namespace commands { /** * @brief OnASAppServiceDataNotificationFromHMI command class **/ -class OnASAppServiceDataNotificationFromHMI : public app_mngr::commands::NotificationFromHMI { +class OnASAppServiceDataNotificationFromHMI + : public app_mngr::commands::NotificationFromHMI { public: /** * @brief OnASAppServiceDataNotificationFromHMI class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index a798bed613..ede7afbc73 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -44,20 +44,18 @@ namespace commands { /** * @brief PublishAppServiceRequest command class **/ -class PublishAppServiceRequest - : public app_mngr::commands::CommandRequestImpl { +class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { public: /** * @brief PublishAppServiceRequest class constructor * * @param message Incoming SmartObject message **/ - PublishAppServiceRequest( - 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_handle); + PublishAppServiceRequest(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_handle); /** * @brief PublishAppServiceRequest class destructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h index 27b4d6ad2f..a11399c9e1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -52,12 +52,11 @@ class PublishAppServiceResponse * * @param message Incoming SmartObject message **/ - PublishAppServiceResponse( - 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_handle); + PublishAppServiceResponse(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_handle); /** * @brief PublishAppServiceResponse class destructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index 746636aff0..e741d7bfd4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -88,9 +88,9 @@ bool AppServiceHmiCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { UNUSED(source); - return buildCommandCreator( - function_id, hmi_apis::messageType::INVALID_ENUM, source) - .CanBeCreated(); + return buildCommandCreator(function_id, + hmi_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); } app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index 3b4e3490f6..e0e667e975 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -89,9 +89,9 @@ bool AppServiceMobileCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { UNUSED(source); - return buildCommandCreator( - function_id, mobile_apis::messageType::INVALID_ENUM, source) - .CanBeCreated(); + return buildCommandCreator(function_id, + mobile_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); } app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( @@ -108,7 +108,8 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( : factory.GetCreator(); case mobile_apis::FunctionID::OnAppServiceDataID: return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source - ? factory.GetCreator() + ? factory.GetCreator< + commands::OnAppServiceDataNotificationFromMobile>() : factory.GetCreator(); default: LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index e590d63a05..0cd269b04e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -57,8 +57,7 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification( } } -OnASAppServiceDataNotification:: - ~OnASAppServiceDataNotification() {} +OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {} void OnASAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 3dea2a6a12..01a8e817a2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -57,7 +57,8 @@ OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( } } -OnASAppServiceDataNotificationFromHMI::~OnASAppServiceDataNotificationFromHMI() {} +OnASAppServiceDataNotificationFromHMI:: + ~OnASAppServiceDataNotificationFromHMI() {} void OnASAppServiceDataNotificationFromHMI::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index e5f7c40471..05fe75c887 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -78,6 +78,42 @@ void PublishAppServiceRequest::Run() { service_record[strings::service_published] = true; service_record[strings::service_active] = true; + std::string requested_service_name = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_name].asString(); + std::string requested_service_type = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asString(); + smart_objects::SmartArray* requested_handled_rpcs = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::handled_rpcs].asArray(); + + std::string service_name = std::string(); + std::string service_type = std::string(); + std::vector handled_rpcs = {}; + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + policy_handler_.GetAppServiceParameters( + app->policy_app_id(), service_name, service_type, handled_rpcs); + + if (service_name != requested_service_name) { + SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); + } + + if (service_type != requested_service_type) { + SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); + } + + for (auto requested_it = requested_handled_rpcs->begin(); + requested_it != requested_handled_rpcs->end(); + ++requested_it) { + auto find_result = std::find( + handled_rpcs.begin(), handled_rpcs.end(), requested_it->asUInt()); + if (find_result == handled_rpcs.end()) { + SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); + } + } + response_params[strings::app_service_record] = service_record; SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); -- cgit v1.2.1 From ec5457edb06cf971b820b7fc79e7f25694dd0829 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 23 Jan 2019 12:44:31 -0500 Subject: Add validation of app service manifest --- .../commands/hmi/as_publish_app_service_request.h | 2 ++ .../commands/mobile/publish_app_service_request.h | 2 ++ .../commands/hmi/as_publish_app_service_request.cc | 23 +++++++++++++++++++++- .../commands/mobile/publish_app_service_request.cc | 22 +++++++++++++++++++-- 4 files changed, 46 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h index b21f99885a..0c7f222c1d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -69,6 +69,8 @@ class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { virtual void Run(); private: + bool ValidateManifest(smart_objects::SmartObject& manifest); + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index a798bed613..ac5caa4e6d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -70,6 +70,8 @@ class PublishAppServiceRequest virtual void Run(); private: + bool ValidateManifest(smart_objects::SmartObject& manifest); + AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 9acc8c3146..835762f78a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -59,14 +59,35 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} +bool ASPublishAppServiceRequest::ValidateManifest( + smart_objects::SmartObject& manifest) { + if (manifest.keyExists(strings::uri_scheme)) { + Json::Value value; + Json::Reader reader; + if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) { + SendResponse( + false, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_PublishAppService, + hmi_apis::Common_Result::INVALID_DATA); + return false; + } + } + return true; +} + void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject service_record = smart_objects::SmartObject(smart_objects::SmartType_Map); - service_record[strings::service_manifest] = + smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; + if (!ValidateManifest(manifest)) { + return; + } + service_record[strings::service_manifest] = manifest; service_record[strings::service_id] = "This is a service ID"; service_record[strings::service_published] = true; service_record[strings::service_active] = true; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index e5f7c40471..b22d0a8c6e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -62,6 +62,21 @@ PublishAppServiceRequest::PublishAppServiceRequest( PublishAppServiceRequest::~PublishAppServiceRequest() {} +bool PublishAppServiceRequest::ValidateManifest( + smart_objects::SmartObject& manifest) { + if (manifest.keyExists(strings::uri_scheme)) { + Json::Value value; + Json::Reader reader; + if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) { + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Provided uriScheme was not valid JSON"); + return false; + } + } + return true; +} + void PublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received a PublishAppService"); @@ -69,11 +84,14 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject service_record = smart_objects::SmartObject(smart_objects::SmartType_Map); - service_record[strings::service_manifest] = + smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; + if (!ValidateManifest(manifest)) { + return; + } + service_record[strings::service_manifest] = manifest; service_record[strings::service_id] = "This is a service ID"; service_record[strings::service_published] = true; service_record[strings::service_active] = true; -- cgit v1.2.1 From 7406748f90c18a0544cd0757d388fdcef5f4d8d9 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 23 Jan 2019 13:55:15 -0500 Subject: Fix Style --- .../app_service_hmi_command_factory.h | 9 ++++----- .../app_service_rpc_plugin/app_service_rpc_plugin.h | 4 ++-- .../hmi/on_as_app_service_data_notification_from_hmi.h | 3 ++- .../commands/mobile/publish_app_service_request.h | 14 ++++++-------- .../commands/mobile/publish_app_service_response.h | 11 +++++------ .../src/app_service_hmi_command_factory.cc | 6 +++--- .../src/app_service_mobile_command_factory.cc | 9 +++++---- .../commands/hmi/on_as_app_service_data_notification.cc | 3 +-- .../hmi/on_as_app_service_data_notification_from_hmi.cc | 3 ++- 9 files changed, 30 insertions(+), 32 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h index dfe333b881..c42b64f559 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h @@ -43,11 +43,10 @@ namespace app_mngr = application_manager; */ class AppServiceHmiCommandFactory : public app_mngr::CommandFactory { public: - AppServiceHmiCommandFactory( - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler); + AppServiceHmiCommandFactory(app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); app_mngr::CommandSharedPtr CreateCommand( const app_mngr::commands::MessageSharedPtr& message, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h index 398711b7a7..1113911a22 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -36,7 +36,7 @@ #include "application_manager/command_factory.h" namespace app_service_rpc_plugin { -//class AppServiceAppExtension; +// class AppServiceAppExtension; namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; @@ -67,7 +67,7 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { * @param ext application extension */ // TODO - //void ProcessResumptionSubscription(app_mngr::Application& app, + // void ProcessResumptionSubscription(app_mngr::Application& app, // AppServiceAppExtension& ext); private: diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h index df4cec9287..7ca20d692a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -44,7 +44,8 @@ namespace commands { /** * @brief OnASAppServiceDataNotificationFromHMI command class **/ -class OnASAppServiceDataNotificationFromHMI : public app_mngr::commands::NotificationFromHMI { +class OnASAppServiceDataNotificationFromHMI + : public app_mngr::commands::NotificationFromHMI { public: /** * @brief OnASAppServiceDataNotificationFromHMI class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index ac5caa4e6d..459fa0457e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -44,20 +44,18 @@ namespace commands { /** * @brief PublishAppServiceRequest command class **/ -class PublishAppServiceRequest - : public app_mngr::commands::CommandRequestImpl { +class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { public: /** * @brief PublishAppServiceRequest class constructor * * @param message Incoming SmartObject message **/ - PublishAppServiceRequest( - 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_handle); + PublishAppServiceRequest(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_handle); /** * @brief PublishAppServiceRequest class destructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h index 27b4d6ad2f..a11399c9e1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -52,12 +52,11 @@ class PublishAppServiceResponse * * @param message Incoming SmartObject message **/ - PublishAppServiceResponse( - 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_handle); + PublishAppServiceResponse(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_handle); /** * @brief PublishAppServiceResponse class destructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index 746636aff0..e741d7bfd4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -88,9 +88,9 @@ bool AppServiceHmiCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { UNUSED(source); - return buildCommandCreator( - function_id, hmi_apis::messageType::INVALID_ENUM, source) - .CanBeCreated(); + return buildCommandCreator(function_id, + hmi_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); } app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index 3b4e3490f6..e0e667e975 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -89,9 +89,9 @@ bool AppServiceMobileCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { UNUSED(source); - return buildCommandCreator( - function_id, mobile_apis::messageType::INVALID_ENUM, source) - .CanBeCreated(); + return buildCommandCreator(function_id, + mobile_apis::messageType::INVALID_ENUM, + source).CanBeCreated(); } app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( @@ -108,7 +108,8 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( : factory.GetCreator(); case mobile_apis::FunctionID::OnAppServiceDataID: return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source - ? factory.GetCreator() + ? factory.GetCreator< + commands::OnAppServiceDataNotificationFromMobile>() : factory.GetCreator(); default: LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index e590d63a05..0cd269b04e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -57,8 +57,7 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification( } } -OnASAppServiceDataNotification:: - ~OnASAppServiceDataNotification() {} +OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {} void OnASAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 3dea2a6a12..01a8e817a2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -57,7 +57,8 @@ OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( } } -OnASAppServiceDataNotificationFromHMI::~OnASAppServiceDataNotificationFromHMI() {} +OnASAppServiceDataNotificationFromHMI:: + ~OnASAppServiceDataNotificationFromHMI() {} void OnASAppServiceDataNotificationFromHMI::Run() { LOG4CXX_AUTO_TRACE(logger_); -- cgit v1.2.1 From 512f736856ad28572a0470d6ca5afe38d1977af3 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 23 Jan 2019 16:43:11 -0500 Subject: Add basic App Service Manager --- src/components/application_manager/rpc_plugins/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/CMakeLists.txt b/src/components/application_manager/rpc_plugins/CMakeLists.txt index e4f0051738..8884b30532 100644 --- a/src/components/application_manager/rpc_plugins/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/CMakeLists.txt @@ -32,4 +32,4 @@ add_subdirectory(vehicle_info_plugin) add_subdirectory(sdl_rpc_plugin) add_subdirectory(rc_rpc_plugin) -add_subdirectory(app_service_rpc_plugin) \ No newline at end of file +add_subdirectory(app_service_rpc_plugin) -- cgit v1.2.1 From 1057d6f4fc933c681ec52365c51268a8f3418a07 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 23 Jan 2019 21:27:56 -0500 Subject: Change handled_rpc to uint32 --- .../src/commands/mobile/publish_app_service_request.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 05fe75c887..b48f844263 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -90,7 +90,7 @@ void PublishAppServiceRequest::Run() { std::string service_name = std::string(); std::string service_type = std::string(); - std::vector handled_rpcs = {}; + std::vector handled_rpcs = {}; ApplicationSharedPtr app = application_manager_.application(connection_key()); policy_handler_.GetAppServiceParameters( -- cgit v1.2.1 From f27fe0bc5980ea19baf89791d45414854fa91325 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 23 Jan 2019 23:17:25 -0500 Subject: Add policy handler CheckAppServiceParameters --- .../commands/mobile/publish_app_service_request.cc | 23 +++------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index b48f844263..d2cc165656 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -88,32 +88,15 @@ void PublishAppServiceRequest::Run() { (*message_)[strings::msg_params][strings::app_service_manifest] [strings::handled_rpcs].asArray(); - std::string service_name = std::string(); - std::string service_type = std::string(); - std::vector handled_rpcs = {}; ApplicationSharedPtr app = application_manager_.application(connection_key()); - policy_handler_.GetAppServiceParameters( - app->policy_app_id(), service_name, service_type, handled_rpcs); + bool result = policy_handler_.CheckAppServiceParameters( + app->policy_app_id(), requested_service_name, requested_service_type, requested_handled_rpcs); - if (service_name != requested_service_name) { + if (!result) { SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); } - if (service_type != requested_service_type) { - SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); - } - - for (auto requested_it = requested_handled_rpcs->begin(); - requested_it != requested_handled_rpcs->end(); - ++requested_it) { - auto find_result = std::find( - handled_rpcs.begin(), handled_rpcs.end(), requested_it->asUInt()); - if (find_result == handled_rpcs.end()) { - SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); - } - } - response_params[strings::app_service_record] = service_record; SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); -- cgit v1.2.1 From d861c8f7097e331e82c86b926d2db104caade052 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 24 Jan 2019 09:40:16 -0500 Subject: Fix style --- .../src/commands/mobile/publish_app_service_request.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index d2cc165656..da91930509 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -90,8 +90,11 @@ void PublishAppServiceRequest::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); - bool result = policy_handler_.CheckAppServiceParameters( - app->policy_app_id(), requested_service_name, requested_service_type, requested_handled_rpcs); + bool result = + policy_handler_.CheckAppServiceParameters(app->policy_app_id(), + requested_service_name, + requested_service_type, + requested_handled_rpcs); if (!result) { SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); -- cgit v1.2.1 From 1a1a91088051a6a0d2ac856bb810df3621499a9f Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 24 Jan 2019 10:34:39 -0500 Subject: Update PublishAppService in AppServiceManager --- .../src/commands/hmi/as_publish_app_service_request.cc | 9 +++------ .../src/commands/mobile/publish_app_service_request.cc | 8 ++------ 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 835762f78a..1e235c1282 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -80,17 +80,14 @@ void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject service_record = - smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; if (!ValidateManifest(manifest)) { return; } - service_record[strings::service_manifest] = manifest; - service_record[strings::service_id] = "This is a service ID"; - service_record[strings::service_published] = true; - service_record[strings::service_active] = true; + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService(manifest); + response_params[strings::app_service_record] = service_record; // TODO: Add AppServiceRecord to response SendResponse(true, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index b22d0a8c6e..bf1fbae4f5 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -84,17 +84,13 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject service_record = - smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; if (!ValidateManifest(manifest)) { return; } - service_record[strings::service_manifest] = manifest; - service_record[strings::service_id] = "This is a service ID"; - service_record[strings::service_published] = true; - service_record[strings::service_active] = true; + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService(manifest); response_params[strings::app_service_record] = service_record; -- cgit v1.2.1 From f1c9edcbcf2822cc93a38810a592bc6412070214 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 24 Jan 2019 10:57:15 -0500 Subject: OnAppServiceDataNotificationFromMobile check parameters --- .../on_app_service_data_notification_from_mobile.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index a7a8042fee..20036cc30a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -67,6 +67,22 @@ void OnAppServiceDataNotificationFromMobile::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); MessageHelper::PrintSmartObject(*message_); + + std::string service_type = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asString(); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + bool result = policy_handler_.CheckAppServiceParameters( + app->policy_app_id(), std::string(), service_type, {}); + + if (!result) { + LOG4CXX_DEBUG(logger_, + "Incorrect service type received in " + "OnAppServiceDataNotificationFromMobile"); + return; + } } } // namespace commands -- cgit v1.2.1 From cb01cd11870ce4642ba49f7b86d4bd45562f2f1d Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 24 Jan 2019 11:05:40 -0500 Subject: Check if handled_rpcs is null --- .../src/commands/mobile/on_app_service_data_notification_from_mobile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 20036cc30a..6a9dc8f1a7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -75,7 +75,7 @@ void OnAppServiceDataNotificationFromMobile::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); bool result = policy_handler_.CheckAppServiceParameters( - app->policy_app_id(), std::string(), service_type, {}); + app->policy_app_id(), std::string(), service_type, NULL); if (!result) { LOG4CXX_DEBUG(logger_, -- cgit v1.2.1 From b978621cc24a49dbe6c59bb59a8406f52fc2c9db Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 30 Jan 2019 15:52:59 -0500 Subject: Change request type to enum --- .../commands/mobile/on_app_service_data_notification_from_mobile.cc | 5 +++-- .../src/commands/mobile/publish_app_service_request.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 6a9dc8f1a7..d4396d49a8 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -68,9 +68,10 @@ void OnAppServiceDataNotificationFromMobile::Run() { LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); MessageHelper::PrintSmartObject(*message_); - std::string service_type = + // Todo: revision make service type string. + mobile_apis::AppServiceType::eType service_type = static_cast( (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asString(); + [strings::service_type].asUInt()); ApplicationSharedPtr app = application_manager_.application(connection_key()); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index f975cb0543..03c1b91785 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -95,9 +95,10 @@ void PublishAppServiceRequest::Run() { std::string requested_service_name = (*message_)[strings::msg_params][strings::app_service_manifest] [strings::service_name].asString(); - std::string requested_service_type = + // Todo: revision make service type string. + mobile_apis::AppServiceType::eType requested_service_type = static_cast( (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asString(); + [strings::service_type].asUInt()); smart_objects::SmartArray* requested_handled_rpcs = (*message_)[strings::msg_params][strings::app_service_manifest] [strings::handled_rpcs].asArray(); -- cgit v1.2.1 From 000a8e84cbae684537b2edbd34716923e418d938 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Tue, 5 Feb 2019 14:46:10 -0500 Subject: Update PublishAppService --- .../src/commands/hmi/as_publish_app_service_request.cc | 3 ++- .../src/commands/mobile/publish_app_service_request.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 1e235c1282..7a71bea57f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -86,7 +86,8 @@ void ASPublishAppServiceRequest::Run() { return; } smart_objects::SmartObject service_record = - application_manager_.GetAppServiceManager().PublishAppService(manifest); + application_manager_.GetAppServiceManager().PublishAppService( + manifest, false, UINT32_MAX); response_params[strings::app_service_record] = service_record; // TODO: Add AppServiceRecord to response diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index bf1fbae4f5..78372661dc 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -90,7 +90,8 @@ void PublishAppServiceRequest::Run() { return; } smart_objects::SmartObject service_record = - application_manager_.GetAppServiceManager().PublishAppService(manifest); + application_manager_.GetAppServiceManager().PublishAppService( + manifest, true, connection_key()); response_params[strings::app_service_record] = service_record; -- cgit v1.2.1 From 35db01e868d559fe4395f2e6c6709d22a862b8a1 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 5 Feb 2019 14:55:06 -0500 Subject: Address review comments. --- .../src/commands/hmi/as_publish_app_service_request.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 7a71bea57f..ff69c90029 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -90,7 +90,6 @@ void ASPublishAppServiceRequest::Run() { manifest, false, UINT32_MAX); response_params[strings::app_service_record] = service_record; - // TODO: Add AppServiceRecord to response SendResponse(true, (*message_)[strings::params][strings::correlation_id].asUInt(), hmi_apis::FunctionID::AppService_PublishAppService, -- cgit v1.2.1 From 6c94329eab4c3bca1ddc066e610accc9a8c58033 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 8 Feb 2019 16:44:56 -0500 Subject: Minor formatting fix --- .../src/commands/hmi/as_publish_app_service_request.cc | 4 ++-- .../src/commands/hmi/as_publish_app_service_response.cc | 4 ++-- .../src/commands/hmi/on_as_app_service_data_notification.cc | 4 ++-- .../src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc | 4 ++-- .../src/commands/mobile/on_app_service_data_notification.cc | 4 ++-- .../commands/mobile/on_app_service_data_notification_from_mobile.cc | 4 ++-- .../src/commands/mobile/publish_app_service_request.cc | 4 ++-- .../src/commands/mobile/publish_app_service_response.cc | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index ff69c90029..89da1e744c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -49,9 +49,9 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( hmi_apis::FunctionID::AppService_PublishAppService, - app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + app_mngr::commands::Command::CommandSource::SOURCE_HMI); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc index 2513a92f15..1191b07abe 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc @@ -49,9 +49,9 @@ ASPublishAppServiceResponse::ASPublishAppServiceResponse( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( hmi_apis::FunctionID::AppService_PublishAppService, - app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + app_mngr::commands::Command::CommandSource::SOURCE_HMI); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index 0cd269b04e..29562d3086 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -49,9 +49,9 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( hmi_apis::FunctionID::AppService_OnAppServiceData, - app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + app_mngr::commands::Command::CommandSource::SOURCE_HMI); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 01a8e817a2..ce68192d13 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -49,9 +49,9 @@ OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( hmi_apis::FunctionID::AppService_OnAppServiceData, - app_mngr::commands::Command::CommandSource::SOURCE_HMI)); + app_mngr::commands::Command::CommandSource::SOURCE_HMI); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 33ab1a7246..ef2ab7a4ab 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -52,9 +52,9 @@ OnAppServiceDataNotification::OnAppServiceDataNotification( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( mobile_apis::FunctionID::OnAppServiceDataID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index a7a8042fee..0b0ac0b68c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -52,9 +52,9 @@ OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( mobile_apis::FunctionID::OnAppServiceDataID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 78372661dc..7a0333e763 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -52,9 +52,9 @@ PublishAppServiceRequest::PublishAppServiceRequest( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( mobile_apis::FunctionID::PublishAppServiceID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc index 6c3e9344bf..b302189ef7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -52,9 +52,9 @@ PublishAppServiceResponse::PublishAppServiceResponse( hmi_capabilities, policy_handler) , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + auto plugin = application_manager.GetPluginManager().FindPluginToProcess( mobile_apis::FunctionID::PublishAppServiceID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); if (plugin) { plugin_ = dynamic_cast(&(*plugin)); } -- cgit v1.2.1 From fe724122fa194196e65e2b3ece2d2916c0e98cc1 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 13 Feb 2019 16:39:46 -0500 Subject: Address Comments --- ...on_app_service_data_notification_from_mobile.cc | 7 ++--- .../commands/mobile/publish_app_service_request.cc | 30 +++++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 6c69eae3b6..1a90572ecf 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -69,9 +69,10 @@ void OnAppServiceDataNotificationFromMobile::Run() { MessageHelper::PrintSmartObject(*message_); // Todo: revision make service type string. - mobile_apis::AppServiceType::eType service_type = static_cast( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); + mobile_apis::AppServiceType::eType service_type = + static_cast( + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asUInt()); ApplicationSharedPtr app = application_manager_.application(connection_key()); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 052ad9751a..06f7f4b13a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -93,16 +93,28 @@ void PublishAppServiceRequest::Run() { application_manager_.GetAppServiceManager().PublishAppService( manifest, true, connection_key()); - std::string requested_service_name = - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_name].asString(); + std::string requested_service_name = ""; + + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::service_name)) { + requested_service_name = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_name].asString(); + } + // Todo: revision make service type string. - mobile_apis::AppServiceType::eType requested_service_type = static_cast( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); - smart_objects::SmartArray* requested_handled_rpcs = - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::handled_rpcs].asArray(); + mobile_apis::AppServiceType::eType requested_service_type = + static_cast( + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asUInt()); + + smart_objects::SmartArray* requested_handled_rpcs; + if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( + strings::handled_rpcs)) { + requested_handled_rpcs = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::handled_rpcs].asArray(); + } ApplicationSharedPtr app = application_manager_.application(connection_key()); -- cgit v1.2.1 From a090527479222dbb659d6e390d034dd5dc72a107 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Tue, 19 Feb 2019 15:29:55 -0500 Subject: Update AppServiceType to string --- .../mobile/on_app_service_data_notification_from_mobile.cc | 8 +++----- .../src/commands/mobile/publish_app_service_request.cc | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 1a90572ecf..96b085c344 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -68,11 +68,9 @@ void OnAppServiceDataNotificationFromMobile::Run() { LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); MessageHelper::PrintSmartObject(*message_); - // Todo: revision make service type string. - mobile_apis::AppServiceType::eType service_type = - static_cast( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); + std::string service_type = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asString(); ApplicationSharedPtr app = application_manager_.application(connection_key()); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 06f7f4b13a..6ef63aa1b8 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -102,11 +102,9 @@ void PublishAppServiceRequest::Run() { [strings::service_name].asString(); } - // Todo: revision make service type string. - mobile_apis::AppServiceType::eType requested_service_type = - static_cast( - (*message_)[strings::msg_params][strings::app_service_manifest] - [strings::service_type].asUInt()); + std::string requested_service_type = + (*message_)[strings::msg_params][strings::app_service_manifest] + [strings::service_type].asString(); smart_objects::SmartArray* requested_handled_rpcs; if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( -- cgit v1.2.1 From a4011490d9aa4606d6d835690bc8703c4375526b Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Thu, 21 Feb 2019 17:53:08 -0500 Subject: SystemCapability Subscription (#2800) * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Add binary data to OEM_SPECIFIC request type * Add check for missing presetBankCapabilities in Buttons.GetCapabilities * Revert "Add missing resource close in LoadPlugin" This reverts commit 35defc42777c57412cbf8b793489ab0dac502f4e. * Genericize vehicle info in hmi_capabilities.json * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Added AppServices structs to MOBILE API * Add binary data to OEM_SPECIFIC request type * Add check for missing presetBankCapabilities in Buttons.GetCapabilities * Revert "Add missing resource close in LoadPlugin" This reverts commit 35defc42777c57412cbf8b793489ab0dac502f4e. * Genericize vehicle info in hmi_capabilities.json * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Added and implemented OnSystemCapabilityUpdated notification * Added AppServices structs to MOBILE API * Add binary data to OEM_SPECIFIC request type * Add check for missing presetBankCapabilities in Buttons.GetCapabilities * Revert "Add missing resource close in LoadPlugin" This reverts commit 35defc42777c57412cbf8b793489ab0dac502f4e. * Genericize vehicle info in hmi_capabilities.json * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Added AppServices structs to MOBILE API * Implemented AppServiceCapabilities response * Renamed SystemCapability App Extension filename and ExtractExtension function * Fix style * Add OnSystemCapabilityUpdated(APP_SERVICES) handling * Fix missing include and unused variables * Made fix in App service manager and added notifcation RPC to policy table * Implemented automatic app system capability subscription of App Service Provider * Add binary data to OEM_SPECIFIC request type * Add check for missing presetBankCapabilities in Buttons.GetCapabilities * Revert "Add missing resource close in LoadPlugin" This reverts commit 35defc42777c57412cbf8b793489ab0dac502f4e. * Genericize vehicle info in hmi_capabilities.json * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Added AppServices structs to MOBILE API * Implemented AppServiceCapabilities response * Renamed SystemCapability App Extension filename and ExtractExtension function * Fix style * Add OnSystemCapabilityUpdated(APP_SERVICES) handling * Fix missing include and unused variables * Made fix in App service manager and added notifcation RPC to policy table * Implemented automatic app system capability subscription of App Service Provider * Rebase and style fix * Added all published app services in OnSystemCapabilityUpdate notification * Add binary data to OEM_SPECIFIC request type * Add check for missing presetBankCapabilities in Buttons.GetCapabilities * Revert "Add missing resource close in LoadPlugin" This reverts commit 35defc42777c57412cbf8b793489ab0dac502f4e. * Genericize vehicle info in hmi_capabilities.json * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added enabling/disabling subscription in * Added and implemented OnSystemCapabilityUpdated notification * Added AppServices structs to MOBILE API * Implemented AppServiceCapabilities response * Renamed SystemCapability App Extension filename and ExtractExtension function * Fix style * Add OnSystemCapabilityUpdated(APP_SERVICES) handling * Fix missing include and unused variables * Made fix in App service manager and added notifcation RPC to policy table * Implemented automatic app system capability subscription of App Service Provider * Added subscribe paramater and SystemCapability App Extension * Added SystemCapability app extension in sdl_rpc_plugin * Added and implemented OnSystemCapabilityUpdated notification * Renamed SystemCapability App Extension filename and ExtractExtension function * Fix style * Add OnSystemCapabilityUpdated(APP_SERVICES) handling * Made fix in App service manager and added notifcation RPC to policy table * Rebase and style fix * Added all published app services in OnSystemCapabilityUpdate notification * Applied parameter updateReason only to published app service which triggers OnSystemCapabilityUpdated notification * Implemented OnSystemCapabilityUpdated notification to HMI * Addressed review comments * Implemented UnPublishAppService in ASM * Implemented ASP removal notification * Moved ASP removal notification to ApplicationManagerImpl::UnregisterApplication * Moved HMI OSCU notification from app services plugin to sdl rpc plugin * Initialize AppServiceManager in Application manager tests * Moved create notification functions to message helper class * Fix style * Removed setServiceActive function * Update SystemCapability structs with new revisions * Fixed error from previous commit and addressed style comments * Addressed review comments * Addressed review comments and removed extra debug statements --- .../app_service_rpc_plugin/CMakeLists.txt | 6 +- .../commands/hmi/as_publish_app_service_request.cc | 1 + .../commands/mobile/publish_app_service_request.cc | 9 +- .../rpc_plugins/sdl_rpc_plugin/CMakeLists.txt | 6 +- .../on_bc_system_capability_updated_notification.h | 79 +++++++++++++++++ .../on_system_capability_updated_notification.h | 84 +++++++++++++++++++ .../extensions/system_capability_app_extension.h | 83 ++++++++++++++++++ .../include/sdl_rpc_plugin/sdl_rpc_plugin.h | 25 +++--- ...on_bc_system_capability_updated_notification.cc | 67 +++++++++++++++ .../mobile/get_system_capability_request.cc | 41 +++++++++ .../on_system_capability_updated_notification.cc | 70 ++++++++++++++++ .../extensions/system_capability_app_extension.cc | 98 ++++++++++++++++++++++ .../sdl_rpc_plugin/src/hmi_command_factory.cc | 6 ++ .../sdl_rpc_plugin/src/mobile_command_factory.cc | 5 ++ .../sdl_rpc_plugin/src/sdl_rpc_plugin.cc | 37 +++++--- 15 files changed, 591 insertions(+), 26 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt index e254c36587..2bdc150906 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -28,7 +28,10 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -include_directories(include) +include_directories( + include + ${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include + ) set (COMMANDS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/commands @@ -54,6 +57,7 @@ set(LIBRARIES v4_protocol_v1_2_no_extra SmartObjects Utils + sdl_rpc_plugin ) if(ENABLE_LOG) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 89da1e744c..a3e6bfed2a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -78,6 +78,7 @@ bool ASPublishAppServiceRequest::ValidateManifest( void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI"); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 7a0333e763..96f17f732a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -35,6 +35,7 @@ #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" namespace app_service_rpc_plugin { using namespace application_manager; @@ -79,7 +80,7 @@ bool PublishAppServiceRequest::ValidateManifest( void PublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received a PublishAppService"); + LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key()); MessageHelper::PrintSmartObject(*message_); smart_objects::SmartObject response_params = @@ -89,6 +90,12 @@ void PublishAppServiceRequest::Run() { if (!ValidateManifest(manifest)) { return; } + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + auto& ext = + sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app); + ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES); + smart_objects::SmartObject service_record = application_manager_.GetAppServiceManager().PublishAppService( manifest, true, connection_key()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt index 11dd35d061..fdf02b57cb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt @@ -42,8 +42,12 @@ set (HMI_COMMANDS_SOURCE_DIR ${COMMANDS_SOURCE_DIR}/hmi ) +set (EXTENSIONS_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src/extensions +) collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}") collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}") +collect_sources(APP_EXTENSIONS "${EXTENSIONS_SOURCE_DIR}") collect_sources(RPC_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src") set(LIBRARIES @@ -60,7 +64,7 @@ if(ENABLE_LOG) list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() -add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES}) +add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS}) target_link_libraries("sdl_rpc_plugin" ${LIBRARIES}) set(INSTALL_DESTINATION bin) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h new file mode 100644 index 0000000000..17f8a5b3c8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ + +#include "application_manager/commands/notification_to_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief OnASSystemCapabilityUpdatedNotification command class + **/ +class OnBCSystemCapabilityUpdatedNotification + : public app_mngr::commands::NotificationToHMI { + public: + /** + * @brief OnASSystemCapabilityUpdatedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnBCSystemCapabilityUpdatedNotification( + 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_handle); + + /** + * @brief OnASSystemCapabilityUpdatedNotification class destructor + **/ + virtual ~OnBCSystemCapabilityUpdatedNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotification); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h new file mode 100644 index 0000000000..1f7e8468db --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h @@ -0,0 +1,84 @@ +/* + Copyright (c) 2018, 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ + +#include "application_manager/commands/command_notification_impl.h" +#include "policy/policy_table/enums.h" +#include + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +namespace mobile { + +/** + * @brief OnSystemCapabilityUpdatedNotification class + **/ +class OnSystemCapabilityUpdatedNotification + : public app_mngr::commands::CommandNotificationImpl { + public: + typedef std::vector BinaryMessage; + /** + * @brief OnSystemCapabilityUpdatedNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnSystemCapabilityUpdatedNotification( + 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); + + /** + * @brief OnSystemCapabilityUpdatedNotification class destructor + **/ + ~OnSystemCapabilityUpdatedNotification() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(OnSystemCapabilityUpdatedNotification); +}; + +} // namespace mobile +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h new file mode 100644 index 0000000000..fb82cf37c2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h @@ -0,0 +1,83 @@ +/* + Copyright (c) 2018, 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H +#include +#include +#include +#include "sdl_rpc_plugin/sdl_rpc_plugin.h" + +namespace sdl_rpc_plugin { +class SDLRPCPlugin; + +namespace app_mngr_ = application_manager; + +typedef mobile_apis::SystemCapabilityType::eType SystemCapabilityType; +typedef std::set + SystemCapabilitySubscriptions; + +class SystemCapabilityAppExtension : public app_mngr_::AppExtension { + public: + SystemCapabilityAppExtension(SDLRPCPlugin& plugin, + app_mngr_::Application& app); + virtual ~SystemCapabilityAppExtension(); + + bool SubscribeTo(const SystemCapabilityType system_capability_type); + + bool UnsubscribeFrom(const SystemCapabilityType system_capability_type); + + void UnsubscribeFromAll(); + + bool IsSubscribedTo(const SystemCapabilityType system_capability_type) const; + + SystemCapabilitySubscriptions Subscriptions(); + + void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject& + resumption_data) OVERRIDE; + + void ProcessResumption( + const smart_objects::SmartObject& resumption_data) OVERRIDE; + + static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID; + + static SystemCapabilityAppExtension& ExtractExtension( + app_mngr_::Application& app); + + private: + SystemCapabilitySubscriptions subscribed_data_; + SDLRPCPlugin& plugin_; + app_mngr_::Application& app_; +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h index 6ae3a0b6bc..b57fcbec12 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h @@ -36,29 +36,32 @@ #include "application_manager/command_factory.h" namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; + +class SystemCapabilityAppExtension; + class SDLRPCPlugin : public plugins::RPCPlugin { // RPCPlugin interface public: - bool Init(application_manager::ApplicationManager& app_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, + bool Init(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) OVERRIDE; bool IsAbleToProcess( const int32_t function_id, - const application_manager::commands::Command::CommandSource - message_source) OVERRIDE; + const app_mngr::commands::Command::CommandSource message_source) OVERRIDE; std::string PluginName() OVERRIDE; - application_manager::CommandFactory& GetCommandFactory() OVERRIDE; - void OnPolicyEvent( - application_manager::plugin_manager::PolicyEvent event) OVERRIDE; - void OnApplicationEvent( - application_manager::plugin_manager::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) OVERRIDE; + app_mngr::CommandFactory& GetCommandFactory() OVERRIDE; + void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE; + void OnApplicationEvent(plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) OVERRIDE; private: + void ClearSubscriptions(app_mngr::ApplicationSharedPtr app); + std::unique_ptr command_factory_; }; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc new file mode 100644 index 0000000000..3f8dcf08f6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -0,0 +1,67 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/HMI_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +OnBCSystemCapabilityUpdatedNotification:: + OnBCSystemCapabilityUpdatedNotification( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : NotificationToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnBCSystemCapabilityUpdatedNotification:: + ~OnBCSystemCapabilityUpdatedNotification() {} + +void OnBCSystemCapabilityUpdatedNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "Sending BasicCommunication.OnSystemCapabilityUpdated " + "Notification to HMI"); + SendNotification(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index a6c627aad2..1449f0e061 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -31,6 +31,9 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "application_manager/message_helper.h" +#include namespace sdl_rpc_plugin { using namespace application_manager; @@ -128,10 +131,48 @@ void GetSystemCapabilityRequest::Run() { return; } break; + case mobile_apis::SystemCapabilityType::APP_SERVICES: { + smart_objects::SmartObject app_service_capabilities( + smart_objects::SmartType_Map); + smart_objects::SmartObject app_services(smart_objects::SmartType_Array); + + std::vector service_records = + application_manager_.GetAppServiceManager().GetAllServices(); + + for (auto& record : service_records) { + smart_objects::SmartObject app_services_capabilities( + smart_objects::SmartType_Map); + app_services_capabilities[strings::updated_app_service_record] = record; + app_services.asArray()->push_back(app_services_capabilities); + } + + app_service_capabilities[strings::app_services] = app_services; + response_params[strings::system_capability] + [strings::app_services_capabilities] = + app_service_capabilities; + + break; + } default: // Return unsupported resource SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } + + if ((*message_)[app_mngr::strings::msg_params].keyExists( + strings::subscribe)) { + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + if ((*message_)[app_mngr::strings::msg_params][strings::subscribe] + .asBool() == true) { + LOG4CXX_DEBUG(logger_, + "Subscribe to system capability: " << response_type); + ext.SubscribeTo(response_type); + } else { + LOG4CXX_DEBUG(logger_, + "Unsubscribe from system capability: " << response_type); + ext.UnsubscribeFrom(response_type); + } + } + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc new file mode 100644 index 0000000000..6a1f0844d9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -0,0 +1,70 @@ +#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h" +#include "application_manager/application_manager.h" +#include "application_manager/helpers/application_helper.h" +#include "application_manager/message_helper.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "smart_objects/enum_schema_item.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { +namespace mobile { + +OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification( + 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) + : CommandNotificationImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +OnSystemCapabilityUpdatedNotification:: + ~OnSystemCapabilityUpdatedNotification() {} + +void OnSystemCapabilityUpdatedNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + mobile_apis::SystemCapabilityType::eType system_capability_type = + static_cast( + (*message_)[strings::msg_params][strings::system_capability] + [strings::system_capability_type].asInt()); + + const char* capability_type_string; + ns_smart_device_link::ns_smart_objects::EnumConversionHelper< + mobile_apis::SystemCapabilityType::eType>:: + EnumToCString(system_capability_type, &capability_type_string); + + auto subscribed_to_capability_predicate = + [&system_capability_type](const ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + return ext.IsSubscribedTo(system_capability_type); + }; + + const std::vector& applications = FindAllApps( + application_manager_.applications(), subscribed_to_capability_predicate); + + LOG4CXX_DEBUG(logger_, + "Number of Notifications to be sent: " << applications.size()); + + std::vector::const_iterator app_it = + applications.begin(); + + for (; applications.end() != app_it; ++app_it) { + const ApplicationSharedPtr app = *app_it; + LOG4CXX_INFO(logger_, + "Sending OnSystemCapabilityUpdated " << capability_type_string + << " application id " + << app->app_id()); + (*message_)[strings::params][strings::connection_key] = app->app_id(); + SendNotification(); + } +} + +} // namespace mobile +} // namespace commands +} // namespace application_manager diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc new file mode 100644 index 0000000000..130585a927 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc @@ -0,0 +1,98 @@ +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" + +namespace sdl_rpc_plugin { +CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension") + +namespace app_mngr_ = application_manager; +const app_mngr_::AppExtensionUID + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200; + +SystemCapabilityAppExtension::SystemCapabilityAppExtension( + sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app) + : app_mngr_::AppExtension( + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID) + , plugin_(plugin) + , app_(app) {} + +SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {} + +bool SystemCapabilityAppExtension::SubscribeTo( + const SystemCapabilityType system_capability_type) { + LOG4CXX_INFO(logger_, + "Subscribing to System Capability " << system_capability_type); + return subscribed_data_.insert(system_capability_type).second; +} + +bool SystemCapabilityAppExtension::UnsubscribeFrom( + const SystemCapabilityType system_capability_type) { + LOG4CXX_INFO(logger_, + "Unsubscribing from System Capability " + << system_capability_type); + auto it = subscribed_data_.find(system_capability_type); + if (it != subscribed_data_.end()) { + subscribed_data_.erase(it); + return true; + } + return false; +} + +void SystemCapabilityAppExtension::UnsubscribeFromAll() { + LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities"); + subscribed_data_.clear(); +} + +bool SystemCapabilityAppExtension::IsSubscribedTo( + const SystemCapabilityType system_capability_type) const { + LOG4CXX_DEBUG(logger_, system_capability_type); + return subscribed_data_.find(system_capability_type) != + subscribed_data_.end(); +} + +SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() { + return subscribed_data_; +} + +void SystemCapabilityAppExtension::SaveResumptionData( + ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) { + LOG4CXX_AUTO_TRACE(logger_); + const char* application_system_capability = "systemCapability"; + + resumption_data[application_system_capability] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + + int i = 0; + for (const auto& subscription : subscribed_data_) { + resumption_data[application_system_capability][i] = subscription; + i++; + } +} + +void SystemCapabilityAppExtension::ProcessResumption( + const smart_objects::SmartObject& resumption_data) { + LOG4CXX_AUTO_TRACE(logger_); + + const char* application_system_capability = "systemCapability"; + if (resumption_data.keyExists(application_system_capability)) { + const smart_objects::SmartObject& subscriptions = + resumption_data[application_system_capability]; + for (size_t i = 0; i < subscriptions.length(); ++i) { + SystemCapabilityType capability_type = + static_cast((resumption_data[i]).asInt()); + SubscribeTo(capability_type); + } + } +} + +SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension( + app_mngr_::Application& app) { + LOG4CXX_AUTO_TRACE(logger_); + auto ext_ptr = app.QueryInterface( + SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID); + DCHECK(ext_ptr); + DCHECK(dynamic_cast(ext_ptr.get())); + auto app_extension = + std::static_pointer_cast(ext_ptr); + DCHECK(app_extension); + return *app_extension; +} +} \ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 7065c7cf7d..dc94474b9d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -241,6 +241,8 @@ #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h" #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h" +#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" + namespace sdl_rpc_plugin { using namespace application_manager; @@ -840,6 +842,10 @@ CommandCreator& HMICommandFactory::get_creator_factory( ? factory.GetCreator() : factory.GetCreator(); } + case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: { + return factory + .GetCreator(); + } default: { return factory.GetCreator(); } } } 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 8eab054be3..77be545e0b 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 @@ -73,6 +73,7 @@ #include "sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h" #include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h" #include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h" +#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h" #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h" #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h" #include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h" @@ -388,6 +389,10 @@ CommandCreator& MobileCommandFactory::get_creator_factory( case mobile_apis::FunctionID::OnTouchEventID: { return factory.GetCreator(); } + case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID: { + return factory.GetCreator< + commands::mobile::OnSystemCapabilityUpdatedNotification>(); + } case mobile_apis::FunctionID::OnSystemRequestID: { return factory .GetCreator(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index 22b818f5e0..aa82c74098 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -32,15 +32,18 @@ #include "sdl_rpc_plugin/sdl_rpc_plugin.h" #include "sdl_rpc_plugin/sdl_command_factory.h" +#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; -bool SDLRPCPlugin::Init( - application_manager::ApplicationManager& app_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) { +CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin") + +bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) { command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory( app_manager, rpc_service, hmi_capabilities, policy_handler)); return true; @@ -48,8 +51,7 @@ bool SDLRPCPlugin::Init( bool SDLRPCPlugin::IsAbleToProcess( const int32_t function_id, - const application_manager::commands::Command::CommandSource - message_source) { + const app_mngr::commands::Command::CommandSource message_source) { return command_factory_->IsAbleToProcess(function_id, message_source); } @@ -57,16 +59,27 @@ std::string SDLRPCPlugin::PluginName() { return "SDL RPC Plugin"; } -application_manager::CommandFactory& SDLRPCPlugin::GetCommandFactory() { +app_mngr::CommandFactory& SDLRPCPlugin::GetCommandFactory() { return *command_factory_; } -void SDLRPCPlugin::OnPolicyEvent( - application_manager::plugin_manager::PolicyEvent event) {} +void SDLRPCPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} void SDLRPCPlugin::OnApplicationEvent( - application_manager::plugin_manager::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) {} + plugins::ApplicationEvent event, + app_mngr::ApplicationSharedPtr application) { + if (plugins::ApplicationEvent::kApplicationRegistered == event) { + application->AddExtension( + std::make_shared(*this, *application)); + } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { + ClearSubscriptions(application); + } +} + +void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) { + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + ext.UnsubscribeFromAll(); +} } // namespace sdl_rpc_plugin -- cgit v1.2.1 From ef8116cef0eec0e972fd8fc4ffd437711a7508a2 Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Fri, 22 Feb 2019 09:43:22 -0500 Subject: Update src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc Add info for DISALLOWED Co-Authored-By: JackLivio --- .../src/commands/mobile/publish_app_service_request.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 6ef63aa1b8..123a4d4def 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -123,7 +123,7 @@ void PublishAppServiceRequest::Run() { requested_handled_rpcs); if (!result) { - SendResponse(false, mobile_apis::Result::DISALLOWED, NULL, NULL); + SendResponse(false, mobile_apis::Result::DISALLOWED, "Service disallowed by policies", NULL); } response_params[strings::app_service_record] = service_record; -- cgit v1.2.1 From 5a0d510affcc77ddf240fc2b3465da6b570b1da1 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 22 Feb 2019 12:47:44 -0500 Subject: style --- .../src/commands/mobile/publish_app_service_request.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index bdbf8d0983..7ccbe9fecd 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -130,7 +130,10 @@ void PublishAppServiceRequest::Run() { requested_handled_rpcs); if (!result) { - SendResponse(false, mobile_apis::Result::DISALLOWED, "Service disallowed by policies", NULL); + SendResponse(false, + mobile_apis::Result::DISALLOWED, + "Service disallowed by policies", + NULL); } response_params[strings::app_service_record] = service_record; -- cgit v1.2.1 From 2a26de5bc0f3a357e28e6a83c9a7d439d2673431 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Sat, 23 Feb 2019 12:35:11 -0500 Subject: App Service Activation Logic (#2809) * Add AS.AppServiceActivation and AS.GetAppServiceRecords RPCs * Initialize AppServiceManager in Application manager tests * Moved create notification functions to message helper class * Fix style * Removed setServiceActive function * Add OnSystemCapabilityUpdated triggers to AppServiceManager Includes refactoring of OnSystemCapabilityUpdated notification classes. * Remove servicesSupported parameter * Update SystemCapability structs with new revisions * Include additional cases for activation 1. Services are activated if their publishing app is in the foreground. 2. If a service is deactivated without another being activated, the embedded service becomes active if available. * Fixed error from previous commit and addressed style comments * Addressed review comments * Address review comments * Fix LastState usage in app service manager * Addressed review comments and removed extra debug statements * Fix style --- .../hmi/as_app_service_activation_request.h | 80 ++++++++++++++++++ .../hmi/as_app_service_activation_response.h | 80 ++++++++++++++++++ .../hmi/as_get_app_service_records_request.h | 80 ++++++++++++++++++ .../hmi/as_get_app_service_records_response.h | 80 ++++++++++++++++++ .../src/app_service_hmi_command_factory.cc | 14 ++++ .../hmi/as_app_service_activation_request.cc | 87 ++++++++++++++++++++ .../hmi/as_app_service_activation_response.cc | 59 ++++++++++++++ .../hmi/as_get_app_service_records_request.cc | 88 ++++++++++++++++++++ .../hmi/as_get_app_service_records_response.cc | 59 ++++++++++++++ .../commands/mobile/publish_app_service_request.cc | 5 ++ ...on_bc_system_capability_updated_notification.cc | 80 ++++++++++++++++++ .../mobile/get_system_capability_request.cc | 22 +---- .../on_system_capability_updated_notification.cc | 95 +++++++++++++++++++++- 13 files changed, 807 insertions(+), 22 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h new file mode 100644 index 0000000000..c98979da0f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASAppServiceActivationRequest command class + **/ +class ASAppServiceActivationRequest + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASAppServiceActivationRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASAppServiceActivationRequest( + 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_handle); + + /** + * @brief ASAppServiceActivationRequest class destructor + **/ + virtual ~ASAppServiceActivationRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h new file mode 100644 index 0000000000..68b77cb7e3 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASAppServiceActivationResponse command class + **/ +class ASAppServiceActivationResponse + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASAppServiceActivationResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASAppServiceActivationResponse( + 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_handle); + + /** + * @brief ASAppServiceActivationResponse class destructor + **/ + virtual ~ASAppServiceActivationResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h new file mode 100644 index 0000000000..79ea0922a8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceRecordsRequest command class + **/ +class ASGetAppServiceRecordsRequest + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASGetAppServiceRecordsRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceRecordsRequest( + 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_handle); + + /** + * @brief ASGetAppServiceRecordsRequest class destructor + **/ + virtual ~ASGetAppServiceRecordsRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h new file mode 100644 index 0000000000..6db24132af --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceRecordsResponse command class + **/ +class ASGetAppServiceRecordsResponse + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASGetAppServiceRecordsResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceRecordsResponse( + 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_handle); + + /** + * @brief ASGetAppServiceRecordsResponse class destructor + **/ + virtual ~ASGetAppServiceRecordsResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index e741d7bfd4..7afc04c8e9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -34,6 +34,10 @@ #include "application_manager/message.h" #include "interfaces/HMI_API.h" +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h" #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" @@ -111,6 +115,16 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( commands::OnASAppServiceDataNotificationFromHMI>() : factory .GetCreator(); + case hmi_apis::FunctionID::AppService_GetAppServiceRecords: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory + .GetCreator(); + case hmi_apis::FunctionID::AppService_AppServiceActivation: + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory + .GetCreator(); default: LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); return factory.GetCreator(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc new file mode 100644 index 0000000000..7c32d9bbe1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc @@ -0,0 +1,87 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASAppServiceActivationRequest::ASAppServiceActivationRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {} + +void ASAppServiceActivationRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + AppServiceManager& service_manager = + application_manager_.GetAppServiceManager(); + smart_objects::SmartObject params = (*message_)[strings::msg_params]; + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + std::string service_id = params[strings::service_id].asString(); + response_params[strings::service_id] = service_id; + if (params[strings::activate].asBool()) { + response_params[strings::activate] = + service_manager.ActivateAppService(service_id); + } else { + service_manager.DeactivateAppService(service_id); + response_params[strings::activate] = false; + } + + if (params.keyExists(strings::set_as_default)) { + if (params[strings::set_as_default].asBool()) { + response_params[strings::set_as_default] = + service_manager.SetDefaultService(service_id); + } else { + service_manager.RemoveDefaultService(service_id); + response_params[strings::set_as_default] = false; + } + } + + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_AppServiceActivation, + hmi_apis::Common_Result::SUCCESS, + &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc new file mode 100644 index 0000000000..c77d3ed381 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc @@ -0,0 +1,59 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASAppServiceActivationResponse::ASAppServiceActivationResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {} + +void ASAppServiceActivationResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc new file mode 100644 index 0000000000..1131448d2f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -0,0 +1,88 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {} + +void ASGetAppServiceRecordsRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + std::string type; + if ((*message_)[strings::msg_params].keyExists(strings::service_type)) { + type = (*message_)[strings::msg_params][strings::service_type].asString(); + } + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject records = + smart_objects::SmartObject(smart_objects::SmartType_Array); + std::vector service_records = + application_manager_.GetAppServiceManager().GetAllServices(); + + int index = 0; + for (auto& record : service_records) { + if (!type.empty() && + record[strings::service_manifest][strings::service_type].asString() != + type) { + continue; + } + records[index] = record; + index++; + } + + if (!records.empty()) { + response_params[strings::service_records] = records; + } + SendResponse(true, + (*message_)[strings::params][strings::correlation_id].asUInt(), + hmi_apis::FunctionID::AppService_GetAppServiceRecords, + hmi_apis::Common_Result::SUCCESS, + &response_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc new file mode 100644 index 0000000000..0479aa8d31 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc @@ -0,0 +1,59 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {} + +void ASGetAppServiceRecordsResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 96f17f732a..ab82bf77dd 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -99,6 +99,11 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject service_record = application_manager_.GetAppServiceManager().PublishAppService( manifest, true, connection_key()); + if (app->is_foreground()) { + // Service should be activated if app is in the foreground + application_manager_.GetAppServiceManager().ActivateAppService( + service_record[strings::service_id].asString()); + } response_params[strings::app_service_record] = service_record; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 3f8dcf08f6..d0c33e76d9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -32,6 +32,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" #include "interfaces/HMI_API.h" @@ -60,6 +61,85 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { LOG4CXX_DEBUG(logger_, "Sending BasicCommunication.OnSystemCapabilityUpdated " "Notification to HMI"); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + + hmi_apis::Common_SystemCapabilityType::eType system_capability_type = + static_cast( + msg_params[strings::system_capability] + [strings::system_capability_type].asInt()); + switch (system_capability_type) { + case hmi_apis::Common_SystemCapabilityType::NAVIGATION: { + if (hmi_capabilities_.navigation_capability()) { + msg_params[strings::system_capability][strings::navigation_capability] = + *hmi_capabilities_.navigation_capability(); + } + break; + } + case hmi_apis::Common_SystemCapabilityType::PHONE_CALL: { + if (hmi_capabilities_.phone_capability()) { + msg_params[strings::system_capability][strings::phone_capability] = + *hmi_capabilities_.phone_capability(); + } + break; + } + case hmi_apis::Common_SystemCapabilityType::REMOTE_CONTROL: { + if (!hmi_capabilities_.is_rc_cooperating()) { + return; + } + if (hmi_capabilities_.rc_capability()) { + msg_params[strings::system_capability][strings::rc_capability] = + *hmi_capabilities_.rc_capability(); + } + break; + } + case hmi_apis::Common_SystemCapabilityType::VIDEO_STREAMING: + if (hmi_capabilities_.video_streaming_capability()) { + msg_params[strings::system_capability] + [strings::video_streaming_capability] = + *hmi_capabilities_.video_streaming_capability(); + } + break; + case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: { + auto all_services = + application_manager_.GetAppServiceManager().GetAllServices(); + auto app_service_caps = + MessageHelper::CreateAppServiceCapabilities(all_services); + + smart_objects::SmartArray* app_services = + app_service_caps[strings::app_services].asArray(); + smart_objects::SmartObject& updated_capabilities = + msg_params[strings::system_capability] + [strings::app_services_capabilities][strings::app_services]; + for (size_t i = 0; i < updated_capabilities.length(); i++) { + std::string service_id = + updated_capabilities[i][strings::updated_app_service_record] + [strings::service_id].asString(); + auto matching_service_predicate = [&service_id]( + const smart_objects::SmartObject& app_service_capability) { + return service_id == + app_service_capability[strings::updated_app_service_record] + [strings::service_id].asString(); + }; + + auto it = std::find_if(app_services->begin(), + app_services->end(), + matching_service_predicate); + if (it != app_services->end()) { + LOG4CXX_DEBUG(logger_, + "Replacing updated record with service_id " + << service_id); + app_services->erase(it); + } + app_services->push_back(updated_capabilities[i]); + } + msg_params[strings::system_capability] + [strings::app_services_capabilities] = app_service_caps; + break; + } + default: + return; + } SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 1449f0e061..b551db0008 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -132,25 +132,11 @@ void GetSystemCapabilityRequest::Run() { } break; case mobile_apis::SystemCapabilityType::APP_SERVICES: { - smart_objects::SmartObject app_service_capabilities( - smart_objects::SmartType_Map); - smart_objects::SmartObject app_services(smart_objects::SmartType_Array); - - std::vector service_records = + auto all_services = application_manager_.GetAppServiceManager().GetAllServices(); - - for (auto& record : service_records) { - smart_objects::SmartObject app_services_capabilities( - smart_objects::SmartType_Map); - app_services_capabilities[strings::updated_app_service_record] = record; - app_services.asArray()->push_back(app_services_capabilities); - } - - app_service_capabilities[strings::app_services] = app_services; - response_params[strings::system_capability] - [strings::app_services_capabilities] = - app_service_capabilities; - + response_params + [strings::system_capability][strings::app_services_capabilities] = + MessageHelper::CreateAppServiceCapabilities(all_services); break; } default: // Return unsupported resource diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index 6a1f0844d9..0745bc08dc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -28,10 +28,84 @@ OnSystemCapabilityUpdatedNotification:: void OnSystemCapabilityUpdatedNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - mobile_apis::SystemCapabilityType::eType system_capability_type = - static_cast( - (*message_)[strings::msg_params][strings::system_capability] - [strings::system_capability_type].asInt()); + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + mobile_apis::SystemCapabilityType::eType system_capability_type = static_cast< + mobile_apis::SystemCapabilityType::eType>( + msg_params[strings::system_capability][strings::system_capability_type] + .asInt()); + + switch (system_capability_type) { + case mobile_apis::SystemCapabilityType::NAVIGATION: { + if (hmi_capabilities_.navigation_capability()) { + msg_params[strings::system_capability][strings::navigation_capability] = + *hmi_capabilities_.navigation_capability(); + } + break; + } + case mobile_apis::SystemCapabilityType::PHONE_CALL: { + if (hmi_capabilities_.phone_capability()) { + msg_params[strings::system_capability][strings::phone_capability] = + *hmi_capabilities_.phone_capability(); + } + break; + } + case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { + if (!hmi_capabilities_.is_rc_cooperating()) { + return; + } + if (hmi_capabilities_.rc_capability()) { + msg_params[strings::system_capability][strings::rc_capability] = + *hmi_capabilities_.rc_capability(); + } + break; + } + case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: + if (hmi_capabilities_.video_streaming_capability()) { + msg_params[strings::system_capability] + [strings::video_streaming_capability] = + *hmi_capabilities_.video_streaming_capability(); + } + break; + case mobile_apis::SystemCapabilityType::APP_SERVICES: { + auto all_services = + application_manager_.GetAppServiceManager().GetAllServices(); + auto app_service_caps = + MessageHelper::CreateAppServiceCapabilities(all_services); + + smart_objects::SmartArray* app_services = + app_service_caps[strings::app_services].asArray(); + smart_objects::SmartObject& updated_capabilities = + msg_params[strings::system_capability] + [strings::app_services_capabilities][strings::app_services]; + for (size_t i = 0; i < updated_capabilities.length(); i++) { + std::string service_id = + updated_capabilities[i][strings::updated_app_service_record] + [strings::service_id].asString(); + auto matching_service_predicate = [&service_id]( + const smart_objects::SmartObject& app_service_capability) { + return service_id == + app_service_capability[strings::updated_app_service_record] + [strings::service_id].asString(); + }; + + auto it = std::find_if(app_services->begin(), + app_services->end(), + matching_service_predicate); + if (it != app_services->end()) { + LOG4CXX_DEBUG(logger_, + "Replacing updated record with service_id " + << service_id); + app_services->erase(it); + } + app_services->push_back(updated_capabilities[i]); + } + msg_params[strings::system_capability] + [strings::app_services_capabilities] = app_service_caps; + break; + } + default: + return; + } const char* capability_type_string; ns_smart_device_link::ns_smart_objects::EnumConversionHelper< @@ -56,6 +130,19 @@ void OnSystemCapabilityUpdatedNotification::Run() { for (; applications.end() != app_it; ++app_it) { const ApplicationSharedPtr app = *app_it; + if (system_capability_type == + mobile_apis::SystemCapabilityType::REMOTE_CONTROL && + !app->is_remote_control_supported()) { + LOG4CXX_WARN( + logger_, + "App with connection key: " + << app->app_id() + << " was subcribed to REMOTE_CONTROL system capabilities, but " + "does not have RC permissions. Unsubscribing"); + auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); + ext.UnsubscribeFrom(system_capability_type); + continue; + } LOG4CXX_INFO(logger_, "Sending OnSystemCapabilityUpdated " << capability_type_string << " application id " -- cgit v1.2.1 From 7d7af1bc71540dcfefbf669fc27e07f7996c586a Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sat, 23 Feb 2019 13:49:50 -0500 Subject: Set behavior for omitted and missing service_names and handled_rpcs --- .../src/commands/mobile/publish_app_service_request.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 7ccbe9fecd..81f369a6d8 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -113,7 +113,7 @@ void PublishAppServiceRequest::Run() { (*message_)[strings::msg_params][strings::app_service_manifest] [strings::service_type].asString(); - smart_objects::SmartArray* requested_handled_rpcs; + smart_objects::SmartArray* requested_handled_rpcs = NULL; if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists( strings::handled_rpcs)) { requested_handled_rpcs = @@ -121,8 +121,6 @@ void PublishAppServiceRequest::Run() { [strings::handled_rpcs].asArray(); } - ApplicationSharedPtr app = application_manager_.application(connection_key()); - bool result = policy_handler_.CheckAppServiceParameters(app->policy_app_id(), requested_service_name, -- cgit v1.2.1 From da17adca89fa2cc7429230aae5c179cd3b1f4832 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sat, 23 Feb 2019 13:55:03 -0500 Subject: Move publish app service & subscribe after policy check --- .../src/commands/mobile/publish_app_service_request.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 81f369a6d8..953cc56b67 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -92,13 +92,6 @@ void PublishAppServiceRequest::Run() { } ApplicationSharedPtr app = application_manager_.application(connection_key()); - auto& ext = - sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app); - ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES); - - smart_objects::SmartObject service_record = - application_manager_.GetAppServiceManager().PublishAppService( - manifest, true, connection_key()); std::string requested_service_name = ""; @@ -134,6 +127,14 @@ void PublishAppServiceRequest::Run() { NULL); } + auto& ext = + sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app); + ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES); + + smart_objects::SmartObject service_record = + application_manager_.GetAppServiceManager().PublishAppService( + manifest, true, connection_key()); + response_params[strings::app_service_record] = service_record; SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); -- cgit v1.2.1 From c3f3360bebde3f1c6a52234c94749434cfa69693 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 23 Feb 2019 13:30:31 -0500 Subject: Fix API typo and style Also remove unused member variable in App Service messages --- .../commands/hmi/as_publish_app_service_request.h | 1 - .../commands/hmi/as_publish_app_service_response.h | 1 - .../commands/hmi/on_as_app_service_data_notification.h | 1 - .../hmi/on_as_app_service_data_notification_from_hmi.h | 1 - .../commands/mobile/on_app_service_data_notification.h | 1 - .../mobile/on_app_service_data_notification_from_mobile.h | 1 - .../commands/mobile/publish_app_service_request.h | 1 - .../commands/mobile/publish_app_service_response.h | 1 - .../src/commands/hmi/as_publish_app_service_request.cc | 10 +--------- .../src/commands/hmi/as_publish_app_service_response.cc | 10 +--------- .../src/commands/hmi/on_as_app_service_data_notification.cc | 10 +--------- .../hmi/on_as_app_service_data_notification_from_hmi.cc | 10 +--------- .../src/commands/mobile/on_app_service_data_notification.cc | 10 +--------- .../mobile/on_app_service_data_notification_from_mobile.cc | 10 +--------- .../src/commands/mobile/publish_app_service_request.cc | 10 +--------- .../src/commands/mobile/publish_app_service_response.cc | 10 +--------- 16 files changed, 8 insertions(+), 80 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h index 0c7f222c1d..ec2c00a714 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -71,7 +71,6 @@ class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { private: bool ValidateManifest(smart_objects::SmartObject& manifest); - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h index c532225632..519d57c609 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h @@ -69,7 +69,6 @@ class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI { virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h index 44d6d09fd3..30af13038a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h @@ -70,7 +70,6 @@ class OnASAppServiceDataNotification virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h index 7ca20d692a..5a23e35df0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h @@ -70,7 +70,6 @@ class OnASAppServiceDataNotificationFromHMI virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h index 4bc818f9be..719f5ebf5b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h @@ -70,7 +70,6 @@ class OnAppServiceDataNotification virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h index f163e5848b..c41fabf7b1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h @@ -70,7 +70,6 @@ class OnAppServiceDataNotificationFromMobile virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index 459fa0457e..72e4f1c629 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -70,7 +70,6 @@ class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { private: bool ValidateManifest(smart_objects::SmartObject& manifest); - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h index a11399c9e1..9275f9e468 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h @@ -69,7 +69,6 @@ class PublishAppServiceResponse virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index a3e6bfed2a..5e20ca20d1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -47,15 +47,7 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - hmi_apis::FunctionID::AppService_PublishAppService, - app_mngr::commands::Command::CommandSource::SOURCE_HMI); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc index 1191b07abe..c143315b8c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc @@ -47,15 +47,7 @@ ASPublishAppServiceResponse::ASPublishAppServiceResponse( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - hmi_apis::FunctionID::AppService_PublishAppService, - app_mngr::commands::Command::CommandSource::SOURCE_HMI); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index 29562d3086..899cc44f94 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -47,15 +47,7 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - hmi_apis::FunctionID::AppService_OnAppServiceData, - app_mngr::commands::Command::CommandSource::SOURCE_HMI); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index ce68192d13..c89b52a683 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -47,15 +47,7 @@ OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - hmi_apis::FunctionID::AppService_OnAppServiceData, - app_mngr::commands::Command::CommandSource::SOURCE_HMI); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} OnASAppServiceDataNotificationFromHMI:: ~OnASAppServiceDataNotificationFromHMI() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index ef2ab7a4ab..6a6a50dc86 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -50,15 +50,7 @@ OnAppServiceDataNotification::OnAppServiceDataNotification( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::OnAppServiceDataID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} OnAppServiceDataNotification::~OnAppServiceDataNotification() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 0b0ac0b68c..b46bc7934e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -50,15 +50,7 @@ OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::OnAppServiceDataID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} OnAppServiceDataNotificationFromMobile:: ~OnAppServiceDataNotificationFromMobile() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index ab82bf77dd..ed60bb14df 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -51,15 +51,7 @@ PublishAppServiceRequest::PublishAppServiceRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::PublishAppServiceID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} PublishAppServiceRequest::~PublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc index b302189ef7..b1136c79d0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -50,15 +50,7 @@ PublishAppServiceResponse::PublishAppServiceResponse( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::PublishAppServiceID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} PublishAppServiceResponse::~PublishAppServiceResponse() {} -- cgit v1.2.1 From aa8ad39cc936c7de63818d4307d8ac6a4dff5530 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sun, 24 Feb 2019 14:28:12 -0500 Subject: Get App Service Data With Subscribe (#2812) * Initial app service app extension * Add GetAppServiceData rpc templates. * Add request to mobile, and fix HMI GASD naming * Add Core->Mobile Requests and Responses * HMI GetAppService Request/Response to hmi and from hmi. * Add mobile on event handling * Fix GASD Response From Mobile * Fixes for GetAppServiceData subscribe, and OnAppServiceData Fixes allow for multiple consumers on a single app service type. Consumer/provider can be any combination of an ios app(s), android app(s), or an ivi HMI app(s). * Update AppServicetype to string and fix unit tests * Address review comments * Address comments * Address comments * Pass info from provider in GASD response --- .../app_service_app_extension.h | 131 +++++++++++++++++++ .../app_service_rpc_plugin.h | 18 +-- .../hmi/as_get_app_service_data_request_from_hmi.h | 93 ++++++++++++++ .../hmi/as_get_app_service_data_request_to_hmi.h | 79 ++++++++++++ .../as_get_app_service_data_response_from_hmi.h | 79 ++++++++++++ .../hmi/as_get_app_service_data_response_to_hmi.h | 79 ++++++++++++ .../commands/mobile/get_app_service_data_request.h | 88 +++++++++++++ .../get_app_service_data_request_to_mobile.h | 79 ++++++++++++ .../mobile/get_app_service_data_response.h | 78 ++++++++++++ .../get_app_service_data_response_from_mobile.h | 81 ++++++++++++ .../src/app_service_app_extension.cc | 122 ++++++++++++++++++ .../src/app_service_command_factory.cc | 9 +- .../src/app_service_hmi_command_factory.cc | 29 ++++- .../src/app_service_mobile_command_factory.cc | 17 +++ .../src/app_service_rpc_plugin.cc | 25 ++-- .../as_get_app_service_data_request_from_hmi.cc | 114 +++++++++++++++++ .../hmi/as_get_app_service_data_request_to_hmi.cc | 62 +++++++++ .../as_get_app_service_data_response_from_hmi.cc | 67 ++++++++++ .../hmi/as_get_app_service_data_response_to_hmi.cc | 62 +++++++++ .../hmi/on_as_app_service_data_notification.cc | 5 +- ...on_as_app_service_data_notification_from_hmi.cc | 4 +- .../mobile/get_app_service_data_request.cc | 130 +++++++++++++++++++ .../get_app_service_data_request_to_mobile.cc | 62 +++++++++ .../mobile/get_app_service_data_response.cc | 62 +++++++++ .../get_app_service_data_response_from_mobile.cc | 74 +++++++++++ .../mobile/on_app_service_data_notification.cc | 37 +++++- ...on_app_service_data_notification_from_mobile.cc | 3 + .../commands/mobile/publish_app_service_request.cc | 1 + .../rc_rpc_plugin/src/rc_command_factory.cc | 6 +- .../test/commands/button_press_request_test.cc | 9 +- .../get_interior_vehicle_data_request_test.cc | 61 +++++---- .../sdl_rpc_plugin/src/sdl_command_factory.cc | 6 +- .../test/commands/hmi/get_urls_test.cc | 12 +- .../test/commands/hmi/hmi_notifications_test.cc | 4 +- .../test/commands/hmi/rc_is_ready_request_test.cc | 2 +- .../test/commands/hmi/response_from_hmi_test.cc | 4 +- .../commands/hmi/sdl_activate_app_request_test.cc | 8 +- .../commands/hmi/simple_request_from_hmi_test.cc | 2 +- .../commands/hmi/simple_response_from_hmi_test.cc | 2 +- .../test/commands/hmi/ui_is_ready_request_test.cc | 6 +- .../test/commands/hmi/vr_is_ready_request_test.cc | 6 +- .../commands/mobile/add_command_request_test.cc | 140 ++++++++++----------- .../test/commands/mobile/alert_request_test.cc | 64 +++++----- .../mobile/create_interaction_choice_set_test.cc | 2 +- .../mobile/delete_interaction_choice_set_test.cc | 2 +- .../test/commands/mobile/delete_sub_menu_test.cc | 22 ++-- .../commands/mobile/dial_number_request_test.cc | 8 +- .../commands/mobile/get_way_points_request_test.cc | 2 +- .../mobile/perform_audio_pass_thru_test.cc | 38 +++--- .../test/commands/mobile/put_file_test.cc | 9 +- .../mobile/register_app_interface_request_test.cc | 89 +++++++------ .../mobile/reset_global_properties_test.cc | 79 ++++++------ .../test/commands/mobile/send_haptic_data_test.cc | 2 +- .../commands/mobile/send_location_request_test.cc | 9 +- .../commands/mobile/set_display_layout_test.cc | 2 +- .../commands/mobile/set_global_properties_test.cc | 13 +- .../commands/mobile/set_media_clock_timer_test.cc | 4 +- .../test/commands/mobile/show_test.cc | 38 +++--- .../test/commands/mobile/slider_test.cc | 2 +- .../test/commands/mobile/speak_request_test.cc | 4 +- .../mobile/subscribe_button_request_test.cc | 4 +- .../test/commands/mobile/system_request_test.cc | 6 +- .../mobile/unsubscribe_button_request_test.cc | 16 ++- .../mobile/unsubscribe_way_points_request_test.cc | 6 +- .../src/vehicle_info_command_factory.cc | 6 +- .../test/commands/hmi/vi_is_ready_request_test.cc | 2 +- .../mobile/diagnostic_message_request_test.cc | 8 +- .../test/commands/mobile/get_dtcs_request_test.cc | 7 +- .../mobile/get_vehicle_data_request_test.cc | 8 +- .../mobile/unsubscribe_vehicle_request_test.cc | 7 +- 70 files changed, 2047 insertions(+), 370 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h new file mode 100644 index 0000000000..9be93f5c9e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h @@ -0,0 +1,131 @@ +/* + Copyright (c) 2018, Livio + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H + +#include +#include "application_manager/app_extension.h" + +#include +#include + +namespace app_service_rpc_plugin { +class AppServiceRpcPlugin; + +namespace app_mngr = application_manager; + +typedef int AppExtensionUID; +typedef mobile_apis::VehicleDataType::eType VehicleDataType; +/** + * @brief Defines set of app service types + */ +typedef std::set AppServiceSubscriptions; + +class AppServiceAppExtension : public app_mngr::AppExtension { + public: + /** + * @brief AppServiceAppExtension constructor + * @param plugin app service plugin + * @param app application that contains this plugin + */ + AppServiceAppExtension(AppServiceRpcPlugin& plugin, + app_mngr::Application& app); + virtual ~AppServiceAppExtension(); + + /** + * @brief subscribeToAppService add vehicle_data to list of subscriptions of + * application extension + * @param vehicle_data data to subscribe + * @return true in case if subscription is successful + */ + bool SubscribeToAppService(const std::string app_service_type); + + /** + * @brief unsubscribeFromAppService remove vehicle_data from list of + * subscriptions of application extension + * @param vehicle_data data to unsubscribe + * @return true in case if unsubscription is successful + */ + bool UnsubscribeFromAppService(const std::string app_service_type); + /** + * @brief unsubscribeFromAppService unsubscribe from all app service types + */ + void UnsubscribeFromAppService(); + + /** + * @brief isSubscribedToAppService checks if extension is subscribed to + * app service type + * @param app_service_type data type to check subscription + * @return true if extension is subscribed this app_service_type, otherwise + * return false + */ + bool IsSubscribedToAppService(const std::string app_service_type) const; + + /** + * @brief Subscriptions get list of subscriptions for application extension + * @return list of subscriptions for application extension + */ + AppServiceSubscriptions Subscriptions(); + + /** + * @brief SaveResumptionData saves vehicle info data + * @param resumption_data plase to store resumption data + */ + void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject& + resumption_data) OVERRIDE; + + /** + * @brief ProcessResumption load resumtion data back to plugin during + * resumption + * @param resumption_data resumption data + */ + void ProcessResumption( + const smart_objects::SmartObject& resumption_data) OVERRIDE; + + /** + * @brief ExtractVIExtension utility function to extract application extension + * from application + * @param app : applicaiton that contains vehicle info app_extension + * @return application extension extracted from application + */ + static AppServiceAppExtension& ExtractASExtension( + application_manager::Application& app); + + private: + AppServiceSubscriptions subscribed_data_; + AppServiceRpcPlugin& plugin_; + app_mngr::Application& app_; +}; +} + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_APP_EXTENSION_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h index 1113911a22..c9cb98cdfb 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H #include "application_manager/command_factory.h" @@ -60,17 +60,9 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { void OnApplicationEvent(plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) OVERRIDE; - /** - * @brief ProcessResumptionSubscription send Subscribe vehicle data requests - * to HMI - * @param app application for subscription - * @param ext application extension - */ - // TODO - // void ProcessResumptionSubscription(app_mngr::Application& app, - // AppServiceAppExtension& ext); - private: + void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app); + std::unique_ptr command_factory_; app_mngr::ApplicationManager* application_manager_; }; @@ -78,4 +70,4 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { extern "C" application_manager::plugin_manager::RPCPlugin* Create(); -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_app_service_PLUGIN_INCLUDE_app_service_PLUGIN_app_service_PLUGIN_H +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h new file mode 100644 index 0000000000..847b921502 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h @@ -0,0 +1,93 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ + +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataRequestFromHMI command class + **/ +class ASGetAppServiceDataRequestFromHMI + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASGetAppServiceDataRequestFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataRequestFromHMI( + 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_handle); + + /** + * @brief ASGetAppServiceDataRequestFromHMI class destructor + **/ + virtual ~ASGetAppServiceDataRequestFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h new file mode 100644 index 0000000000..c4b3026176 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_ + +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataRequestToHMI command class + **/ +class ASGetAppServiceDataRequestToHMI + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASGetAppServiceDataRequestToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataRequestToHMI( + 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_handle); + + /** + * @brief ASGetAppServiceDataRequestToHMI class destructor + **/ + virtual ~ASGetAppServiceDataRequestToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_TO_HMI_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h new file mode 100644 index 0000000000..b46626a56b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ + +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataResponseFromHMI command class + **/ +class ASGetAppServiceDataResponseFromHMI + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASGetAppServiceDataResponseFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataResponseFromHMI( + 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_handle); + + /** + * @brief ASGetAppServiceDataResponseFromHMI class destructor + **/ + virtual ~ASGetAppServiceDataResponseFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h new file mode 100644 index 0000000000..e48a9d1429 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ + +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetAppServiceDataResponseToHMI command class + **/ +class ASGetAppServiceDataResponseToHMI + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASGetAppServiceDataResponseToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetAppServiceDataResponseToHMI( + 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_handle); + + /** + * @brief ASGetAppServiceDataResponseToHMI class destructor + **/ + virtual ~ASGetAppServiceDataResponseToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h new file mode 100644 index 0000000000..8295e855fa --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -0,0 +1,88 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataRequest command class + **/ +class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief GetAppServiceDataRequest class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataRequest(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_handle); + + /** + * @brief GetAppServiceDataRequest class destructor + **/ + virtual ~GetAppServiceDataRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const app_mngr::event_engine::Event& event); + + virtual void on_event(const app_mngr::event_engine::MobileEvent& event); + + private: + AppServiceRpcPlugin* plugin_; + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h new file mode 100644 index 0000000000..279cf15055 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ + +#include "application_manager/commands/command_request_to_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataRequestToMobile command class + **/ +class GetAppServiceDataRequestToMobile + : public app_mngr::commands::CommandRequestToMobile { + public: + /** + * @brief GetAppServiceDataRequestToMobile class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataRequestToMobile( + 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_handle); + + /** + * @brief GetAppServiceDataRequestToMobile class destructor + **/ + virtual ~GetAppServiceDataRequestToMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequestToMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h new file mode 100644 index 0000000000..f5758e1c39 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h @@ -0,0 +1,78 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataResponse command class + **/ +class GetAppServiceDataResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief GetAppServiceDataResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataResponse(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_handle); + + /** + * @brief GetAppServiceDataResponse class destructor + **/ + virtual ~GetAppServiceDataResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h new file mode 100644 index 0000000000..1411b23e5a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h @@ -0,0 +1,81 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_from_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetAppServiceDataResponseFromMobile command class + **/ +class GetAppServiceDataResponseFromMobile + : public app_mngr::commands::CommandResponseFromMobile { + public: + /** + * @brief GetAppServiceDataResponseFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + GetAppServiceDataResponseFromMobile( + 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_handle); + + /** + * @brief GetAppServiceDataResponseFromMobile class destructor + **/ + virtual ~GetAppServiceDataResponseFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + AppServiceRpcPlugin* plugin_; + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponseFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc new file mode 100644 index 0000000000..63812056f1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -0,0 +1,122 @@ +/* + Copyright (c) 2018, 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. + */ + +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") + +namespace app_service_rpc_plugin { + +const AppExtensionUID AppServiceAppExtensionUID = 455; + +AppServiceAppExtension::AppServiceAppExtension( + AppServiceRpcPlugin& plugin, application_manager::Application& app) + : app_mngr::AppExtension(AppServiceAppExtensionUID) + , plugin_(plugin) + , app_(app) { + LOG4CXX_AUTO_TRACE(logger_); +} + +AppServiceAppExtension::~AppServiceAppExtension() { + LOG4CXX_AUTO_TRACE(logger_); +} + +bool AppServiceAppExtension::SubscribeToAppService( + const std::string app_service_type) { + LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type); + return subscribed_data_.insert(app_service_type).second; +} + +bool AppServiceAppExtension::UnsubscribeFromAppService( + const std::string app_service_type) { + LOG4CXX_DEBUG(logger_, app_service_type); + auto it = subscribed_data_.find(app_service_type); + if (it != subscribed_data_.end()) { + subscribed_data_.erase(it); + return true; + } + return false; +} + +void AppServiceAppExtension::UnsubscribeFromAppService() { + LOG4CXX_AUTO_TRACE(logger_); + subscribed_data_.clear(); +} + +bool AppServiceAppExtension::IsSubscribedToAppService( + const std::string app_service_type) const { + LOG4CXX_DEBUG(logger_, + "isSubscribedToAppService for type: " << app_service_type); + return subscribed_data_.find(app_service_type) != subscribed_data_.end(); +} + +AppServiceSubscriptions AppServiceAppExtension::Subscriptions() { + return subscribed_data_; +} + +void AppServiceAppExtension::SaveResumptionData( + smart_objects::SmartObject& resumption_data) { + const char* app_service_info = "appService"; + resumption_data[app_service_info] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + int i = 0; + for (const auto& subscription : subscribed_data_) { + resumption_data[app_service_info][i] = subscription; + i++; + } +} + +void AppServiceAppExtension::ProcessResumption( + const smart_objects::SmartObject& resumption_data) { + const char* app_service_info = "appService"; + if (resumption_data.keyExists(app_service_info)) { + const smart_objects::SmartObject& subscriptions_app_services = + resumption_data[app_service_info]; + for (size_t i = 0; i < subscriptions_app_services.length(); ++i) { + std::string service_type = resumption_data[i].asString(); + SubscribeToAppService(service_type); + } + } +} + +AppServiceAppExtension& AppServiceAppExtension::ExtractASExtension( + application_manager::Application& app) { + auto ext_ptr = app.QueryInterface(AppServiceAppExtensionUID); + DCHECK(ext_ptr); + DCHECK(dynamic_cast(ext_ptr.get())); + auto vi_app_extension = + std::static_pointer_cast(ext_ptr); + DCHECK(vi_app_extension); + return *vi_app_extension; +} +} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc index 0405bb3e7c..f0a0698bb7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc @@ -55,7 +55,8 @@ AppServiceCommandFactory::~AppServiceCommandFactory() { app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { return hmi_command_factory_->CreateCommand(message, source); } else { return mobile_command_factory_->CreateCommand(message, source); @@ -65,7 +66,11 @@ app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( bool AppServiceCommandFactory::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) const { - return commands::Command::SOURCE_HMI == source + LOG4CXX_DEBUG(logger_, + "AppServiceCommandFactory::IsAbleToProcess" << function_id + << " " << source); + return (commands::Command::SOURCE_HMI == source || + commands::Command::SOURCE_SDL_TO_HMI == source) ? hmi_command_factory_->IsAbleToProcess(function_id, source) : mobile_command_factory_->IsAbleToProcess(function_id, source); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index 7afc04c8e9..b2b5ec7974 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -42,6 +42,10 @@ #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") @@ -78,6 +82,8 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( message_type_str = "response"; } else if (hmi_apis::messageType::error_response == message_type) { message_type_str = "error response"; + } else if (hmi_apis::messageType::notification == message_type) { + message_type_str = "notification"; } UNUSED(message_type_str); @@ -91,6 +97,8 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( bool AppServiceHmiCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { + LOG4CXX_DEBUG(logger_, + "HMI App Service Plugin IsAbleToProcess: " << function_id); UNUSED(source); return buildCommandCreator(function_id, hmi_apis::messageType::INVALID_ENUM, @@ -104,6 +112,9 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( auto factory = app_mngr::CommandCreatorFactory( application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); + LOG4CXX_DEBUG(logger_, + "buildCommandCreator: " << function_id << " " << source); + switch (function_id) { case hmi_apis::FunctionID::AppService_PublishAppService: return hmi_apis::messageType::request == message_type @@ -115,6 +126,22 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( commands::OnASAppServiceDataNotificationFromHMI>() : factory .GetCreator(); + case hmi_apis::FunctionID::AppService_GetAppServiceData: + if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASGetAppServiceDataRequestFromHMI>() + : factory.GetCreator< + commands::ASGetAppServiceDataResponseFromHMI>(); + } else if (app_mngr::commands::Command::CommandSource:: + SOURCE_SDL_TO_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASGetAppServiceDataRequestToHMI>() + : factory.GetCreator< + commands::ASGetAppServiceDataResponseToHMI>(); + } + case hmi_apis::FunctionID::AppService_GetAppServiceRecords: return hmi_apis::messageType::request == message_type ? factory.GetCreator() @@ -126,7 +153,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( : factory .GetCreator(); default: - LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id); return factory.GetCreator(); } } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index e0e667e975..3e00408a91 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -39,6 +39,10 @@ #include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") @@ -111,6 +115,19 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( ? factory.GetCreator< commands::OnAppServiceDataNotificationFromMobile>() : factory.GetCreator(); + case mobile_apis::FunctionID::GetAppServiceDataID: + if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator< + commands::GetAppServiceDataResponseFromMobile>(); + } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == + source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands::GetAppServiceDataRequestToMobile>() + : factory.GetCreator(); + } default: LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); return factory.GetCreator(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc index 739d8bb0e2..971e3cc5e0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -32,7 +32,7 @@ #include "application_manager/message_helper.h" #include "application_manager/smart_object_keys.h" -//#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" #include "app_service_rpc_plugin/app_service_command_factory.h" #include "app_service_rpc_plugin/app_service_rpc_plugin.h" @@ -71,13 +71,24 @@ void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} void AppServiceRpcPlugin::OnApplicationEvent( plugins::ApplicationEvent event, - app_mngr::ApplicationSharedPtr application) {} + app_mngr::ApplicationSharedPtr application) { + if (plugins::ApplicationEvent::kApplicationRegistered == event) { + application->AddExtension( + std::make_shared(*this, *application)); + } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { + DeleteSubscriptions(application); + } +} + +void AppServiceRpcPlugin::DeleteSubscriptions( + application_manager::ApplicationSharedPtr app) { + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + auto subscriptions = ext.Subscriptions(); + for (auto& service_type : subscriptions) { + ext.UnsubscribeFromAppService(service_type); + } +} -/*void AppServiceRpcPlugin::ProcessResumptionSubscription( - application_manager::Application& app, AppServiceAppExtension& ext) { - LOG4CXX_AUTO_TRACE(logger_); - // TODO -}*/ } // namespace app_service_rpc_plugin extern "C" application_manager::plugin_manager::RPCPlugin* Create() { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc new file mode 100644 index 0000000000..5cdbbfc012 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -0,0 +1,114 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/enum_schema_item.h" + +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {} + +void ASGetAppServiceDataRequestFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + std::string service_type = + (*message_)[strings::msg_params][strings::service_type].asString(); + + LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type); + + SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*message_), + true); +} + +void ASGetAppServiceDataRequestFromHMI::on_event( + const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType result = + static_cast( + event_message[strings::params][hmi_response::code].asInt()); + bool success = + IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASGetAppServiceDataRequestFromHMI::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType mobile_result = + static_cast( + msg_params[strings::result_code].asInt()); + hmi_apis::Common_Result::eType result = + MessageHelper::MobileToHMIResult(mobile_result); + bool success = IsMobileResultSuccess(mobile_result); + + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc new file mode 100644 index 0000000000..822cd0a29b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {} + +void ASGetAppServiceDataRequestToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc new file mode 100644 index 0000000000..9ce6ffdb50 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc @@ -0,0 +1,67 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {} + +void ASGetAppServiceDataResponseFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc new file mode 100644 index 0000000000..9e2289d39e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {} + +void ASGetAppServiceDataResponseToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index 899cc44f94..80dd88c15f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -31,7 +31,6 @@ */ #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" -#include "application_manager/message_helper.h" namespace app_service_rpc_plugin { using namespace application_manager; @@ -53,8 +52,8 @@ OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {} void OnASAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); - MessageHelper::PrintSmartObject(*message_); + LOG4CXX_DEBUG(logger_, "Sending AS data to HMI"); + SendNotification(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index c89b52a683..05266f834b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -31,7 +31,6 @@ */ #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" -#include "application_manager/message_helper.h" namespace app_service_rpc_plugin { using namespace application_manager; @@ -55,7 +54,8 @@ OnASAppServiceDataNotificationFromHMI:: void OnASAppServiceDataNotificationFromHMI::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); - MessageHelper::PrintSmartObject(*message_); + SendNotificationToConsumers( + mobile_apis::FunctionID::eType::OnAppServiceDataID); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc new file mode 100644 index 0000000000..b54071068f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -0,0 +1,130 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/enum_schema_item.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataRequest::GetAppServiceDataRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::GetAppServiceDataID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} + +GetAppServiceDataRequest::~GetAppServiceDataRequest() {} + +void GetAppServiceDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + std::string service_type = + (*message_)[strings::msg_params][strings::service_type].asString(); + + bool subscribe = false; + if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { + subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool(); + } + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + + if (subscribe) { + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + ext.SubscribeToAppService(service_type); + } + + SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*message_), + true); +} + +void GetAppServiceDataRequest::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType result = static_cast( + msg_params[strings::result_code].asInt()); + bool success = IsMobileResultSuccess(result); + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +void GetAppServiceDataRequest::on_event(const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + event_message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc new file mode 100644 index 0000000000..2bf81b3a2d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {} + +void GetAppServiceDataRequestToMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc new file mode 100644 index 0000000000..df7bbba2f7 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataResponse::GetAppServiceDataResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +GetAppServiceDataResponse::~GetAppServiceDataResponse() {} + +void GetAppServiceDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc new file mode 100644 index 0000000000..f8c1f3892d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc @@ -0,0 +1,74 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseFromMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) + , plugin_(NULL) { + auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( + mobile_apis::FunctionID::PublishAppServiceID, + app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); + if (plugin) { + plugin_ = dynamic_cast(&(*plugin)); + } +} + +GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {} + +void GetAppServiceDataResponseFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 6a6a50dc86..a016d1fe16 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -31,11 +31,15 @@ */ #include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" #include "application_manager/application_impl.h" +#include "application_manager/helpers/application_helper.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" +#include "smart_objects/enum_schema_item.h" + namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { @@ -58,7 +62,38 @@ void OnAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); MessageHelper::PrintSmartObject(*message_); - SendNotification(); + + std::string service_type = + (*message_)[strings::msg_params][strings::service_type].asString(); + + auto subscribed_to_app_service_predicate = + [service_type](const ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + auto& ext = AppServiceAppExtension::ExtractASExtension(*app); + LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type); + return ext.IsSubscribedToAppService(service_type); + }; + + const std::vector& applications = + application_manager::FindAllApps(application_manager_.applications(), + subscribed_to_app_service_predicate); + + std::vector::const_iterator app_it = + applications.begin(); + + for (; applications.end() != app_it; ++app_it) { + const ApplicationSharedPtr app = *app_it; + if (!app) { + LOG4CXX_ERROR(logger_, "NULL pointer"); + continue; + } + LOG4CXX_DEBUG(logger_, + "Sending OnAppServiceDataNotification to mobile connection: " + << app->app_id()); + (*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] = + app->app_id(); + SendNotification(); + } } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 1aa8504ff9..1328e128d4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -75,6 +75,9 @@ void OnAppServiceDataNotificationFromMobile::Run() { "OnAppServiceDataNotificationFromMobile"); return; } + + SendNotificationToConsumers( + hmi_apis::FunctionID::eType::AppService_OnAppServiceData); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index f951d2b126..05210208ca 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -117,6 +117,7 @@ void PublishAppServiceRequest::Run() { mobile_apis::Result::DISALLOWED, "Service disallowed by policies", NULL); + return; } auto& ext = 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 ecfc1dcda4..d49f3e9e36 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 @@ -124,7 +124,8 @@ RCCommandFactory::RCCommandFactory(const RCCommandParams& params) CommandSharedPtr RCCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { hmi_apis::messageType::eType message_type = static_cast( (*message)[strings::params][strings::message_type].asInt()); @@ -153,7 +154,8 @@ bool RCCommandFactory::IsAbleToProcess( const application_manager::commands::Command::CommandSource message_source) const { using app_mngr::commands::Command; - if (Command::SOURCE_HMI == message_source) { + if (Command::SOURCE_HMI == message_source || + Command::SOURCE_SDL_TO_HMI == message_source) { return get_hmi_creator_factory( static_cast(function_id), hmi_apis::messageType::INVALID_ENUM).CanBeCreated(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc index 59d038a790..e9d1063648 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc @@ -196,8 +196,8 @@ TEST_F(ButtonPressRequestTest, SetResourceState(resource, kAppId, rc_rpc_plugin::ResourceState::BUSY)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), + _)).WillOnce(Return(true)); // Act std::shared_ptr command = @@ -230,8 +230,9 @@ TEST_F( .Times(2); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_ButtonPress))).Times(0); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), + _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc index 25dad2dc04..4e74e74ef8 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc @@ -199,9 +199,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, mobile_message); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act command->Run(); @@ -225,9 +226,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, mobile_message); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act command->Run(); @@ -253,7 +255,7 @@ TEST_F( .WillOnce(Return(true)); EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio)) .WillOnce(Return(radio_data)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL( mock_rpc_service_, @@ -295,9 +297,10 @@ TEST_F( .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, @@ -347,7 +350,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, EXPECT_CALL(mock_interior_data_cache_, Retrieve(enums_value::kRadio)) .WillOnce(Return(radio_data)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); MessageSharedPtr command_result; EXPECT_CALL( mock_rpc_service_, @@ -383,7 +386,7 @@ TEST_F( .WillByDefault(Return(&rc_capabilities)); // Expectations - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), @@ -407,7 +410,7 @@ TEST_F( ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(false)); // Expectations - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::DISALLOWED), _)) @@ -443,9 +446,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); // Act @@ -478,9 +482,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( @@ -519,9 +524,10 @@ TEST_F(GetInteriorVehicleDataRequestTest, .WillByDefault(Return(true)); // Expectations - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( @@ -569,10 +575,11 @@ TEST_F(GetInteriorVehicleDataRequestTest, StoreRequestToHMITime(enums_value::kRadio)); EXPECT_CALL(mock_interior_data_cache_, Contains(enums_value::kRadio)) .WillRepeatedly(Return(false)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::RC_GetInteriorVehicleData))) - .WillRepeatedly(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), + _)).WillRepeatedly(Return(true)); // Act command->Run(); } @@ -585,7 +592,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::REJECTED), _)) .WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); // Act command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc index efdcde7526..d745cd8f44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc @@ -55,7 +55,8 @@ SDLCommandFactory::SDLCommandFactory( app_mngr::CommandSharedPtr SDLCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { return hmi_command_factory_->CreateCommand(message, source); } else { return mobile_command_factory_->CreateCommand(message, source); @@ -70,7 +71,8 @@ bool SDLCommandFactory::IsAbleToProcess( bool is_mobile_command_factory_able_to_process = mobile_command_factory_->IsAbleToProcess(FunctionID, source); - return app_mngr::commands::Command::SOURCE_HMI == source + return (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) ? is_hmi_command_factory_able_to_process : is_mobile_command_factory_able_to_process; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc index 2191900750..20a05d8601 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc @@ -110,7 +110,7 @@ TEST_F(GetUrlsTest, RUN_SUCCESS) { TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) { EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -127,7 +127,7 @@ TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) { .WillOnce(SetArgReferee<1>(endpoints_)); EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -160,7 +160,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) { EXPECT_CALL(app_mngr_, application(kAppIdForSending)) .WillOnce(Return(mock_app)); EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -197,7 +197,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) { EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) .WillOnce(Return(kInvalidAppId_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0); @@ -226,7 +226,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(kAppIdForSending)) .WillOnce(Return(invalid_mock_app)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); @@ -261,7 +261,7 @@ TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) { EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) .WillOnce(Return(true)); request_command_->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index fe82b16f3f..ca322ea425 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -945,7 +945,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(GetMessage(temp_message)); command->Run(); @@ -973,7 +973,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, SetUnregisterAllApplicationsReason(_)).Times(0); EXPECT_CALL(app_mngr_, HeadUnitReset(_)).Times(0); EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc index 030db2f424..c7fbdb663b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc @@ -99,7 +99,7 @@ class RCIsReadyRequestTest EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _)) .WillOnce(Return(capabilities)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc index 0b1f2df491..25abefb010 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc @@ -86,7 +86,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) { ResponseFromHMIPtr command(CreateCommand()); MessageSharedPtr result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(true))); const hmi_apis::FunctionID::eType posted_function_id = @@ -115,7 +115,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_CantManageCommand_Covering) { MessageSharedPtr result_msg; ON_CALL(app_mngr_, GetNextHMICorrelationID()).WillByDefault(Return(1u)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(false))); const hmi_apis::FunctionID::eType posted_function_id = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 8543a201bf..a90c0c70fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -166,9 +166,9 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_REJECTED) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp), _)) .WillOnce(Return(true)); command->Run(); @@ -487,7 +487,7 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { std::shared_ptr command( CreateCommand(msg)); ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->onTimeOut(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc index 5c42d265c7..a69f6c71fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc @@ -81,7 +81,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) { const bool success = false; const uint32_t correlation_id = 1u; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull())); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull(), _)); command->SendResponse(success, correlation_id, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc index 4a86fa9458..4f415975ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc @@ -310,7 +310,7 @@ TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(correlation_id)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(CheckMsgType(am::MessageType::kRequest))) + ManageHMICommand(CheckMsgType(am::MessageType::kRequest), _)) .WillOnce(Return(false)); command->CreateHMIRequest(hmi_apis::FunctionID::INVALID_ENUM, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc index fe0d8a8470..70fc80bbd1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc @@ -125,9 +125,9 @@ class UIIsReadyRequestTest .WillOnce(Return(get_capabilities)); EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*get_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language, _)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language, _)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc index 5aa00e0264..259fd0b92b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc @@ -98,7 +98,7 @@ class VRIsReadyRequestTest CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _)) .WillOnce(Return(language)); EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language, _)); smart_objects::SmartObjectSPtr support_language( new smart_objects::SmartObject(smart_objects::SmartType_Map)); @@ -106,14 +106,14 @@ class VRIsReadyRequestTest mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _)) .WillOnce(Return(support_language)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language, _)); smart_objects::SmartObjectSPtr capabilities( new smart_objects::SmartObject(smart_objects::SmartType_Map)); EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _)) .WillOnce(Return(capabilities)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc index 7c99b5f2b8..0023368b5a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc @@ -190,11 +190,11 @@ class AddCommandRequestTest EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); @@ -207,7 +207,7 @@ class AddCommandRequestTest EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(cmd_to_delete))) + ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _)) .WillOnce(Return(true)); SmartObjectSPtr response = std::make_shared(SmartType_Map); @@ -276,7 +276,7 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_WARNINGS) { commands_map, lock_ptr_))); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr request_ptr = CreateCommand(msg_); @@ -492,13 +492,13 @@ TEST_F(AddCommandRequestTest, { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); @@ -522,7 +522,7 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr request_ptr = CreateCommand(msg_); @@ -547,7 +547,7 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, help_prompt_manager()) @@ -578,7 +578,7 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, help_prompt_manager()) @@ -659,7 +659,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr request_ptr = CreateCommand(msg_); @@ -690,13 +690,13 @@ TEST_F(AddCommandRequestTest, { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -734,13 +734,13 @@ TEST_F( commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } @@ -779,13 +779,13 @@ TEST_F( { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } @@ -824,13 +824,13 @@ TEST_F( { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } std::shared_ptr request_ptr = @@ -873,13 +873,13 @@ TEST_F( commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } std::shared_ptr request_ptr = @@ -921,7 +921,7 @@ TEST_F( commands_map, lock_ptr_))); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr request_ptr = CreateCommand(msg_); @@ -958,7 +958,7 @@ TEST_F( EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); std::shared_ptr request_ptr = CreateCommand(msg_); @@ -996,13 +996,13 @@ TEST_F(AddCommandRequestTest, commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -1020,9 +1020,9 @@ TEST_F(AddCommandRequestTest, event_ui.set_smart_object(*msg_ui); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); event_vr.set_smart_object(*msg_); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2); request_ptr->on_event(event_ui); @@ -1044,13 +1044,13 @@ TEST_F(AddCommandRequestTest, commands_map, lock_ptr_))); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, @@ -1063,9 +1063,9 @@ TEST_F(AddCommandRequestTest, Event event_ui(hmi_apis::FunctionID::UI_AddCommand); event_ui.set_smart_object(*msg_); request_ptr->on_event(event_ui); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); @@ -1119,13 +1119,13 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { .WillOnce(Return(so_ptr_.get())); { InSequence dummy; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index e32cc2b335..a66d0d557f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -169,11 +169,11 @@ class AlertRequestTest : public CommandRequestTest { void ExpectManageHmiCommandTTSAndUI() { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)) .WillOnce(Return(true)); } sync_primitives::Lock lock_; @@ -452,7 +452,7 @@ TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))); + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)); command->on_event(event); } @@ -477,10 +477,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) { (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand(msg_)); command->Run(); @@ -509,10 +508,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand(msg_)); command->Run(); @@ -556,9 +554,9 @@ TEST_F(AlertRequestTest, CommandPtr command(CreateCommand(msg_)); command->Run(); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -605,9 +603,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSUnsupportedResourceUiAlertSuccess_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -643,10 +641,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand(msg_)); command->Run(); @@ -654,9 +651,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::INVALID_ENUM; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -693,10 +690,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { VerifyTtsFiles( (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))) - .WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), + _)).WillOnce(Return(true)); CommandPtr command(CreateCommand(msg_)); command->Run(); @@ -704,9 +700,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::INVALID_ENUM; - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); @@ -743,9 +739,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) { CommandPtr command(CreateCommand(msg_)); command->Run(); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_Alert); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index c42be48e57..3abda89234 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -232,7 +232,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { .WillByDefault( Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_)) .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL)); req_vr->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc index 43c30809e5..c209c4fea2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -252,7 +252,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { EXPECT_CALL(*app_, UpdateHash()); } - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); DeleteInteractionChoiceSetRequestPtr command = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc index f1c44f86ac..ff9e29c872 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc @@ -224,9 +224,9 @@ TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) { EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _)) .WillOnce(Return(true)); command_->Run(); } @@ -273,9 +273,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); @@ -284,9 +284,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, help_prompt_manager()) .WillOnce(ReturnRef(*mock_help_prompt_manager_)); EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _)) .WillOnce(Return(true)); EXPECT_CALL(*app_, RemoveSubMenu(_)); @@ -330,7 +330,7 @@ TEST_F(DeleteSubMenuRequestTest, std::make_pair(0, &((*message_)[am::strings::msg_params]))); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); @@ -357,7 +357,7 @@ TEST_F(DeleteSubMenuRequestTest, std::make_pair(0, &((*message_)[am::strings::msg_params]))); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc index 5d6c6dc89e..ffa1b833be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc @@ -131,9 +131,11 @@ TEST_F(DialNumberRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_DialNumber))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_DialNumber), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc index 09a3336a10..f450d4b671 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc @@ -205,7 +205,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) { EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); CallOnEvent caller(*command_sptr_, event); caller(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index f51f1aa655..acda9b9fc7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -239,7 +239,7 @@ TEST_F(PerformAudioPassThruRequestTest, MessageSharedPtr response_to_mobile; uint32_t app_id = kConnectionKey; EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(false)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillRepeatedly(Return(true)); EXPECT_CALL( mock_rpc_service_, @@ -342,7 +342,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -355,7 +355,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun run_caller(*command_sptr_); @@ -431,7 +431,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -444,7 +444,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun caller(*command_sptr_); @@ -505,7 +505,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -518,7 +518,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); } CallRun caller(*command_sptr_); @@ -551,7 +551,7 @@ TEST_F( .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Perform audio path thru request sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); // Perform audio path thru request sending @@ -564,7 +564,7 @@ TEST_F( .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // Start recording notification sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&start_record_result_msg), Return(true))); } @@ -613,7 +613,7 @@ TEST_F(PerformAudioPassThruRequestTest, // Start recording notification sending - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); // Start microphone recording cals uint32_t app_id = kConnectionKey; @@ -676,7 +676,7 @@ TEST_F(PerformAudioPassThruRequestTest, msg_params_[am::strings::function_id] = kFunctionId; msg_params_[am::strings::correlation_id] = kCorrelationId; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); uint32_t app_id = kConnectionKey; EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true)); @@ -703,7 +703,7 @@ TEST_F(PerformAudioPassThruRequestTest, msg_params_[am::strings::function_id] = kFunctionId; uint32_t app_id = kConnectionKey; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true)); EXPECT_CALL( @@ -751,7 +751,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command_sptr_->onTimeOut(); } @@ -783,7 +783,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true))); // Perform audio path thru request sending @@ -796,7 +796,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true))); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); @@ -807,7 +807,7 @@ TEST_F(PerformAudioPassThruRequestTest, // For setting is_active_tts_speak -> true - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .Times(2) .WillRepeatedly(Return(false)); CallRun caller(*command_sptr_); @@ -819,9 +819,9 @@ TEST_F(PerformAudioPassThruRequestTest, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)); command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(false)); command_sptr_->onTimeOut(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc index df4f69f0d0..415b559f82 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc @@ -315,10 +315,11 @@ TEST_F(PutFileRequestTest, Run_SendOnPutFileNotification_SUCCESS) { EXPECT_CALL(app_mngr_, SaveBinary(binary_data_, kStorageFolder, kFileName, kZeroOffset)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnPutFile))) - .WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_OnPutFile), + _)).WillOnce(Return(true)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::SUCCESS); PutFileRequestPtr command(CreateCommand(msg_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 7dab16fe35..868d353a85 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -207,27 +207,36 @@ class RegisterAppInterfaceRequestTest mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(response_result_code), _)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _)) + .Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _)) + .Times(0); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _)) + .Times(0); EXPECT_CALL(app_mngr_, OnApplicationSwitched( @@ -297,13 +306,15 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) .Times(2); @@ -399,25 +410,27 @@ TEST_F(RegisterAppInterfaceRequestTest, .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_ChangeRegistration))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration))) - .WillOnce(Return(true)); + HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), + _)).WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) .Times(2); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index 0e3cd685fa..38585319e4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -170,7 +170,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) { EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); command_->Run(); } @@ -238,12 +238,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { .WillOnce(Return(so_help_prompt.get())); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); @@ -275,9 +276,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); command_->Run(); @@ -321,12 +322,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, (*ui_msg)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::eType::SUCCESS; EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties); ui_event.set_smart_object(*ui_msg); @@ -363,9 +365,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); smart_objects::SmartObjectSPtr vr_help = std::make_shared( smart_objects::SmartType_Map); @@ -413,12 +415,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); ResetGlobalPropertiesRequestPtr command = @@ -478,12 +481,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); @@ -542,12 +546,13 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); command_->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc index 6c7127e48c..19f799448a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc @@ -102,7 +102,7 @@ TEST_F(SendHapticDataRequestTest, Run_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData))) + HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData), _)) .WillOnce(Return(true)); SendHapticDataRequestPtr command(CreateCommand(msg_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc index 4f44293fc9..4cab3db2a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc @@ -137,15 +137,16 @@ class SendLocationRequestTest void FinishSetup() { EXPECT_CALL(*mock_app_, hmi_app_id()).WillOnce(Return(kAppID)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Navigation_SendLocation))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Navigation_SendLocation), _)); } void FinishSetupCancelled(mobile_apis::Result::eType result) { EXPECT_CALL(*mock_app_, hmi_app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(result), _)); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc index cd6af1512d..10ca925739 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc @@ -201,7 +201,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(CheckMshCorrId(kCorrelationKey))) + ManageHMICommand(CheckMshCorrId(kCorrelationKey), _)) .WillOnce(Return(true)); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc index 03aa5d85a1..94dbbc8b44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc @@ -322,12 +322,13 @@ TEST_F(SetGlobalPropertiesRequestTest, (*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::UI_SetGlobalProperties))) - .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::TTS_SetGlobalProperties))) + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), + _)).WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _)) .WillOnce(Return(true)); (*msg_vr)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc index a69d3d741b..04a7da60cf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc @@ -179,7 +179,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->Run(); } @@ -217,7 +217,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc index 4725af4671..4540980b9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc @@ -125,7 +125,7 @@ class ShowRequestTest : public CommandRequestTest { static_cast(field_name); msg_params[am::hmi_request::show_strings][0][am::hmi_request::field_text] = text_field_; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); } @@ -143,7 +143,7 @@ class ShowRequestTest : public CommandRequestTest { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); } @@ -196,7 +196,7 @@ class ShowRequestTest : public CommandRequestTest { } } - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); } @@ -272,7 +272,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) { EXPECT_CALL( mock_message_helper_, SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -296,7 +296,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) { smart_objects::SmartObject(smart_objects::SmartType_Array); EXPECT_CALL(*mock_app_, UnsubscribeFromSoftButtons(kFunctionID)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -321,7 +321,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) { EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _)) .Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -348,7 +348,7 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -375,7 +375,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WARNINGS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -398,7 +398,7 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) { .WillOnce(Return(mobile_apis::Result::INVALID_DATA)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -421,7 +421,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -447,7 +447,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -473,7 +473,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WARNINGS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -497,7 +497,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -520,7 +520,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); @@ -836,7 +836,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) { msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -859,7 +859,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) { msg_params[am::strings::app_id] = kAppId; msg_params[am::hmi_request::show_strings] = smart_objects::SmartObject(smart_objects::SmartType_Array); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)); EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); @@ -880,7 +880,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -895,7 +895,7 @@ TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) { .WillOnce(Return(MockAppPtr())); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); @@ -910,7 +910,7 @@ TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) { .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); EXPECT_CALL(*mock_app_, app_id()).Times(0); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index be14aebc8f..14e670a387 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -268,7 +268,7 @@ TEST_F(SliderRequestTest, Run_SUCCESS) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider), _)); CommandPtr command(CreateCommand(msg_)); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc index 9eb23eeee3..5dcbd7e6b9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc @@ -295,7 +295,7 @@ TEST_F(SpeakRequestTest, Run_MsgWithEmptyString_Success) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)); command->Run(); } @@ -315,7 +315,7 @@ TEST_F(SpeakRequestTest, Run_MsgCorrect_Success) { EXPECT_CALL( mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak))); + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc index caca56e297..df3e778ee6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc @@ -182,7 +182,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) { MessageSharedPtr hmi_result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); MessageSharedPtr mobile_result_msg; @@ -230,7 +230,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) { MessageSharedPtr hmi_result_msg; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); MessageSharedPtr mobile_result_msg; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc index 9e6bc8f505..298661dc74 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc @@ -160,7 +160,7 @@ TEST_F(SystemRequestTest, .WillOnce(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObjectSPtr result; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); std::shared_ptr command(CreateCommand(msg)); @@ -201,7 +201,7 @@ TEST_F( .WillOnce(Return(false)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); std::shared_ptr command(CreateCommand(msg)); ASSERT_TRUE(command->Init()); @@ -222,7 +222,7 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) { .WillOnce(Return(false)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); std::shared_ptr command(CreateCommand(msg)); ASSERT_TRUE(command->Init()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc index a848fff2b2..22893b771c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc @@ -139,9 +139,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); @@ -182,9 +184,11 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) { EXPECT_CALL(*mock_app, UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE)) .WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Buttons_OnButtonSubscription))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), + _)); EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc index f345d719c6..818ee06e96 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -123,8 +123,10 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { .WillOnce(Return(true)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints))); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints), + _)); command_->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc index 32959174da..0c6e0a07b1 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc @@ -53,7 +53,8 @@ VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {} app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand( const app_mngr::commands::MessageSharedPtr& message, app_mngr::commands::Command::CommandSource source) { - if (app_mngr::commands::Command::SOURCE_HMI == source) { + if (app_mngr::commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) { return hmi_command_factory_->CreateCommand(message, source); } else { return mob_command_factory_->CreateCommand(message, source); @@ -63,7 +64,8 @@ app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand( bool VehicleInfoCommandFactory::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) const { - return commands::Command::SOURCE_HMI == source + return (commands::Command::SOURCE_HMI == source || + app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) ? hmi_command_factory_->IsAbleToProcess(function_id, source) : mob_command_factory_->IsAbleToProcess(function_id, source); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc index d4477d5d5f..679d9d0e58 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc @@ -101,7 +101,7 @@ class VIIsReadyRequestTest mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _)) .WillOnce(Return(ivi_type)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type, _)); } void PrepareEvent(bool is_message_contain_param, diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc index 9cdf60b1ea..b27a306a5c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc @@ -141,9 +141,11 @@ TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) { EXPECT_CALL(app_mngr_settings_, supported_diag_modes()) .WillOnce(ReturnRef(supported_diag_modes)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc index 4473a36c63..981d649a94 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc @@ -98,9 +98,10 @@ TEST_F(GetDTCsRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs), _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc index a88d362968..cb78e44904 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc @@ -200,9 +200,11 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_GetVehicleData))); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetVehicleData), + _)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc index 323334de2d..165c7694b1 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc @@ -149,9 +149,10 @@ TEST_F(UnsubscribeVehicleRequestTest, .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_rpc_service_, - ManageHMICommand(HMIResultCodeIs( - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData))) - .WillOnce(Return(true)); + ManageHMICommand( + HMIResultCodeIs( + hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData), + _)).WillOnce(Return(true)); vehicle_info_plugin::VehicleInfoAppExtension* vi_app_extension = dynamic_cast( vi_app_extension_ptr_.get()); -- cgit v1.2.1 From 45b9c2e8d109ed124c604c4b690b1847bc93c9c6 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Tue, 26 Feb 2019 12:53:56 -0500 Subject: PerformAppServiceInteraction RPC (#2815) * Add PerformAppServiceInteraction RPC * Add handling for `requestServiceActive` parameter * Fix style * Change PerformAppServiceInteraction class naming Clarify direction in class name --- .../hmi/as_get_active_service_consent_request.h | 80 ++++++++++ .../hmi/as_get_active_service_consent_response.h | 80 ++++++++++ ...form_app_service_interaction_request_from_hmi.h | 94 +++++++++++ ...erform_app_service_interaction_request_to_hmi.h | 80 ++++++++++ ...orm_app_service_interaction_response_from_hmi.h | 80 ++++++++++ ...rform_app_service_interaction_response_to_hmi.h | 80 ++++++++++ .../perform_app_service_interaction_request.h | 89 +++++++++++ ...orm_app_service_interaction_request_to_mobile.h | 80 ++++++++++ .../perform_app_service_interaction_response.h | 80 ++++++++++ ..._app_service_interaction_response_from_mobile.h | 80 ++++++++++ .../src/app_service_hmi_command_factory.cc | 43 ++++- .../src/app_service_mobile_command_factory.cc | 29 +++- .../hmi/as_get_active_service_consent_request.cc | 59 +++++++ .../hmi/as_get_active_service_consent_response.cc | 62 ++++++++ ...orm_app_service_interaction_request_from_hmi.cc | 137 ++++++++++++++++ ...rform_app_service_interaction_request_to_hmi.cc | 61 +++++++ ...rm_app_service_interaction_response_from_hmi.cc | 64 ++++++++ ...form_app_service_interaction_response_to_hmi.cc | 61 +++++++ .../perform_app_service_interaction_request.cc | 176 +++++++++++++++++++++ ...rm_app_service_interaction_request_to_mobile.cc | 63 ++++++++ .../perform_app_service_interaction_response.cc | 61 +++++++ ...app_service_interaction_response_from_mobile.cc | 66 ++++++++ 22 files changed, 1698 insertions(+), 7 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h new file mode 100644 index 0000000000..2286d4c67c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetActiveServiceConsentRequest command class + **/ +class ASGetActiveServiceConsentRequest + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASGetActiveServiceConsentRequest class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetActiveServiceConsentRequest( + 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_handle); + + /** + * @brief ASGetActiveServiceConsentRequest class destructor + **/ + virtual ~ASGetActiveServiceConsentRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h new file mode 100644 index 0000000000..f69152208c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASGetActiveServiceConsentResponse command class + **/ +class ASGetActiveServiceConsentResponse + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASGetActiveServiceConsentResponse class constructor + * + * @param message Incoming SmartObject message + **/ + ASGetActiveServiceConsentResponse( + 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_handle); + + /** + * @brief ASGetActiveServiceConsentResponse class destructor + **/ + virtual ~ASGetActiveServiceConsentResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h new file mode 100644 index 0000000000..775bb9f812 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h @@ -0,0 +1,94 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionRequestFromHMI command class + **/ +class ASPerformAppServiceInteractionRequestFromHMI + : public app_mngr::commands::RequestFromHMI { + public: + /** + * @brief ASPerformAppServiceInteractionRequestFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionRequestFromHMI( + 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_handle); + + /** + * @brief ASPerformAppServiceInteractionRequestFromHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionRequestFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + + /** + * @brief on_event allows to handle events + * + * @param event event type that current request subscribed on. + */ + void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h new file mode 100644 index 0000000000..0b67dd5624 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/request_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionRequestToHMI command class + **/ +class ASPerformAppServiceInteractionRequestToHMI + : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief ASPerformAppServiceInteractionRequestToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionRequestToHMI( + 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_handle); + + /** + * @brief ASPerformAppServiceInteractionRequestToHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionRequestToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h new file mode 100644 index 0000000000..f807348833 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_from_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionResponseFromHMI command class + **/ +class ASPerformAppServiceInteractionResponseFromHMI + : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief ASPerformAppServiceInteractionResponseFromHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionResponseFromHMI( + 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_handle); + + /** + * @brief ASPerformAppServiceInteractionResponseFromHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionResponseFromHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseFromHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h new file mode 100644 index 0000000000..7ce05bdba1 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/response_to_hmi.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief ASPerformAppServiceInteractionResponseToHMI command class + **/ +class ASPerformAppServiceInteractionResponseToHMI + : public app_mngr::commands::ResponseToHMI { + public: + /** + * @brief ASPerformAppServiceInteractionResponseToHMI class constructor + * + * @param message Incoming SmartObject message + **/ + ASPerformAppServiceInteractionResponseToHMI( + 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_handle); + + /** + * @brief ASPerformAppServiceInteractionResponseToHMI class destructor + **/ + virtual ~ASPerformAppServiceInteractionResponseToHMI(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseToHMI); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h new file mode 100644 index 0000000000..854ed3c6aa --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h @@ -0,0 +1,89 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionRequest command class + **/ +class PerformAppServiceInteractionRequest + : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief PerformAppServiceInteractionRequest class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionRequest( + 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_handle); + + /** + * @brief PerformAppServiceInteractionRequest class destructor + **/ + virtual ~PerformAppServiceInteractionRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + virtual void on_event(const app_mngr::event_engine::Event& event); + + virtual void on_event(const app_mngr::event_engine::MobileEvent& event); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequest); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h new file mode 100644 index 0000000000..5c38e6a71e --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_request_to_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionRequestToMobile command class + **/ +class PerformAppServiceInteractionRequestToMobile + : public app_mngr::commands::CommandRequestToMobile { + public: + /** + * @brief PerformAppServiceInteractionRequestToMobile class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionRequestToMobile( + 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_handle); + + /** + * @brief PerformAppServiceInteractionRequestToMobile class destructor + **/ + virtual ~PerformAppServiceInteractionRequestToMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequestToMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h new file mode 100644 index 0000000000..b4c422fac6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_impl.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionResponse command class + **/ +class PerformAppServiceInteractionResponse + : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief PerformAppServiceInteractionResponse class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionResponse( + 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_handle); + + /** + * @brief PerformAppServiceInteractionResponse class destructor + **/ + virtual ~PerformAppServiceInteractionResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponse); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h new file mode 100644 index 0000000000..4530cb2dfd --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ + +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/commands/command_response_from_mobile.h" + +namespace app_service_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief PerformAppServiceInteractionResponseFromMobile command class + **/ +class PerformAppServiceInteractionResponseFromMobile + : public app_mngr::commands::CommandResponseFromMobile { + public: + /** + * @brief PerformAppServiceInteractionResponseFromMobile class constructor + * + * @param message Incoming SmartObject message + **/ + PerformAppServiceInteractionResponseFromMobile( + 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_handle); + + /** + * @brief PerformAppServiceInteractionResponseFromMobile class destructor + **/ + virtual ~PerformAppServiceInteractionResponseFromMobile(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponseFromMobile); +}; + +} // namespace commands + +} // namespace app_service_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_ diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index b2b5ec7974..7cfbdd22d0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -36,16 +36,22 @@ #include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" #include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h" +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h" #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" -#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h" -#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" -#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" -#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") @@ -141,7 +147,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( : factory.GetCreator< commands::ASGetAppServiceDataResponseToHMI>(); } - + break; case hmi_apis::FunctionID::AppService_GetAppServiceRecords: return hmi_apis::messageType::request == message_type ? factory.GetCreator() @@ -152,9 +158,34 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( ? factory.GetCreator() : factory .GetCreator(); + case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction: + if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands:: + ASPerformAppServiceInteractionRequestFromHMI>() + : factory.GetCreator< + commands:: + ASPerformAppServiceInteractionResponseFromHMI>(); + } else if (app_mngr::commands::Command::CommandSource:: + SOURCE_SDL_TO_HMI == source) { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator< + commands::ASPerformAppServiceInteractionRequestToHMI>() + : factory.GetCreator< + commands:: + ASPerformAppServiceInteractionResponseToHMI>(); + } + break; + case hmi_apis::FunctionID::AppService_GetActiveServiceConsent: + return hmi_apis::messageType::request == message_type + ? factory + .GetCreator() + : factory.GetCreator< + commands::ASGetActiveServiceConsentResponse>(); default: LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id); - return factory.GetCreator(); } + return factory.GetCreator(); } } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index 3e00408a91..572e637108 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -35,8 +35,16 @@ #include "application_manager/message.h" #include "interfaces/MOBILE_API.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" +#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" #include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" #include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h" +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" #include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" @@ -128,9 +136,28 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( commands::GetAppServiceDataRequestToMobile>() : factory.GetCreator(); } + break; + case mobile_apis::FunctionID::PerformAppServiceInteractionID: + if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands::PerformAppServiceInteractionRequest>() + : factory.GetCreator< + commands:: + PerformAppServiceInteractionResponseFromMobile>(); + } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == + source) { + return mobile_apis::messageType::request == message_type + ? factory.GetCreator< + commands:: + PerformAppServiceInteractionRequestToMobile>() + : factory.GetCreator< + commands::PerformAppServiceInteractionResponse>(); + } + break; default: LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); - return factory.GetCreator(); } + return factory.GetCreator(); } } // namespace vehicle_info_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc new file mode 100644 index 0000000000..b1f3d6fdbf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc @@ -0,0 +1,59 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {} + +void ASGetActiveServiceConsentRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc new file mode 100644 index 0000000000..038c2922ad --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {} + +void ASGetActiveServiceConsentResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event( + hmi_apis::FunctionID::AppService_GetActiveServiceConsent); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc new file mode 100644 index 0000000000..8f52268f19 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -0,0 +1,137 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "application_manager/message_helper.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionRequestFromHMI:: + ASPerformAppServiceInteractionRequestFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionRequestFromHMI:: + ~ASPerformAppServiceInteractionRequestFromHMI() {} + +void ASPerformAppServiceInteractionRequestFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + std::string service_id = msg_params[strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (service.first.empty()) { + smart_objects::SmartObject response_params; + response_params[strings::info] = "The requested service ID does not exist"; + SendResponse(false, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::INVALID_ID, + &response_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + + bool request_service_active = false; + if (msg_params.keyExists(strings::request_service_active)) { + request_service_active = + msg_params[strings::request_service_active].asBool(); + msg_params.erase(strings::request_service_active); + } + + // Only activate service if it is not already active + bool activate_service = + request_service_active && + !service.second.record[strings::service_active].asBool(); + if (activate_service) { + application_manager_.GetAppServiceManager().ActivateAppService(service_id); + } + + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); +} + +void ASPerformAppServiceInteractionRequestFromHMI::on_event( + const event_engine::Event& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + hmi_apis::Common_Result::eType result = + static_cast( + event_message[strings::params][hmi_response::code].asInt()); + bool success = + IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +void ASPerformAppServiceInteractionRequestFromHMI::on_event( + const event_engine::MobileEvent& event) { + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + mobile_apis::Result::eType mobile_result = + static_cast( + msg_params[strings::result_code].asInt()); + hmi_apis::Common_Result::eType result = + MessageHelper::MobileToHMIResult(mobile_result); + bool success = IsMobileResultSuccess(mobile_result); + SendResponse(success, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + result, + &msg_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc new file mode 100644 index 0000000000..22876328de --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionRequestToHMI:: + ASPerformAppServiceInteractionRequestToHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionRequestToHMI:: + ~ASPerformAppServiceInteractionRequestToHMI() {} + +void ASPerformAppServiceInteractionRequestToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc new file mode 100644 index 0000000000..a2ffa65a73 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc @@ -0,0 +1,64 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionResponseFromHMI:: + ASPerformAppServiceInteractionResponseFromHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionResponseFromHMI:: + ~ASPerformAppServiceInteractionResponseFromHMI() {} + +void ASPerformAppServiceInteractionResponseFromHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event( + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc new file mode 100644 index 0000000000..5ddef55c2a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +ASPerformAppServiceInteractionResponseToHMI:: + ASPerformAppServiceInteractionResponseToHMI( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ASPerformAppServiceInteractionResponseToHMI:: + ~ASPerformAppServiceInteractionResponseToHMI() {} + +void ASPerformAppServiceInteractionResponseToHMI::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToHMI(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc new file mode 100644 index 0000000000..d21c413b29 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -0,0 +1,176 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {} + +void PerformAppServiceInteractionRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + auto app = application_manager_.application(connection_key()); + if (!app) { + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + std::string service_id = msg_params[strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (service.first.empty()) { + SendResponse(false, + mobile_apis::Result::INVALID_ID, + "The requested service ID does not exist"); + return; + } + + bool request_service_active = false; + if (msg_params.keyExists(strings::request_service_active)) { + request_service_active = + msg_params[strings::request_service_active].asBool(); + msg_params.erase(strings::request_service_active); + } + + // Only activate service if it is not already active + bool activate_service = + request_service_active && + !service.second.record[strings::service_active].asBool(); + if (activate_service) { + if (app->is_foreground()) { + // App is in foreground, we can just activate the service + application_manager_.GetAppServiceManager().ActivateAppService( + service_id); + } else { + // App is not in foreground, we need to prompt the user to activate the + // service + smart_objects::SmartObject request_params; + request_params[strings::service_id] = service_id; + SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent, + &request_params, + true); + return; + } + } + + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); +} + +void PerformAppServiceInteractionRequest::on_event( + const event_engine::Event& event) { + LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event"); + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + hmi_apis::Common_Result::eType hmi_result = + static_cast( + event_message[strings::params][hmi_response::code].asInt()); + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + + switch (event.id()) { + case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction: + SendResponse(success, result, info, &msg_params); + break; + case hmi_apis::FunctionID::AppService_GetActiveServiceConsent: + if (msg_params[strings::activate].asBool()) { + // User agreed to activate service, we can now send the provider request + application_manager_.GetAppServiceManager().ActivateAppService( + (*message_)[strings::msg_params][strings::service_id].asString()); + SendProviderRequest( + mobile_apis::FunctionID::PerformAppServiceInteractionID, + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + &(*message_), + true); + } else if (mobile_apis::Result::SUCCESS == result) { + // Request was successful, but user denied the request to activate the + // service + SendResponse(false, + mobile_apis::Result::USER_DISALLOWED, + "Request to activate service was denied by driver"); + } else { + SendResponse(success, result, info); + } + break; + default: + break; + } +} + +void PerformAppServiceInteractionRequest::on_event( + const event_engine::MobileEvent& event) { + LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event"); + const smart_objects::SmartObject& event_message = event.smart_object(); + + auto msg_params = event_message[strings::msg_params]; + + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + mobile_apis::Result::eType result = static_cast( + msg_params[strings::result_code].asInt()); + bool success = IsMobileResultSuccess(result); + + SendResponse(success, result, info, &msg_params); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc new file mode 100644 index 0000000000..8d71174c8d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc @@ -0,0 +1,63 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionRequestToMobile:: + PerformAppServiceInteractionRequestToMobile( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +PerformAppServiceInteractionRequestToMobile:: + ~PerformAppServiceInteractionRequestToMobile() {} + +void PerformAppServiceInteractionRequestToMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc new file mode 100644 index 0000000000..774ec93720 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc @@ -0,0 +1,61 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {} + +void PerformAppServiceInteractionResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc new file mode 100644 index 0000000000..9912df84ce --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc @@ -0,0 +1,66 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h" +#include "application_manager/application_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace app_service_rpc_plugin { +using namespace application_manager; +namespace commands { + +PerformAppServiceInteractionResponseFromMobile:: + PerformAppServiceInteractionResponseFromMobile( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandResponseFromMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +PerformAppServiceInteractionResponseFromMobile:: + ~PerformAppServiceInteractionResponseFromMobile() {} + +void PerformAppServiceInteractionResponseFromMobile::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::MobileEvent event( + mobile_apis::FunctionID::PerformAppServiceInteractionID); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace app_service_rpc_plugin -- cgit v1.2.1 From 97806312bc0df88d74fadc0c9c620599545b0887 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 26 Feb 2019 15:45:55 -0500 Subject: Add capability updates for NAVIGATION service type Also revise name of `timeStamp` parameter in NavigationServiceData --- .../on_bc_system_capability_updated_notification.cc | 20 +++++++++++++++++++- .../commands/mobile/get_system_capability_request.cc | 14 ++++++++++++-- .../on_system_capability_updated_notification.cc | 20 +++++++++++++++++++- 3 files changed, 50 insertions(+), 4 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index d0c33e76d9..73ec1137a8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -70,9 +70,21 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { [strings::system_capability_type].asInt()); switch (system_capability_type) { case hmi_apis::Common_SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; if (hmi_capabilities_.navigation_capability()) { + has_nav_capability = true; + nav_capability = *hmi_capabilities_.navigation_capability(); + } + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { msg_params[strings::system_capability][strings::navigation_capability] = - *hmi_capabilities_.navigation_capability(); + nav_capability; + } else { + return; } break; } @@ -80,6 +92,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { if (hmi_capabilities_.phone_capability()) { msg_params[strings::system_capability][strings::phone_capability] = *hmi_capabilities_.phone_capability(); + } else { + return; } break; } @@ -90,6 +104,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { if (hmi_capabilities_.rc_capability()) { msg_params[strings::system_capability][strings::rc_capability] = *hmi_capabilities_.rc_capability(); + } else { + return; } break; } @@ -98,6 +114,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { msg_params[strings::system_capability] [strings::video_streaming_capability] = *hmi_capabilities_.video_streaming_capability(); + } else { + return; } break; case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index b551db0008..63a4416139 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -83,10 +83,20 @@ void GetSystemCapabilityRequest::Run() { switch (response_type) { case mobile_apis::SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; if (hmi_capabilities.navigation_capability()) { + has_nav_capability = true; + auto nav_capability = *hmi_capabilities.navigation_capability(); + } + + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { response_params[strings::system_capability] - [strings::navigation_capability] = - *hmi_capabilities.navigation_capability(); + [strings::navigation_capability] = nav_capability; } else { SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index 0745bc08dc..b5e3a73ee4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -36,9 +36,21 @@ void OnSystemCapabilityUpdatedNotification::Run() { switch (system_capability_type) { case mobile_apis::SystemCapabilityType::NAVIGATION: { + smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map); + bool has_nav_capability = false; if (hmi_capabilities_.navigation_capability()) { + has_nav_capability = true; + nav_capability = *hmi_capabilities_.navigation_capability(); + } + has_nav_capability = application_manager_.GetAppServiceManager() + .UpdateNavigationCapabilities(nav_capability) || + has_nav_capability; + + if (has_nav_capability) { msg_params[strings::system_capability][strings::navigation_capability] = - *hmi_capabilities_.navigation_capability(); + nav_capability; + } else { + return; } break; } @@ -46,6 +58,8 @@ void OnSystemCapabilityUpdatedNotification::Run() { if (hmi_capabilities_.phone_capability()) { msg_params[strings::system_capability][strings::phone_capability] = *hmi_capabilities_.phone_capability(); + } else { + return; } break; } @@ -56,6 +70,8 @@ void OnSystemCapabilityUpdatedNotification::Run() { if (hmi_capabilities_.rc_capability()) { msg_params[strings::system_capability][strings::rc_capability] = *hmi_capabilities_.rc_capability(); + } else { + return; } break; } @@ -64,6 +80,8 @@ void OnSystemCapabilityUpdatedNotification::Run() { msg_params[strings::system_capability] [strings::video_streaming_capability] = *hmi_capabilities_.video_streaming_capability(); + } else { + return; } break; case mobile_apis::SystemCapabilityType::APP_SERVICES: { -- cgit v1.2.1 From 0c3ff46e28386f59b530a08c1df8de67372dce77 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 26 Feb 2019 19:08:27 -0500 Subject: Add logic for `HMIOriginID` and `EmbeddedServices` --- ...erform_app_service_interaction_request_from_hmi.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 8f52268f19..c384e73d33 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -57,6 +57,25 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + std::string hmi_origin_id = + application_manager_.get_settings().hmi_origin_id(); + if (!msg_params.keyExists(strings::origin_app)) { + if (hmi_origin_id.empty()) { + smart_objects::SmartObject response_params; + response_params[strings::info] = + "No HMI origin ID to use for interaction passthrough"; + SendResponse( + false, + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::INVALID_DATA, + &response_params, + application_manager::commands::Command::SOURCE_SDL_TO_HMI); + return; + } + msg_params[strings::origin_app] = hmi_origin_id; + } + std::string service_id = msg_params[strings::service_id].asString(); auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); -- cgit v1.2.1 From 090ebab24ddb3c761386f20e873b0142fb42db51 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 27 Feb 2019 17:49:02 -0500 Subject: Add lock for `published_services` map Also modify getter functions for services --- .../hmi/as_perform_app_service_interaction_request_from_hmi.cc | 7 +++---- .../src/commands/mobile/perform_app_service_interaction_request.cc | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index c384e73d33..2b66993d8f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -79,7 +79,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() { std::string service_id = msg_params[strings::service_id].asString(); auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); - if (service.first.empty()) { + if (!service) { smart_objects::SmartObject response_params; response_params[strings::info] = "The requested service ID does not exist"; SendResponse(false, @@ -99,9 +99,8 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() { } // Only activate service if it is not already active - bool activate_service = - request_service_active && - !service.second.record[strings::service_active].asBool(); + bool activate_service = request_service_active && + !service->record[strings::service_active].asBool(); if (activate_service) { application_manager_.GetAppServiceManager().ActivateAppService(service_id); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index d21c413b29..952d1834fb 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -66,7 +66,7 @@ void PerformAppServiceInteractionRequest::Run() { std::string service_id = msg_params[strings::service_id].asString(); auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); - if (service.first.empty()) { + if (!service) { SendResponse(false, mobile_apis::Result::INVALID_ID, "The requested service ID does not exist"); @@ -81,9 +81,8 @@ void PerformAppServiceInteractionRequest::Run() { } // Only activate service if it is not already active - bool activate_service = - request_service_active && - !service.second.record[strings::service_active].asBool(); + bool activate_service = request_service_active && + !service->record[strings::service_active].asBool(); if (activate_service) { if (app->is_foreground()) { // App is in foreground, we can just activate the service -- cgit v1.2.1 From bc6cec5d29ff36b7092112dc1ea69ccd4d92acc3 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 28 Feb 2019 09:55:21 -0500 Subject: Close Cloud Connection (#2825) * Close Cloud Connection * Address Comments * Update based on merge --- .../src/commands/hmi/on_exit_application_notification.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc index 681390fbf4..b6d44a4511 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc @@ -106,6 +106,10 @@ void OnExitApplicationNotification::Run() { application_manager_.UnregisterApplication(app_id, Result::SUCCESS); return; } + case Common_ApplicationExitReason::CLOSE_CLOUD_CONNECTION: { + application_manager_.DisconnectCloudApp(app_impl); + break; + } default: { LOG4CXX_WARN(logger_, "Unhandled reason"); return; -- cgit v1.2.1 From fc9f7d13c0e03caee9e196a636815e791213ad66 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 1 Mar 2019 15:00:38 -0500 Subject: Get Icon URL Request (#2823) * Fix regex command for reading paths post port number * Add Icon URL to policies * Create Icon Request and save to icon folder. * Fixes for get icon url * Fix unit tests * Send Icon_url request after PTU * Address comments * Address Comments --- .../mobile/register_app_interface_request.cc | 3 +++ .../src/commands/mobile/system_request.cc | 26 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index b346ee5798..6317d9b068 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -447,6 +447,9 @@ void RegisterAppInterfaceRequest::Run() { GetLockScreenIconUrlNotification(connection_key(), application); rpc_service_.ManageMobileCommand(so, SOURCE_SDL); application_manager_.SendDriverDistractionState(application); + // Create onSystemRequest to mobile to obtain cloud app icons + application_manager_.SendGetIconUrlNotifications(connection_key(), + application); } smart_objects::SmartObjectSPtr diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index cea00a9d5e..da39aefd6a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -511,7 +511,8 @@ void SystemRequest::Run() { return; } - if (!file_system::IsFileNameValid(file_name)) { + if (!file_system::IsFileNameValid(file_name) && + mobile_apis::RequestType::ICON_URL != request_type) { const std::string err_msg = "Sync file name contains forbidden symbols."; LOG4CXX_ERROR(logger_, err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); @@ -533,8 +534,21 @@ void SystemRequest::Run() { std::string binary_data_folder; if ((*message_)[strings::params].keyExists(strings::binary_data)) { binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); - binary_data_folder = - application_manager_.get_settings().system_files_path(); + if (mobile_apis::RequestType::ICON_URL == request_type) { + binary_data_folder = + application_manager_.get_settings().app_icons_folder(); + // Use the URL file name to identify the policy id. + // Save the icon file with the policy id as the name. + file_name = application_manager_.PolicyIDByIconUrl(file_name); + if (file_name.empty()) { + const std::string err_msg = "Invalid file name"; + SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + } + LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name); + } else { + binary_data_folder = + application_manager_.get_settings().system_files_path(); + } } else { binary_data_folder = application_manager_.get_settings().app_storage_folder(); @@ -581,6 +595,12 @@ void SystemRequest::Run() { LOG4CXX_DEBUG(logger_, "Binary data ok."); + if (mobile_apis::RequestType::ICON_URL == request_type) { + application_manager_.SetIconFileFromSystemRequest(file_name); + SendResponse(true, mobile_apis::Result::SUCCESS); + return; + } + if (mobile_apis::RequestType::HTTP == request_type && (*message_)[strings::msg_params].keyExists(strings::file_name)) { const std::string& file = -- cgit v1.2.1 From 9ef245688d5f4c16e44c1980483cf78506a227c9 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 1 Mar 2019 16:19:45 -0500 Subject: GetCloudAppProperties (#2824) * GetCloudAppProperties * Update setCloudAppProperties to use properties param * Address comments * Add set endpoint and app name * Remove setAppName * Address comment * Address Comments * Add return value to GetCloudAppParameters * Add return --- .../mobile/get_cloud_app_properties_request.h | 31 ++++++ .../mobile/get_cloud_app_properties_response.h | 31 ++++++ .../mobile/get_cloud_app_properties_request.cc | 110 +++++++++++++++++++++ .../mobile/get_cloud_app_properties_response.cc | 31 ++++++ .../sdl_rpc_plugin/src/mobile_command_factory.cc | 8 ++ 5 files changed, 211 insertions(+) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h new file mode 100644 index 0000000000..3d74a80dc2 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class GetCloudAppPropertiesRequest + : public app_mngr::commands::CommandRequestImpl { + public: + GetCloudAppPropertiesRequest( + 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 ~GetCloudAppPropertiesRequest(); + virtual void Run(); + virtual void on_event(const app_mngr::event_engine::Event& event); + + private: + DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesRequest); +}; // GetCloudAppPropertiesRequest + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h new file mode 100644 index 0000000000..f716c7dcb5 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h @@ -0,0 +1,31 @@ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +class GetCloudAppPropertiesResponse + : public app_mngr::commands::CommandResponseImpl { + public: + GetCloudAppPropertiesResponse( + 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 ~GetCloudAppPropertiesResponse(); + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesResponse); + +}; // GetCloudAppPropertiesResponse + +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc new file mode 100644 index 0000000000..62c91ff3d5 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -0,0 +1,110 @@ +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( + 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) {} + +GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {} + +void GetCloudAppPropertiesRequest::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; + } + + std::string policy_app_id = + (*message_)[strings::msg_params][strings::app_id].asString(); + + bool enabled = true; + std::string endpoint; + std::string auth_token; + std::string certificate; + std::string cloud_transport_type; + std::string hybrid_app_preference; + + bool result = policy_handler_.GetCloudAppParameters(policy_app_id, + enabled, + endpoint, + certificate, + auth_token, + cloud_transport_type, + hybrid_app_preference); + + if (!result) { + SendResponse(false, + mobile_apis::Result::DATA_NOT_AVAILABLE, + "Cloud app does not exist on module"); + return; + } + + ApplicationSharedPtr cloud_app = + application_manager_.application_by_policy_id(policy_app_id); + std::string cloud_name; + if (cloud_app) { + cloud_name = cloud_app->name().AsMBString(); + } else { + policy::StringArray nicknames; + policy::StringArray app_hmi_types; + + policy_handler_.GetInitialAppData( + policy_app_id, &nicknames, &app_hmi_types); + + if (!nicknames.size()) { + LOG4CXX_ERROR(logger_, "Cloud App missing nickname"); + SendResponse(false, + mobile_apis::Result::DATA_NOT_AVAILABLE, + "No available nick names for the requested app"); + return; + } + cloud_name = nicknames[0]; + } + + smart_objects::SmartObject response_params(smart_objects::SmartType_Map); + smart_objects::SmartObject properties(smart_objects::SmartType_Map); + + properties[strings::app_name] = cloud_name; + properties[strings::app_id] = policy_app_id; + properties[strings::enabled] = enabled; + + if (!auth_token.empty()) { + properties[strings::auth_token] = auth_token; + } + if (!cloud_transport_type.empty()) { + properties[strings::cloud_transport_type] = cloud_transport_type; + } + if (!hybrid_app_preference.empty()) { + properties[strings::hybrid_app_preference] = hybrid_app_preference; + } + if (!endpoint.empty()) { + properties[strings::endpoint] = endpoint; + } + + response_params[strings::properties] = properties; + + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); +} + +void GetCloudAppPropertiesRequest::on_event( + const app_mngr::event_engine::Event& event) { + LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event"); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc new file mode 100644 index 0000000000..813a9e7006 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_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/get_cloud_app_properties_response.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse( + 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) {} + +GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {} + +void GetCloudAppPropertiesResponse::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 8eab054be3..5ef76b59ef 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 @@ -126,6 +126,8 @@ #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h" #include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" #include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h" +#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h" #include "interfaces/MOBILE_API.h" CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") @@ -345,6 +347,12 @@ CommandCreator& MobileCommandFactory::get_creator_factory( : factory .GetCreator(); } + case mobile_apis::FunctionID::GetCloudAppPropertiesID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator() + : factory + .GetCreator(); + } case mobile_apis::FunctionID::OnButtonEventID: { return factory.GetCreator(); } -- cgit v1.2.1 From ba7bd475d6099d8a1f3d4c9b2de9317070c84718 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 1 Mar 2019 16:28:38 -0500 Subject: Remove URI Scheme and URI Prefix (#2828) * Remove URI Scheme and URI Prefix * Remove ValidateManifest() * Style --- .../commands/hmi/as_publish_app_service_request.h | 2 -- .../commands/mobile/publish_app_service_request.h | 2 -- .../commands/hmi/as_publish_app_service_request.cc | 20 -------------------- .../commands/mobile/publish_app_service_request.cc | 18 ------------------ 4 files changed, 42 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h index ec2c00a714..4433444602 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h @@ -69,8 +69,6 @@ class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI { virtual void Run(); private: - bool ValidateManifest(smart_objects::SmartObject& manifest); - DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index 72e4f1c629..d70f279658 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -68,8 +68,6 @@ class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { virtual void Run(); private: - bool ValidateManifest(smart_objects::SmartObject& manifest); - DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 5e20ca20d1..b816016fa7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -51,23 +51,6 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} -bool ASPublishAppServiceRequest::ValidateManifest( - smart_objects::SmartObject& manifest) { - if (manifest.keyExists(strings::uri_scheme)) { - Json::Value value; - Json::Reader reader; - if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) { - SendResponse( - false, - (*message_)[strings::params][strings::correlation_id].asUInt(), - hmi_apis::FunctionID::AppService_PublishAppService, - hmi_apis::Common_Result::INVALID_DATA); - return false; - } - } - return true; -} - void ASPublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI"); @@ -75,9 +58,6 @@ void ASPublishAppServiceRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; - if (!ValidateManifest(manifest)) { - return; - } smart_objects::SmartObject service_record = application_manager_.GetAppServiceManager().PublishAppService( manifest, false, UINT32_MAX); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 05210208ca..22d8e50c3a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -55,21 +55,6 @@ PublishAppServiceRequest::PublishAppServiceRequest( PublishAppServiceRequest::~PublishAppServiceRequest() {} -bool PublishAppServiceRequest::ValidateManifest( - smart_objects::SmartObject& manifest) { - if (manifest.keyExists(strings::uri_scheme)) { - Json::Value value; - Json::Reader reader; - if (!reader.parse(manifest[strings::uri_scheme].asString(), value)) { - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "Provided uriScheme was not valid JSON"); - return false; - } - } - return true; -} - void PublishAppServiceRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key()); @@ -79,9 +64,6 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; - if (!ValidateManifest(manifest)) { - return; - } ApplicationSharedPtr app = application_manager_.application(connection_key()); -- cgit v1.2.1 From 3d3178c0d78dc2c0c1f515bb955eadff78a83e59 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 5 Mar 2019 14:32:47 -0500 Subject: Handle hybrid app preference If both a cloud app and mobile app attempt to register with the same name, the hybrid app preference of the cloud app is used to determine which app should be registered --- .../mobile/register_app_interface_request.h | 3 +- .../mobile/register_app_interface_request.cc | 56 ++++++++++++++++++---- 2 files changed, 48 insertions(+), 11 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index f8be896996..a6bfdec209 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -148,7 +148,8 @@ class RegisterAppInterfaceRequest * return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms, * otherwise appropriate error code returns */ - mobile_apis::Result::eType CheckCoincidence(); + mobile_apis::Result::eType CheckCoincidence( + app_mngr::ApplicationSharedPtr& app); /* * @brief Predicate for using with CheckCoincidence method to compare with VR diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 6317d9b068..e4540fe888 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -281,17 +281,49 @@ void RegisterAppInterfaceRequest::Run() { return; } - mobile_apis::Result::eType coincidence_result = CheckCoincidence(); + ApplicationSharedPtr duplicate_app; + mobile_apis::Result::eType coincidence_result = + CheckCoincidence(duplicate_app); + + if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { + bool error_response = true; + if (duplicate_app->is_cloud_app()) { + if (duplicate_app->hybrid_app_preference() == + mobile_apis::HybridAppPreference::MOBILE) { + // Unregister cloud application and allow mobile application to register + // in it's place + application_manager_.UnregisterApplication( + duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); + error_response = false; + } + } else { + ApplicationSharedPtr cloud_app = + application_manager_.pending_application_by_policy_id(policy_app_id); + // If the duplicate name was not because of a mobile/cloud app pair, go + // through the normal process for handling duplicate names + if (cloud_app.use_count() == 0 || !cloud_app->is_cloud_app()) { + usage_statistics::AppCounter count_of_rejections_duplicate_name( + GetPolicyHandler().GetStatisticManager(), + policy_app_id, + usage_statistics::REJECTIONS_DUPLICATE_NAME); + ++count_of_rejections_duplicate_name; + } else if (cloud_app->hybrid_app_preference() == + mobile_apis::HybridAppPreference::CLOUD) { + // Unregister mobile application and allow cloud application to + // register in it's place + application_manager_.UnregisterApplication( + duplicate_app->app_id(), mobile_apis::Result::USER_DISALLOWED); + error_response = false; + } + } - if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); - if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { - usage_statistics::AppCounter count_of_rejections_duplicate_name( - GetPolicyHandler().GetStatisticManager(), - policy_app_id, - usage_statistics::REJECTIONS_DUPLICATE_NAME); - ++count_of_rejections_duplicate_name; + if (error_response) { + LOG4CXX_ERROR(logger_, "Coincidence check failed."); + SendResponse(false, coincidence_result); + return; } + } else if (mobile_apis::Result::SUCCESS != coincidence_result) { + LOG4CXX_ERROR(logger_, "Coincidence check failed."); SendResponse(false, coincidence_result); return; } @@ -922,7 +954,8 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( DCHECK(rpc_service_.ManageHMICommand(notification)); } -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { +mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( + ApplicationSharedPtr& out_app) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -938,6 +971,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { const custom_str::CustomString& cur_name = (*it)->name(); if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); + out_app = *it; return mobile_apis::Result::DUPLICATE_NAME; } @@ -949,6 +983,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { LOG4CXX_ERROR(logger_, "Application name is known already."); + out_app = *it; return mobile_apis::Result::DUPLICATE_NAME; } } @@ -961,6 +996,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); + out_app = *it; return mobile_apis::Result::DUPLICATE_NAME; } } // end vr check -- cgit v1.2.1 From 00a12837cc8f2b334eeeed1fd033826fe772c362 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 5 Mar 2019 18:45:53 -0500 Subject: Add logic for handling `allowAppConsumers` --- .../mobile/on_app_service_data_notification.cc | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index a016d1fe16..e198cc0fcd 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -61,10 +61,30 @@ OnAppServiceDataNotification::~OnAppServiceDataNotification() {} void OnAppServiceDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); - MessageHelper::PrintSmartObject(*message_); + + std::string service_id = + (*message_)[strings::msg_params][strings::service_data] + [strings::service_id] + .asString(); + auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); + + if (!service) { + LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published"); + return; + } else if (!service + ->record[strings::service_manifest] + [strings::allow_app_consumers] + .asBool()) { + LOG4CXX_ERROR(logger_, + "Service does not allow for app consumers, skipping mobile " + "OnAppServiceData notification"); + return; + } std::string service_type = - (*message_)[strings::msg_params][strings::service_type].asString(); + (*message_)[strings::msg_params][strings::service_data] + [strings::service_type] + .asString(); auto subscribed_to_app_service_predicate = [service_type](const ApplicationSharedPtr app) { -- cgit v1.2.1 From f9e39400db6458d4a3199913b33279149d0ce70c Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 5 Mar 2019 18:47:12 -0500 Subject: Fix usage of `subscribe` parameter in GetAppServiceData --- .../src/commands/mobile/get_app_service_data_request.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index b54071068f..0d387785ee 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -70,16 +70,16 @@ void GetAppServiceDataRequest::Run() { std::string service_type = (*message_)[strings::msg_params][strings::service_type].asString(); - bool subscribe = false; - if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { - subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool(); - } - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (subscribe) { + if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { + bool subscribe = + (*message_)[strings::msg_params][strings::subscribe].asBool(); auto& ext = AppServiceAppExtension::ExtractASExtension(*app); - ext.SubscribeToAppService(service_type); + if (subscribe) { + ext.SubscribeToAppService(service_type); + } else { + ext.UnsubscribeFromAppService(service_type); + } } SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, -- cgit v1.2.1 From 24be2c57bb2965d29c86f6891346b6491bcf08e6 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Tue, 5 Mar 2019 18:50:50 -0500 Subject: Fix style --- .../commands/mobile/on_app_service_data_notification.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index e198cc0fcd..2c6ba414e0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -64,17 +64,15 @@ void OnAppServiceDataNotification::Run() { std::string service_id = (*message_)[strings::msg_params][strings::service_data] - [strings::service_id] - .asString(); - auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); - + [strings::service_id].asString(); + auto service = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (!service) { LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published"); return; - } else if (!service - ->record[strings::service_manifest] - [strings::allow_app_consumers] - .asBool()) { + } else if (!service->record[strings::service_manifest] + [strings::allow_app_consumers].asBool()) { LOG4CXX_ERROR(logger_, "Service does not allow for app consumers, skipping mobile " "OnAppServiceData notification"); @@ -83,8 +81,7 @@ void OnAppServiceDataNotification::Run() { std::string service_type = (*message_)[strings::msg_params][strings::service_data] - [strings::service_type] - .asString(); + [strings::service_type].asString(); auto subscribed_to_app_service_predicate = [service_type](const ApplicationSharedPtr app) { -- cgit v1.2.1 From bcd314658814edf6b822b9a23267c0694865e06c Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 6 Mar 2019 13:20:21 -0500 Subject: Implement cloud app properties revision --- .../mobile/get_cloud_app_properties_request.cc | 34 +++++++--------------- .../mobile/set_cloud_app_properties_request.cc | 6 ---- 2 files changed, 11 insertions(+), 29 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc index 62c91ff3d5..34ed30c243 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -54,32 +54,20 @@ void GetCloudAppPropertiesRequest::Run() { return; } - ApplicationSharedPtr cloud_app = - application_manager_.application_by_policy_id(policy_app_id); - std::string cloud_name; - if (cloud_app) { - cloud_name = cloud_app->name().AsMBString(); - } else { - policy::StringArray nicknames; - policy::StringArray app_hmi_types; - - policy_handler_.GetInitialAppData( - policy_app_id, &nicknames, &app_hmi_types); - - if (!nicknames.size()) { - LOG4CXX_ERROR(logger_, "Cloud App missing nickname"); - SendResponse(false, - mobile_apis::Result::DATA_NOT_AVAILABLE, - "No available nick names for the requested app"); - return; - } - cloud_name = nicknames[0]; - } + policy::StringArray nicknames; + policy::StringArray app_hmi_types; + + policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types); smart_objects::SmartObject response_params(smart_objects::SmartType_Map); smart_objects::SmartObject properties(smart_objects::SmartType_Map); - - properties[strings::app_name] = cloud_name; + smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array); + size_t i = 0; + for (std::string nickname : nicknames) { + nicknames_array[i] = nickname; + ++i; + } + properties[strings::nicknames] = nicknames_array; properties[strings::app_id] = policy_app_id; properties[strings::enabled] = enabled; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc index 663881a2ea..5173be56d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -29,12 +29,6 @@ void SetCloudAppPropertiesRequest::Run() { return; } - if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - policy_handler_.OnSetCloudAppProperties(*message_); SendResponse(true, mobile_apis::Result::SUCCESS); -- cgit v1.2.1 From 222ec0566594288744d73ef30174e714bd6f29ce Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Wed, 6 Mar 2019 13:36:58 -0500 Subject: GetFile RPC (#2811) * Implemented GetFile rpc in MOBILE API * Initial implementation of GetFile rpc * Implemented GetFile RPC * Fixed binary data param in GetFile response * Added case for handling SmartType UInteger in SmartObject::duplicate function * Implemented offset and length params * Implemented GetFile for services published by the HMI * Switched to events to handle forwarding GetFile request to HMI * Addressed review comments * Addressed review comments * Addressed review comments * Implemented length parameter * Changed RPC name from GetFileFromHMI to GetFilePath * Fix MOBILE_API formatting * Fix HMI_API formatting * Addressed review comments * Checking success rather than result code for hmi response --- .../commands/hmi/bc_get_file_path_request.h | 77 +++++ .../commands/hmi/bc_get_file_path_response.h | 77 +++++ .../commands/mobile/get_file_request.h | 87 +++++ .../commands/mobile/get_file_response.h | 77 +++++ .../src/commands/hmi/bc_get_file_path_request.cc | 62 ++++ .../src/commands/hmi/bc_get_file_path_response.cc | 66 ++++ .../src/commands/mobile/get_file_request.cc | 353 +++++++++++++++++++++ .../src/commands/mobile/get_file_response.cc | 63 ++++ .../sdl_rpc_plugin/src/hmi_command_factory.cc | 7 + .../sdl_rpc_plugin/src/mobile_command_factory.cc | 7 + 10 files changed, 876 insertions(+) create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h new file mode 100644 index 0000000000..fd241da3c4 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h @@ -0,0 +1,77 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BCGetFilePathRequest command class + **/ +class BCGetFilePathRequest : public app_mngr::commands::RequestToHMI { + public: + /** + * @brief BCGetFilePathRequest class constructor + * + * @param message Incoming SmartObject message + **/ + BCGetFilePathRequest(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); + + /** + * @brief BCGetFilePathRequest class destructor + **/ + virtual ~BCGetFilePathRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(BCGetFilePathRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_sdl_RPC_PLUGIN_INCLUDE_sdl_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h new file mode 100644 index 0000000000..2a6025cbdf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h @@ -0,0 +1,77 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ + +#include "application_manager/commands/response_from_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief BCGetFilePathResponse command class + **/ +class BCGetFilePathResponse : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief BCGetFilePathResponse class constructor + * + * @param message Incoming SmartObject message + **/ + BCGetFilePathResponse(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); + + /** + * @brief BCGetFilePathResponse class destructor + **/ + virtual ~BCGetFilePathResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(BCGetFilePathResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h new file mode 100644 index 0000000000..d4182ea004 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h @@ -0,0 +1,87 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ + +#include "application_manager/commands/command_request_impl.h" +#include "application_manager/event_engine/event.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetFileRequest command class + **/ +class GetFileRequest : public app_mngr::commands::CommandRequestImpl { + public: + /** + * @brief GetFileRequest class constructor + * + * @param message Incoming SmartObject message + **/ + GetFileRequest(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_handle); + + /** + * @brief GetFileRequest class destructor + **/ + virtual ~GetFileRequest(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + bool GetFilePath(std::string& file_path, bool& forward_to_hmi); + + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + private: + std::string file_name_; + mobile_apis::FileType::eType file_type_; + uint32_t length_; + uint32_t offset_; + + DISALLOW_COPY_AND_ASSIGN(GetFileRequest); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h new file mode 100644 index 0000000000..bc191d224c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h @@ -0,0 +1,77 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ + +#include "application_manager/commands/command_response_impl.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +/** + * @brief GetFileResponse command class + **/ +class GetFileResponse : public app_mngr::commands::CommandResponseImpl { + public: + /** + * @brief GetFileResponse class constructor + * + * @param message Incoming SmartObject message + **/ + GetFileResponse(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_handle); + + /** + * @brief GetFileResponse class destructor + **/ + virtual ~GetFileResponse(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(GetFileResponse); +}; + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc new file mode 100644 index 0000000000..b735cd9bdf --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc @@ -0,0 +1,62 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BCGetFilePathRequest::BCGetFilePathRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BCGetFilePathRequest::~BCGetFilePathRequest() {} + +void BCGetFilePathRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc new file mode 100644 index 0000000000..b86ab6a2b8 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc @@ -0,0 +1,66 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/event_engine/event.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +BCGetFilePathResponse::BCGetFilePathResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +BCGetFilePathResponse::~BCGetFilePathResponse() {} + +void BCGetFilePathResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + application_manager::event_engine::Event event( + hmi_apis::FunctionID::BasicCommunication_GetFilePath); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc new file mode 100644 index 0000000000..c0fbcee146 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -0,0 +1,353 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "sdl_rpc_plugin/commands/mobile/get_file_request.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/message_helper.h" +#include "application_manager/app_service_manager.h" +#include "utils/file_system.h" +#include + +namespace { +/** +* Calculates CRC32 checksum +* @param binary_data - input data for which CRC32 should be calculated +* @return calculated CRC32 checksum +*/ +uint32_t GetCrc32CheckSum(const std::vector& binary_data) { + const std::size_t file_size = binary_data.size(); + boost::crc_32_type result; + result.process_bytes(&binary_data[0], file_size); + return result.checksum(); +} + +} // namespace + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetFileRequest::GetFileRequest( + const application_manager::commands::MessageSharedPtr& message, + 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) + , file_name_("") + , file_type_(mobile_apis::FileType::INVALID_ENUM) + , length_(0) + , offset_(0) {} + +GetFileRequest::~GetFileRequest() {} + +bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) { + std::string path = application_manager_.get_settings().app_storage_folder(); + auto connect_key = connection_key(); + forward_to_hmi = false; + + if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) { + std::string service_id = + (*message_)[strings::msg_params][strings::app_service_id].asString(); + LOG4CXX_DEBUG(logger_, + "Finding storage directory for service id: " << service_id); + + AppService* app_service_info = + application_manager_.GetAppServiceManager().FindServiceByID(service_id); + if (app_service_info) { + if (app_service_info->mobile_service) { + connect_key = app_service_info->connection_key; + } else { + forward_to_hmi = true; + return true; + } + } else { + return false; + } + } else { + LOG4CXX_DEBUG(logger_, "Using current storage directory"); + } + + ApplicationSharedPtr app = application_manager_.application(connect_key); + file_path = path + "/" + app->folder_name(); + return true; +} + +void GetFileRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_INFO(logger_, "Received GetFile request"); + + ApplicationSharedPtr app = application_manager_.application(connection_key()); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + if (!app) { + LOG4CXX_ERROR(logger_, "Application is not registered"); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; + } + + file_name_ = (*message_)[strings::msg_params][strings::file_name].asString(); + + if (!file_system::IsFileNameValid(file_name_)) { + LOG4CXX_ERROR(logger_, + "File name " << file_name_ << " contains forbidden symbols."); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "File name contains forbidden symbols", + &response_params); + return; + } + + // Initialize other params with default values. If exists overwrite the values + LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values"); + + if ((*message_)[strings::msg_params].keyExists(strings::file_type)) { + file_type_ = static_cast( + (*message_)[strings::msg_params][strings::file_type].asInt()); + } + + // Check if file exists on system (may have to use app service id to get the + // correct app folder) + LOG4CXX_DEBUG(logger_, "Check if file exists on system"); + std::string file_path; + bool forward_to_hmi; + + if (GetFilePath(file_path, forward_to_hmi)) { + if (forward_to_hmi) { + LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI"); + SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath, + &(*message_)[strings::msg_params], + true); + return; + } + } else { + LOG4CXX_ERROR(logger_, "Could not get file path"); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Could not get file path", + &response_params); + return; + } + + const std::string full_path = file_path + "/" + file_name_; + if (!file_system::FileExists(full_path)) { + LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SendResponse(false, + mobile_apis::Result::FILE_NOT_FOUND, + "File does not exist", + &response_params); + return; + } + + // Handle offset + LOG4CXX_DEBUG(logger_, "Handle offset and length parameters"); + const uint64_t file_size = file_system::FileSize(full_path); + + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + offset_ = (*message_)[strings::msg_params][strings::offset].asUInt(); + } + + length_ = file_size - offset_; + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + length_ = std::min( + static_cast( + (*message_)[strings::msg_params][strings::length].asUInt()), + length_); + } + + if (offset_ > file_size) { + LOG4CXX_ERROR(logger_, + "Offset " << offset_ << " greater than file size " + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Offset greater than file size", + &response_params); + return; + } + if (length_ > file_size - offset_) { + LOG4CXX_ERROR(logger_, + "Length " << length_ << " greater than file size - offset" + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Length greater than file size - offset", + &response_params); + return; + } + + // Load data from file as binary data + LOG4CXX_DEBUG(logger_, "Load binary data from file"); + std::vector bin_data; + if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { + LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Unable to read from file", + &response_params); + return; + } + + // Construct response message + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + response_params[strings::offset] = offset_; + } + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + response_params[strings::length] = length_; + } + if ((*message_)[strings::msg_params].keyExists(strings::file_type)) { + response_params[strings::file_type] = file_type_; + } + const uint32_t crc_calculated = GetCrc32CheckSum(bin_data); + response_params[strings::crc32_check_sum] = crc_calculated; + + SendResponse(true, + mobile_apis::Result::SUCCESS, + "File uploaded", + &response_params, + bin_data); +} + +void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + + if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) { + return; + } + const smart_objects::SmartObject& event_message = event.smart_object(); + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + event_message[strings::params][hmi_response::code].asInt()); + + mobile_apis::Result::eType result = + MessageHelper::HMIToMobileResult(hmi_result); + bool success = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + + if (!success) { + auto msg_params = event_message[strings::msg_params]; + const char* info = msg_params.keyExists(strings::info) + ? msg_params[strings::info].asCharArray() + : NULL; + + SendResponse(false, result, info, &msg_params); + return; + } + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + std::vector bin_data; + + if (event_message[strings::msg_params].keyExists(strings::file_type)) { + response_params[strings::file_type] = + event_message[strings::msg_params][strings::file_type]; + } + + if (event_message[strings::msg_params].keyExists(strings::file_path)) { + std::string full_path = + event_message[strings::msg_params][strings::file_path].asString(); + + if (!file_system::FileExists(full_path)) { + LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SendResponse(false, + mobile_apis::Result::FILE_NOT_FOUND, + "File does not exist", + &response_params); + return; + } + + const uint64_t file_size = file_system::FileSize(full_path); + if ((*message_)[strings::msg_params].keyExists(strings::offset)) { + offset_ = (*message_)[strings::msg_params][strings::offset].asUInt(); + } + + length_ = file_size - offset_; + if ((*message_)[strings::msg_params].keyExists(strings::length)) { + length_ = std::min( + static_cast( + (*message_)[strings::msg_params][strings::length].asUInt()), + length_); + } + + if (offset_ > file_size) { + LOG4CXX_ERROR(logger_, + "Offset " << offset_ << " greater than file size " + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Offset greater than file size", + &response_params); + return; + } + if (length_ > file_size - offset_) { + LOG4CXX_ERROR(logger_, + "Length " << length_ << " greater than file size - offset" + << file_size); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "Length greater than file size - offset", + &response_params); + return; + } + if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { + LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Failed to read from file", + &response_params); + return; + } + + const uint32_t crc_calculated = GetCrc32CheckSum(bin_data); + response_params[strings::crc32_check_sum] = crc_calculated; + + } else { + LOG4CXX_ERROR(logger_, "HMI did not return a file path: "); + SendResponse(false, + mobile_apis::Result::INVALID_DATA, + "HMI did not return a file path", + &response_params); + return; + } + + SendResponse(true, result, "File uploaded", &response_params, bin_data); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc new file mode 100644 index 0000000000..2ea8dde02a --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc @@ -0,0 +1,63 @@ +/* + Copyright (c) 2019, Ford Motor Company, Livio + 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 the copyright holders nor the names of their + 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. + */ + +#include "sdl_rpc_plugin/commands/mobile/get_file_response.h" +#include "application_manager/application_impl.h" +#include "application_manager/rpc_service.h" +#include "interfaces/MOBILE_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +GetFileResponse::GetFileResponse( + const application_manager::commands::MessageSharedPtr& message, + 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) {} + +GetFileResponse::~GetFileResponse() {} + +void GetFileResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_INFO(logger_, "Sending GetFile response"); + rpc_service_.SendMessageToMobile(message_); +} + +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index dc94474b9d..3cfe4d7118 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -240,6 +240,8 @@ #include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h" #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h" #include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h" +#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h" +#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h" #include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" @@ -842,6 +844,11 @@ CommandCreator& HMICommandFactory::get_creator_factory( ? factory.GetCreator() : factory.GetCreator(); } + case hmi_apis::FunctionID::BasicCommunication_GetFilePath: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + } case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: { return factory .GetCreator(); 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 77be545e0b..f12dcbb485 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 @@ -127,6 +127,8 @@ #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h" #include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h" #include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h" +#include "sdl_rpc_plugin/commands/mobile/get_file_request.h" +#include "sdl_rpc_plugin/commands/mobile/get_file_response.h" #include "interfaces/MOBILE_API.h" CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") @@ -234,6 +236,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory( ? factory.GetCreator() : factory.GetCreator(); } + case mobile_apis::FunctionID::GetFileID: { + return mobile_api::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + } case mobile_apis::FunctionID::DeleteFileID: { return mobile_api::messageType::request == message_type ? factory.GetCreator() -- cgit v1.2.1 From 82f77e91d31a8a5507c8cdd2388e24642e1c846f Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 6 Mar 2019 14:56:36 -0500 Subject: Add passthrough timeout to provider requests --- .../src/commands/mobile/perform_app_service_interaction_request.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index d21c413b29..9623cffd36 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -94,6 +94,8 @@ void PerformAppServiceInteractionRequest::Run() { // service smart_objects::SmartObject request_params; request_params[strings::service_id] = service_id; + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent, &request_params, true); -- cgit v1.2.1 From 969c77262efd0db36a51eaaa665e091a076efebf Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 6 Mar 2019 15:30:13 -0500 Subject: Add forwarding timeout for GetFile --- .../rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index c0fbcee146..2b3611fece 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -151,6 +151,8 @@ void GetFileRequest::Run() { if (GetFilePath(file_path, forward_to_hmi)) { if (forward_to_hmi) { LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI"); + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath, &(*message_)[strings::msg_params], true); -- cgit v1.2.1 From b49f662b54b5be8a67140fca1e8f55f87bef13d2 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 7 Mar 2019 17:20:16 -0500 Subject: Address review comments Also fix bug where an app name could coincide with several apps vr synonyms --- .../mobile/register_app_interface_request.h | 6 ++++-- .../mobile/register_app_interface_request.cc | 25 +++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index a6bfdec209..91ee8ea813 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -144,12 +144,14 @@ class RegisterAppInterfaceRequest /* * @brief Check new application parameters (name, tts, vr) for * coincidence with already known parameters of registered applications + * @param out_duplicate_apps In the case other apps was found with duplicate + * names, this field will be filled with a list of said apps * * return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms, * otherwise appropriate error code returns - */ + */ mobile_apis::Result::eType CheckCoincidence( - app_mngr::ApplicationSharedPtr& app); + std::vector& out_duplicate_apps); /* * @brief Predicate for using with CheckCoincidence method to compare with VR diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index e4540fe888..924705f82b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -281,11 +281,13 @@ void RegisterAppInterfaceRequest::Run() { return; } - ApplicationSharedPtr duplicate_app; + std::vector duplicate_apps; mobile_apis::Result::eType coincidence_result = - CheckCoincidence(duplicate_app); + CheckCoincidence(duplicate_apps); - if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { + if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result && + duplicate_apps.size() == 1) { + ApplicationSharedPtr duplicate_app = duplicate_apps.front(); bool error_response = true; if (duplicate_app->is_cloud_app()) { if (duplicate_app->hybrid_app_preference() == @@ -955,7 +957,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( - ApplicationSharedPtr& out_app) { + std::vector& out_duplicate_apps) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -971,8 +973,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( const custom_str::CustomString& cur_name = (*it)->name(); if (app_name.CompareIgnoreCase(cur_name)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_app = *it; - return mobile_apis::Result::DUPLICATE_NAME; + out_duplicate_apps.push_back(*it); + continue; } const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); @@ -983,8 +985,8 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { LOG4CXX_ERROR(logger_, "Application name is known already."); - out_app = *it; - return mobile_apis::Result::DUPLICATE_NAME; + out_duplicate_apps.push_back(*it); + continue; } } @@ -996,13 +998,16 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence( CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); - out_app = *it; - return mobile_apis::Result::DUPLICATE_NAME; + out_duplicate_apps.push_back(*it); + continue; } } // end vr check } // application for end + if (!out_duplicate_apps.empty()) { + return mobile_apis::Result::DUPLICATE_NAME; + } return mobile_apis::Result::SUCCESS; } // method end -- cgit v1.2.1 From 3be4d6a8384f5422a040121c11b448a7dd6901fc Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Thu, 7 Mar 2019 21:43:31 -0500 Subject: RPC Passing and Handling unknown RPC parameters (#2821) * Initial app service app extension * Add GetAppServiceData rpc templates. * Add request to mobile, and fix HMI GASD naming * Add Core->Mobile Requests and Responses * HMI GetAppService Request/Response to hmi and from hmi. * Add mobile on event handling * Fix GASD Response From Mobile * Add PerformAppServiceInteraction RPC * Fixes for GetAppServiceData subscribe, and OnAppServiceData Fixes allow for multiple consumers on a single app service type. Consumer/provider can be any combination of an ios app(s), android app(s), or an ivi HMI app(s). * Update AppServicetype to string and fix unit tests * Implemented RpcPassThroughTimeout param and IncreaseForwardedRequestTimeout function * Address review comments * Fixed build tests * Fix style * Address comments * Address comments * Pass info from provider in GASD response * Implemented boolean paramter to keep/remove unknown RPC paramaters * Added plugin keys * Implemented allowing unknown rpc params if function is handled by AS plugin or is related to SystemCapability * Implemented handling unknown params for OSCU notifications * Fixed build tests * Implemented handling unknown params for RPC Passing * Initial implementation of RPC Passing * fixed UNSUPPORTED_REQUEST case * Moved RPCPassing implementation into seperate class * Implemented passthrough request timeout * Addressed style and formatting comments * Put RPCPassingHandler in seperate file * Removed unused request/response file (based on review comment r263121367) * Fixed timeout implementation * Created functions for handling forwarding requests/responses to core and mobile * Moved Populating request queue functionality to seperate function * Changed implementation to use one map with the original request and a queue of app service information * Fixed timeout implementation * Seperated RPCPassing checks from IsAppServiceRPC checks * Added locks for request and timeout queues * Addressed review comments * Fixed rpc_passing_handler_ initializer and added comments * Reduced scope of locks for rpc_passing_queue --- .../rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc | 4 +++- .../rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc | 4 ++-- .../rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc | 3 ++- .../rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc index 971e3cc5e0..b96e5c199d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -35,11 +35,13 @@ #include "app_service_rpc_plugin/app_service_app_extension.h" #include "app_service_rpc_plugin/app_service_command_factory.h" #include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "application_manager/plugin_manager/plugin_keys.h" namespace app_service_rpc_plugin { CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") namespace strings = application_manager::strings; +namespace plugins = application_manager::plugin_manager; AppServiceRpcPlugin::AppServiceRpcPlugin() : application_manager_(nullptr) {} @@ -60,7 +62,7 @@ bool AppServiceRpcPlugin::IsAbleToProcess( } std::string AppServiceRpcPlugin::PluginName() { - return "App Service RPC Plugin"; + return plugins::plugin_names::app_service_rpc_plugin; } app_mngr::CommandFactory& AppServiceRpcPlugin::GetCommandFactory() { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index fd6b4e86ac..3bc1106573 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -29,7 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#include "application_manager/plugin_manager/plugin_keys.h" #include "rc_rpc_plugin/rc_rpc_plugin.h" #include "rc_rpc_plugin/rc_command_factory.h" #include "rc_rpc_plugin/rc_app_extension.h" @@ -77,7 +77,7 @@ bool RCRPCPlugin::IsAbleToProcess( } std::string RCRPCPlugin::PluginName() { - return "RC RPC Plugin"; + return plugins::plugin_names::rc_rpc_plugin; } application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index aa82c74098..c448b41ff1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "application_manager/plugin_manager/plugin_keys.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" #include "sdl_rpc_plugin/sdl_command_factory.h" #include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" @@ -56,7 +57,7 @@ bool SDLRPCPlugin::IsAbleToProcess( } std::string SDLRPCPlugin::PluginName() { - return "SDL RPC Plugin"; + return plugins::plugin_names::sdl_rpc_plugin; } app_mngr::CommandFactory& SDLRPCPlugin::GetCommandFactory() { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index d0bcc36ab4..c9e9839929 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -33,6 +33,7 @@ #include "vehicle_info_plugin/vehicle_info_plugin.h" #include "vehicle_info_plugin/vehicle_info_command_factory.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" +#include "application_manager/plugin_manager/plugin_keys.h" #include "application_manager/smart_object_keys.h" #include "application_manager/message_helper.h" #include "application_manager/message_helper.h" @@ -41,6 +42,7 @@ namespace vehicle_info_plugin { CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") namespace strings = application_manager::strings; +namespace plugins = application_manager::plugin_manager; VehicleInfoPlugin::VehicleInfoPlugin() : application_manager_(nullptr) {} @@ -61,7 +63,7 @@ bool VehicleInfoPlugin::IsAbleToProcess( } std::string VehicleInfoPlugin::PluginName() { - return "Vehicle Info Plugin"; + return plugins::plugin_names::vehicle_info_rpc_plugin; } app_mngr::CommandFactory& VehicleInfoPlugin::GetCommandFactory() { -- cgit v1.2.1 From 0fdfd32ff5ebeae5d6eb8f92131b235de5441236 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 7 Mar 2019 23:26:35 -0500 Subject: Update preloaded PT and fix merge issues --- .../app_service_rpc_plugin/src/app_service_mobile_command_factory.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index 572e637108..4b4da5e3e9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -47,10 +47,6 @@ #include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" #include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h" -#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h" -#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" -#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" -#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h" CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") -- cgit v1.2.1 From db9199e556ef01e3dc86b414c223c7fea5383877 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Mon, 11 Mar 2019 15:21:29 -0400 Subject: Remove unused code and headers --- .../commands/mobile/get_app_service_data_request.h | 1 - .../mobile/get_app_service_data_response_from_mobile.h | 1 - .../src/commands/hmi/as_get_app_service_data_request_to_hmi.cc | 1 - .../commands/hmi/as_get_app_service_data_response_from_hmi.cc | 2 +- .../commands/hmi/as_get_app_service_data_response_to_hmi.cc | 1 - .../src/commands/mobile/get_app_service_data_request.cc | 10 +--------- .../commands/mobile/get_app_service_data_request_to_mobile.cc | 1 - .../src/commands/mobile/get_app_service_data_response.cc | 1 - .../mobile/get_app_service_data_response_from_mobile.cc | 10 +--------- .../perform_app_service_interaction_request_to_mobile.cc | 1 - .../mobile/perform_app_service_interaction_response.cc | 1 - .../src/commands/mobile/publish_app_service_response.cc | 1 - 12 files changed, 3 insertions(+), 28 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h index 8295e855fa..70cf0dc6b9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -77,7 +77,6 @@ class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { virtual void on_event(const app_mngr::event_engine::MobileEvent& event); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h index 1411b23e5a..7e2b26d8fb 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h @@ -70,7 +70,6 @@ class GetAppServiceDataResponseFromMobile virtual void Run(); private: - AppServiceRpcPlugin* plugin_; DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponseFromMobile); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc index 822cd0a29b..635cd7319a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc @@ -33,7 +33,6 @@ #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc index 9ce6ffdb50..c0b1b274fb 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc @@ -33,7 +33,7 @@ #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" +#include "interfaces/HMI_API.h" #include "application_manager/message_helper.h" diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc index 9e2289d39e..b489ec4765 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc @@ -33,7 +33,6 @@ #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index 0d387785ee..d8ff1d8040 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -52,15 +52,7 @@ GetAppServiceDataRequest::GetAppServiceDataRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::GetAppServiceDataID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} GetAppServiceDataRequest::~GetAppServiceDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc index 2bf81b3a2d..0af1a5436b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc @@ -33,7 +33,6 @@ #include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc index df7bbba2f7..32ad8e014d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc @@ -33,7 +33,6 @@ #include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc index f8c1f3892d..90fca04eb2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc @@ -50,15 +50,7 @@ GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , plugin_(NULL) { - auto plugin = (application_manager.GetPluginManager().FindPluginToProcess( - mobile_apis::FunctionID::PublishAppServiceID, - app_mngr::commands::Command::CommandSource::SOURCE_MOBILE)); - if (plugin) { - plugin_ = dynamic_cast(&(*plugin)); - } -} + policy_handler) {} GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc index 8d71174c8d..2a7b644cb3 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc @@ -32,7 +32,6 @@ #include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc index 774ec93720..5e84f42c34 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc @@ -32,7 +32,6 @@ #include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h" #include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc index b1136c79d0..d1bfc6e154 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -34,7 +34,6 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" -#include "interfaces/MOBILE_API.h" namespace app_service_rpc_plugin { using namespace application_manager; -- cgit v1.2.1 From 30c31d0b35961079e7b84cec74e1418a9af8451a Mon Sep 17 00:00:00 2001 From: JackLivio Date: Mon, 11 Mar 2019 16:20:12 -0400 Subject: Fix onAppServiceData from mobile --- .../src/commands/mobile/on_app_service_data_notification_from_mobile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 1328e128d4..7bb62d298d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -61,7 +61,7 @@ void OnAppServiceDataNotificationFromMobile::Run() { MessageHelper::PrintSmartObject(*message_); std::string service_type = - (*message_)[strings::msg_params][strings::app_service_manifest] + (*message_)[strings::msg_params][strings::service_data] [strings::service_type].asString(); ApplicationSharedPtr app = application_manager_.application(connection_key()); -- cgit v1.2.1 From c86f4a10067bf31e96dd82bec6aa776aed846f6a Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Wed, 13 Mar 2019 10:36:18 -0400 Subject: Fix SDL.ActivateApp unit tests for EXTERNAL_PROPRIETARY build --- .../sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index a90c0c70fc..917de81fb3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -140,6 +140,8 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { std::shared_ptr command( CreateCommand(msg)); + EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID)) + .WillOnce(Return(ApplicationSharedPtr())); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, @@ -446,8 +448,10 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true)); +#ifndef EXTERNAL_PROPRIETARY_MODE EXPECT_CALL(app_mngr_, application(kAppID)) .WillOnce(Return(ApplicationSharedPtr())); +#endif EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID)) .WillOnce(Return(mock_app)); -- cgit v1.2.1 From b84c348facd194ec0f94348af1621534549320b0 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Thu, 14 Mar 2019 11:11:44 -0400 Subject: Add mock app service manager --- .../app_service_rpc_plugin/src/app_service_app_extension.cc | 8 ++++---- .../src/commands/hmi/as_get_app_service_records_request.cc | 2 +- .../commands/hmi/on_bc_system_capability_updated_notification.cc | 2 +- .../src/commands/mobile/get_system_capability_request.cc | 2 +- .../commands/mobile/on_system_capability_updated_notification.cc | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc index 63812056f1..6d8b0c08cc 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2018, Ford Motor Company + Copyright (c) 2019, Ford Motor Company, Livio All rights reserved. Redistribution and use in source and binary forms, with or without @@ -13,9 +13,9 @@ 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. + Neither the name of the the copyright holders nor the names of their + 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 diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc index 1131448d2f..6123843704 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -61,7 +61,7 @@ void ASGetAppServiceRecordsRequest::Run() { smart_objects::SmartObject records = smart_objects::SmartObject(smart_objects::SmartType_Array); std::vector service_records = - application_manager_.GetAppServiceManager().GetAllServices(); + application_manager_.GetAppServiceManager().GetAllServiceRecords(); int index = 0; for (auto& record : service_records) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 73ec1137a8..494651379f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -120,7 +120,7 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { break; case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: { auto all_services = - application_manager_.GetAppServiceManager().GetAllServices(); + application_manager_.GetAppServiceManager().GetAllServiceRecords(); auto app_service_caps = MessageHelper::CreateAppServiceCapabilities(all_services); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 63a4416139..a90c51f48a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -143,7 +143,7 @@ void GetSystemCapabilityRequest::Run() { break; case mobile_apis::SystemCapabilityType::APP_SERVICES: { auto all_services = - application_manager_.GetAppServiceManager().GetAllServices(); + application_manager_.GetAppServiceManager().GetAllServiceRecords(); response_params [strings::system_capability][strings::app_services_capabilities] = MessageHelper::CreateAppServiceCapabilities(all_services); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index b5e3a73ee4..6ab560f56c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -86,7 +86,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { break; case mobile_apis::SystemCapabilityType::APP_SERVICES: { auto all_services = - application_manager_.GetAppServiceManager().GetAllServices(); + application_manager_.GetAppServiceManager().GetAllServiceRecords(); auto app_service_caps = MessageHelper::CreateAppServiceCapabilities(all_services); -- cgit v1.2.1 From 2209cb392b84215398a929f0f4be5cb7d470684d Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 14 Mar 2019 17:00:52 -0400 Subject: OnAppServiceDataTests --- .../app_service_rpc_plugin/CMakeLists.txt | 2 +- .../app_service_rpc_plugin/test/CMakeLists.txt | 72 +++++++ .../on_app_service_data_notification_test.cc | 217 +++++++++++++++++++++ 3 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt index 2bdc150906..1e23aac8ee 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -80,5 +80,5 @@ install(TARGETS app_service_rpc_plugin ) if(BUILD_TESTS) - # add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt new file mode 100644 index 0000000000..02fb4fe4ec --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt @@ -0,0 +1,72 @@ +# Copyright (c) 2019, Livio +# 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 copyright holders nor the names of their 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. + +include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) + +include_directories ( + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${COMPONENTS_DIR}/application_manager/test/include + ${COMPONENTS_DIR}/include/test/application_manager/ + ${COMPONENTS_DIR}/resumption/include + ) + +set(APP_SERVICE_COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands) + +file(GLOB SOURCES + ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${APP_SERVICE_COMMANDS_TEST_DIR}/* + ${APP_SERVICE_COMMANDS_TEST_DIR}/mobile/* +) + +set(LIBRARIES + AppServiceRpcPluginStaticLib + ApplicationManager + connectionHandler + SmartObjects + ProtocolHandler + MessageHelper + connectionHandler + Utils + jsoncpp + gmock_main + dl + Resumption +) + +if(ENABLE_LOG) + list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) + list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) + list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) + list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY}) +endif() + +create_test("app_service_commands_test" "${SOURCES}" "${LIBRARIES}" ) + diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc new file mode 100644 index 0000000000..d501ea08ea --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2018, 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. + */ + +#include "application_manager/application.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_app_service_manager.h" +#include "application_manager/commands/commands_test.h" +#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" +#include "app_service_rpc_plugin/app_service_rpc_plugin.h" +#include "app_service_rpc_plugin/app_service_app_extension.h" +#include "gtest/gtest.h" +#include "interfaces/MOBILE_API.h" +#include "application_manager/commands/command_impl.h" +#include "resumption/last_state_impl.h" + +namespace am = application_manager; +using ::testing::_; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::ReturnNull; +using ::testing::NiceMock; +using ::testing::SaveArg; +using ::testing::Mock; +using am::ApplicationSet; +using am::commands::MessageSharedPtr; +using test::components::application_manager_test::MockApplication; +using test::components::application_manager_test::MockApplicationManager; +using test::components::application_manager_test::MockAppServiceManager; +using test::components::commands_test::CommandsTest; +using test::components::commands_test::CommandsTestMocks; +using app_service_rpc_plugin::commands::OnAppServiceDataNotification; + +namespace { +const uint32_t kAppId = 0u; +const uint32_t kConnectionKey = 1u; +const std::string kPolicyAppId = "Test"; +const int kModuleId = 153u; +} + +namespace app_service_plugin_test { +using namespace app_service_rpc_plugin; +using application_manager::ApplicationSet; + +class OnAppServiceDatanotificationTest + : public CommandsTest { + public: + OnAppServiceDatanotificationTest() + : mock_app_(std::make_shared >()) + , app_service_app_extension_( + std::make_shared( + app_service_plugin_, *mock_app_)) + , apps_lock_(std::make_shared()) + , apps_da_(apps_, apps_lock_) + , last_state_("app_storage_folder", "app_info_storage") + , app_service_manager_(app_mngr_, last_state_) { + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); + ON_CALL(*mock_app_, is_remote_control_supported()) + .WillByDefault(Return(true)); + ON_CALL(*mock_app_, QueryInterface(_)) + .WillByDefault(Return(app_service_app_extension_)); + } + + MessageSharedPtr CreateBasicMessage() { + MessageSharedPtr message = CreateMessage(); + (*message)[application_manager::strings::params] + [application_manager::strings::function_id] = + mobile_apis::FunctionID::OnAppServiceDataID; + (*message)[application_manager::strings::params] + [application_manager::strings::connection_key] = kConnectionKey; + (*message)[application_manager::strings::params] + [application_manager::strings::app_id] = kAppId; + + return message; + } + + protected: + std::shared_ptr mock_app_; + std::shared_ptr app_service_app_extension_; + app_service_rpc_plugin::AppServiceRpcPlugin app_service_plugin_; + application_manager::ApplicationSet apps_; + const std::shared_ptr apps_lock_; + DataAccessor apps_da_; + resumption::LastStateImpl last_state_; + MockAppServiceManager app_service_manager_; +}; + +TEST_F(OnAppServiceDatanotificationTest, Run_SendMessageToMobile_Notification) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + app_service_app_extension_->SubscribeToAppService("MEDIA"); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + am::AppService service; + service.connection_key = 1; + service.mobile_service = true; + service + .record[am::strings::service_manifest][am::strings::allow_app_consumers] = + true; + EXPECT_CALL(app_service_manager_, FindServiceByID(_)) + .WillOnce(Return(&service)); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr command = + CreateCommand(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)) + .WillOnce(SaveArg<0>(&mobile_message)); + // Act + command->Run(); + + // Assertions + ASSERT_TRUE(mobile_message.get()); + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +TEST_F(OnAppServiceDatanotificationTest, Run_NoService) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + app_service_app_extension_->SubscribeToAppService("MEDIA"); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + EXPECT_CALL(app_service_manager_, FindServiceByID(_)).WillOnce(ReturnNull()); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr command = + CreateCommand(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0); + command->Run(); + + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +TEST_F(OnAppServiceDatanotificationTest, Run_NoSubscribedApps) { + MessageSharedPtr mobile_message = CreateBasicMessage(); + + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_type] = "MEDIA"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + [am::strings::service_id] = "mediaid1234"; + (*mobile_message)[am::strings::msg_params][am::strings::service_data] + ["mediaServiceData"]["mediaTitle"] = "media title"; + + apps_.insert(mock_app_); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_)); + + am::AppService service; + service.connection_key = 1; + service.mobile_service = true; + service + .record[am::strings::service_manifest][am::strings::allow_app_consumers] = + true; + EXPECT_CALL(app_service_manager_, FindServiceByID(_)) + .WillOnce(Return(&service)); + + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager_)); + + std::shared_ptr command = + CreateCommand(mobile_message); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0); + command->Run(); + + Mock::VerifyAndClearExpectations(&app_mngr_); +} + +} // namespace rc_rpc_plugin_test -- cgit v1.2.1 From 2ff8225f536a1595d6a409ddeb7e46c3ec9ebb95 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 15 Mar 2019 09:40:24 -0400 Subject: Rearrange includes and make AppServiceManager methods virtual --- .../src/commands/hmi/as_app_service_activation_request.cc | 2 ++ .../src/commands/hmi/as_get_app_service_records_request.cc | 2 ++ .../commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc | 2 ++ .../src/commands/hmi/as_publish_app_service_request.cc | 2 ++ .../src/commands/mobile/on_app_service_data_notification.cc | 2 ++ .../src/commands/mobile/perform_app_service_interaction_request.cc | 2 ++ .../src/commands/mobile/publish_app_service_request.cc | 2 ++ .../src/commands/hmi/on_bc_system_capability_updated_notification.cc | 2 ++ .../rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc | 2 ++ .../sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc | 2 ++ .../src/commands/mobile/on_system_capability_updated_notification.cc | 2 ++ 11 files changed, 22 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc index 7c32d9bbe1..fd7312ca98 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc @@ -32,6 +32,8 @@ #include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h" +#include "application_manager/app_service_manager.h" + namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc index 6123843704..fa704c1995 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -32,6 +32,8 @@ #include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h" +#include "application_manager/app_service_manager.h" + namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 2b66993d8f..70a5a10be0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -31,6 +31,8 @@ */ #include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/message_helper.h" namespace app_service_rpc_plugin { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index b816016fa7..c9466ff52d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -31,6 +31,8 @@ */ #include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/message_helper.h" namespace app_service_rpc_plugin { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 2c6ba414e0..fd3891e0e8 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -31,7 +31,9 @@ */ #include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h" + #include "app_service_rpc_plugin/app_service_app_extension.h" +#include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" #include "application_manager/helpers/application_helper.h" #include "application_manager/message_helper.h" diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 9e262f0ca3..989b57ca12 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -31,6 +31,8 @@ */ #include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 22d8e50c3a..171c10913e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -31,6 +31,8 @@ */ #include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 494651379f..0677c97db8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -31,6 +31,8 @@ */ #include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index 2b3611fece..2c92d74b47 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -31,6 +31,8 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_file_request.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/application_impl.h" #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index a90c51f48a..2a25928b97 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -31,7 +31,9 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h" + #include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" +#include "application_manager/app_service_manager.h" #include "application_manager/message_helper.h" #include diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index 6ab560f56c..a8544ae643 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -1,4 +1,6 @@ #include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h" + +#include "application_manager/app_service_manager.h" #include "application_manager/application_manager.h" #include "application_manager/helpers/application_helper.h" #include "application_manager/message_helper.h" -- cgit v1.2.1 From 02d737241c5024c51d9fef20223b49afff5817f1 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 16 Mar 2019 12:06:30 -0400 Subject: API changes to app service manager --- .../src/commands/hmi/as_publish_app_service_request.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index c9466ff52d..6d2f516f0f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -62,7 +62,7 @@ void ASPublishAppServiceRequest::Run() { (*message_)[strings::msg_params][strings::app_service_manifest]; smart_objects::SmartObject service_record = application_manager_.GetAppServiceManager().PublishAppService( - manifest, false, UINT32_MAX); + manifest, false); response_params[strings::app_service_record] = service_record; SendResponse(true, -- cgit v1.2.1 From 7b3aaabb4543a8a6363761435bb1d43e060b7c19 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 16 Mar 2019 16:46:24 -0400 Subject: Make DefaultServiceByType private Also fix unnecessary `application_manager_impl.h` includes --- .../commands/hmi/basic_communication_get_system_time_response.h | 2 +- .../sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h | 2 +- .../rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc | 1 - .../rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc | 2 ++ 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h index 90160d9953..3a97ebdfb5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h @@ -36,7 +36,7 @@ #include "application_manager/commands/response_from_hmi.h" #include "utils/macro.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h index 0beba8dc6b..7cd8410d8e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_TIME_READY_NOTIFICATION_H_ #include "application_manager/commands/notification_from_hmi.h" -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index 2c92d74b47..a582670426 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -37,7 +37,6 @@ #include "application_manager/rpc_service.h" #include "interfaces/MOBILE_API.h" #include "application_manager/message_helper.h" -#include "application_manager/app_service_manager.h" #include "utils/file_system.h" #include diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 3cfe4d7118..fb809e8834 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -248,6 +248,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; +CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory") + HMICommandFactory::HMICommandFactory( ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, -- cgit v1.2.1 From b9d5a91818e253da2fe94e344bb1fb92b4555d3e Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 16 Mar 2019 16:48:52 -0400 Subject: Fix style and add more tests --- .../src/commands/hmi/as_publish_app_service_request.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 6d2f516f0f..637240666d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -61,8 +61,8 @@ void ASPublishAppServiceRequest::Run() { smart_objects::SmartObject manifest = (*message_)[strings::msg_params][strings::app_service_manifest]; smart_objects::SmartObject service_record = - application_manager_.GetAppServiceManager().PublishAppService( - manifest, false); + application_manager_.GetAppServiceManager().PublishAppService(manifest, + false); response_params[strings::app_service_record] = service_record; SendResponse(true, -- cgit v1.2.1 From e169090156eb89a060088df093b254599d4b4c68 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 16 Mar 2019 17:00:27 -0400 Subject: Add safety checks in PerformAppServiceInteraction and GetAppServiceData --- .../commands/mobile/get_app_service_data_request.h | 2 ++ .../mobile/get_app_service_data_request.cc | 22 +++++++++++++++------- .../perform_app_service_interaction_request.cc | 9 +++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h index 70cf0dc6b9..7c80ec5e03 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -77,6 +77,8 @@ class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { virtual void on_event(const app_mngr::event_engine::MobileEvent& event); private: + void HandleSubscribe(); + DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index d8ff1d8040..7b29160692 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -59,13 +59,20 @@ GetAppServiceDataRequest::~GetAppServiceDataRequest() {} void GetAppServiceDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); + SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*message_), + true); +} + +void GetAppServiceDataRequest::HandleSubscribe() { std::string service_type = (*message_)[strings::msg_params][strings::service_type].asString(); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { bool subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool(); + ApplicationSharedPtr app = + application_manager_.application(connection_key()); auto& ext = AppServiceAppExtension::ExtractASExtension(*app); if (subscribe) { ext.SubscribeToAppService(service_type); @@ -73,11 +80,6 @@ void GetAppServiceDataRequest::Run() { ext.UnsubscribeFromAppService(service_type); } } - - SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, - hmi_apis::FunctionID::AppService_GetAppServiceData, - &(*message_), - true); } void GetAppServiceDataRequest::on_event( @@ -89,6 +91,9 @@ void GetAppServiceDataRequest::on_event( mobile_apis::Result::eType result = static_cast( msg_params[strings::result_code].asInt()); bool success = IsMobileResultSuccess(result); + if (success) { + HandleSubscribe(); + } const char* info = msg_params.keyExists(strings::info) ? msg_params[strings::info].asCharArray() @@ -110,6 +115,9 @@ void GetAppServiceDataRequest::on_event(const event_engine::Event& event) { MessageHelper::HMIToMobileResult(hmi_result); bool success = PrepareResultForMobileResponse( hmi_result, HmiInterfaces::HMI_INTERFACE_AppService); + if (success) { + HandleSubscribe(); + } const char* info = msg_params.keyExists(strings::info) ? msg_params[strings::info].asCharArray() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 989b57ca12..4046ac7379 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -75,6 +75,15 @@ void PerformAppServiceInteractionRequest::Run() { return; } + if (!service->record[strings::service_manifest][strings::allow_app_consumers] + .asBool()) { + SendResponse( + false, + mobile_apis::Result::REJECTED, + "The requested service ID does not allow mobile app consumers"); + return; + } + bool request_service_active = false; if (msg_params.keyExists(strings::request_service_active)) { request_service_active = -- cgit v1.2.1 From 04edfb6b21232dffb3598feca80e2f8e2bf7783c Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Sat, 16 Mar 2019 17:40:17 -0400 Subject: App service mobile and hmi command creation unit tests (#2843) * Created dummy_command_tests for app_service_rpc_plugin and added other App Service related RPCs * Set expectation that shared_ptr for command was succesfully created in dummy_command_tests --- .../app_service_rpc_plugin/CMakeLists.txt | 2 +- .../app_service_rpc_plugin/test/CMakeLists.txt | 37 +++++ .../test/commands/hmi/dummy_hmi_commands_test.cc | 151 +++++++++++++++++++++ .../commands/mobile/dummy_mobile_commands_test.cc | 135 ++++++++++++++++++ .../test/commands/hmi/dummy_hmi_commands_test.cc | 16 ++- .../commands/mobile/dummy_mobile_commands_test.cc | 30 ++-- 6 files changed, 352 insertions(+), 19 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt index 2bdc150906..1e23aac8ee 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -80,5 +80,5 @@ install(TARGETS app_service_rpc_plugin ) if(BUILD_TESTS) - # add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt new file mode 100644 index 0000000000..63b52da062 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt @@ -0,0 +1,37 @@ +include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) + +include_directories( + ${GMOCK_INCLUDE_DIRECTORY} + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/ + ${COMPONENTS_DIR}/application_manager/test/include/ + ${POLICY_MOCK_INCLUDE_PATH}/ + ${CMAKE_SOURCE_DIR}/src +) + + +set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands) + +file(GLOB SOURCES + ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc + ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc + ${COMMANDS_TEST_DIR}/hmi/* + ${COMMANDS_TEST_DIR}/mobile/* + ${COMPONENTS_DIR}/application_manager/src/message.cc + ${COMPONENTS_DIR}/application_manager/src/event_engine/* +) + +set(LIBRARIES + gmock + Utils + SmartObjects + HMI_API + MOBILE_API + connectionHandler + app_service_rpc_plugin + jsoncpp + Policy +) + +create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" ) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc new file mode 100644 index 0000000000..8ef87b6de9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2018, 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. + */ + +#include "application_manager/commands/command_request_test.h" + +#include +#include +#include +#include "gtest/gtest.h" + +#include "hmi/as_app_service_activation_request.h" +#include "hmi/as_app_service_activation_response.h" +#include "hmi/as_get_active_service_consent_request.h" +#include "hmi/as_get_active_service_consent_response.h" +#include "hmi/as_get_app_service_data_request_from_hmi.h" +#include "hmi/as_get_app_service_data_request_to_hmi.h" +#include "hmi/as_get_app_service_data_response_from_hmi.h" +#include "hmi/as_get_app_service_data_response_to_hmi.h" +#include "hmi/as_get_app_service_records_request.h" +#include "hmi/as_get_app_service_records_response.h" +#include "hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_request_to_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_to_hmi.h" +#include "hmi/as_publish_app_service_request.h" +#include "hmi/as_publish_app_service_response.h" +#include "hmi/on_as_app_service_data_notification.h" +#include "hmi/on_as_app_service_data_notification_from_hmi.h" + +#include "application_manager/commands/commands_test.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace am = application_manager; + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace dummy_hmi_commands_test { + +namespace commands = app_service_rpc_plugin::commands; + +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; +using application_manager::commands::MessageSharedPtr; +using ::test::components::event_engine_test::MockEventDispatcher; +using ::test::components::application_manager_test::MockApplicationManager; +using ::test::components::application_manager_test:: + MockApplicationManagerSettings; +using ::application_manager::ApplicationSharedPtr; +using ::test::components::application_manager_test::MockApplication; + +template +class HMICommandsTest : public components::commands_test::CommandRequestTest< + CommandsTestMocks::kIsNice> { + public: + typedef Command CommandType; + + void InitCommand(const uint32_t& timeout) OVERRIDE { + stream_retry_.first = 0; + stream_retry_.second = 0; + EXPECT_CALL(app_mngr_settings_, default_timeout()) + .WillOnce(ReturnRef(timeout)); + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, start_stream_retry_amount()) + .WillByDefault(ReturnRef(stream_retry_)); + } + + protected: + std::pair stream_retry_; +}; + +template +class HMICommandsTestFirst : public HMICommandsTest { + public: + using typename HMICommandsTest::CommandType; +}; + +/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few + * TYPED_TEST_CASE for HMI and mobile commands + */ + +typedef Types + HMICommandsListFirst; + +TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); + +TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr command = + this->template CreateCommand(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_hmi_commands_test +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc new file mode 100644 index 0000000000..3c8a780128 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2018, 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. + */ + +#include "application_manager/commands/command_request_test.h" + +#include +#include +#include +#include "gtest/gtest.h" + +#include "mobile/get_app_service_data_request.h" +#include "mobile/get_app_service_data_request_to_mobile.h" +#include "mobile/get_app_service_data_response.h" +#include "mobile/get_app_service_data_response_from_mobile.h" +#include "mobile/on_app_service_data_notification.h" +#include "mobile/on_app_service_data_notification_from_mobile.h" +#include "mobile/perform_app_service_interaction_request.h" +#include "mobile/perform_app_service_interaction_request_to_mobile.h" +#include "mobile/perform_app_service_interaction_response.h" +#include "mobile/perform_app_service_interaction_response_from_mobile.h" +#include "mobile/publish_app_service_request.h" +#include "mobile/publish_app_service_response.h" + +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "test/application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" + +namespace am = application_manager; + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace dummy_mobile_commands_test { + +namespace commands = app_service_rpc_plugin::commands; +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; +using am::commands::MessageSharedPtr; +using ::test::components::event_engine_test::MockEventDispatcher; +using ::test::components::application_manager_test::MockApplicationManager; +using ::test::components::application_manager_test:: + MockApplicationManagerSettings; +using ::application_manager::ApplicationSharedPtr; +using ::test::components::application_manager_test::MockApplication; + +namespace { +const std::string kEmptyString_ = ""; +} // namespace + +template +class MobileCommandsTest : public components::commands_test::CommandRequestTest< + CommandsTestMocks::kIsNice> { + public: + typedef Command CommandType; + + void InitCommand(const uint32_t& timeout) OVERRIDE { + EXPECT_CALL(app_mngr_settings_, default_timeout()) + .WillOnce(ReturnRef(timeout)); + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, app_icons_folder()) + .WillByDefault(ReturnRef(kEmptyString_)); + } +}; + +template +class MobileCommandsTestFirst : public MobileCommandsTest { + public: + using typename MobileCommandsTest::CommandType; +}; + +/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few + * TYPED_TEST_CASE for HMI and mobile commands + */ + +typedef Types MobileCommandsListFirst; + +TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst); + +TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr command = + this->template CreateCommand(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_mobile_commands_test +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index a6497ca6e1..874d27b4b0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -223,6 +223,8 @@ #include "hmi/on_tts_reset_timeout_notification.h" #include "hmi/dial_number_request.h" #include "hmi/dial_number_response.h" +#include "hmi/bc_get_file_path_request.h" +#include "hmi/bc_get_file_path_response.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -496,7 +498,9 @@ typedef Types HMICommandsListFifth; + commands::AllowAppResponse, + commands::BCGetFilePathRequest, + commands::BCGetFilePathResponse> HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond); @@ -507,30 +511,30 @@ TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth); TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_hmi_commands_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc index 8589cbb6be..9c20143c39 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -62,6 +62,8 @@ #include "mobile/end_audio_pass_thru_request.h" #include "mobile/end_audio_pass_thru_response.h" #include "mobile/generic_response.h" +#include "mobile/get_file_request.h" +#include "mobile/get_file_response.h" #include "mobile/get_way_points_request.h" #include "mobile/get_way_points_response.h" #include "mobile/list_files_request.h" @@ -78,6 +80,7 @@ #include "mobile/on_keyboard_input_notification.h" #include "mobile/on_language_change_notification.h" #include "mobile/on_permissions_change_notification.h" +#include "mobile/on_system_capability_updated_notification.h" #include "mobile/on_system_request_notification.h" #include "mobile/on_tbt_client_state_notification.h" #include "mobile/on_touch_event_notification.h" @@ -220,6 +223,8 @@ typedef Types + commands::mobile::OnSystemCapabilityUpdatedNotification> MobileCommandsListFirst; -typedef Types MobileCommandsListSecond; + commands::UnregisterAppInterfaceRequest> MobileCommandsListSecond; -typedef Types MobileCommandsListThird; @@ -294,18 +300,18 @@ TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird); TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_mobile_commands_test -- cgit v1.2.1 From 57c4c45dc343217c25b6fd0985516d35326363af Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sun, 17 Mar 2019 09:48:58 -0400 Subject: Fix build failure after merge --- .../rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt index 63b52da062..97d2efaf07 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt @@ -30,6 +30,7 @@ set(LIBRARIES MOBILE_API connectionHandler app_service_rpc_plugin + sdl_rpc_plugin jsoncpp Policy ) -- cgit v1.2.1 From 14b83db71c0fd4249f5753134a33e4e36f6a775f Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sun, 17 Mar 2019 10:50:10 -0400 Subject: Add null check for app in HandleSubscribe --- .../src/commands/mobile/get_app_service_data_request.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index 7b29160692..7c2e62abe2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -68,11 +68,10 @@ void GetAppServiceDataRequest::Run() { void GetAppServiceDataRequest::HandleSubscribe() { std::string service_type = (*message_)[strings::msg_params][strings::service_type].asString(); - if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { + ApplicationSharedPtr app = application_manager_.application(connection_key()); + if (app && (*message_)[strings::msg_params].keyExists(strings::subscribe)) { bool subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool(); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); auto& ext = AppServiceAppExtension::ExtractASExtension(*app); if (subscribe) { ext.SubscribeToAppService(service_type); -- cgit v1.2.1 From 36b383be1c8dd77218d0954e7851389c1de71f08 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sun, 17 Mar 2019 15:15:16 -0400 Subject: Address comments --- .../commands/mobile/on_app_service_data_notification_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc index d501ea08ea..47358ef631 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc @@ -70,10 +70,10 @@ namespace app_service_plugin_test { using namespace app_service_rpc_plugin; using application_manager::ApplicationSet; -class OnAppServiceDatanotificationTest +class OnAppServiceDataNotificationTest : public CommandsTest { public: - OnAppServiceDatanotificationTest() + OnAppServiceDataNotificationTest() : mock_app_(std::make_shared >()) , app_service_app_extension_( std::make_shared( @@ -113,7 +113,7 @@ class OnAppServiceDatanotificationTest MockAppServiceManager app_service_manager_; }; -TEST_F(OnAppServiceDatanotificationTest, Run_SendMessageToMobile_Notification) { +TEST_F(OnAppServiceDataNotificationTest, Run_SendMessageToMobile_Notification) { MessageSharedPtr mobile_message = CreateBasicMessage(); (*mobile_message)[am::strings::msg_params][am::strings::service_data] @@ -152,7 +152,7 @@ TEST_F(OnAppServiceDatanotificationTest, Run_SendMessageToMobile_Notification) { Mock::VerifyAndClearExpectations(&app_mngr_); } -TEST_F(OnAppServiceDatanotificationTest, Run_NoService) { +TEST_F(OnAppServiceDataNotificationTest, Run_NoService) { MessageSharedPtr mobile_message = CreateBasicMessage(); (*mobile_message)[am::strings::msg_params][am::strings::service_data] @@ -180,7 +180,7 @@ TEST_F(OnAppServiceDatanotificationTest, Run_NoService) { Mock::VerifyAndClearExpectations(&app_mngr_); } -TEST_F(OnAppServiceDatanotificationTest, Run_NoSubscribedApps) { +TEST_F(OnAppServiceDataNotificationTest, Run_NoSubscribedApps) { MessageSharedPtr mobile_message = CreateBasicMessage(); (*mobile_message)[am::strings::msg_params][am::strings::service_data] -- cgit v1.2.1 From 645b370783a3e93361d1bd88069f3a2cc0481ba7 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 22 Mar 2019 15:06:25 -0400 Subject: Change is_foreground() usages to IsFullscreen() --- .../src/commands/mobile/perform_app_service_interaction_request.cc | 2 +- .../src/commands/mobile/publish_app_service_request.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 4046ac7379..63b6e47d8e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -95,7 +95,7 @@ void PerformAppServiceInteractionRequest::Run() { bool activate_service = request_service_active && !service->record[strings::service_active].asBool(); if (activate_service) { - if (app->is_foreground()) { + if (app->IsFullscreen()) { // App is in foreground, we can just activate the service application_manager_.GetAppServiceManager().ActivateAppService( service_id); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 171c10913e..bb0855d42f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -111,7 +111,7 @@ void PublishAppServiceRequest::Run() { smart_objects::SmartObject service_record = application_manager_.GetAppServiceManager().PublishAppService( manifest, true, connection_key()); - if (app->is_foreground()) { + if (app->IsFullscreen()) { // Service should be activated if app is in the foreground application_manager_.GetAppServiceManager().ActivateAppService( service_record[strings::service_id].asString()); -- cgit v1.2.1 From 31041084b3ded5367a97060c081976e9e3251985 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Mon, 1 Apr 2019 16:24:58 -0400 Subject: Add timeout logic for HMI App Service Consumer RPCs --- .../commands/hmi/as_get_app_service_data_request_from_hmi.h | 5 +++++ .../as_perform_app_service_interaction_request_from_hmi.h | 5 +++++ .../hmi/as_get_app_service_data_request_from_hmi.cc | 12 ++++++++++++ .../as_perform_app_service_interaction_request_from_hmi.cc | 13 +++++++++++++ 4 files changed, 35 insertions(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h index 847b921502..7b175fc0d4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h @@ -68,6 +68,11 @@ class ASGetAppServiceDataRequestFromHMI **/ virtual void Run(); + /** + * @brief onTimeOut from request controller + */ + virtual void onTimeOut(); + /** * @brief on_event allows to handle events * diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h index 775bb9f812..36acf116f4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h @@ -83,6 +83,11 @@ class ASPerformAppServiceInteractionRequestFromHMI */ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE; + /** + * @brief onTimeOut from request controller + */ + virtual void onTimeOut(); + private: DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index 5cdbbfc012..a339ffb9a6 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -110,5 +110,17 @@ void ASGetAppServiceDataRequestFromHMI::on_event( application_manager::commands::Command::SOURCE_SDL_TO_HMI); } +void ASGetAppServiceDataRequestFromHMI::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject response_params; + response_params[strings::info] = + "The provider did not respond to the request"; + SendErrorResponse(correlation_id(), + hmi_apis::FunctionID::AppService_GetAppServiceData, + hmi_apis::Common_Result::GENERIC_ERROR, + "The provider did not respond to the request", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + } // namespace commands } // namespace app_service_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 70a5a10be0..1588845274 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -153,5 +153,18 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event( application_manager::commands::Command::SOURCE_SDL_TO_HMI); } +void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObject response_params; + response_params[strings::info] = + "The provider did not respond to the request"; + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::GENERIC_ERROR, + "The provider did not respond to the request", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); +} + } // namespace commands } // namespace app_service_rpc_plugin -- cgit v1.2.1 From 7a10720c6c3e0e008462706c40e68403b8ed40c7 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Tue, 2 Apr 2019 10:01:20 -0400 Subject: HMI.UnsubscribeWayPoints logic fix (#2869) --- .../commands/mobile/unsubscribe_way_points_request.cc | 17 ++++++++++++++--- .../mobile/unsubscribe_way_points_request_test.cc | 5 +++++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc index 40bb1ddfc9..4b40b7a9ce 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc @@ -71,9 +71,20 @@ void UnsubscribeWayPointsRequest::Run() { return; } - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); + std::set subscribed_apps = + application_manager_.GetAppsSubscribedForWayPoints(); + + if (subscribed_apps.size() > 1) { + // More than 1 subscribed app, don't send HMI unsubscribe request + application_manager_.UnsubscribeAppFromWayPoints(app); + SendResponse(true, mobile_apis::Result::SUCCESS, NULL); + return; + } else { + // Only subscribed app, send HMI unsubscribe request + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); + } } void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc index 818ee06e96..05e15a78af 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -122,6 +122,11 @@ TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { ::testing::Matcher(mock_app))) .WillOnce(Return(true)); + const std::set subscribed_apps{kConnectionKey}; + + EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints()) + .WillOnce(Return(subscribed_apps)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand( HMIResultCodeIs( -- cgit v1.2.1 From 53fc68a800da61123a1e5f34d17912e01630060c Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 4 Apr 2019 14:05:04 -0400 Subject: Fix Icon Url Corner Cases (#2875) * Add missing return * Check if correlation id < 1 for requests * Add clarifying comment --- .../rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index da39aefd6a..ca9182469a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -543,6 +543,7 @@ void SystemRequest::Run() { if (file_name.empty()) { const std::string err_msg = "Invalid file name"; SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); + return; } LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name); } else { -- cgit v1.2.1 From bf33c29fd8e712bf3c6f0cc6177fcb902a01b69b Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Tue, 9 Apr 2019 14:18:07 -0400 Subject: Error Response for AppService.GetAppServiceData with unknown service type/service id (#2880) * Added error response for AppService.GetAppServiceData request with unknown service type * Addressed review comments --- ...orm_app_service_interaction_request_from_hmi.cc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/components/application_manager/rpc_plugins') diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 1588845274..6499b08c28 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -63,15 +63,11 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() { application_manager_.get_settings().hmi_origin_id(); if (!msg_params.keyExists(strings::origin_app)) { if (hmi_origin_id.empty()) { - smart_objects::SmartObject response_params; - response_params[strings::info] = - "No HMI origin ID to use for interaction passthrough"; - SendResponse( - false, + SendErrorResponse( correlation_id(), hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, hmi_apis::Common_Result::INVALID_DATA, - &response_params, + "No HMI origin ID to use for interaction passthrough", application_manager::commands::Command::SOURCE_SDL_TO_HMI); return; } @@ -82,14 +78,12 @@ void ASPerformAppServiceInteractionRequestFromHMI::Run() { auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - smart_objects::SmartObject response_params; - response_params[strings::info] = "The requested service ID does not exist"; - SendResponse(false, - correlation_id(), - hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, - hmi_apis::Common_Result::INVALID_ID, - &response_params, - application_manager::commands::Command::SOURCE_SDL_TO_HMI); + SendErrorResponse( + correlation_id(), + hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, + hmi_apis::Common_Result::INVALID_ID, + "The requested service ID does not exist", + application_manager::commands::Command::SOURCE_SDL_TO_HMI); return; } -- cgit v1.2.1