summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-02-24 14:28:12 -0500
committerGitHub <noreply@github.com>2019-02-24 14:28:12 -0500
commitaa8ad39cc936c7de63818d4307d8ac6a4dff5530 (patch)
treea68556366fb073b1ee238e0a834835ff33ad09c0 /src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
parentc1a903b5fe0831044b5e88dc4d27b0160b703955 (diff)
downloadsdl_core-aa8ad39cc936c7de63818d4307d8ac6a4dff5530.tar.gz
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
Diffstat (limited to 'src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc29
1 files changed, 28 insertions, 1 deletions
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<commands::OnASAppServiceDataNotification>();
+ 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<commands::ASGetAppServiceRecordsRequest>()
@@ -126,7 +153,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
: factory
.GetCreator<commands::ASAppServiceActivationResponse>();
default:
- LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id);
return factory.GetCreator<app_mngr::InvalidCommand>();
}
}