summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/application_manager_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/application_manager_impl.cc')
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc81
1 files changed, 15 insertions, 66 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index f23600f46b..0b10da9e35 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -45,6 +45,7 @@
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service_impl.h"
#include "application_manager/rpc_handler_impl.h"
+#include "application_manager/sdl_command_factory.h"
#include "application_manager/mobile_message_handler.h"
#include "application_manager/policies/policy_handler.h"
#include "application_manager/hmi_capabilities_impl.h"
@@ -159,7 +160,6 @@ ApplicationManagerImpl::ApplicationManagerImpl(
, request_ctrl_(am_settings)
, hmi_so_factory_(NULL)
, mobile_so_factory_(NULL)
- , audio_pass_thru_messages_("AudioPassThru", this)
, hmi_capabilities_(new HMICapabilitiesImpl(*this))
, unregister_reason_(
mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM)
@@ -489,7 +489,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
mobile_apis::FunctionID::RegisterAppInterfaceID,
message[strings::params][strings::correlation_id].asUInt(),
mobile_apis::Result::GENERIC_ERROR));
- rpc_service_->ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
+ rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL);
return ApplicationSharedPtr();
}
@@ -521,7 +521,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
mobile_apis::FunctionID::RegisterAppInterfaceID,
message[strings::params][strings::correlation_id].asUInt(),
mobile_apis::Result::DISALLOWED));
- rpc_service_->ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
+ rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL);
return ApplicationSharedPtr();
}
@@ -540,7 +540,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
mobile_apis::FunctionID::RegisterAppInterfaceID,
message[strings::params][strings::correlation_id].asUInt(),
mobile_apis::Result::OUT_OF_MEMORY));
- rpc_service_->ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
+ rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL);
return ApplicationSharedPtr();
}
@@ -887,23 +887,6 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
session_key, get_settings().recording_file_name(), max_duration);
}
-void ApplicationManagerImpl::SendAudioPassThroughNotification(
- uint32_t session_key, std::vector<uint8_t>& binary_data) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!audio_pass_thru_active_) {
- LOG4CXX_ERROR(logger_,
- "Trying to send PassThroughNotification"
- " when PassThrough is not active");
- return;
- }
-
- impl::AudioData data;
- data.session_key = session_key;
- data.binary_data = binary_data;
- audio_pass_thru_messages_.PostMessage(data);
-}
-
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
@@ -1597,7 +1580,7 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
rpc_service_->ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
session_key, AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS),
- commands::Command::ORIGIN_SDL);
+ commands::Command::SOURCE_SDL);
break;
}
case CloseSessionReason::kMalformed: {
@@ -1719,6 +1702,8 @@ void ApplicationManagerImpl::set_protocol_handler(
protocol_handler_,
hmi_handler_,
*commands_holder_));
+ command_factory_.reset(new SDLCommandFactory(
+ *this, *rpc_service_, *hmi_capabilities_, *policy_handler_));
}
void ApplicationManagerImpl::StartDevicesDiscovery() {
@@ -2432,7 +2417,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
rpc_service_->ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app_to_remove->app_id(), unregister_reason_),
- commands::Command::ORIGIN_SDL);
+ commands::Command::SOURCE_SDL);
UnregisterApplication(app_to_remove->app_id(),
mobile_apis::Result::INVALID_ENUM,
is_ignition_off,
@@ -2598,46 +2583,6 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
connection_handler::kUnauthorizedApp);
}
-void ApplicationManagerImpl::Handle(const impl::AudioData message) {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr on_audio_pass =
- new smart_objects::SmartObject();
-
- if (!on_audio_pass) {
- LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer");
- return;
- }
-
- LOG4CXX_DEBUG(logger_, "Fill smart object");
-
- (*on_audio_pass)[strings::params][strings::message_type] =
- application_manager::MessageType::kNotification;
-
- (*on_audio_pass)[strings::params][strings::connection_key] =
- static_cast<int32_t>(message.session_key);
- (*on_audio_pass)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnAudioPassThruID;
-
- LOG4CXX_DEBUG(logger_, "Fill binary data");
- // binary data
- (*on_audio_pass)[strings::params][strings::binary_data] =
- smart_objects::SmartObject(message.binary_data);
-
- LOG4CXX_DEBUG(logger_, "After fill binary data");
- LOG4CXX_DEBUG(logger_, "Send data");
- CommandSharedPtr command(MobileCommandFactory::CreateCommand(
- on_audio_pass, commands::Command::ORIGIN_SDL, *this));
- if (!command) {
- LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object");
- return;
- }
-
- if (command->Init()) {
- command->Run();
- command->CleanUp();
- }
-}
-
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const ApplicationSharedPtr app,
const std::string& function_id,
@@ -2696,6 +2641,10 @@ bool ApplicationManagerImpl::is_stopping() const {
return is_stopping_;
}
+bool ApplicationManagerImpl::is_audio_pass_thru_active() const {
+ return audio_pass_thru_active_;
+}
+
void ApplicationManagerImpl::OnLowVoltage() {
LOG4CXX_AUTO_TRACE(logger_);
is_low_voltage_ = true;
@@ -2794,7 +2743,7 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
rpc_service_->ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app_id, PROTOCOL_VIOLATION),
- commands::Command::ORIGIN_SDL);
+ commands::Command::SOURCE_SDL);
UnregisterApplication(app_id, ABORTED);
return;
}
@@ -2987,7 +2936,7 @@ void ApplicationManagerImpl::SendHMIStatusNotification(
static_cast<int32_t>(app->system_context());
rpc_service_->ManageMobileCommand(notification,
- commands::Command::ORIGIN_SDL);
+ commands::Command::SOURCE_SDL);
}
void ApplicationManagerImpl::ClearTimerPool() {
@@ -3033,7 +2982,7 @@ void ApplicationManagerImpl::CloseNaviApp() {
rpc_service_->ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
app_id, PROTOCOL_VIOLATION),
- commands::Command::ORIGIN_SDL);
+ commands::Command::SOURCE_SDL);
UnregisterApplication(app_id, ABORTED);
}
}