summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Byzhynar <AByzhynar@luxoft.com>2018-01-12 15:14:55 +0200
committerAndriy Byzhynar <AByzhynar@luxoft.com>2018-01-18 12:03:51 +0200
commita56108fabda2fed248778cdb9778c8cd3162b762 (patch)
tree8576b6e3b1dd8197b6db4cdce158c4811c7fba50
parent45f978f112d46fe81ec54d47ae54eb1bf48444cc (diff)
downloadsdl_core-a56108fabda2fed248778cdb9778c8cd3162b762.tar.gz
Add wrappers for deprecated methods
Added wrappers for some deprecated methods Grouped iface checks in SendRegisterAppInterfaceResponseToMobile Removed duplicated "if" statement Improved readability
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/helpers/application_helper.h6
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc8
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc68
-rw-r--r--src/components/application_manager/src/commands/hmi/notification_from_hmi.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/notification_to_hmi.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/request_from_hmi.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/request_to_hmi.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/response_from_hmi.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/response_to_hmi.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc22
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc2
12 files changed, 52 insertions, 90 deletions
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index ffdd83eb5d..3d7e29fb99 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -91,6 +91,15 @@ class ApplicationImpl : public virtual Application,
utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
ApplicationManager& application_manager);
+ // DEPRECATED
+ ApplicationImpl(
+ uint32_t application_id,
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const custom_str::CustomString& app_name,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ ApplicationManager& application_manager);
+
~ApplicationImpl();
/**
diff --git a/src/components/application_manager/include/application_manager/helpers/application_helper.h b/src/components/application_manager/include/application_manager/helpers/application_helper.h
index 73cc54515c..cecda0cd6f 100644
--- a/src/components/application_manager/include/application_manager/helpers/application_helper.h
+++ b/src/components/application_manager/include/application_manager/helpers/application_helper.h
@@ -30,7 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#pragma once
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_
+
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
@@ -91,3 +93,5 @@ struct SubscribedToIVIPredicate {
void DeleteApplicationData(ApplicationSharedPtr app,
ApplicationManager& app_manager);
} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index da28cf9635..cf8aae75f3 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -95,7 +95,7 @@ DeviceTypes devicesType = {
hmi_apis::Common_TransportType::USB_IOS),
std::make_pair(std::string("BLUETOOTH"),
hmi_apis::Common_TransportType::BLUETOOTH),
- std::make_pair(std::string("IOS_BLUETOOTH"),
+ std::make_pair(std::string("BLUETOOTH_IOS"),
hmi_apis::Common_TransportType::BLUETOOTH),
std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)};
}
@@ -2109,7 +2109,7 @@ bool ApplicationManagerImpl::ManageHMICommand(
}
int32_t message_type =
- (*(message.get()))[strings::params][strings::message_type].asInt();
+ (*message)[strings::params][strings::message_type].asInt();
if (kRequest == message_type) {
LOG4CXX_DEBUG(logger_, "ManageHMICommand");
@@ -2120,9 +2120,9 @@ bool ApplicationManagerImpl::ManageHMICommand(
command->Run();
if (kResponse == message_type) {
const uint32_t correlation_id =
- (*(message.get()))[strings::params][strings::correlation_id].asUInt();
+ (*message)[strings::params][strings::correlation_id].asUInt();
const int32_t function_id =
- (*(message.get()))[strings::params][strings::function_id].asInt();
+ (*message)[strings::params][strings::function_id].asInt();
request_ctrl_.OnHMIResponse(correlation_id, function_id);
}
return true;
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 5251c9e122..ea179a5bfc 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -96,6 +96,7 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) {
bool CommandImpl::ReplaceMobileWithHMIAppId(
NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
application_manager_.application(message[strings::app_id].asUInt());
@@ -141,37 +142,8 @@ bool CommandImpl::ReplaceMobileWithHMIAppId(
// DEPRECATED
void CommandImpl::ReplaceMobileByHMIAppId(
NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
- if (message.keyExists(strings::app_id)) {
- ApplicationSharedPtr application =
- application_manager_.application(message[strings::app_id].asUInt());
- if (application.valid()) {
- LOG4CXX_DEBUG(logger_,
- "ReplaceMobileWithHMIAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->hmi_app_id());
- message[strings::app_id] = application->hmi_app_id();
- }
- } else {
- switch (message.getType()) {
- case smart_objects::SmartType::SmartType_Array: {
- smart_objects::SmartArray* message_array = message.asArray();
- smart_objects::SmartArray::iterator it = message_array->begin();
- for (; it != message_array->end(); ++it) {
- ReplaceMobileWithHMIAppId(*it);
- }
- break;
- }
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- std::string k = *key;
- ReplaceMobileWithHMIAppId(message[*key]);
- }
- break;
- }
- default: { break; }
- }
+ if (!ReplaceMobileWithHMIAppId(message)) {
+ LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed.");
}
}
@@ -223,38 +195,8 @@ bool CommandImpl::ReplaceHMIWithMobileAppId(
// DEPRECATED
void CommandImpl::ReplaceHMIByMobileAppId(
NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
- if (message.keyExists(strings::app_id)) {
- ApplicationSharedPtr application =
- application_manager_.application_by_hmi_app(
- message[strings::app_id].asUInt());
-
- if (application.valid()) {
- LOG4CXX_DEBUG(logger_,
- "ReplaceHMIByMobileAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->app_id());
- message[strings::app_id] = application->app_id();
- }
- } else {
- switch (message.getType()) {
- case smart_objects::SmartType::SmartType_Array: {
- smart_objects::SmartArray* message_array = message.asArray();
- smart_objects::SmartArray::iterator it = message_array->begin();
- for (; it != message_array->end(); ++it) {
- ReplaceHMIByMobileAppId(*it);
- }
- break;
- }
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- ReplaceHMIByMobileAppId(message[*key]);
- }
- break;
- }
- default: { break; }
- }
+ if (!ReplaceHMIWithMobileAppId(message)) {
+ LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed.");
}
}
diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
index 3c2d73b10c..64eb63fde8 100644
--- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc
@@ -42,7 +42,7 @@ NotificationFromHMI::NotificationFromHMI(
const MessageSharedPtr& message, ApplicationManager& application_manager)
: CommandImpl(message, application_manager) {
// Replace HMI app id with Mobile connection id
- ReplaceHMIWithMobileAppId(*message);
+ ReplaceHMIByMobileAppId(*message);
}
NotificationFromHMI::~NotificationFromHMI() {}
diff --git a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
index b6639c9aea..c136f7b770 100644
--- a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc
@@ -39,12 +39,15 @@ namespace commands {
NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager)
- : CommandImpl(message, application_manager) {}
+ : CommandImpl(message, application_manager) {
+ // Replace Mobile connection id with HMI app id
+ ReplaceMobileByHMIAppId(*message_);
+}
NotificationToHMI::~NotificationToHMI() {}
bool NotificationToHMI::Init() {
- return ReplaceMobileWithHMIAppId(*message_);
+ return true;
}
bool NotificationToHMI::CleanUp() {
diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
index c91423e369..a203110ce4 100644
--- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
@@ -43,7 +43,7 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message,
: CommandImpl(message, application_manager)
, EventObserver(application_manager.event_dispatcher()) {
// Replace HMI app id with Mobile connection id
- ReplaceHMIWithMobileAppId(*(message.get()));
+ ReplaceHMIByMobileAppId(*message);
}
RequestFromHMI::~RequestFromHMI() {}
diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
index cba36cbb0c..8079558545 100644
--- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc
@@ -61,12 +61,15 @@ bool ChangeInterfaceState(ApplicationManager& application_manager,
RequestToHMI::RequestToHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager)
- : CommandImpl(message, application_manager) {}
+ : CommandImpl(message, application_manager) {
+ // Replace Mobile connection id with HMI app id
+ ReplaceMobileByHMIAppId(*message);
+}
RequestToHMI::~RequestToHMI() {}
bool RequestToHMI::Init() {
- return ReplaceMobileWithHMIAppId(*message_);
+ return true;
}
bool RequestToHMI::CleanUp() {
diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
index c5a6dd9d3e..5f5a9deca3 100644
--- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc
@@ -48,7 +48,7 @@ ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message,
}
// Replace HMI app id with Mobile connection id
- ReplaceHMIWithMobileAppId(*(message.get()));
+ ReplaceHMIByMobileAppId(*message);
}
ResponseFromHMI::~ResponseFromHMI() {}
diff --git a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
index 94f6967e23..d70cc20e4c 100644
--- a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc
@@ -39,12 +39,15 @@ namespace commands {
ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message,
ApplicationManager& application_manager)
- : CommandImpl(message, application_manager) {}
+ : CommandImpl(message, application_manager) {
+ // Replace Mobile connection id with HMI app id
+ ReplaceMobileByHMIAppId(*message);
+}
ResponseToHMI::~ResponseToHMI() {}
bool ResponseToHMI::Init() {
- return ReplaceMobileWithHMIAppId(*message_);
+ return true;
}
bool ResponseToHMI::CleanUp() {
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index 26e50d39fe..2d787f3a1f 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -581,18 +581,27 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
FillUIRelatedFields(response_params, hmi_capabilities);
}
+ if (HmiInterfaces::STATE_NOT_AVAILABLE !=
+ application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo)) {
+ FillVIRelatedFields(response_params, hmi_capabilities);
+ }
+
if (hmi_capabilities.button_capabilities()) {
response_params[hmi_response::button_capabilities] =
*hmi_capabilities.button_capabilities();
}
+
if (hmi_capabilities.soft_button_capabilities()) {
response_params[hmi_response::soft_button_capabilities] =
*hmi_capabilities.soft_button_capabilities();
}
+
if (hmi_capabilities.preset_bank_capabilities()) {
response_params[hmi_response::preset_bank_capabilities] =
*hmi_capabilities.preset_bank_capabilities();
}
+
if (hmi_capabilities.hmi_zone_capabilities()) {
if (smart_objects::SmartType_Array ==
hmi_capabilities.hmi_zone_capabilities()->getType()) {
@@ -605,23 +614,11 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
}
- if (HmiInterfaces::STATE_NOT_AVAILABLE !=
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_TTS)) {
- FillTTSRelatedFields(response_params, hmi_capabilities);
- }
-
if (hmi_capabilities.pcm_stream_capabilities()) {
response_params[strings::pcm_stream_capabilities] =
*hmi_capabilities.pcm_stream_capabilities();
}
- if (HmiInterfaces::STATE_NOT_AVAILABLE !=
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_VehicleInfo)) {
- FillVIRelatedFields(response_params, hmi_capabilities);
- }
-
const std::vector<uint32_t>& diag_modes =
application_manager_.get_settings().supported_diag_modes();
if (!diag_modes.empty()) {
@@ -632,6 +629,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
++index;
}
}
+
response_params[strings::sdl_version] =
application_manager_.get_settings().sdl_version();
const std::string ccpu_version =
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index 944f3594c4..caacaaaa68 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -48,7 +48,7 @@ namespace {
DeviceTypes devicesType = {
std::make_pair(DeviceType::AOA, std::string("USB_AOA")),
std::make_pair(DeviceType::IOS_USB, std::string("USB_IOS")),
- std::make_pair(DeviceType::IOS_BT, std::string("IOS_BLUETOOTH")),
+ std::make_pair(DeviceType::IOS_BT, std::string("BLUETOOTH_IOS")),
std::make_pair(DeviceType::BLUETOOTH, std::string("BLUETOOTH")),
std::make_pair(DeviceType::TCP, std::string("WIFI"))};
}