diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-05 18:45:53 -0500 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-05 18:45:53 -0500 |
commit | 00a12837cc8f2b334eeeed1fd033826fe772c362 (patch) | |
tree | 91cbee948a53f019c44c6294bb986d88228e059d /src/components/application_manager/rpc_plugins/app_service_rpc_plugin | |
parent | c2f835cffa63fe1c5ac37c28a8c3e89acb30e086 (diff) | |
download | sdl_core-00a12837cc8f2b334eeeed1fd033826fe772c362.tar.gz |
Add logic for handling `allowAppConsumers`
Diffstat (limited to 'src/components/application_manager/rpc_plugins/app_service_rpc_plugin')
-rw-r--r-- | src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc | 24 |
1 files changed, 22 insertions, 2 deletions
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) { |