summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc')
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
index 25ef2a24d1..920c6fbdf9 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -35,27 +35,26 @@
#include "application_manager/message_helper.h"
#include "protocol_handler/protocol_handler.h"
-
namespace application_manager {
namespace commands {
AudioStartStreamRequest::AudioStartStreamRequest(
const MessageSharedPtr& message, ApplicationManager& application_manager)
- : RequestToHMI(message, application_manager),
- EventObserver(application_manager.event_dispatcher()),
- retry_number_(0) {
+ : RequestToHMI(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher())
+ , retry_number_(0) {
LOG4CXX_AUTO_TRACE(logger_);
std::pair<uint32_t, int32_t> stream_retry =
application_manager_.get_settings().start_stream_retry_amount();
default_timeout_ = stream_retry.second;
retry_number_ = stream_retry.first;
- LOG4CXX_DEBUG(logger_, "default_timeout_ = " << default_timeout_
- <<"; retry_number_ = " << retry_number_);
+ LOG4CXX_DEBUG(logger_,
+ "default_timeout_ = " << default_timeout_
+ << "; retry_number_ = " << retry_number_);
}
-AudioStartStreamRequest::~AudioStartStreamRequest() {
-}
+AudioStartStreamRequest::~AudioStartStreamRequest() {}
void AudioStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -64,14 +63,15 @@ void AudioStartStreamRequest::Run() {
subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream,
correlation_id());
- ApplicationSharedPtr app = application_manager_.
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (app) {
app->set_audio_streaming_allowed(true);
SendRequest();
} else {
- LOG4CXX_ERROR(logger_, "Applcation with hmi_app_id "
- << application_id() << " does not exist");
+ LOG4CXX_ERROR(logger_,
+ "Applcation with hmi_app_id " << application_id()
+ << " does not exist");
}
}
@@ -79,11 +79,11 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager_.
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
+ "StartAudioStreamRequest aborted. Application not found");
return;
}
@@ -98,12 +98,13 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == code) {
LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
- if (application_manager_.
- HMILevelAllowsStreaming(app->app_id(), ServiceType::kAudio)) {
+ if (application_manager_.HMILevelAllowsStreaming(app->app_id(),
+ ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
- LOG4CXX_WARN(logger_,
- "StartAudioStreamRequest aborted. Application can not stream");
+ LOG4CXX_WARN(
+ logger_,
+ "StartAudioStreamRequest aborted. Application can not stream");
}
break;
}
@@ -114,7 +115,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
}
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
return;
}
}
@@ -123,18 +124,17 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
void AudioStartStreamRequest::onTimeOut() {
RetryStartSession();
- application_manager_.TerminateRequest(
- connection_key(), correlation_id());
+ application_manager_.TerminateRequest(connection_key(), correlation_id());
}
void AudioStartStreamRequest::RetryStartSession() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager_.
- application_by_hmi_app(application_id());
+ ApplicationSharedPtr app =
+ application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
+ "StartAudioStreamRequest aborted. Application not found");
return;
}
@@ -144,21 +144,24 @@ void AudioStartStreamRequest::RetryStartSession() {
}
if (app->audio_streaming_approved()) {
- LOG4CXX_INFO(logger_, "AudioStartStream retry sequence stopped. "
- << "SUCCESS received");
+ LOG4CXX_INFO(logger_,
+ "AudioStartStream retry sequence stopped. "
+ << "SUCCESS received");
app->set_audio_stream_retry_number(0);
return;
}
- uint32_t curr_retry_number = app->audio_stream_retry_number();
+ uint32_t curr_retry_number = app->audio_stream_retry_number();
if (curr_retry_number < retry_number_ - 1) {
- LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry. retry_number = "
- << curr_retry_number);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Send AudioStartStream retry. retry_number = " << curr_retry_number);
MessageHelper::SendAudioStartStream(app->app_id(), application_manager_);
app->set_audio_stream_retry_number(++curr_retry_number);
} else {
- LOG4CXX_DEBUG(logger_, "Audio start stream retry sequence stopped. "
- << "Attempts expired.");
+ LOG4CXX_DEBUG(logger_,
+ "Audio start stream retry sequence stopped. "
+ << "Attempts expired.");
application_manager_.EndNaviServices(app->app_id());
}