summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtrunov <dtrunov@luxoft.com>2016-09-06 10:35:16 +0300
committerdtrunov <dtrunov@luxoft.com>2016-10-11 17:26:12 +0300
commit2e436abb0c431e1d0d9e8a08fa6ab56ba43adc5e (patch)
tree1995eddd8ec71567a9503af4e39761cb5f7fe076
parentb89104ebe3c6b02e29b00fbbfd894fa992387803 (diff)
downloadsdl_core-2e436abb0c431e1d0d9e8a08fa6ab56ba43adc5e.tar.gz
Fix comments after review
Renamed structure, renamed method, move common logic to separate method Fix comments after review. Remove OVERRIDE from destructor, create const variable, and change the method of obtaining parameter from smart object Related issue [APPLINK-25171](https://adc.luxoft.com/jira/browse/APPLINK-25171)
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h1
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h10
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h1
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h4
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc1
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc6
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc6
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc30
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc19
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc5
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc1
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_request.cc21
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc31
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc26
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc23
22 files changed, 156 insertions, 87 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index 30859765ba..d8929c7a2a 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -223,6 +223,7 @@ class CommandRequestImpl : public CommandImpl,
*/
bool PrepareResultForMobileResponse(ResponseInfo& out_first,
ResponseInfo& out_second) const;
+
/**
* @brief If message from HMI contains returns this info
* or process result code from HMI and checks state of interface
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
index 9f1adaeee0..77ce48a2cc 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_is_ready_request.h
@@ -42,7 +42,8 @@ namespace commands {
/**
* @brief NaviIsReadyRequest command class
**/
-class NaviIsReadyRequest : public RequestToHMI {
+class NaviIsReadyRequest : public RequestToHMI,
+ public event_engine::EventObserver {
public:
/**
* @brief NaviIsReadyRequest class constructor
@@ -60,7 +61,12 @@ class NaviIsReadyRequest : public RequestToHMI {
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
+
+ /**
+ * @brief On event callback
+ **/
+ void on_event(const event_engine::Event& event) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NaviIsReadyRequest);
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
index 9ebb5761c1..b30044fd26 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h
@@ -48,6 +48,7 @@ namespace commands {
*/
bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager,
HmiInterfaces::InterfaceID interface);
+
/**
* @brief Change interface state
* @param application_manager contains ApplicationManager instance
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
index b0acec73b2..340a00d294 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h
@@ -56,7 +56,7 @@ class TTSIsReadyRequest : public RequestToHMI,
/**
* @brief TTSIsReadyRequest class destructor
**/
- ~TTSIsReadyRequest() OVERRIDE;
+ virtual ~TTSIsReadyRequest();
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
index 33da7a67b7..49942d81a7 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h
@@ -56,7 +56,7 @@ class UIIsReadyRequest : public RequestToHMI,
/**
* @brief UIIsReadyRequest class destructor
**/
- ~UIIsReadyRequest() OVERRIDE;
+ virtual ~UIIsReadyRequest();
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
index a81a8c8b7c..07ab9df605 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h
@@ -56,7 +56,7 @@ class VIIsReadyRequest : public RequestToHMI,
/**
* @brief VIIsReadyRequest class destructor
**/
- ~VIIsReadyRequest() OVERRIDE;
+ virtual ~VIIsReadyRequest();
/**
* @brief Execute command
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
index 784a6e4a48..55a2101e1a 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vr_is_ready_request.h
@@ -62,17 +62,17 @@ class VRIsReadyRequest : public RequestToHMI,
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
/**
* @brief On event callback
**/
- virtual void on_event(const event_engine::Event& event);
+ void on_event(const event_engine::Event& event) OVERRIDE;
/**
* @brief onTimeOut from requrst Controller
*/
- virtual void onTimeOut();
+ void onTimeOut() OVERRIDE;
/**
* @brief Send request to HMI for fetching of cappabilities
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
index e923424114..92211b54a2 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h
@@ -74,11 +74,11 @@ class AlertManeuverRequest : public CommandRequestImpl {
virtual void on_event(const event_engine::Event& event);
private:
-
/**
* @brief Prepare parameters for sending to mobile application
* @param result_code contains result code for sending to mobile application
- * @param return_info contains result result info for sending to mobil application
+ * @param return_info contains resulting info for sending to mobile
+ * application
* @return result for sending to mobile application.
*/
bool PrepareResponseParameters(mobile_apis::Result::eType& result_code,
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 94700dff11..f8840057f1 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -651,7 +651,6 @@ bool CommandRequestImpl::PrepareResultForMobileResponse(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
using namespace helpers;
-
if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
result_code,
hmi_apis::Common_Result::SUCCESS,
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 920c6fbdf9..8bdfa7dd81 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
@@ -58,7 +58,11 @@ AudioStartStreamRequest::~AudioStartStreamRequest() {}
void AudioStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
+ if (!CheckAvailabilityHMIInterfaces(
+ application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
+ LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ return;
+ }
SetAllowedToTerminate(false);
subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream,
correlation_id());
diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
index d0f1a96282..f86ee8302a 100644
--- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc
@@ -43,7 +43,11 @@ AudioStopStreamRequest::~AudioStopStreamRequest() {}
void AudioStopStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
+ if (!CheckAvailabilityHMIInterfaces(
+ application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
+ LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ return;
+ }
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
index 92e972e8f4..4392258a31 100644
--- a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc
@@ -38,16 +38,42 @@ namespace commands {
NaviIsReadyRequest::NaviIsReadyRequest(const MessageSharedPtr& message,
ApplicationManager& application_manager)
- : RequestToHMI(message, application_manager) {}
+ : RequestToHMI(message, application_manager)
+ , EventObserver(application_manager.event_dispatcher()) {}
NaviIsReadyRequest::~NaviIsReadyRequest() {}
void NaviIsReadyRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
+ subscribe_on_event(hmi_apis::FunctionID::Navigation_IsReady,
+ correlation_id());
SendRequest();
}
+void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+ switch (event.id()) {
+ case hmi_apis::FunctionID::Navigation_IsReady: {
+ LOG4CXX_DEBUG(logger_, "Received Navigation_IsReady event");
+ unsubscribe_from_event(hmi_apis::FunctionID::Navigation_IsReady);
+ const bool is_available =
+ ChangeInterfaceState(application_manager_,
+ message,
+ HmiInterfaces::HMI_INTERFACE_Navigation);
+
+ HMICapabilities& hmi_capabilities =
+ application_manager_.hmi_capabilities();
+ hmi_capabilities.set_is_navi_cooperating(is_available);
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+ }
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
index 3838ce465c..7daba4258b 100644
--- a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc
@@ -43,22 +43,9 @@ NaviIsReadyResponse::~NaviIsReadyResponse() {}
void NaviIsReadyResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject& object = *message_;
-
- bool is_available = false;
- if (object[strings::msg_params].keyExists(strings::available)) {
- is_available = object[strings::msg_params][strings::available].asBool();
- const HmiInterfaces::InterfaceState interface_state =
- is_available ? HmiInterfaces::STATE_AVAILABLE
- : HmiInterfaces::STATE_NOT_AVAILABLE;
- HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
- hmi_interfaces.SetInterfaceState(HmiInterfaces::HMI_INTERFACE_Navigation,
- interface_state);
- }
-
- HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
-
- hmi_capabilities.set_is_navi_cooperating(is_available);
+ event_engine::Event event(hmi_apis::FunctionID::Navigation_IsReady);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
index f0104cbaee..0c03f19bdd 100644
--- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc
@@ -58,6 +58,11 @@ NaviStartStreamRequest::~NaviStartStreamRequest() {}
void NaviStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ if (!CheckAvailabilityHMIInterfaces(
+ application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
+ LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ return;
+ }
SetAllowedToTerminate(false);
subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream,
diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
index 4b72ff28b4..a40ee13b68 100644
--- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
+++ b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc
@@ -12,7 +12,11 @@ NaviStopStreamRequest::~NaviStopStreamRequest() {}
void NaviStopStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
+ if (!CheckAvailabilityHMIInterfaces(
+ application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) {
+ LOG4CXX_INFO(logger_, "Interface Navi is not supported by system");
+ return;
+ }
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
index 111788c28d..6042fb1815 100644
--- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc
@@ -213,7 +213,6 @@ bool AlertManeuverRequest::PrepareResponseParameters(
return_info = std::string("Unsupported phoneme type sent in a prompt");
return result;
}
-
result_code =
PrepareResultCodeForResponse(navigation_alert_info, tts_alert_info);
return_info = MergeInfos(info_navi_, info_tts_);
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
index 9baf747ee4..3a253d1d7f 100644
--- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
@@ -1,5 +1,6 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/mobile/get_way_points_request.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -35,16 +36,24 @@ void GetWayPointsRequest::Run() {
void GetWayPointsRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager_.application(connection_key());
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_GetWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event");
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc
index f3ab7d60d1..4f1f1c9783 100644
--- a/src/components/application_manager/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc
@@ -31,11 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
#include <algorithm>
-
#include "application_manager/commands/mobile/send_location_request.h"
-
#include "application_manager/message_helper.h"
-#include "utils/helpers.h"
#include "utils/custom_string.h"
namespace application_manager {
@@ -136,23 +133,23 @@ void SendLocationRequest::Run() {
void SendLocationRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
- namespace Result = mobile_apis::Result;
- using namespace helpers;
+ using namespace hmi_apis;
const smart_objects::SmartObject& message = event.smart_object();
if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) {
LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event");
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
- bool result = Compare<Result::eType, EQ, ONE>(
- result_code, Result::SAVED, Result::SUCCESS, Result::WARNINGS);
- result =
- result || (Result::UNSUPPORTED_RESOURCE == result &&
- HmiInterfaces::STATE_AVAILABLE ==
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_Navigation));
-
- SendResponse(result, result_code, NULL, &(message[strings::params]));
+ const Common_Result::eType result_code = static_cast<Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::params]));
return;
}
LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
index ac730a959d..7c2bd7722b 100644
--- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc
@@ -178,22 +178,26 @@ void ShowConstantTBTRequest::Run() {
void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_ShowConstantTBT: {
LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event");
-
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
- result =
- result || (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code &&
- (HmiInterfaces::STATE_AVAILABLE ==
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_Navigation)));
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const Common_Result::eType result_code =
+ static_cast<Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
index 8134730eee..26e89b44bf 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc
@@ -1,5 +1,6 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/mobile/subscribe_way_points_request.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -47,14 +48,23 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event");
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ const hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
application_manager_.SubscribeAppForWayPoints(app->app_id());
}
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
if (result) {
app->UpdateHash();
}
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
index b19e292025..d5c98e1a36 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -1,5 +1,6 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/mobile/unsubscribe_way_points_request.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -40,14 +41,23 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event");
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ const hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
if (result) {
application_manager_.UnsubscribeAppFromWayPoints(app->app_id());
}
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
if (result) {
app->UpdateHash();
}
diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
index 3f0783b663..a17f1acd55 100644
--- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc
@@ -155,17 +155,20 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
case hmi_apis::FunctionID::Navigation_UpdateTurnList: {
LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event");
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ const hmi_apis::Common_Result::eType result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
-
- bool result = mobile_apis::Result::SUCCESS == result_code;
- result =
- result || (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code &&
- (HmiInterfaces::STATE_AVAILABLE ==
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_Navigation)));
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ std::string response_info;
+ GetInfo(HmiInterfaces::HMI_INTERFACE_Navigation,
+ result_code,
+ message,
+ response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {