diff options
Diffstat (limited to 'src/components/application_manager/src/application_impl.cc')
-rw-r--r-- | src/components/application_manager/src/application_impl.cc | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 2edf3860d6..6b4500e394 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -311,8 +311,9 @@ bool ApplicationImpl::webengine_projection_enabled() const { struct StateIDComparator { HmiState::StateID state_id_; - StateIDComparator(HmiState::StateID state_id) : state_id_(state_id) {} - bool operator()(const HmiStatePtr cur) { + explicit StateIDComparator(HmiState::StateID state_id) + : state_id_(state_id) {} + bool operator()(const HmiStatePtr cur) const { return cur->state_id() == state_id_; } }; @@ -475,10 +476,6 @@ void ApplicationImpl::set_is_media_application(bool option) { is_media_ = option; } -bool IsTTSState(const HmiStatePtr state) { - return state->state_id() == HmiState::STATE_ID_TTS_SESSION; -} - void ApplicationImpl::set_tts_properties_in_none(bool active) { tts_properties_in_none_ = active; } @@ -616,6 +613,9 @@ void ApplicationImpl::StopStreaming( void ApplicationImpl::StopNaviStreaming() { SDL_LOG_AUTO_TRACE(); video_stream_suspend_timer_.Stop(); + application_manager_.OnAppStreaming(app_id(), + protocol_handler::ServiceType::kMobileNav, + StreamingState::kStopped); MessageHelper::SendNaviStopStream(app_id(), application_manager_); set_video_streaming_approved(false); set_video_stream_retry_number(0); @@ -624,6 +624,9 @@ void ApplicationImpl::StopNaviStreaming() { void ApplicationImpl::StopAudioStreaming() { SDL_LOG_AUTO_TRACE(); audio_stream_suspend_timer_.Stop(); + application_manager_.OnAppStreaming(app_id(), + protocol_handler::ServiceType::kAudio, + StreamingState::kStopped); MessageHelper::SendAudioStopStream(app_id(), application_manager_); set_audio_streaming_approved(false); set_audio_stream_retry_number(0); @@ -634,14 +637,17 @@ void ApplicationImpl::SuspendStreaming( using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); - if (ServiceType::kMobileNav == service_type) { + if (ServiceType::kMobileNav == service_type && !video_streaming_suspended_) { video_stream_suspend_timer_.Stop(); - application_manager_.OnAppStreaming(app_id(), service_type, false); + application_manager_.OnAppStreaming( + app_id(), service_type, StreamingState::kSuspended); sync_primitives::AutoLock lock(video_streaming_suspended_lock_); video_streaming_suspended_ = true; - } else if (ServiceType::kAudio == service_type) { + } else if (ServiceType::kAudio == service_type && + !audio_streaming_suspended_) { audio_stream_suspend_timer_.Stop(); - application_manager_.OnAppStreaming(app_id(), service_type, false); + application_manager_.OnAppStreaming( + app_id(), service_type, StreamingState::kSuspended); sync_primitives::AutoLock lock(audio_streaming_suspended_lock_); audio_streaming_suspended_ = true; } @@ -650,7 +656,7 @@ void ApplicationImpl::SuspendStreaming( } void ApplicationImpl::WakeUpStreaming( - protocol_handler::ServiceType service_type, uint32_t timer_len) { + protocol_handler::ServiceType service_type) { using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); @@ -660,30 +666,31 @@ void ApplicationImpl::WakeUpStreaming( if (ServiceType::kMobileNav == service_type) { { // reduce the range of video_streaming_suspended_lock_ - sync_primitives::AutoLock lock(video_streaming_suspended_lock_); + sync_primitives::AutoLock auto_lock(video_streaming_suspended_lock_); if (video_streaming_suspended_) { - application_manager_.OnAppStreaming(app_id(), service_type, true); + application_manager_.OnAppStreaming( + app_id(), service_type, StreamingState::kStarted); application_manager_.ProcessOnDataStreamingNotification( service_type, app_id(), true); video_streaming_suspended_ = false; } } - video_stream_suspend_timer_.Start( - timer_len == 0 ? video_stream_suspend_timeout_ : timer_len, - timer::kPeriodic); + + video_stream_suspend_timer_.Start(video_stream_suspend_timeout_, + timer::kPeriodic); } else if (ServiceType::kAudio == service_type) { { // reduce the range of audio_streaming_suspended_lock_ - sync_primitives::AutoLock lock(audio_streaming_suspended_lock_); + sync_primitives::AutoLock auto_lock(audio_streaming_suspended_lock_); if (audio_streaming_suspended_) { - application_manager_.OnAppStreaming(app_id(), service_type, true); + application_manager_.OnAppStreaming( + app_id(), service_type, StreamingState::kStarted); application_manager_.ProcessOnDataStreamingNotification( service_type, app_id(), true); audio_streaming_suspended_ = false; } } - audio_stream_suspend_timer_.Start( - timer_len == 0 ? audio_stream_suspend_timeout_ : timer_len, - timer::kPeriodic); + audio_stream_suspend_timer_.Start(audio_stream_suspend_timeout_, + timer::kPeriodic); } } @@ -940,10 +947,7 @@ bool ApplicationImpl::AreCommandLimitsExceeded( limit.first = current; limit.second = 1; - return false; - - break; } // In case of policy table values, there is EVEN limitation for number of // commands per minute, e.g. 10 command per minute i.e. 1 command per 6 sec @@ -984,7 +988,6 @@ bool ApplicationImpl::AreCommandLimitsExceeded( cmd_number_to_time_limits_[cmd_id] = {current, dummy_limit}; return false; - break; } default: { SDL_LOG_WARN("Limit source is not implemented."); @@ -1163,10 +1166,10 @@ void ApplicationImpl::SubscribeToSoftButtons( struct FindSoftButtonId { uint32_t soft_button_id_; - FindSoftButtonId(const uint32_t soft_button_id) + explicit FindSoftButtonId(const uint32_t soft_button_id) : soft_button_id_(soft_button_id) {} - bool operator()(const std::pair<uint32_t, WindowID>& element) { + bool operator()(const std::pair<uint32_t, WindowID>& element) const { return soft_button_id_ == element.first; } }; |