From 922fd38b6fd9399bb9467d7f5b17dcd03f832afc Mon Sep 17 00:00:00 2001 From: Andriy Byzhynar Date: Fri, 7 Sep 2018 13:39:19 +0300 Subject: Rework usage of PrintSmartObject function Removed redundant #IFDEFs DEBUG wrappers from calling PrintSmartObject function as this wrapper moved into function body --- .../include/application_manager/message_helper.h | 8 ++++++++ .../application_manager/src/application_manager_impl.cc | 2 -- .../application_manager/src/message_helper/message_helper.cc | 7 ++----- src/components/application_manager/src/rpc_service_impl.cc | 3 +-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 010816808c..609b240301 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -700,6 +700,14 @@ class MessageHelper { ApplicationSharedPtr app, int32_t function_id); + /** + * @brief Prints SmartObject contents to log file + * @param object - SmartObject to print + * @return always True as this function is used for internal debug purposes + * only + * @note Function prints SmartObject only in DEBUG build mode. There will not + * be any print in RELEASE build mode + */ static bool PrintSmartObject(const smart_objects::SmartObject& object); template diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 69040997fe..eaac84dcf2 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1305,9 +1305,7 @@ bool ApplicationManagerImpl::StartNaviService( return false; } else if (!converted_params.empty()) { LOG4CXX_INFO(logger_, "Sending video configuration params"); -#ifdef DEBUG MessageHelper::PrintSmartObject(converted_params); -#endif bool request_sent = application(app_id)->SetVideoConfig(service_type, converted_params); if (request_sent) { diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index eb074327ab..a52cb52fbe 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2221,11 +2221,7 @@ void MessageHelper::SendSystemRequestNotification( commands::CommandImpl::protocol_version_; content[strings::params][strings::connection_key] = connection_key; - -#ifdef DEBUG PrintSmartObject(content); -#endif - DCHECK(app_mngr.GetRPCService().ManageMobileCommand( std::make_shared(content), commands::Command::SOURCE_SDL)); @@ -2876,11 +2872,12 @@ void MessageHelper::SubscribeApplicationToSoftButton( } bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) { +#ifdef DEBUG Json::Value tmp; namespace Formatters = ns_smart_device_link::ns_json_handler::formatters; Formatters::CFormatterJsonBase::objToJsonValue(object, tmp); LOG4CXX_DEBUG(logger_, "SMART OBJECT: " << tmp.toStyledString()); - +#endif return true; } diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index 217af091b5..7a68ae5779 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -71,9 +71,8 @@ bool RPCServiceImpl::ManageMobileCommand( LOG4CXX_WARN(logger_, "Low Voltage is active"); return false; } -#ifdef DEBUG + MessageHelper::PrintSmartObject(*message); -#endif const uint32_t connection_key = static_cast( (*message)[strings::params][strings::connection_key].asUInt()); -- cgit v1.2.1