summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-05-24 11:37:06 -0400
committerGitHub <noreply@github.com>2019-05-24 11:37:06 -0400
commit584631a2fa1305306b2bdfde17884b812c143617 (patch)
tree4e9a19aaa8006b203a45654e7fb0427f92d1f0af
parent15cc79c54b79f39e359c028a0c7bd296cd038015 (diff)
parentae78d836128922dd37eddcd7825c445acaf6b45e (diff)
downloadsdl_core-584631a2fa1305306b2bdfde17884b812c143617.tar.gz
Merge pull request #2924 from smartdevicelink/hotfix/mobile_notification_broadcasting
Check message source before constructing commands
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h14
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc93
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc88
7 files changed, 226 insertions, 73 deletions
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 4b4da5e3e9..795de4838e 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
@@ -111,9 +111,12 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
switch (function_id) {
case mobile_apis::FunctionID::PublishAppServiceID:
- return mobile_apis::messageType::request == message_type
- ? factory.GetCreator<commands::PublishAppServiceRequest>()
- : factory.GetCreator<commands::PublishAppServiceResponse>();
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::PublishAppServiceRequest>()
+ : factory.GetCreator<commands::PublishAppServiceResponse>();
+ }
+ break;
case mobile_apis::FunctionID::OnAppServiceDataID:
return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
index 56be342b56..a9cf0e2a21 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
@@ -75,12 +75,18 @@ class RCCommandFactory : public application_manager::CommandFactory {
private:
app_mngr::CommandCreator& get_mobile_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type) const;
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_mobile_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_mobile_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
app_mngr::CommandCreator& get_hmi_creator_factory(
- hmi_apis::FunctionID::eType id,
- hmi_apis::messageType::eType message_type) const;
+ const hmi_apis::FunctionID::eType id,
+ const hmi_apis::messageType::eType message_type) const;
RCCommandParams params_;
};
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 d49f3e9e36..acfc75a389 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
@@ -144,7 +144,7 @@ CommandSharedPtr RCCommandFactory::CreateCommand(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asInt());
- return get_mobile_creator_factory(function_id, message_type)
+ return get_mobile_creator_factory(function_id, message_type, source)
.create(message);
}
}
@@ -160,51 +160,90 @@ bool RCCommandFactory::IsAbleToProcess(
static_cast<hmi_apis::FunctionID::eType>(function_id),
hmi_apis::messageType::INVALID_ENUM).CanBeCreated();
} else {
- return get_mobile_creator_factory(
- static_cast<mobile_api::FunctionID::eType>(function_id),
- mobile_api::messageType::INVALID_ENUM).CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_mobile_command_creator(
+ id, mobile_apis::messageType::INVALID_ENUM).CanBeCreated() ||
+ get_mobile_notification_creator(id).CanBeCreated();
}
}
-CommandCreator& RCCommandFactory::get_mobile_creator_factory(
- mobile_api::FunctionID::eType id,
- mobile_api::messageType::eType message_type) const {
+CommandCreator& RCCommandFactory::get_mobile_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
LOG4CXX_DEBUG(logger_,
- "CreateMobileCommand function_id: " << id << " message_type: "
- << message_type);
+ "get_mobile_command_creator function_id: "
+ << id << " message_type: " << message_type);
RCCommandCreatorFactory rc_factory(params_);
-
switch (id) {
case mobile_apis::FunctionID::ButtonPressID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory.GetCreator<commands::ButtonPressRequest>()
: rc_factory.GetCreator<commands::ButtonPressResponse>();
}
case mobile_apis::FunctionID::GetInteriorVehicleDataID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory
.GetCreator<commands::GetInteriorVehicleDataRequest>()
: rc_factory
.GetCreator<commands::GetInteriorVehicleDataResponse>();
}
case mobile_apis::FunctionID::SetInteriorVehicleDataID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory
.GetCreator<commands::SetInteriorVehicleDataRequest>()
: rc_factory
.GetCreator<commands::SetInteriorVehicleDataResponse>();
}
+ default: {}
+ }
+ return rc_factory.GetCreator<RCInvalidCommand>();
+}
+
+CommandCreator& RCCommandFactory::get_mobile_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ RCCommandCreatorFactory rc_factory(params_);
+ switch (id) {
case mobile_apis::FunctionID::OnInteriorVehicleDataID: {
return rc_factory
.GetCreator<commands::OnInteriorVehicleDataNotification>();
}
- default: { return rc_factory.GetCreator<RCInvalidCommand>(); }
+ default: {}
+ }
+ return rc_factory.GetCreator<RCInvalidCommand>();
+}
+
+CommandCreator& RCCommandFactory::get_mobile_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ RCCommandCreatorFactory rc_factory(params_);
+ switch (message_type) {
+ case mobile_apis::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_mobile_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_mobile_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_mobile_notification_creator(id);
+ }
+ break;
+ }
+ default: {}
}
+ return rc_factory.GetCreator<RCInvalidCommand>();
}
CommandCreator& RCCommandFactory::get_hmi_creator_factory(
- hmi_apis::FunctionID::eType id,
- hmi_apis::messageType::eType message_type) const {
+ const hmi_apis::FunctionID::eType id,
+ const hmi_apis::messageType::eType message_type) const {
LOG4CXX_DEBUG(logger_,
"CreateHMICommand function_id: " << id << " message_type: "
<< message_type);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
index f0840dde41..44a4475b62 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
@@ -59,9 +59,16 @@ class MobileCommandFactory : public app_mngr::CommandFactory {
private:
app_mngr::CommandCreator& get_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type,
- app_mngr::commands::Command::CommandSource source) const;
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
+ app_mngr::CommandCreator& get_notification_from_mobile_creator(
+ const mobile_apis::FunctionID::eType id) const;
app_mngr::ApplicationManager& application_manager_;
app_mngr::rpc_service::RPCService& rpc_service_;
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 554d004360..fbbe5183df 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
@@ -137,13 +137,11 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
namespace sdl_rpc_plugin {
using namespace application_manager;
-CommandCreator& MobileCommandFactory::get_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type,
- app_mngr::commands::Command::CommandSource source) const {
+CommandCreator& MobileCommandFactory::get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
CommandCreatorFactory factory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
-
switch (id) {
case mobile_apis::FunctionID::RegisterAppInterfaceID: {
return mobile_api::messageType::request == message_type
@@ -182,7 +180,6 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::AddSubMenuRequest>()
: factory.GetCreator<commands::AddSubMenuResponse>();
}
-
case mobile_apis::FunctionID::DeleteSubMenuID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteSubMenuRequest>()
@@ -215,7 +212,6 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::PerformAudioPassThruRequest>()
: factory.GetCreator<commands::PerformAudioPassThruResponse>();
}
-
case mobile_apis::FunctionID::CreateInteractionChoiceSetID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<
@@ -298,7 +294,6 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::ScrollableMessageRequest>()
: factory.GetCreator<commands::ScrollableMessageResponse>();
}
-
case mobile_apis::FunctionID::AlertManeuverID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::AlertManeuverRequest>()
@@ -361,6 +356,20 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
: factory
.GetCreator<commands::GetCloudAppPropertiesResponse>();
}
+ case mobile_apis::FunctionID::GenericResponseID: {
+ using app_mngr::commands::Command;
+ return factory.GetCreator<commands::GenericResponse>();
+ }
+ default: {}
+ }
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ switch (id) {
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}
@@ -391,11 +400,7 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
return factory.GetCreator<commands::OnPermissionsChangeNotification>();
}
case mobile_apis::FunctionID::OnHMIStatusID: {
- using app_mngr::commands::Command;
- return Command::CommandSource::SOURCE_MOBILE == source
- ? factory.GetCreator<
- commands::OnHMIStatusNotificationFromMobile>()
- : factory.GetCreator<commands::OnHMIStatusNotification>();
+ return factory.GetCreator<commands::OnHMIStatusNotification>();
}
case mobile_apis::FunctionID::OnKeyboardInputID: {
return factory
@@ -413,19 +418,60 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
.GetCreator<commands::mobile::OnSystemRequestNotification>();
}
case mobile_apis::FunctionID::OnHashChangeID: {
- using app_mngr::commands::Command;
return factory.GetCreator<commands::mobile::OnHashChangeNotification>();
}
case mobile_apis::FunctionID::OnWayPointChangeID: {
- using app_mngr::commands::Command;
return factory.GetCreator<commands::OnWayPointChangeNotification>();
}
- case mobile_apis::FunctionID::GenericResponseID: {
- using app_mngr::commands::Command;
- return factory.GetCreator<commands::GenericResponse>();
+ default: {}
+ }
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ switch (id) {
+ case mobile_apis::FunctionID::OnHMIStatusID: {
+ return factory.GetCreator<commands::OnHMIStatusNotificationFromMobile>();
}
- default: { return factory.GetCreator<InvalidCommand>(); }
+ default: {}
+ }
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ switch (message_type) {
+ case mobile_api::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_api::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_api::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_notification_creator(id);
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE ==
+ source) {
+ return get_notification_from_mobile_creator(id);
+ }
+ break;
+ }
+ default: {}
}
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ return factory.GetCreator<InvalidCommand>();
}
MobileCommandFactory::MobileCommandFactory(
@@ -442,11 +488,10 @@ bool MobileCommandFactory::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource message_source)
const {
- using app_mngr::commands::Command;
- return get_creator_factory(
- static_cast<mobile_apis::FunctionID::eType>(function_id),
- mobile_apis::messageType::INVALID_ENUM,
- message_source).CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_command_creator(id, mobile_apis::messageType::INVALID_ENUM)
+ .CanBeCreated() ||
+ get_notification_creator(id).CanBeCreated();
}
CommandSharedPtr MobileCommandFactory::CreateCommand(
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
index 6cfc77a41c..d38ef6fb90 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
@@ -63,8 +63,15 @@ class VehicleInfoMobileCommandFactory : public app_mngr::CommandFactory {
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::CommandCreator& get_creator_factory(
+ const mobile_apis::FunctionID::eType function_id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
DISALLOW_COPY_AND_ASSIGN(VehicleInfoMobileCommandFactory);
};
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
index 7600afa091..41ecd451dd 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
@@ -69,8 +69,6 @@ VehicleInfoMobileCommandFactory::VehicleInfoMobileCommandFactory(
app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- UNUSED(source);
-
const mobile_apis::FunctionID::eType function_id =
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asInt());
@@ -91,54 +89,102 @@ app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand(
"HMICommandFactory::CreateCommand function_id: "
<< function_id << ", message type: " << message_type_str);
- return buildCommandCreator(function_id, message_type).create(message);
+ return get_creator_factory(function_id, message_type, source).create(message);
}
bool VehicleInfoMobileCommandFactory::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)
- .CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_command_creator(id, mobile_apis::messageType::INVALID_ENUM)
+ .CanBeCreated() ||
+ get_notification_creator(id).CanBeCreated();
}
-app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::buildCommandCreator(
- const int32_t function_id, const int32_t message_type) const {
+app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
auto factory = app_mngr::CommandCreatorFactory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
-
- switch (function_id) {
- case mobile_apis::FunctionID::GetVehicleDataID:
+ switch (id) {
+ case mobile_apis::FunctionID::GetVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::GetVehicleDataRequest>()
: factory.GetCreator<commands::GetVehicleDataResponse>();
- case mobile_apis::FunctionID::SubscribeVehicleDataID:
+ }
+ case mobile_apis::FunctionID::SubscribeVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::SubscribeVehicleDataRequest>()
: factory.GetCreator<commands::SubscribeVehicleDataResponse>();
- case mobile_apis::FunctionID::UnsubscribeVehicleDataID:
+ }
+ case mobile_apis::FunctionID::UnsubscribeVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::UnsubscribeVehicleDataRequest>()
: factory
.GetCreator<commands::UnsubscribeVehicleDataResponse>();
- case mobile_apis::FunctionID::OnVehicleDataID:
- return factory.GetCreator<commands::OnVehicleDataNotification>();
- case mobile_apis::FunctionID::ReadDIDID:
+ }
+ case mobile_apis::FunctionID::ReadDIDID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::ReadDIDRequest>()
: factory.GetCreator<commands::ReadDIDResponse>();
- case mobile_apis::FunctionID::GetDTCsID:
+ }
+ case mobile_apis::FunctionID::GetDTCsID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::GetDTCsRequest>()
: factory.GetCreator<commands::GetDTCsResponse>();
- case mobile_apis::FunctionID::DiagnosticMessageID:
+ }
+ case mobile_apis::FunctionID::DiagnosticMessageID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::DiagnosticMessageRequest>()
: factory.GetCreator<commands::DiagnosticMessageResponse>();
- default:
- LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
- return factory.GetCreator<app_mngr::InvalidCommand>();
+ }
+ default: {}
+ }
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+}
+
+app_mngr::CommandCreator&
+VehicleInfoMobileCommandFactory::get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ switch (id) {
+ case mobile_apis::FunctionID::OnVehicleDataID: {
+ return factory.GetCreator<commands::OnVehicleDataNotification>();
+ }
+ default: {}
+ }
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+}
+
+app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ switch (message_type) {
+ case mobile_apis::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_notification_creator(id);
+ }
+ break;
+ }
+ default: {}
}
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ return factory.GetCreator<app_mngr::InvalidCommand>();
}
}