Skip to content

Commit

Permalink
Merge pull request #2583 from AByzhynar/fix/Set_SmartObject_print_in_…
Browse files Browse the repository at this point in the history
…DEBUG_build_mode_only

Rework usage of PrintSmartObject function
  • Loading branch information
jacobkeeler authored Sep 7, 2018
2 parents 08e2e6e + 922fd38 commit 28235f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename From, typename To>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<smart_objects::SmartObject>(content),
commands::Command::SOURCE_SDL));
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/components/application_manager/src/rpc_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(
(*message)[strings::params][strings::connection_key].asUInt());
Expand Down

0 comments on commit 28235f8

Please # to comment.