diff options
Diffstat (limited to 'src/components/application_manager/src/application_manager_impl.cc')
-rw-r--r-- | src/components/application_manager/src/application_manager_impl.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index d51d4c9d06..974f125def 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -3479,6 +3479,46 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) { std::for_each(messages.begin(), messages.end(), push_allowed_messages); } +void ApplicationManagerImpl::ProcessOnDataStreamingNotification( + const protocol_handler::ServiceType service_type, + const uint32_t app_id, + const bool streaming_data_available) { + LOG4CXX_AUTO_TRACE(logger_); + + bool should_send_notification = false; + + { + sync_primitives::AutoLock lock(streaming_services_lock_); + auto& active_services = streaming_application_services_[service_type]; + should_send_notification = active_services.empty(); + if (streaming_data_available) { + active_services.insert(app_id); + LOG4CXX_DEBUG(logger_, + "Streaming session with id " + << app_id << " for service " + << static_cast<uint32_t>(service_type) + << " was added. Currently streaming sessions count: " + << active_services.size()); + } else { + active_services.erase(app_id); + should_send_notification = + !should_send_notification && active_services.empty(); + + LOG4CXX_DEBUG(logger_, + "Streaming session with id " + << app_id << " for service " + << static_cast<uint32_t>(service_type) + << " was removed. Currently streaming sessions count: " + << active_services.size()); + } + } + + if (should_send_notification) { + MessageHelper::SendOnDataStreaming( + service_type, streaming_data_available, *this); + } +} + void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, const mobile_apis::HMILevel::eType from, const mobile_apis::HMILevel::eType to) { |