diff options
author | Kozoriz <kozorizandriy@gmail.com> | 2016-04-25 16:39:26 +0300 |
---|---|---|
committer | Kozoriz <kozorizandriy@gmail.com> | 2016-04-25 16:39:26 +0300 |
commit | 990bee92cc9d67f9845629bf86e0a700ccc700ce (patch) | |
tree | 2feedfc333dfd6af412db96e189c941b367e08c7 /src/components/application_manager/src/commands/mobile | |
parent | 388ef32944603a105ed34db4aa089acf5a7a87fd (diff) | |
download | sdl_core-990bee92cc9d67f9845629bf86e0a700ccc700ce.tar.gz |
Code style format with clang-format
Diffstat (limited to 'src/components/application_manager/src/commands/mobile')
102 files changed, 1938 insertions, 2032 deletions
diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index 6f45826d5a..03bdfadd66 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -46,18 +46,17 @@ namespace commands { namespace custom_str = utils::custom_string; -AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - send_ui_(false), - send_vr_(false), - is_ui_received_(false), - is_vr_received_(false), - ui_result_(hmi_apis::Common_Result::INVALID_ENUM), - vr_result_(hmi_apis::Common_Result::INVALID_ENUM) { -} - -AddCommandRequest::~AddCommandRequest() { -} +AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , send_ui_(false) + , send_vr_(false) + , is_ui_received_(false) + , is_vr_received_(false) + , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) + , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + +AddCommandRequest::~AddCommandRequest() {} void AddCommandRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); @@ -78,14 +77,14 @@ void AddCommandRequest::Run() { } if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - mobile_apis::Result::eType verification_result = - MessageHelper::VerifyImage((*message_)[strings::msg_params] - [strings::cmd_icon], app, application_manager_); + mobile_apis::Result::eType verification_result = MessageHelper::VerifyImage( + (*message_)[strings::msg_params][strings::cmd_icon], + app, + application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyImage return " << verification_result); + logger_, "MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); return; } @@ -98,13 +97,13 @@ void AddCommandRequest::Run() { } if (app->FindCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { + (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { LOG4CXX_ERROR(logger_, "INVALID_ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } - bool data_exist = false; + bool data_exist = false; if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { if (!CheckCommandName(app)) { @@ -112,21 +111,21 @@ void AddCommandRequest::Run() { return; } if (((*message_)[strings::msg_params][strings::menu_params].keyExists( - hmi_request::parent_id)) && (0 != (*message_)[strings::msg_params] - [strings::menu_params][hmi_request::parent_id].asUInt())) { + hmi_request::parent_id)) && + (0 != + (*message_)[strings::msg_params][strings::menu_params] + [hmi_request::parent_id].asUInt())) { if (!CheckCommandParentId(app)) { - SendResponse(false, mobile_apis::Result::INVALID_ID, - "Parent ID doesn't exist"); + SendResponse( + false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist"); return; } } data_exist = true; } - if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) - && ((*message_)[strings::msg_params] - [strings::vr_commands].length() > 0)) { - + if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) && + ((*message_)[strings::msg_params][strings::vr_commands].length() > 0)) { if (!CheckCommandVRSynonym(app)) { SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); return; @@ -142,18 +141,16 @@ void AddCommandRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming add command has contains \t\n \\t \\n"); + LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } - app->AddCommand((*message_)[strings::msg_params] - [strings::cmd_id].asUInt(), - (*message_)[strings::msg_params]); + app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(), + (*message_)[strings::msg_params]); - smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject ui_msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { ui_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -162,10 +159,11 @@ void AddCommandRequest::Run() { ui_msg_params[strings::app_id] = app->app_id(); - if ( ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) - && ((*message_)[strings::msg_params][strings::cmd_icon].keyExists(strings::value)) - && (0 < (*message_)[strings::msg_params][strings::cmd_icon] - [strings::value].length())) { + if (((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) && + ((*message_)[strings::msg_params][strings::cmd_icon].keyExists( + strings::value)) && + (0 < (*message_)[strings::msg_params][strings::cmd_icon][strings::value] + .length())) { ui_msg_params[strings::cmd_icon] = (*message_)[strings::msg_params][strings::cmd_icon]; } @@ -173,8 +171,8 @@ void AddCommandRequest::Run() { send_ui_ = true; } - smart_objects::SmartObject vr_msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject vr_msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) { vr_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -207,10 +205,10 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { CommandsMap::const_iterator i = commands.begin(); uint32_t saved_parent_id = 0; uint32_t parent_id = 0; - if ((*message_)[strings::msg_params] - [strings::menu_params].keyExists(hmi_request::parent_id)) { - parent_id = (*message_)[strings::msg_params] - [strings::menu_params][hmi_request::parent_id].asUInt(); + if ((*message_)[strings::msg_params][strings::menu_params].keyExists( + hmi_request::parent_id)) { + parent_id = (*message_)[strings::msg_params][strings::menu_params] + [hmi_request::parent_id].asUInt(); } for (; commands.end() != i; ++i) { @@ -220,13 +218,15 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { saved_parent_id = 0; if ((*i->second)[strings::menu_params].keyExists(hmi_request::parent_id)) { - saved_parent_id = (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt(); + saved_parent_id = + (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt(); } - if (((*i->second)[strings::menu_params][strings::menu_name].asString() - == (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asString()) && + if (((*i->second)[strings::menu_params][strings::menu_name].asString() == + (*message_)[strings::msg_params][strings::menu_params] + [strings::menu_name].asString()) && (saved_parent_id == parent_id)) { - LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandName received" + LOG4CXX_INFO(logger_, + "AddCommandRequest::CheckCommandName received" " command name already exist in same level menu"); return false; } @@ -244,23 +244,23 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { CommandsMap::const_iterator it = commands.begin(); for (; commands.end() != it; ++it) { - - if(!(*it->second).keyExists(strings::vr_commands)) { + if (!(*it->second).keyExists(strings::vr_commands)) { continue; } for (size_t i = 0; i < (*it->second)[strings::vr_commands].length(); ++i) { for (size_t j = 0; - j < (*message_)[strings::msg_params][strings::vr_commands].length(); - ++j) { + j < (*message_)[strings::msg_params][strings::vr_commands].length(); + ++j) { const custom_str::CustomString& vr_cmd_i = (*it->second)[strings::vr_commands][i].asCustomString(); const custom_str::CustomString& vr_cmd_j = - (*message_)[strings::msg_params] - [strings::vr_commands][j].asCustomString(); + (*message_)[strings::msg_params][strings::vr_commands][j] + .asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandVRSynonym" + LOG4CXX_INFO(logger_, + "AddCommandRequest::CheckCommandVRSynonym" " received command vr synonym already exist"); return false; } @@ -277,11 +277,12 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { const int32_t parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asInt(); + [hmi_request::parent_id].asInt(); smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); if (!parent) { - LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandParentId received" + LOG4CXX_INFO(logger_, + "AddCommandRequest::CheckCommandParentId received" " submenu doesn't exist"); return false; } @@ -303,7 +304,8 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } smart_objects::SmartObject msg_param(smart_objects::SmartType_Map); - msg_param[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; + msg_param[strings::cmd_id] = + (*message_)[strings::msg_params][strings::cmd_id]; msg_param[strings::app_id] = application->app_id(); switch (event.id()) { @@ -330,7 +332,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; } } @@ -344,93 +346,83 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; + msg_params[strings::cmd_id] = + (*message_)[strings::msg_params][strings::cmd_id]; msg_params[strings::app_id] = application->app_id(); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; const bool is_vr_invalid_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + vr_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); const bool is_ui_ivalid_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + ui_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - const bool is_no_ui_error = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); - const bool is_no_vr_error = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + const bool is_no_vr_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + vr_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); - bool result = - (is_no_ui_error && is_no_vr_error) || - (is_no_ui_error && is_vr_invalid_unsupported) || - (is_no_vr_error && is_ui_ivalid_unsupported); + bool result = (is_no_ui_error && is_no_vr_error) || + (is_no_ui_error && is_vr_invalid_unsupported) || + (is_no_vr_error && is_ui_ivalid_unsupported); const bool is_vr_or_ui_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, - ui_result_, - vr_result_); + hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); - if (!result && - hmi_apis::Common_Result::REJECTED == ui_result_) { + if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) { result_code = MessageHelper::HMIToMobileResult(ui_result_); } else if (is_vr_or_ui_warning) { result_code = mobile_apis::Result::WARNINGS; } else { - result_code = MessageHelper::HMIToMobileResult( - std::max(ui_result_, vr_result_)); + result_code = + MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_)); } if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) { - const bool is_ui_not_ok = - Compare<hmi_apis::Common_Result::eType, NEQ, ALL>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + const bool is_ui_not_ok = Compare<hmi_apis::Common_Result::eType, NEQ, ALL>( + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); if (is_ui_not_ok) { - result_code = - ui_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED - : mobile_apis::Result::GENERIC_ERROR; + result_code = ui_result_ == hmi_apis::Common_Result::REJECTED + ? mobile_apis::Result::REJECTED + : mobile_apis::Result::GENERIC_ERROR; msg_params[strings::grammar_id] = application->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - application->RemoveCommand((*message_)[strings::msg_params] - [strings::cmd_id].asUInt()); + application->RemoveCommand( + (*message_)[strings::msg_params][strings::cmd_id].asUInt()); result = false; } } - if(BothSend() && - hmi_apis::Common_Result::SUCCESS == ui_result_ && - !is_no_vr_error) { - - result_code = - vr_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED : - mobile_apis::Result::GENERIC_ERROR; + if (BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ && + !is_no_vr_error) { + result_code = vr_result_ == hmi_apis::Common_Result::REJECTED + ? mobile_apis::Result::REJECTED + : mobile_apis::Result::GENERIC_ERROR; SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - application->RemoveCommand((*message_)[strings::msg_params] - [strings::cmd_id].asUInt()); + application->RemoveCommand( + (*message_)[strings::msg_params][strings::cmd_id].asUInt()); result = false; } @@ -451,7 +443,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { str = (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asCharArray(); + [strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed."); return true; @@ -463,8 +455,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() { (*message_)[strings::msg_params][strings::vr_commands].length(); for (size_t i = 0; i < len; ++i) { - str = (*message_)[strings::msg_params] - [strings::vr_commands][i].asCharArray(); + str = (*message_)[strings::msg_params][strings::vr_commands][i] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); return true; @@ -473,8 +465,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - str = (*message_)[strings::msg_params] - [strings::cmd_icon][strings::value].asCharArray(); + str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed"); return true; @@ -489,19 +481,19 @@ bool AddCommandRequest::BothSend() const { void AddCommandRequest::RemoveCommand() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { LOG4CXX_ERROR(logger_, "No application associated with session key"); return; } smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; + msg_params[strings::cmd_id] = + (*message_)[strings::msg_params][strings::cmd_id]; msg_params[strings::app_id] = app->app_id(); - app->RemoveCommand((*message_)[strings::msg_params] - [strings::cmd_id].asUInt()); + app->RemoveCommand( + (*message_)[strings::msg_params][strings::cmd_id].asUInt()); if (BothSend() && !(is_vr_received_ || is_ui_received_)) { // in case we have send bth UI and VR and no one respond diff --git a/src/components/application_manager/src/commands/mobile/add_command_response.cc b/src/components/application_manager/src/commands/mobile/add_command_response.cc index 21f881a574..fc468f9c57 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/add_command_response.h" - namespace application_manager { namespace commands { -AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -AddCommandResponse::~AddCommandResponse() { -} +AddCommandResponse::~AddCommandResponse() {} void AddCommandResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index c1d364b6cd..83f137ac19 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -40,18 +40,16 @@ namespace application_manager { namespace commands { -AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -AddSubMenuRequest::~AddSubMenuRequest() { -} +AddSubMenuRequest::~AddSubMenuRequest() {} void AddSubMenuRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -82,14 +80,14 @@ void AddSubMenuRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::menu_id] = (*message_)[strings::msg_params][strings::menu_id]; if ((*message_)[strings::msg_params].keyExists(strings::position)) { - msg_params[strings::menu_params][strings::position] = - (*message_)[strings::msg_params][strings::position]; + msg_params[strings::menu_params][strings::position] = + (*message_)[strings::msg_params][strings::position]; } msg_params[strings::menu_params][strings::menu_name] = (*message_)[strings::msg_params][strings::menu_name]; @@ -109,14 +107,13 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - application_manager_.application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -124,10 +121,10 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { } if (result) { - application->AddSubMenu((*message_)[strings::msg_params] - [strings::menu_id].asInt(), - (*message_)[strings::msg_params]); - } + application->AddSubMenu( + (*message_)[strings::msg_params][strings::menu_id].asInt(), + (*message_)[strings::msg_params]); + } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); if (result) { application->UpdateHash(); diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc index 02672edadd..1fbdb4e66c 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -AddSubMenuResponse::~AddSubMenuResponse() { -} +AddSubMenuResponse::~AddSubMenuResponse() {} void AddSubMenuResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 7c0c557b62..d771553962 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 @@ -43,15 +43,15 @@ namespace application_manager { namespace commands { -AlertManeuverRequest::AlertManeuverRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - tts_speak_result_code_(mobile_apis::Result::INVALID_ENUM), - navi_alert_maneuver_result_code_(mobile_apis::Result::INVALID_ENUM) { +AlertManeuverRequest::AlertManeuverRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , tts_speak_result_code_(mobile_apis::Result::INVALID_ENUM) + , navi_alert_maneuver_result_code_(mobile_apis::Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); } -AlertManeuverRequest::~AlertManeuverRequest() { -} +AlertManeuverRequest::~AlertManeuverRequest() {} void AlertManeuverRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -80,11 +80,13 @@ void AlertManeuverRequest::Run() { return; } - //ProcessSoftButtons checks strings on the contents incorrect character + // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager_.GetPolicyHandler(), application_manager_); + MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], + app, + application_manager_.GetPolicyHandler(), + application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); @@ -103,25 +105,25 @@ void AlertManeuverRequest::Run() { } } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { msg_params[hmi_request::soft_buttons] = - (*message_)[strings::msg_params][strings::soft_buttons]; - MessageHelper::SubscribeApplicationToSoftButton((*message_)[strings::msg_params], - app, function_id()); + (*message_)[strings::msg_params][strings::soft_buttons]; + MessageHelper::SubscribeApplicationToSoftButton( + (*message_)[strings::msg_params], app, function_id()); } pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver); - SendHMIRequest(hmi_apis::FunctionID::Navigation_AlertManeuver, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true); if (tts_is_ok) { - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[hmi_request::tts_chunks] = (*message_)[strings::msg_params][strings::tts_chunks]; @@ -146,7 +148,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { navi_alert_maneuver_result_code_ = static_cast<mobile_apis::Result::eType>( - message[strings::params][hmi_response::code].asInt()); + message[strings::params][hmi_response::code].asInt()); break; } @@ -155,8 +157,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { pending_requests_.Remove(event_id); - tts_speak_result_code_ = - static_cast<mobile_apis::Result::eType>( + tts_speak_result_code_ = static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); break; @@ -169,9 +170,9 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); - SendResponse(false, mobile_apis::Result::INVALID_ENUM, - "Received unknown event"); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SendResponse( + false, mobile_apis::Result::INVALID_ENUM, "Received unknown event"); return; } } @@ -189,47 +190,44 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { hmi_apis::Common_Result::eType navi_result = MessageHelper::MobileToHMIResult(navi_alert_maneuver_result_code_); - const bool is_tts_ok = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - tts_result, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::INVALID_ENUM); + const bool is_tts_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + tts_result, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::INVALID_ENUM); const bool is_no_navi_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - navi_result, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + navi_result, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); const bool result = (is_tts_ok && is_no_navi_error) || (hmi_apis::Common_Result::SUCCESS == tts_result && - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == navi_result ); + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == navi_result); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( - std::max(tts_speak_result_code_, navi_alert_maneuver_result_code_)); + std::max(tts_speak_result_code_, navi_alert_maneuver_result_code_)); std::string return_info = message[strings::msg_params][hmi_response::message].asString(); const bool is_tts_or_navi_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, - tts_result, - navi_result); + hmi_apis::Common_Result::WARNINGS, tts_result, navi_result); - if (result && - (is_tts_or_navi_warning || - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result)) { + if (result && (is_tts_or_navi_warning || + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result)) { result_code = mobile_apis::Result::WARNINGS; - return_info = - std::string("Unsupported phoneme type sent in a prompt"); + return_info = std::string("Unsupported phoneme type sent in a prompt"); } - SendResponse(result, result_code, return_info.c_str(), + SendResponse(result, + result_code, + return_info.c_str(), &(message[strings::msg_params])); } diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc index c1c2cdafc0..2f441594c2 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -AlertManeuverResponse::AlertManeuverResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +AlertManeuverResponse::AlertManeuverResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -AlertManeuverResponse::~AlertManeuverResponse() { -} +AlertManeuverResponse::~AlertManeuverResponse() {} void AlertManeuverResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index 66ce432a95..53910a05b7 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -47,21 +47,21 @@ namespace commands { namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; -AlertRequest::AlertRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - awaiting_ui_alert_response_(false), - awaiting_tts_speak_response_(false), - awaiting_tts_stop_speaking_response_(false), - is_alert_succeeded_(false), - is_ui_alert_sent_(false), - alert_result_(mobile_apis::Result::INVALID_ENUM), - tts_speak_result_(mobile_apis::Result::INVALID_ENUM) { +AlertRequest::AlertRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , awaiting_ui_alert_response_(false) + , awaiting_tts_speak_response_(false) + , awaiting_tts_stop_speaking_response_(false) + , is_alert_succeeded_(false) + , is_ui_alert_sent_(false) + , alert_result_(mobile_apis::Result::INVALID_ENUM) + , tts_speak_result_(mobile_apis::Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); } -AlertRequest::~AlertRequest() { -} +AlertRequest::~AlertRequest() {} bool AlertRequest::Init() { /* Timeout in milliseconds. @@ -74,9 +74,11 @@ bool AlertRequest::Init() { default_timeout_ = def_value; } - // If soft buttons are present, SDL will not use initiate timeout tracking for response. + // If soft buttons are present, SDL will not use initiate timeout tracking for + // response. if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - LOG4CXX_INFO(logger_, "Request contains soft buttons - request timeout " + LOG4CXX_INFO(logger_, + "Request contains soft buttons - request timeout " "will be set to 0."); default_timeout_ = 0; } @@ -87,23 +89,25 @@ bool AlertRequest::Init() { void AlertRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = (*message_)[strings::params][strings::connection_key] - .asInt(); + uint32_t app_id = + (*message_)[strings::params][strings::connection_key].asInt(); if (!Validate(app_id)) { // Invalid command, abort execution return; } - bool tts_chunks_exists = (*message_)[strings::msg_params].keyExists(strings::tts_chunks); + bool tts_chunks_exists = + (*message_)[strings::msg_params].keyExists(strings::tts_chunks); size_t length_tts_chunks = 0; if (tts_chunks_exists) { - length_tts_chunks = (*message_)[strings::msg_params][strings::tts_chunks].length(); + length_tts_chunks = + (*message_)[strings::msg_params][strings::tts_chunks].length(); } if ((tts_chunks_exists && length_tts_chunks) || ((*message_)[strings::msg_params].keyExists(strings::play_tone) && - (*message_)[strings::msg_params][strings::play_tone].asBool())) { + (*message_)[strings::msg_params][strings::play_tone].asBool())) { awaiting_tts_speak_response_ = true; } @@ -115,11 +119,13 @@ void AlertRequest::Run() { void AlertRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); - if (false == (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + if (false == + (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { CommandRequestImpl::onTimeOut(); return; } - LOG4CXX_INFO(logger_, "Default timeout ignored. " + LOG4CXX_INFO(logger_, + "Default timeout ignored. " "AlertRequest with soft buttons wait timeout on HMI side"); } @@ -132,11 +138,12 @@ void AlertRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::TTS_OnResetTimeout: case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_alert_response_); + LOG4CXX_INFO(logger_, + "Received UI_OnResetTimeout event " + " or TTS_OnResetTimeout event" + << awaiting_tts_speak_response_ << " " + << awaiting_tts_stop_speaking_response_ << " " + << awaiting_ui_alert_response_); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; @@ -157,12 +164,11 @@ void AlertRequest::on_event(const event_engine::Event& event) { message[strings::params][hmi_response::code].asInt()); // Mobile Alert request is successful when UI_Alert is successful - const bool is_alert_ok = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::UNSUPPORTED_RESOURCE, - mobile_apis::Result::WARNINGS); + const bool is_alert_ok = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::UNSUPPORTED_RESOURCE, + mobile_apis::Result::WARNINGS); is_alert_succeeded_ = is_alert_ok; alert_result_ = result_code; @@ -186,7 +192,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; } } @@ -197,15 +203,12 @@ void AlertRequest::on_event(const event_engine::Event& event) { const bool is_tts_alert_unsupported = Compare<mobile_api::Result::eType, EQ, ALL>( - mobile_api::Result::UNSUPPORTED_RESOURCE, - tts_speak_result_, - alert_result_); + mobile_api::Result::UNSUPPORTED_RESOURCE, + tts_speak_result_, + alert_result_); - const bool is_alert_ok = - Compare<mobile_api::Result::eType, EQ, ONE>( - alert_result_, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool is_alert_ok = Compare<mobile_api::Result::eType, EQ, ONE>( + alert_result_, mobile_api::Result::SUCCESS, mobile_api::Result::WARNINGS); std::string response_info; if (mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_result_ && @@ -215,24 +218,24 @@ void AlertRequest::on_event(const event_engine::Event& event) { response_info = "Unsupported phoneme type sent in a prompt"; } else if (is_tts_alert_unsupported) { alert_result_ = mobile_apis::Result::WARNINGS; - response_info = "Unsupported phoneme type sent in a prompt and " + response_info = + "Unsupported phoneme type sent in a prompt and " "unsupported image sent in soft buttons"; } else if (mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_result_ && is_alert_ok) { alert_result_ = mobile_apis::Result::WARNINGS; response_info = "Unsupported phoneme type sent in a prompt"; } else if (mobile_apis::Result::SUCCESS == tts_speak_result_ && - (mobile_apis::Result::INVALID_ENUM == alert_result_ && - !is_ui_alert_sent_)) { + (mobile_apis::Result::INVALID_ENUM == alert_result_ && + !is_ui_alert_sent_)) { alert_result_ = mobile_apis::Result::SUCCESS; is_alert_succeeded_ = true; } const bool is_tts_not_ok = - Compare<mobile_api::Result::eType, EQ, ONE>( - tts_speak_result_, - mobile_api::Result::ABORTED, - mobile_api::Result::REJECTED); + Compare<mobile_api::Result::eType, EQ, ONE>(tts_speak_result_, + mobile_api::Result::ABORTED, + mobile_api::Result::REJECTED); if (is_tts_not_ok && !is_ui_alert_sent_) { is_alert_succeeded_ = false; @@ -243,15 +246,15 @@ void AlertRequest::on_event(const event_engine::Event& event) { alert_result_ = mobile_apis::Result::WARNINGS; } - SendResponse(is_alert_succeeded_, alert_result_, + SendResponse(is_alert_succeeded_, + alert_result_, response_info.empty() ? NULL : response_info.c_str(), &alert_response_params_); } bool AlertRequest::Validate(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "No application associated with session key"); @@ -261,8 +264,8 @@ bool AlertRequest::Validate(uint32_t app_id) { if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() && app->IsCommandLimitsExceeded( - static_cast<mobile_apis::FunctionID::eType>(function_id()), - application_manager::TLimitSource::POLICY_TABLE)) { + static_cast<mobile_apis::FunctionID::eType>(function_id()), + application_manager::TLimitSource::POLICY_TABLE)) { LOG4CXX_ERROR(logger_, "Alert frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return false; @@ -273,11 +276,13 @@ bool AlertRequest::Validate(uint32_t app_id) { return false; } - //ProcessSoftButtons checks strings on the contents incorrect character + // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager_.GetPolicyHandler(), application_manager_); + MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], + app, + application_manager_.GetPolicyHandler(), + application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -286,13 +291,13 @@ bool AlertRequest::Validate(uint32_t app_id) { } // check if mandatory params(alertText1 and TTSChunk) specified - if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) - && (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) - && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) - && (1 > (*message_)[strings::msg_params] - [strings::tts_chunks].length()))) { + if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) && + (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) && + (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) && + (1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) { LOG4CXX_ERROR(logger_, "Mandatory parameters are missing"); - SendResponse(false, mobile_apis::Result::INVALID_DATA, + SendResponse(false, + mobile_apis::Result::INVALID_DATA, "Mandatory parameters are missing"); return false; } @@ -302,22 +307,21 @@ bool AlertRequest::Validate(uint32_t app_id) { void AlertRequest::SendAlertRequest(int32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(app_id); + ApplicationSharedPtr app = application_manager_.application(app_id); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[hmi_request::alert_strings] = smart_objects::SmartObject( - smart_objects::SmartType_Array); + msg_params[hmi_request::alert_strings] = + smart_objects::SmartObject(smart_objects::SmartType_Array); int32_t index = 0; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = hmi_apis::Common_TextFieldName::alertText1; - msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::alert_text1]; - index++; + msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = + (*message_)[strings::msg_params][strings::alert_text1]; + index++; } if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = @@ -330,7 +334,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = hmi_apis::Common_TextFieldName::alertText3; msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::alert_text3]; + (*message_)[strings::msg_params][strings::alert_text3]; } // softButtons @@ -347,7 +351,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { // NAVI platform progressIndicator if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) { msg_params[strings::progress_indicator] = - (*message_)[strings::msg_params][strings::progress_indicator]; + (*message_)[strings::msg_params][strings::progress_indicator]; } // PASA Alert type @@ -359,14 +363,14 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { // check out if there are alert strings or soft buttons if (msg_params[hmi_request::alert_strings].length() > 0 || msg_params.keyExists(hmi_request::soft_buttons)) { - awaiting_ui_alert_response_ = true; is_ui_alert_sent_ = true; SendHMIRequest(hmi_apis::FunctionID::UI_Alert, &msg_params, true); } } -void AlertRequest::SendSpeakRequest(int32_t app_id, bool tts_chunks_exists, +void AlertRequest::SendSpeakRequest(int32_t app_id, + bool tts_chunks_exists, size_t length_tts_chunks) { LOG4CXX_AUTO_TRACE(logger_); using namespace hmi_apis; @@ -396,7 +400,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); - return false; + return false; } } @@ -404,7 +408,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); - return false; + return false; } } @@ -412,7 +416,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed"); - return false; + return false; } } @@ -432,8 +436,8 @@ bool AlertRequest::CheckStringsOfAlertRequest() { bool AlertRequest::HasHmiResponsesToWait() { LOG4CXX_AUTO_TRACE(logger_); - return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ - || awaiting_tts_stop_speaking_response_; + return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || + awaiting_tts_stop_speaking_response_; } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/alert_response.cc b/src/components/application_manager/src/commands/mobile/alert_response.cc index 5c7918731c..f8ca487eae 100644 --- a/src/components/application_manager/src/commands/mobile/alert_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_response.cc @@ -41,12 +41,11 @@ namespace application_manager { namespace commands { -AlertResponse::AlertResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +AlertResponse::AlertResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -AlertResponse::~AlertResponse() { -} +AlertResponse::~AlertResponse() {} void AlertResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc index 84ce79611a..63339fdc33 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc @@ -42,16 +42,14 @@ namespace { namespace custom_str = utils::custom_string; struct IsSameNickname { - IsSameNickname(const custom_str::CustomString& app_id): - app_id_(app_id) { - } - bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); - } + IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {} + bool operator()(const policy::StringArray::value_type& nickname) const { + return app_id_.CompareIgnoreCase(nickname.c_str()); + } - private: - const custom_str::CustomString& app_id_; - }; + private: + const custom_str::CustomString& app_id_; +}; } namespace application_manager { @@ -60,20 +58,19 @@ namespace commands { ChangeRegistrationRequest::ChangeRegistrationRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - ui_result_(hmi_apis::Common_Result::INVALID_ENUM), - vr_result_(hmi_apis::Common_Result::INVALID_ENUM), - tts_result_(hmi_apis::Common_Result::INVALID_ENUM) { -} + : CommandRequestImpl(message, application_manager) + , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) + , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) + , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} -ChangeRegistrationRequest::~ChangeRegistrationRequest() { -} +ChangeRegistrationRequest::~ChangeRegistrationRequest() {} void ChangeRegistrationRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace smart_objects; - const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + const HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { @@ -113,10 +110,9 @@ void ChangeRegistrationRequest::Run() { const int32_t language = msg_params[strings::language].asInt(); - if (false == - (IsLanguageSupportedByUI(hmi_language) && - IsLanguageSupportedByVR(language) && - IsLanguageSupportedByTTS(language))) { + if (false == (IsLanguageSupportedByUI(hmi_language) && + IsLanguageSupportedByVR(language) && + IsLanguageSupportedByTTS(language))) { LOG4CXX_ERROR(logger_, "Language is not supported"); SendResponse(false, mobile_apis::Result::REJECTED); return; @@ -146,11 +142,10 @@ void ChangeRegistrationRequest::Run() { ui_params[strings::ngn_media_screen_app_name] = msg_params[strings::ngn_media_screen_app_name]; app->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); + msg_params[strings::ngn_media_screen_app_name]); } - SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, - &ui_params, true); + SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, &ui_params, true); // VR processing SmartObject vr_params = SmartObject(SmartType_Map); @@ -160,10 +155,9 @@ void ChangeRegistrationRequest::Run() { vr_params[strings::app_id] = app->app_id(); if (msg_params.keyExists(strings::vr_synonyms)) { vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms]; - app -> set_vr_synonyms(msg_params[strings::vr_synonyms]); + app->set_vr_synonyms(msg_params[strings::vr_synonyms]); } - SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, - &vr_params, true); + SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, &vr_params, true); // TTS processing SmartObject tts_params = SmartObject(SmartType_Map); @@ -176,19 +170,17 @@ void ChangeRegistrationRequest::Run() { app->set_tts_name(msg_params[strings::tts_name]); } - SendHMIRequest(hmi_apis::FunctionID::TTS_ChangeRegistration, - &tts_params, true); + SendHMIRequest( + hmi_apis::FunctionID::TTS_ChangeRegistration, &tts_params, true); } bool ChangeRegistrationRequest::AllHmiResponsesSuccess( - const hmi_apis::Common_Result::eType ui, - const hmi_apis::Common_Result::eType vr, - const hmi_apis::Common_Result::eType tts) { - - return - hmi_apis::Common_Result::SUCCESS == ui && - hmi_apis::Common_Result::SUCCESS == vr && - hmi_apis::Common_Result::SUCCESS == tts; + const hmi_apis::Common_Result::eType ui, + const hmi_apis::Common_Result::eType vr, + const hmi_apis::Common_Result::eType tts) { + return hmi_apis::Common_Result::SUCCESS == ui && + hmi_apis::Common_Result::SUCCESS == vr && + hmi_apis::Common_Result::SUCCESS == tts; } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { @@ -236,28 +228,30 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { if (hmi_apis::Common_Result::SUCCESS == ui_result_) { application->set_ui_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::hmi_display_language].asInt())); + (*message_)[strings::msg_params][strings::hmi_display_language] + .asInt())); } - if (hmi_apis::Common_Result::SUCCESS == vr_result_ - || hmi_apis::Common_Result::SUCCESS == tts_result_) { + if (hmi_apis::Common_Result::SUCCESS == vr_result_ || + hmi_apis::Common_Result::SUCCESS == tts_result_) { application->set_language(static_cast<mobile_api::Language::eType>( (*message_)[strings::msg_params][strings::language].asInt())); } - int32_t greates_result_code = std::max(std::max(ui_result_, vr_result_), - tts_result_); + int32_t greates_result_code = + std::max(std::max(ui_result_, vr_result_), tts_result_); (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::eType::ChangeRegistrationID; + mobile_apis::FunctionID::eType::ChangeRegistrationID; SendResponse(AllHmiResponsesSuccess(ui_result_, vr_result_, tts_result_), static_cast<mobile_apis::Result::eType>(greates_result_code), - NULL, &(message[strings::msg_params])); + NULL, + &(message[strings::msg_params])); } else { LOG4CXX_INFO(logger_, - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + "There are some pending responses from HMI." + "ChangeRegistrationRequest still waiting."); } } @@ -357,10 +351,10 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { } } - if ((*message_)[strings::msg_params]. - keyExists(strings::ngn_media_screen_app_name)) { - str = (*message_)[strings::msg_params] - [strings::ngn_media_screen_app_name].asCharArray(); + if ((*message_)[strings::msg_params].keyExists( + strings::ngn_media_screen_app_name)) { + str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid ngn_media_screen_app_name syntax check failed"); @@ -436,20 +430,19 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { return mobile_apis::Result::DUPLICATE_NAME; } } // end vr check - } // application for end + } // application for end return mobile_apis::Result::SUCCESS; } bool ChangeRegistrationRequest::IsNicknameAllowed( const custom_str::CustomString& app_name) const { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_. - application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Can't find appication with connection key " - << connection_key()); + LOG4CXX_ERROR(logger_, + "Can't find appication with connection key " + << connection_key()); return false; } @@ -458,20 +451,20 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( policy::StringArray app_nicknames; policy::StringArray app_hmi_types; - bool init_result = application_manager_.GetPolicyHandler() - .GetInitialAppData(policy_app_id, &app_nicknames, &app_hmi_types); + bool init_result = application_manager_.GetPolicyHandler().GetInitialAppData( + policy_app_id, &app_nicknames, &app_hmi_types); if (!init_result) { LOG4CXX_ERROR(logger_, "Error during getting of nickname list for application " - << policy_app_id); + << policy_app_id); return false; } if (!app_nicknames.empty()) { IsSameNickname compare(app_name); - policy::StringArray::const_iterator it = std::find_if( - app_nicknames.begin(), app_nicknames.end(), compare); + policy::StringArray::const_iterator it = + std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { LOG4CXX_WARN(logger_, "Application name was not found in nicknames list."); diff --git a/src/components/application_manager/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/src/commands/mobile/change_registration_response.cc index 0c41534e73..210cae64c5 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_response.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/change_registration_response.h" - namespace application_manager { namespace commands { ChangeRegistrationResponse::ChangeRegistrationResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -ChangeRegistrationResponse::~ChangeRegistrationResponse() { -} +ChangeRegistrationResponse::~ChangeRegistrationResponse() {} void ChangeRegistrationResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index 8f2d531032..b602601f26 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -46,12 +46,11 @@ namespace application_manager { namespace commands { CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - expected_chs_count_(0), - received_chs_count_(0), - error_from_hmi_(false) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , expected_chs_count_(0) + , received_chs_count_(0) + , error_from_hmi_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { LOG4CXX_AUTO_TRACE(logger_); @@ -60,8 +59,7 @@ CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { void CreateInteractionChoiceSetRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace mobile_apis; - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -73,32 +71,37 @@ void CreateInteractionChoiceSetRequest::Run() { ++i) { Result::eType verification_result_image = Result::SUCCESS; Result::eType verification_result_secondary_image = Result::SUCCESS; - if ((*message_)[strings::msg_params] - [strings::choice_set][i].keyExists(strings::image)) { + if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists( + strings::image)) { verification_result_image = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::choice_set] - [i][strings::image], app, application_manager_); + (*message_)[strings::msg_params][strings::choice_set][i] + [strings::image], + app, + application_manager_); } - if ((*message_)[strings::msg_params] - [strings::choice_set][i].keyExists(strings::secondary_image)) { + if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists( + strings::secondary_image)) { verification_result_secondary_image = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::choice_set] - [i][strings::secondary_image], app, application_manager_); + (*message_)[strings::msg_params][strings::choice_set][i] + [strings::secondary_image], + app, + application_manager_); } if (verification_result_image == Result::INVALID_DATA || verification_result_secondary_image == Result::INVALID_DATA) { LOG4CXX_ERROR(logger_, "Image verification failed."); - SendResponse(false, Result::INVALID_DATA); + SendResponse(false, Result::INVALID_DATA); return; } } - choice_set_id_ = (*message_)[strings::msg_params] - [strings::interaction_choice_set_id].asInt(); + choice_set_id_ = + (*message_)[strings::msg_params][strings::interaction_choice_set_id] + .asInt(); if (app->FindChoiceSet(choice_set_id_)) { - LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id_ << - " is not found."); + LOG4CXX_ERROR(logger_, + "Choice set with id " << choice_set_id_ << " is not found."); SendResponse(false, Result::INVALID_ID); return; } @@ -115,7 +118,7 @@ void CreateInteractionChoiceSetRequest::Run() { } mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( - ApplicationConstSharedPtr app) { + ApplicationConstSharedPtr app) { using namespace smart_objects; LOG4CXX_AUTO_TRACE(logger_); @@ -130,15 +133,15 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( std::pair<std::set<uint32_t>::iterator, bool> ins_res = choice_id_set.insert((*choice_set_it)[strings::choice_id].asInt()); if (!ins_res.second) { - LOG4CXX_ERROR(logger_, "Choise with ID " - << (*choice_set_it)[strings::choice_id].asInt() - << " already exists"); + LOG4CXX_ERROR(logger_, + "Choise with ID " + << (*choice_set_it)[strings::choice_id].asInt() + << " already exists"); return mobile_apis::Result::INVALID_ID; } if (IsWhiteSpaceExist(*choice_set_it)) { - LOG4CXX_ERROR(logger_, - "Incoming choice set has contains \t\n \\t \\n"); + LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); return mobile_apis::Result::INVALID_DATA; } } @@ -146,24 +149,26 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( } bool CreateInteractionChoiceSetRequest::compareSynonyms( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1, - const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) { + const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1, + const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) { smart_objects::SmartArray* vr_cmds_1 = - choice1[strings::vr_commands].asArray(); + choice1[strings::vr_commands].asArray(); DCHECK(vr_cmds_1 != NULL); smart_objects::SmartArray* vr_cmds_2 = - choice2[strings::vr_commands].asArray(); + choice2[strings::vr_commands].asArray(); DCHECK(vr_cmds_2 != NULL); smart_objects::SmartArray::iterator it; - it = std::find_first_of(vr_cmds_1->begin(), vr_cmds_1->end(), - vr_cmds_2->begin(), vr_cmds_2->end(), + it = std::find_first_of(vr_cmds_1->begin(), + vr_cmds_1->end(), + vr_cmds_2->begin(), + vr_cmds_2->end(), CreateInteractionChoiceSetRequest::compareStr); - if (it != vr_cmds_1->end()) { - LOG4CXX_INFO(logger_, "Incoming choice set has duplicated VR synonyms " - << it->asString()); + LOG4CXX_INFO(logger_, + "Incoming choice set has duplicated VR synonyms " + << it->asString()); return true; } @@ -171,13 +176,13 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms( } bool CreateInteractionChoiceSetRequest::compareStr( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1, - const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) { + const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1, + const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) { return 0 == strcasecmp(str1.asCharArray(), str2.asCharArray()); } bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( - const smart_objects::SmartObject& choice_set) { + const smart_objects::SmartObject& choice_set) { LOG4CXX_AUTO_TRACE(logger_); const char* str = NULL; @@ -204,8 +209,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( } if (choice_set.keyExists(strings::vr_commands)) { - const size_t len = - choice_set[strings::vr_commands].length(); + const size_t len = choice_set[strings::vr_commands].length(); for (size_t i = 0; i < len; ++i) { str = choice_set[strings::vr_commands][i].asCharArray(); @@ -227,8 +231,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::secondary_image)) { str = choice_set[strings::secondary_image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid secondary_image value. " - "Syntax check failed"); + LOG4CXX_ERROR(logger_, + "Invalid secondary_image value. " + "Syntax check failed"); return true; } } @@ -236,15 +241,15 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( } void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( - application_manager::ApplicationSharedPtr const app) { + application_manager::ApplicationSharedPtr const app) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params]; - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; msg_params[strings::app_id] = app->app_id(); - msg_params[strings::grammar_id] = choice_set[strings::grammar_id]; + msg_params[strings::grammar_id] = choice_set[strings::grammar_id]; const uint32_t choice_count = choice_set[strings::choice_set].length(); SetAllowedToTerminate(false); @@ -254,17 +259,18 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( { sync_primitives::AutoLock error_lock(error_from_hmi_lock_); if (error_from_hmi_) { - LOG4CXX_WARN(logger_, "Error from HMI received. Stop sending VRCommands"); + LOG4CXX_WARN(logger_, + "Error from HMI received. Stop sending VRCommands"); break; } } msg_params[strings::cmd_id] = - choice_set[strings::choice_set][chs_num][strings::choice_id]; - msg_params[strings::vr_commands] = smart_objects::SmartObject( - smart_objects::SmartType_Array); + choice_set[strings::choice_set][chs_num][strings::choice_id]; + msg_params[strings::vr_commands] = + smart_objects::SmartObject(smart_objects::SmartType_Array); msg_params[strings::vr_commands] = - choice_set[strings::choice_set][chs_num][strings::vr_commands]; + choice_set[strings::choice_set][chs_num][strings::vr_commands]; sync_primitives::AutoLock commands_lock(vr_commands_lock_); const uint32_t vr_cmd_id = msg_params[strings::cmd_id].asUInt(); @@ -273,8 +279,9 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( VRCommandInfo vr_command(vr_cmd_id); sent_commands_map_[vr_corr_id] = vr_command; - LOG4CXX_DEBUG(logger_, "VR_command sent corr_id " - << vr_corr_id << " cmd_id " << vr_corr_id); + LOG4CXX_DEBUG(logger_, + "VR_command sent corr_id " << vr_corr_id << " cmd_id " + << vr_corr_id); } expected_chs_count_ = chs_num; LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); @@ -289,12 +296,13 @@ void CreateInteractionChoiceSetRequest::on_event( const smart_objects::SmartObject& message = event.smart_object(); if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { received_chs_count_++; - LOG4CXX_DEBUG(logger_, "Got VR.AddCommand response, there are " - << expected_chs_count_ - received_chs_count_ - << " more to wait."); + LOG4CXX_DEBUG(logger_, + "Got VR.AddCommand response, there are " + << expected_chs_count_ - received_chs_count_ + << " more to wait."); - uint32_t corr_id = static_cast<uint32_t>(message[strings::params] - [strings::correlation_id].asUInt()); + uint32_t corr_id = static_cast<uint32_t>( + message[strings::params][strings::correlation_id].asUInt()); { sync_primitives::AutoLock commands_lock(vr_commands_lock_); SentCommandsMap::iterator it = sent_commands_map_.find(corr_id); @@ -303,21 +311,20 @@ void CreateInteractionChoiceSetRequest::on_event( return; } - Common_Result::eType vr_result = static_cast<Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + Common_Result::eType vr_result = static_cast<Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); - const bool is_vr_no_error = - Compare<Common_Result::eType, EQ, ONE>( - vr_result, - Common_Result::SUCCESS, - Common_Result::WARNINGS); + const bool is_vr_no_error = Compare<Common_Result::eType, EQ, ONE>( + vr_result, Common_Result::SUCCESS, Common_Result::WARNINGS); if (is_vr_no_error) { VRCommandInfo& vr_command = it->second; vr_command.succesful_response_received_ = true; } else { - LOG4CXX_DEBUG(logger_, "Hmi response is not Success: " << vr_result - << ". Stop sending VRAddCommand requests"); + LOG4CXX_DEBUG(logger_, + "Hmi response is not Success: " + << vr_result + << ". Stop sending VRAddCommand requests"); if (!error_from_hmi_) { error_from_hmi_ = true; SendResponse(false, GetMobileResultCode(vr_result)); @@ -346,15 +353,14 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { // according to SDLAQ-CRS-2976 sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_); is_timed_out_ = true; - application_manager_.TerminateRequest( - connection_key(), correlation_id()); + application_manager_.TerminateRequest(connection_key(), correlation_id()); } void CreateInteractionChoiceSetRequest::DeleteChoices() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = - application_manager_.application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; @@ -372,9 +378,9 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { msg_param[strings::cmd_id] = vr_command_info.cmd_id_; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param); } else { - LOG4CXX_WARN( - logger_, "Succesfull response has not been received for cmd_id = " - << vr_command_info.cmd_id_); + LOG4CXX_WARN(logger_, + "Succesfull response has not been received for cmd_id = " + << vr_command_info.cmd_id_); } } sent_commands_map_.clear(); @@ -397,8 +403,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { DeleteChoices(); } - application_manager_.TerminateRequest( - connection_key(), correlation_id()); + application_manager_.TerminateRequest(connection_key(), correlation_id()); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc index cac23a4bc9..0cc137d6a0 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc @@ -42,11 +42,9 @@ namespace commands { CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() { -} +CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {} void CreateInteractionChoiceSetResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index baebbe26cd..9a7b92f7b8 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -43,24 +43,23 @@ namespace application_manager { namespace commands { -DeleteCommandRequest::DeleteCommandRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - is_ui_send_(false), - is_vr_send_(false), - is_ui_received_(false), - is_vr_received_(false), - ui_result_(hmi_apis::Common_Result::INVALID_ENUM), - vr_result_(hmi_apis::Common_Result::INVALID_ENUM) { -} - -DeleteCommandRequest::~DeleteCommandRequest() { -} +DeleteCommandRequest::DeleteCommandRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , is_ui_send_(false) + , is_vr_send_(false) + , is_ui_received_(false) + , is_vr_received_(false) + , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) + , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + +DeleteCommandRequest::~DeleteCommandRequest() {} void DeleteCommandRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr application = application_manager_. - application(connection_key()); + ApplicationSharedPtr application = + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -79,8 +78,8 @@ void DeleteCommandRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -123,20 +122,22 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { is_ui_received_ = true; const int result = message[strings::params][hmi_response::code].asInt(); ui_result_ = static_cast<hmi_apis::Common_Result::eType>(result); - LOG4CXX_DEBUG(logger_, "Received UI_DeleteCommand event with result " - << MessageHelper::HMIResultToString(ui_result_)); + LOG4CXX_DEBUG(logger_, + "Received UI_DeleteCommand event with result " + << MessageHelper::HMIResultToString(ui_result_)); break; } case hmi_apis::FunctionID::VR_DeleteCommand: { is_vr_received_ = true; const int result = message[strings::params][hmi_response::code].asInt(); vr_result_ = static_cast<hmi_apis::Common_Result::eType>(result); - LOG4CXX_DEBUG(logger_, "Received VR_DeleteCommand event with result " - << MessageHelper::HMIResultToString(vr_result_)); + LOG4CXX_DEBUG(logger_, + "Received VR_DeleteCommand event with result " + << MessageHelper::HMIResultToString(vr_result_)); break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; } } @@ -160,34 +161,32 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { smart_objects::SmartObject* command = application->FindCommand(cmd_id); if (!command) { - LOG4CXX_ERROR(logger_, "Command id " << cmd_id << " not found for " - "application with connection key " << connection_key()); + LOG4CXX_ERROR(logger_, + "Command id " << cmd_id << " not found for " + "application with connection key " + << connection_key()); return; } const bool is_vr_success_invalid = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::INVALID_ENUM); + vr_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::INVALID_ENUM); const bool is_ui_success_invalid = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::INVALID_ENUM); + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::INVALID_ENUM); const bool is_vr_ui_invalid = Compare<hmi_apis::Common_Result::eType, EQ, ALL>( - hmi_apis::Common_Result::INVALID_ENUM, - vr_result_, - ui_result_); + hmi_apis::Common_Result::INVALID_ENUM, vr_result_, ui_result_); const bool is_vr_or_ui_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, - ui_result_, - vr_result_); + hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); const bool result = // In case of UI/VR is SUCCESS and other is SUCCESS/INVALID_ENUM @@ -202,15 +201,14 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - if (!result && - hmi_apis::Common_Result::REJECTED == ui_result_) { + if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) { result_code = MessageHelper::HMIToMobileResult(vr_result_); } else if (is_vr_or_ui_warning) { LOG4CXX_DEBUG(logger_, "VR or UI result is warning"); result_code = mobile_apis::Result::WARNINGS; } else { - result_code = MessageHelper::HMIToMobileResult( - std::max(ui_result_, vr_result_)); + result_code = + MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_)); } SendResponse(result, result_code, NULL, &msg_params); diff --git a/src/components/application_manager/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc index c1ab1926e2..7abc1c11d4 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/delete_command_response.h" - namespace application_manager { namespace commands { -DeleteCommandResponse::DeleteCommandResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +DeleteCommandResponse::DeleteCommandResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -DeleteCommandResponse::~DeleteCommandResponse() { -} +DeleteCommandResponse::~DeleteCommandResponse() {} void DeleteCommandResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc index adc4dbb776..00d23bb094 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_request.cc @@ -41,12 +41,11 @@ namespace application_manager { namespace commands { -DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -DeleteFileRequest::~DeleteFileRequest() { -} +DeleteFileRequest::~DeleteFileRequest() {} void DeleteFileRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -63,11 +62,12 @@ void DeleteFileRequest::Run() { if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && (application_manager_.get_settings().delete_file_in_none() <= application->delete_file_in_none_count())) { - // If application is in the HMI_NONE level the quantity of allowed - // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, mobile_apis::Result::REJECTED); - return; + // If application is in the HMI_NONE level the quantity of allowed + // DeleteFile request is limited by the configuration profile + LOG4CXX_ERROR(logger_, + "Too many requests from the app with HMILevel HMI_NONE "); + SendResponse(false, mobile_apis::Result::REJECTED); + return; } const std::string& sync_file_name = @@ -97,17 +97,16 @@ void DeleteFileRequest::Run() { } } -void DeleteFileRequest::SendFileRemovedNotification( - const AppFile* file) const { - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); +void DeleteFileRequest::SendFileRemovedNotification(const AppFile* file) const { + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::file_name] = file->file_name; - msg_params[strings::file_type] = file->file_type; + msg_params[strings::app_id] = connection_key(); + msg_params[strings::file_name] = file->file_name; + msg_params[strings::file_type] = file->file_type; - CreateHMINotification( - hmi_apis::FunctionID::BasicCommunication_OnFileRemoved, msg_params); + CreateHMINotification(hmi_apis::FunctionID::BasicCommunication_OnFileRemoved, + msg_params); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/src/commands/mobile/delete_file_response.cc index f9fbd93fa2..8ed6f7ba2e 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_response.cc @@ -39,19 +39,17 @@ namespace application_manager { namespace commands { -DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -DeleteFileResponse::~DeleteFileResponse() { -} +DeleteFileResponse::~DeleteFileResponse() {} void DeleteFileResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = (*message_)[strings::params][strings::connection_key] - .asUInt(); - ApplicationSharedPtr app = - application_manager_.application(app_id); + uint32_t app_id = + (*message_)[strings::params][strings::connection_key].asUInt(); + ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc index 1a5aa490bb..6ef8e5d9da 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -44,32 +44,30 @@ namespace commands { DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + : CommandRequestImpl(message, application_manager) {} -DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() { -} +DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} void DeleteInteractionChoiceSetRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with connection key " - << connection_key()); + LOG4CXX_ERROR(logger_, + "No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } const int32_t choice_set_id = - (*message_)[strings::msg_params] - [strings::interaction_choice_set_id].asInt(); + (*message_)[strings::msg_params][strings::interaction_choice_set_id] + .asInt(); if (!app->FindChoiceSet(choice_set_id)) { - LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id - << " is not found."); + LOG4CXX_ERROR(logger_, + "Choice set with id " << choice_set_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -81,8 +79,8 @@ void DeleteInteractionChoiceSetRequest::Run() { } SendVrDeleteCommand(app); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::interaction_choice_set_id] = choice_set_id; msg_params[strings::app_id] = app->app_id(); @@ -108,17 +106,17 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( const PerformChoiceSetMap& choice_set_map = accessor.GetData(); const uint32_t choice_set_id = - (*message_)[strings::msg_params][strings::interaction_choice_set_id]. - asUInt(); + (*message_)[strings::msg_params][strings::interaction_choice_set_id] + .asUInt(); PerformChoiceSetMap::const_iterator it = choice_set_map.begin(); for (; choice_set_map.end() != it; ++it) { - const PerformChoice& choice = it->second; + const PerformChoice& choice = it->second; PerformChoice::const_iterator choice_it = choice.begin(); for (; choice.end() != choice_it; ++choice_it) { if (choice_it->first == choice_set_id) { - LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id - << " is in use."); + LOG4CXX_ERROR(logger_, + "Choice set with id " << choice_set_id << " is in use."); return true; } } @@ -131,24 +129,24 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( LOG4CXX_AUTO_TRACE(logger_); const uint32_t choice_set_id = - (*message_)[strings::msg_params][strings::interaction_choice_set_id]. - asUInt(); + (*message_)[strings::msg_params][strings::interaction_choice_set_id] + .asUInt(); smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id); if (!choice_set) { - LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id - << " is not found."); + LOG4CXX_ERROR(logger_, + "Choice set with id " << choice_set_id << " is not found."); return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id]; choice_set = &((*choice_set)[strings::choice_set]); - for (uint32_t i = 0; i < (*choice_set).length() ; ++i) { + for (uint32_t i = 0; i < (*choice_set).length(); ++i) { msg_params[strings::cmd_id] = (*choice_set)[i][strings::choice_id]; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); } diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc index 1281cddf6a..97e07529af 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc @@ -43,11 +43,9 @@ namespace commands { DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() { -} +DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {} void DeleteInteractionChoiceSetResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index ea19cb3389..bdb5521921 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -41,18 +41,16 @@ namespace application_manager { namespace commands { -DeleteSubMenuRequest::DeleteSubMenuRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +DeleteSubMenuRequest::DeleteSubMenuRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -DeleteSubMenuRequest::~DeleteSubMenuRequest() { -} +DeleteSubMenuRequest::~DeleteSubMenuRequest() {} void DeleteSubMenuRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -69,8 +67,8 @@ void DeleteSubMenuRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::menu_id] = (*message_)[strings::msg_params][strings::menu_id]; @@ -88,16 +86,14 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands( CommandsMap::const_iterator it = commands.begin(); for (; commands.end() != it; ++it) { - if (!(*it->second).keyExists(strings::vr_commands)) { continue; } - if ((*message_)[strings::msg_params][strings::menu_id].asInt() - == (*it->second)[strings::menu_params] - [hmi_request::parent_id].asInt()) { - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params][strings::menu_id].asInt() == + (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); msg_params[strings::app_id] = app->app_id(); msg_params[strings::grammar_id] = app->get_grammar_id(); @@ -123,11 +119,10 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( continue; } - if ((*message_)[strings::msg_params][strings::menu_id].asInt() - == (*it->second)[strings::menu_params] - [hmi_request::parent_id].asInt()) { - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params][strings::menu_id].asInt() == + (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); app->RemoveCommand((*it->second)[strings::cmd_id].asInt()); @@ -152,14 +147,13 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - application_manager_.application(connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -172,7 +166,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { DeleteSubMenuUICommands(application); application->RemoveSubMenu( (*message_)[strings::msg_params][strings::menu_id].asInt()); - } + } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); if (result) { @@ -187,7 +181,6 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { } } - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc index cea087024c..ad9d2ad858 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/delete_sub_menu_response.h" - namespace application_manager { namespace commands { -DeleteSubMenuResponse::DeleteSubMenuResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +DeleteSubMenuResponse::DeleteSubMenuResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -DeleteSubMenuResponse::~DeleteSubMenuResponse() { -} +DeleteSubMenuResponse::~DeleteSubMenuResponse() {} void DeleteSubMenuResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc index 448c006793..5252ea0e33 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc @@ -42,18 +42,16 @@ namespace application_manager { namespace commands { -DiagnosticMessageRequest::DiagnosticMessageRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +DiagnosticMessageRequest::DiagnosticMessageRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -DiagnosticMessageRequest::~DiagnosticMessageRequest() { -} +DiagnosticMessageRequest::~DiagnosticMessageRequest() {} void DiagnosticMessageRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered."); @@ -72,9 +70,11 @@ void DiagnosticMessageRequest::Run() { if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(), supported_diag_modes.end(), msg_diagnostic_mode)) { - LOG4CXX_ERROR(logger_, "Received diagnostic mode " << msg_diagnostic_mode << - " is not supported."); - SendResponse(false, mobile_apis::Result::REJECTED, + LOG4CXX_ERROR(logger_, + "Received diagnostic mode " << msg_diagnostic_mode + << " is not supported."); + SendResponse(false, + mobile_apis::Result::REJECTED, "Received diagnostic mode is not supported."); return; } @@ -83,8 +83,8 @@ void DiagnosticMessageRequest::Run() { (*message_)[strings::msg_params][strings::app_id] = app->app_id(); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage, - &(*message_)[strings::msg_params], true); - + &(*message_)[strings::msg_params], + true); } void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc index ce987c9592..8c59a97a8b 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/diagnostic_message_response.h" - namespace application_manager { namespace commands { -DiagnosticMessageResponse::DiagnosticMessageResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +DiagnosticMessageResponse::DiagnosticMessageResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -DiagnosticMessageResponse::~DiagnosticMessageResponse() { -} +DiagnosticMessageResponse::~DiagnosticMessageResponse() {} void DiagnosticMessageResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc index 52b6b7aaeb..64685afe2e 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_request.cc @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -DialNumberRequest::~DialNumberRequest() { -} +DialNumberRequest::~DialNumberRequest() {} bool DialNumberRequest::Init() { LOG4CXX_AUTO_TRACE(logger_); @@ -77,7 +76,8 @@ void DialNumberRequest::Run() { StripNumberParam(number); if (number.empty()) { - LOG4CXX_ERROR(logger_, "After strip number param is empty. Invalid incoming data"); + LOG4CXX_ERROR(logger_, + "After strip number param is empty. Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -87,8 +87,8 @@ void DialNumberRequest::Run() { (*message_)[strings::msg_params][strings::number].asString(); msg_params[strings::app_id] = application->hmi_app_id(); - SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_DialNumber, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true); } void DialNumberRequest::on_event(const event_engine::Event& event) { @@ -106,9 +106,9 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { LOG4CXX_INFO(logger_, "Received DialNumber event"); - result_code = CommandRequestImpl::GetMobileResultCode( - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt())); + result_code = CommandRequestImpl::GetMobileResultCode( + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt())); break; } default: { @@ -133,7 +133,8 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { void DialNumberRequest::StripNumberParam(std::string& number) { std::size_t found = 0; - while (std::string::npos != (found = number.find_first_not_of("0123456789*#,;+"))) { + while (std::string::npos != + (found = number.find_first_not_of("0123456789*#,;+"))) { number.erase(number.begin() + found); } (*message_)[strings::msg_params][strings::number] = number; diff --git a/src/components/application_manager/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/src/commands/mobile/dial_number_response.cc index ae44597607..750dcf25c4 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_response.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_response.cc @@ -32,17 +32,15 @@ #include "application_manager/commands/mobile/dial_number_response.h" - namespace application_manager { namespace commands { -DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -DialNumberResponse::~DialNumberResponse() { -} +DialNumberResponse::~DialNumberResponse() {} void DialNumberResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc index 827eb25526..5a922f595f 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/end_audio_pass_thru_request.h" - namespace application_manager { namespace commands { EndAudioPassThruRequest::EndAudioPassThruRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -EndAudioPassThruRequest::~EndAudioPassThruRequest() { -} +EndAudioPassThruRequest::~EndAudioPassThruRequest() {} void EndAudioPassThruRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -65,11 +62,9 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { bool result = mobile_apis::Result::SUCCESS == mobile_code; if (result) { - bool ended_successfully = - application_manager_.EndAudioPassThrough(); + bool ended_successfully = application_manager_.EndAudioPassThrough(); if (ended_successfully) { - application_manager_.StopAudioPassThru( - connection_key()); + application_manager_.StopAudioPassThru(connection_key()); } } diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc index 2f66b6e70c..bb477f5083 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/end_audio_pass_thru_response.h" - namespace application_manager { namespace commands { EndAudioPassThruResponse::EndAudioPassThruResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -EndAudioPassThruResponse::~EndAudioPassThruResponse() { -} +EndAudioPassThruResponse::~EndAudioPassThruResponse() {} void EndAudioPassThruResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/generic_response.cc b/src/components/application_manager/src/commands/mobile/generic_response.cc index cab1779940..20f6931bb9 100644 --- a/src/components/application_manager/src/commands/mobile/generic_response.cc +++ b/src/components/application_manager/src/commands/mobile/generic_response.cc @@ -55,7 +55,7 @@ void GenericResponse::Run() { (*message_)[strings::params][strings::message_type] = MessageType::kResponse; (*message_)[strings::msg_params][strings::success] = false; (*message_)[strings::msg_params][strings::result_code] = - mobile_apis::Result::INVALID_DATA; + mobile_apis::Result::INVALID_DATA; SendResponse(false); } diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc index 4d2a3ba7a7..80bc89f853 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -GetDTCsRequest::~GetDTCsRequest() { -} +GetDTCsRequest::~GetDTCsRequest() {} void GetDTCsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -59,8 +58,8 @@ void GetDTCsRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::ecu_name] = (*message_)[strings::msg_params][strings::ecu_name]; diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc index 3ba11f560f..ecaf5c3d8f 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/get_dtcs_response.h" - namespace application_manager { namespace commands { -GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -GetDTCsResponse::~GetDTCsResponse() { -} +GetDTCsResponse::~GetDTCsResponse() {} void GetDTCsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc index 7f13fa0316..8b7010c6a1 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc @@ -46,20 +46,18 @@ namespace commands { namespace str = strings; #ifdef HMI_DBUS_API -GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +GetVehicleDataRequest::GetVehicleDataRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -GetVehicleDataRequest::~GetVehicleDataRequest() { -} +GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = - appplication_manager.application(app_id); + ApplicationSharedPtr app = appplication_manager.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -71,8 +69,8 @@ void GetVehicleDataRequest::Run() { VehicleData::const_iterator it = vehicle_data.begin(); for (; vehicle_data.end() != it; ++it) { - if (true == (*message_)[str::msg_params].keyExists(it->first) - && true == (*message_)[str::msg_params][it->first].asBool()) { + if (true == (*message_)[str::msg_params].keyExists(it->first) && + true == (*message_)[str::msg_params][it->first].asBool()) { SendRequestsToHmi(app->app_id()); return; } @@ -82,37 +80,44 @@ void GetVehicleDataRequest::Run() { } namespace { - struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; - }; - Subrequest subrequests[] = { - { hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps}, - { hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed}, - { hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm}, - { hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level}, - { hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, str::fuel_level_state}, - { hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, str::instant_fuel_consumption}, - { hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, str::external_temp}, - { hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin}, - { hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl}, - { hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure}, - { hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer}, - { hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status}, - { hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, str::body_information}, - { hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status}, - { hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking}, - { hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status}, - { hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, str::head_lamp_status}, - { hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque}, - { hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos}, - { hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, str::steering_wheel_angle}, - { hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info}, - { hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status}, - { hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event}, - { hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, str::cluster_mode_status}, - { hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key}, - }; +struct Subrequest { + hmi_apis::FunctionID::eType func_id; + const char* str; +}; +Subrequest subrequests[] = { + {hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps}, + {hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed}, + {hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm}, + {hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level}, + {hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, + str::fuel_level_state}, + {hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, + str::instant_fuel_consumption}, + {hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, + str::external_temp}, + {hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin}, + {hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl}, + {hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure}, + {hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer}, + {hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status}, + {hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, + str::body_information}, + {hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status}, + {hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking}, + {hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status}, + {hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, + str::head_lamp_status}, + {hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque}, + {hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos}, + {hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, + str::steering_wheel_angle}, + {hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info}, + {hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status}, + {hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event}, + {hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, + str::cluster_mode_status}, + {hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key}, +}; } void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { @@ -121,8 +126,8 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { const Subrequest& sr = subrequests[i]; - if (true == (*message_)[str::msg_params].keyExists(sr.str) - && true == (*message_)[str::msg_params][sr.str].asBool()) { + if (true == (*message_)[str::msg_params].keyExists(sr.str) && + true == (*message_)[str::msg_params][sr.str].asBool()) { HmiRequest hmi_request; hmi_request.str = sr.str; hmi_request.func_id = sr.func_id; @@ -135,7 +140,8 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { hmi_requests_.size() << " requests are going to be sent to HMI"); for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { + it != hmi_requests_.end(); + ++it) { SendHMIRequest(it->func_id, &msg_params, true); } } @@ -150,9 +156,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { ++it) { HmiRequest& hmi_request = *it; if (hmi_request.func_id == event.id()) { - hmi_request.status = - static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code] - .asInt()); + hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) hmi_request.value = message[str::msg_params][hmi_request.str]; hmi_request.complete = true; @@ -206,16 +211,17 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } } #else -GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +GetVehicleDataRequest::GetVehicleDataRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); + int32_t app_id = + (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { @@ -290,8 +296,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API -} // namespace commands +} // namespace commands -} // namespace application_manager +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc index 138016832a..1e64746262 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -GetVehicleDataResponse::GetVehicleDataResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +GetVehicleDataResponse::GetVehicleDataResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -GetVehicleDataResponse::~GetVehicleDataResponse() { -} +GetVehicleDataResponse::~GetVehicleDataResponse() {} void GetVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 c7d73288cc..596a8c4627 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 @@ -7,23 +7,21 @@ namespace commands { GetWayPointsRequest::GetWayPointsRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - :CommandRequestImpl(message, application_manager){ -} + : CommandRequestImpl(message, application_manager) {} GetWayPointsRequest::~GetWayPointsRequest() {} void GetWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "An application with connection key " - << connection_key() << " is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; + LOG4CXX_ERROR(logger_, + "An application with connection key " + << connection_key() << " is not registered."); + SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); + return; } SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints, NULL, true); @@ -31,24 +29,22 @@ 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()) { + 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())); + 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])); break; } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + break; + } } } diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc index 615a0996a5..7956b34cae 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc @@ -6,12 +6,10 @@ namespace application_manager { namespace commands { GetWayPointsResponse::GetWayPointsResponse( - const MessageSharedPtr &message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -GetWayPointsResponse::~GetWayPointsResponse() { -} +GetWayPointsResponse::~GetWayPointsResponse() {} void GetWayPointsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc index 7410c12a05..425f1ddb46 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc @@ -43,12 +43,11 @@ namespace application_manager { namespace commands { -ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -ListFilesRequest::~ListFilesRequest() { -} +ListFilesRequest::~ListFilesRequest() {} void ListFilesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -65,35 +64,41 @@ void ListFilesRequest::Run() { if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && (application_manager_.get_settings().list_files_in_none() <= application->list_files_in_none_count())) { - // If application is in the HMI_NONE level the quantity of allowed - // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, mobile_apis::Result::REJECTED); - return; + // If application is in the HMI_NONE level the quantity of allowed + // DeleteFile request is limited by the configuration profile + LOG4CXX_ERROR(logger_, + "Too many requests from the app with HMILevel HMI_NONE "); + SendResponse(false, mobile_apis::Result::REJECTED); + return; } application->increment_list_files_in_none_count(); (*message_)[strings::msg_params][strings::space_available] = - static_cast<int32_t>(application->GetAvailableDiskSpace()); + static_cast<int32_t>(application->GetAvailableDiskSpace()); uint32_t i = 0; const AppFilesMap& app_files = application->getAppFiles(); for (AppFilesMap::const_iterator it = app_files.begin(); - it != app_files.end(); ++it) { + it != app_files.end(); + ++it) { std::string filename = it->first.substr(it->first.find_last_of('/') + 1); // In AppFile to application stored full path to file. In message required // to write only name file. // Plus one required for move to next letter after '/'. if (i < application_manager_.get_settings().list_files_response_size()) { - LOG4CXX_DEBUG(logger_, "File " + filename + " added to ListFiles response"); + LOG4CXX_DEBUG(logger_, + "File " + filename + " added to ListFiles response"); (*message_)[strings::msg_params][strings::filenames][i++] = filename; } else { - LOG4CXX_DEBUG(logger_, "File " + filename + " not added to ListFiles response"); + LOG4CXX_DEBUG(logger_, + "File " + filename + " not added to ListFiles response"); } } (*message_)[strings::params][strings::message_type] = application_manager::MessageType::kResponse; - SendResponse(true, mobile_apis::Result::SUCCESS, NULL, + SendResponse(true, + mobile_apis::Result::SUCCESS, + NULL, &(*message_)[strings::msg_params]); } diff --git a/src/components/application_manager/src/commands/mobile/list_files_response.cc b/src/components/application_manager/src/commands/mobile/list_files_response.cc index 8517d37b0d..fde15a94ef 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_response.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_response.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -ListFilesResponse::~ListFilesResponse() { -} +ListFilesResponse::~ListFilesResponse() {} void ListFilesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc index b7a26df478..6064374dab 100644 --- a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc @@ -40,11 +40,10 @@ namespace commands { OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnAppInterfaceUnregisteredNotification::~OnAppInterfaceUnregisteredNotification() { -} +OnAppInterfaceUnregisteredNotification:: + ~OnAppInterfaceUnregisteredNotification() {} void OnAppInterfaceUnregisteredNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc index 9b10cd08ad..d0fa3597bc 100644 --- a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc @@ -38,11 +38,9 @@ namespace commands { OnAudioPassThruNotification::OnAudioPassThruNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnAudioPassThruNotification::~OnAudioPassThruNotification() { -} +OnAudioPassThruNotification::~OnAudioPassThruNotification() {} void OnAudioPassThruNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc index d045dadbe9..fb35257441 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc @@ -44,18 +44,15 @@ namespace mobile { OnButtonEventNotification::OnButtonEventNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnButtonEventNotification::~OnButtonEventNotification() { -} +OnButtonEventNotification::~OnButtonEventNotification() {} void OnButtonEventNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - const uint32_t btn_id = - static_cast<uint32_t>( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); + const uint32_t btn_id = static_cast<uint32_t>( + (*message_)[strings::msg_params][hmi_response::button_name].asInt()); // CUSTOM_BUTTON notification if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { @@ -66,8 +63,9 @@ void OnButtonEventNotification::Run() { } // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + if (false == + (*message_)[strings::msg_params].keyExists( + hmi_response::custom_button_id)) { LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without custom_button_id."); return; @@ -82,8 +80,9 @@ void OnButtonEventNotification::Run() { } uint32_t custom_btn_id = 0; - custom_btn_id = (*message_)[strings::msg_params] - [hmi_response::custom_button_id].asUInt(); + custom_btn_id = + (*message_)[strings::msg_params][hmi_response::custom_button_id] + .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { LOG4CXX_ERROR(logger_, @@ -106,19 +105,21 @@ void OnButtonEventNotification::Run() { continue; } - //Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode + // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, "OnButtonEvent notification is allowed only" - << "in FULL or LIMITED hmi level"); + LOG4CXX_WARN(logger_, + "OnButtonEvent notification is allowed only" + << "in FULL or LIMITED hmi level"); continue; } - //Send ButtonEvent notification for OK button only in HMI_FULL mode + // Send ButtonEvent notification for OK button only in HMI_FULL mode if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) && (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, "OnButtonEvent notification for OK button" - << "is allowed only in FULL hmi level"); + LOG4CXX_WARN(logger_, + "OnButtonEvent notification for OK button" + << "is allowed only in FULL hmi level"); continue; } @@ -132,14 +133,14 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { return; } - smart_objects::SmartObjectSPtr on_btn_event = new smart_objects::SmartObject(); + smart_objects::SmartObjectSPtr on_btn_event = + new smart_objects::SmartObject(); if (!on_btn_event) { LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); return; } - (*on_btn_event)[strings::params][strings::connection_key] = app->app_id(); (*on_btn_event)[strings::params][strings::function_id] = @@ -151,7 +152,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { (*message_)[strings::msg_params][hmi_response::button_mode]; if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + hmi_response::custom_button_id)) { (*on_btn_event)[strings::msg_params][strings::custom_button_id] = (*message_)[strings::msg_params][strings::custom_button_id]; } diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc index 84a59f22e7..d4b7daf185 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc @@ -44,18 +44,15 @@ namespace mobile { OnButtonPressNotification::OnButtonPressNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnButtonPressNotification::~OnButtonPressNotification() { -} +OnButtonPressNotification::~OnButtonPressNotification() {} void OnButtonPressNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - const uint32_t btn_id = - static_cast<uint32_t>( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); + const uint32_t btn_id = static_cast<uint32_t>( + (*message_)[strings::msg_params][hmi_response::button_name].asInt()); // CUSTOM_BUTTON notification if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { @@ -66,8 +63,9 @@ void OnButtonPressNotification::Run() { } // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + if (false == + (*message_)[strings::msg_params].keyExists( + hmi_response::custom_button_id)) { LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without custom_button_id."); return; @@ -82,8 +80,9 @@ void OnButtonPressNotification::Run() { } uint32_t custom_btn_id = 0; - custom_btn_id = (*message_)[strings::msg_params] - [hmi_response::custom_button_id].asUInt(); + custom_btn_id = + (*message_)[strings::msg_params][hmi_response::custom_button_id] + .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { LOG4CXX_ERROR(logger_, @@ -106,19 +105,21 @@ void OnButtonPressNotification::Run() { continue; } - //Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode + // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, "OnButtonPress notification is allowed only" - << "in FULL or LIMITED hmi level"); + LOG4CXX_WARN(logger_, + "OnButtonPress notification is allowed only" + << "in FULL or LIMITED hmi level"); continue; } - //Send ButtonPress notification for OK button only in HMI_FULL mode + // Send ButtonPress notification for OK button only in HMI_FULL mode if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) && (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, "OnButtonPress notification for OK button" - << "is allowed only in FULL hmi level"); + LOG4CXX_WARN(logger_, + "OnButtonPress notification for OK button" + << "is allowed only in FULL hmi level"); continue; } @@ -132,14 +133,14 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { return; } - smart_objects::SmartObjectSPtr on_btn_press = new smart_objects::SmartObject(); + smart_objects::SmartObjectSPtr on_btn_press = + new smart_objects::SmartObject(); if (!on_btn_press) { LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); return; } - (*on_btn_press)[strings::params][strings::connection_key] = app->app_id(); (*on_btn_press)[strings::params][strings::function_id] = @@ -151,7 +152,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { (*message_)[strings::msg_params][hmi_response::button_mode]; if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { + hmi_response::custom_button_id)) { (*on_btn_press)[strings::msg_params][strings::custom_button_id] = (*message_)[strings::msg_params][strings::custom_button_id]; } diff --git a/src/components/application_manager/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/src/commands/mobile/on_command_notification.cc index 5a9070d1af..ae8aeff771 100644 --- a/src/components/application_manager/src/commands/mobile/on_command_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_command_notification.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -OnCommandNotification::OnCommandNotification(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} +OnCommandNotification::OnCommandNotification( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) {} -OnCommandNotification::~OnCommandNotification() { -} +OnCommandNotification::~OnCommandNotification() {} void OnCommandNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -57,12 +56,11 @@ void OnCommandNotification::Run() { return; } - const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id] - .asUInt(); + const uint32_t cmd_id = + (*message_)[strings::msg_params][strings::cmd_id].asUInt(); if (!app->FindCommand(cmd_id)) { - LOG4CXX_ERROR(logger_, - " No applications found for the command " << cmd_id); + LOG4CXX_ERROR(logger_, " No applications found for the command " << cmd_id); return; } diff --git a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc index f55527736c..44ed2cf3b7 100644 --- a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc @@ -44,11 +44,9 @@ namespace mobile { OnDriverDistractionNotification::OnDriverDistractionNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnDriverDistractionNotification::~OnDriverDistractionNotification() { -} +OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc index c8df30d451..19b93f2cbf 100644 --- a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc @@ -46,11 +46,9 @@ namespace mobile { OnHashChangeNotification::OnHashChangeNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnHashChangeNotification::~OnHashChangeNotification() { -} +OnHashChangeNotification::~OnHashChangeNotification() {} void OnHashChangeNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -65,12 +63,12 @@ void OnHashChangeNotification::Run() { (*message_)[strings::msg_params][strings::hash_id] = app->curHash(); SendNotification(); } else { - LOG4CXX_WARN(logger_, "Application with app_id " << app_id << " does not exist"); + LOG4CXX_WARN(logger_, + "Application with app_id " << app_id << " does not exist"); } - } -} //namespace mobile +} // namespace mobile } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc index 7c267f06e1..5225002652 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc @@ -42,19 +42,16 @@ namespace commands { OnHMIStatusNotification::OnHMIStatusNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnHMIStatusNotification::~OnHMIStatusNotification() { -} +OnHMIStatusNotification::~OnHMIStatusNotification() {} void OnHMIStatusNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::message_type] = static_cast<int32_t> ( - application_manager::MessageType::kNotification); - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + (*message_)[strings::params][strings::message_type] = + static_cast<int32_t>(application_manager::MessageType::kNotification); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); return; @@ -67,18 +64,18 @@ void OnHMIStatusNotification::Run() { (mobile_apis::HMILevel::HMI_NONE == hmi_level)) { if (!(app->tts_properties_in_none())) { app->set_tts_properties_in_none(true); - LOG4CXX_INFO(logger_, "OnHMIStatusNotification::Send TTS GlobalProperties" + LOG4CXX_INFO(logger_, + "OnHMIStatusNotification::Send TTS GlobalProperties" " with empty array to HMI"); MessageHelper::SendTTSGlobalProperties(app, false, application_manager_); } } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || - (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { + (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { if (!(app->tts_properties_in_full())) { app->set_tts_properties_in_full(true); LOG4CXX_INFO(logger_, "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); - application_manager_.AddAppToTTSGlobalPropertiesList( - app->app_id()); + application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id()); } } SendNotification(); diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index c729882ae4..9b16bd3572 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -39,8 +39,7 @@ namespace application_manager { namespace commands { OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( - const MessageSharedPtr& message, - ApplicationManager& application_manager) + const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandNotificationFromMobileImpl(message, application_manager) {} OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {} @@ -50,8 +49,7 @@ void OnHMIStatusNotificationFromMobile::Run() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { LOG4CXX_ERROR( @@ -72,11 +70,9 @@ void OnHMIStatusNotificationFromMobile::Run() { bool is_apps_requested_before = application_manager_.IsAppsQueriedFrom(handle); - LOG4CXX_DEBUG( - logger_, - "Mobile HMI state notication came for connection key:" << connection_key() - << " and handle: " - << handle); + LOG4CXX_DEBUG(logger_, + "Mobile HMI state notication came for connection key:" + << connection_key() << " and handle: " << handle); if (!is_apps_requested_before && ProtocolVersion::kV4 == app->protocol_version() && app->is_foreground()) { @@ -109,7 +105,8 @@ void OnHMIStatusNotificationFromMobile::Run() { } if (!is_another_foreground_sdl4_app) { - application_manager_.MarkAppsGreyOut(handle, !is_current_state_foreground); + application_manager_.MarkAppsGreyOut(handle, + !is_current_state_foreground); application_manager_.SendUpdateAppList(); } } diff --git a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc index f94cda91b2..76420b85b6 100644 --- a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc @@ -39,11 +39,9 @@ namespace commands { OnLanguageChangeNotification::OnLanguageChangeNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnLanguageChangeNotification::~OnLanguageChangeNotification() { -} +OnLanguageChangeNotification::~OnLanguageChangeNotification() {} void OnLanguageChangeNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc index 4d2f66075c..a4167a802e 100644 --- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc @@ -41,11 +41,9 @@ namespace commands { OnPermissionsChangeNotification::OnPermissionsChangeNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnPermissionsChangeNotification::~OnPermissionsChangeNotification() { -} +OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {} void OnPermissionsChangeNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc index 14cbff8d28..4f73ad0ffe 100644 --- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc @@ -45,34 +45,33 @@ namespace mobile { OnSystemRequestNotification::OnSystemRequestNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnSystemRequestNotification::~OnSystemRequestNotification() { -} +OnSystemRequestNotification::~OnSystemRequestNotification() {} void OnSystemRequestNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace application_manager; using namespace mobile_apis; - ApplicationSharedPtr app = application_manager_. - application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Application with connection key " - << connection_key() << " is not registered."); + LOG4CXX_ERROR(logger_, + "Application with connection key " << connection_key() + << " is not registered."); return; } - RequestType::eType request_type = static_cast<RequestType::eType> - ((*message_)[strings::msg_params][strings::request_type].asInt()); + RequestType::eType request_type = static_cast<RequestType::eType>( + (*message_)[strings::msg_params][strings::request_type].asInt()); const policy::PolicyHandlerInterface& policy_handler = application_manager_.GetPolicyHandler(); if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), request_type)) { - LOG4CXX_WARN(logger_, "Request type " << request_type - <<" is not allowed by policies"); + LOG4CXX_WARN(logger_, + "Request type " << request_type + << " is not allowed by policies"); return; } @@ -80,7 +79,8 @@ void OnSystemRequestNotification::Run() { /* According to requirements: "If the requestType = PROPRIETARY, add to mobile API fileType = JSON If the requestType = HTTP, add to mobile API fileType = BINARY" - Also in Genivi SDL we don't save the PT to file - we put it directly in binary_data */ + Also in Genivi SDL we don't save the PT to file - we put it directly in + binary_data */ (*message_)[strings::msg_params][strings::file_type] = FileType::JSON; } else if (RequestType::HTTP == request_type) { (*message_)[strings::msg_params][strings::file_type] = FileType::BINARY; @@ -89,7 +89,7 @@ void OnSystemRequestNotification::Run() { SendNotification(); } -} //namespace mobile +} // namespace mobile } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc index aae32c4115..894469ac34 100644 --- a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc @@ -42,11 +42,9 @@ namespace commands { OnTBTClientStateNotification::OnTBTClientStateNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnTBTClientStateNotification::~OnTBTClientStateNotification() { -} +OnTBTClientStateNotification::~OnTBTClientStateNotification() {} void OnTBTClientStateNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc index 3c0b0a5657..c769194c95 100644 --- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc @@ -43,11 +43,9 @@ namespace mobile { OnTouchEventNotification::OnTouchEventNotification( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + : CommandNotificationImpl(message, application_manager) {} -OnTouchEventNotification::~OnTouchEventNotification() { -} +OnTouchEventNotification::~OnTouchEventNotification() {} void OnTouchEventNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc index ec74c1c621..37abbab351 100644 --- a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc @@ -42,19 +42,17 @@ namespace application_manager { namespace commands { OnVehicleDataNotification::OnVehicleDataNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandNotificationImpl(message, application_manager) {} -OnVehicleDataNotification::~OnVehicleDataNotification() { -} +OnVehicleDataNotification::~OnVehicleDataNotification() {} void OnVehicleDataNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); std::vector<ApplicationSharedPtr> appNotification; std::vector<ApplicationSharedPtr>::iterator appNotification_it = - appNotification.begin(); + appNotification.begin(); std::vector<smart_objects::SmartObject> appSO; const VehicleData& vehicle_data = MessageHelper::vehicle_data(); @@ -63,45 +61,47 @@ void OnVehicleDataNotification::Run() { for (; vehicle_data.end() != it; ++it) { if (true == (*message_)[strings::msg_params].keyExists(it->first)) { const std::vector<ApplicationSharedPtr>& applications = - application_manager_.IviInfoUpdated(it->second, - (*message_)[strings::msg_params][it->first].asInt()); + application_manager_.IviInfoUpdated( + it->second, (*message_)[strings::msg_params][it->first].asInt()); std::vector<ApplicationSharedPtr>::const_iterator app_it = - applications.begin(); + applications.begin(); for (; applications.end() != app_it; ++app_it) { const ApplicationSharedPtr app = *app_it; if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); continue; -} + } - appNotification_it = find(appNotification.begin(), appNotification.end(), app); + appNotification_it = + find(appNotification.begin(), appNotification.end(), app); if (appNotification_it == appNotification.end()) { appNotification.push_back(app); - smart_objects::SmartObject msg_param = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_param = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_param[it->first] = (*message_)[strings::msg_params][it->first]; appSO.push_back(msg_param); } else { - size_t idx = std::distance(appNotification.begin(), appNotification_it); + size_t idx = + std::distance(appNotification.begin(), appNotification_it); appSO[idx][it->first] = (*message_)[strings::msg_params][it->first]; - } } } } - LOG4CXX_DEBUG(logger_, "Number of Notifications to be send: " << - appNotification.size()); + LOG4CXX_DEBUG( + logger_, + "Number of Notifications to be send: " << appNotification.size()); for (size_t idx = 0; idx < appNotification.size(); idx++) { - LOG4CXX_INFO( - logger_, - "Send OnVehicleData PRNDL notification to " << appNotification[idx]->name().c_str() - << " application id " << appNotification[idx]->app_id()); + LOG4CXX_INFO(logger_, + "Send OnVehicleData PRNDL notification to " + << appNotification[idx]->name().c_str() + << " application id " << appNotification[idx]->app_id()); (*message_)[strings::params][strings::connection_key] = - appNotification[idx]->app_id(); + appNotification[idx]->app_id(); (*message_)[strings::msg_params] = appSO[idx]; SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc index 3a0cf0143c..0b24228810 100644 --- a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc @@ -51,7 +51,8 @@ void OnWayPointChangeNotification::Run() { for (std::set<int32_t>::const_iterator app_id = subscribed_for_way_points.begin(); - app_id != subscribed_for_way_points.end(); ++app_id) { + app_id != subscribed_for_way_points.end(); + ++app_id) { (*message_)[strings::params][strings::connection_key] = *app_id; SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index 55619bc318..d595119d45 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -46,14 +46,13 @@ namespace str = strings; PerformAudioPassThruRequest::PerformAudioPassThruRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - is_active_tts_speak_(false), - result_tts_speak_(mobile_apis::Result::SUCCESS) { + : CommandRequestImpl(message, application_manager) + , is_active_tts_speak_(false) + , result_tts_speak_(mobile_apis::Result::SUCCESS) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); } -PerformAudioPassThruRequest::~PerformAudioPassThruRequest() { -} +PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} void PerformAudioPassThruRequest::onTimeOut() { LOG4CXX_AUTO_TRACE(logger_); @@ -71,8 +70,7 @@ bool PerformAudioPassThruRequest::Init() { void PerformAudioPassThruRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); @@ -136,18 +134,16 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { FinishTTSSpeak(); std::string return_info; - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - mobile_code, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::RETRY, - mobile_apis::Result::WARNINGS); - - const bool is_result_ok = - Compare<mobile_api::Result::eType, EQ, ONE>( - mobile_code, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + mobile_code, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::RETRY, + mobile_apis::Result::WARNINGS); + + const bool is_result_ok = Compare<mobile_api::Result::eType, EQ, ONE>( + mobile_code, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS); if (is_result_ok && mobile_apis::Result::UNSUPPORTED_RESOURCE == result_tts_speak_) { @@ -155,25 +151,25 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { return_info = "Unsupported phoneme type sent in a prompt"; } - SendResponse(result, mobile_code, return_info.empty() ? NULL : return_info.c_str(), + SendResponse(result, + mobile_code, + return_info.empty() ? NULL : return_info.c_str(), &(message[strings::msg_params])); break; } case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - result_tts_speak_ = GetMobileResultCode( - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt())); + result_tts_speak_ = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt())); is_active_tts_speak_ = false; if (mobile_apis::Result::SUCCESS == result_tts_speak_) { SendRecordStartNotification(); StartMicrophoneRecording(); // update request timeout to get time for perform audio recording - application_manager_. - updateRequestTimeout(connection_key(), - correlation_id(), - default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); } break; } @@ -202,8 +198,8 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { if ((*message_)[str::msg_params].keyExists(str::initial_prompt) && (0 < (*message_)[str::msg_params][str::initial_prompt].length())) { for (uint32_t i = 0; - i < (*message_)[str::msg_params][str::initial_prompt].length(); - ++i) { + i < (*message_)[str::msg_params][str::initial_prompt].length(); + ++i) { msg_params[hmi_request::tts_chunks][i][str::text] = (*message_)[str::msg_params][str::initial_prompt][i][str::text]; msg_params[hmi_request::tts_chunks][i][str::type] = @@ -220,8 +216,8 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[str::app_id] = connection_key(); @@ -232,21 +228,21 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { smart_objects::SmartObject(smart_objects::SmartType_Array); if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text1)) { - msg_params[hmi_request::audio_pass_display_texts] - [0][hmi_request::field_name] = static_cast<int32_t> - (hmi_apis::Common_TextFieldName::audioPassThruDisplayText1); - msg_params[hmi_request::audio_pass_display_texts] - [0][hmi_request::field_text] = - (*message_)[str::msg_params][str::audio_pass_display_text1]; + msg_params[hmi_request::audio_pass_display_texts][0] + [hmi_request::field_name] = static_cast<int32_t>( + hmi_apis::Common_TextFieldName::audioPassThruDisplayText1); + msg_params[hmi_request::audio_pass_display_texts][0] + [hmi_request::field_text] = + (*message_)[str::msg_params][str::audio_pass_display_text1]; } if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text2)) { - msg_params[hmi_request::audio_pass_display_texts] - [1][hmi_request::field_name] = static_cast<int32_t> - (hmi_apis::Common_TextFieldName::audioPassThruDisplayText2); - msg_params[hmi_request::audio_pass_display_texts] - [1][hmi_request::field_text] = - (*message_)[str::msg_params][str::audio_pass_display_text2]; + msg_params[hmi_request::audio_pass_display_texts][1] + [hmi_request::field_name] = static_cast<int32_t>( + hmi_apis::Common_TextFieldName::audioPassThruDisplayText2); + msg_params[hmi_request::audio_pass_display_texts][1] + [hmi_request::field_text] = + (*message_)[str::msg_params][str::audio_pass_display_text2]; } if ((*message_)[str::msg_params].keyExists(str::mute_audio)) { @@ -257,15 +253,15 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { msg_params[str::mute_audio] = true; } - SendHMIRequest(hmi_apis::FunctionID::UI_PerformAudioPassThru, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::UI_PerformAudioPassThru, &msg_params, true); } void PerformAudioPassThruRequest::SendRecordStartNotification() { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = connection_key(); CreateHMINotification(hmi_apis::FunctionID::UI_OnRecordStart, msg_params); @@ -277,7 +273,8 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() { application_manager_.BeginAudioPassThrough(); application_manager_.StartAudioPassThruThread( - connection_key(), correlation_id(), + connection_key(), + correlation_id(), (*message_)[str::msg_params][str::max_duration].asInt(), (*message_)[str::msg_params][str::sampling_rate].asInt(), (*message_)[str::msg_params][str::bits_per_sample].asInt(), @@ -304,25 +301,25 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { } } - if ((*message_)[strings::msg_params]. - keyExists(strings::audio_pass_display_text1)) { - - str = (*message_)[strings::msg_params] - [strings::audio_pass_display_text1].asCharArray(); + if ((*message_)[strings::msg_params].keyExists( + strings::audio_pass_display_text1)) { + str = (*message_)[strings::msg_params][strings::audio_pass_display_text1] + .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, + LOG4CXX_ERROR( + logger_, "Invalid audio_pass_display_text1 value syntax check failed"); return true; } } - if ((*message_)[strings::msg_params]. - keyExists(strings::audio_pass_display_text2)) { - - str = (*message_)[strings::msg_params] - [strings::audio_pass_display_text2].asCharArray(); + if ((*message_)[strings::msg_params].keyExists( + strings::audio_pass_display_text2)) { + str = (*message_)[strings::msg_params][strings::audio_pass_display_text2] + .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, + LOG4CXX_ERROR( + logger_, "Invalid audio_pass_display_text2 value syntax check failed"); return true; } @@ -330,7 +327,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { return false; } -void PerformAudioPassThruRequest::FinishTTSSpeak(){ +void PerformAudioPassThruRequest::FinishTTSSpeak() { LOG4CXX_AUTO_TRACE(logger_); if (application_manager_.EndAudioPassThrough()) { LOG4CXX_DEBUG(logger_, "Stop AudioPassThru."); @@ -352,16 +349,17 @@ bool PerformAudioPassThruRequest::WaitTTSSpeak() { // Waiting for TTS_Speak while (is_active_tts_speak_) { - uint64_t difference_between_start_current_time - = date_time::DateTime::calculateTimeSpan(start_time); + uint64_t difference_between_start_current_time = + date_time::DateTime::calculateTimeSpan(start_time); // Send GENERIC_ERROR after default timeout if (difference_between_start_current_time > default_timeout_msec) { LOG4CXX_WARN(logger_, "Expired timeout for TTS.Speak response"); // Don't use onTimeOut(), because default_timeout_ is bigger than // Default time in *.ini file FinishTTSSpeak(); - SendResponse(false, mobile_apis::Result::eType::GENERIC_ERROR, - "Expired timeout for TTS.Speak response"); + SendResponse(false, + mobile_apis::Result::eType::GENERIC_ERROR, + "Expired timeout for TTS.Speak response"); return false; } } diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc index 411a0a41ae..e8a638c076 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc @@ -33,19 +33,15 @@ #include "application_manager/commands/mobile/perform_audio_pass_thru_response.h" - - namespace application_manager { namespace commands { PerformAudioPassThruResponse::PerformAudioPassThruResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -PerformAudioPassThruResponse::~PerformAudioPassThruResponse() { -} +PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {} void PerformAudioPassThruResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index 4745587fe6..39ad51e822 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -45,8 +45,6 @@ #include "utils/custom_string.h" #include "utils/gen_hash.h" - - namespace application_manager { namespace commands { @@ -56,23 +54,22 @@ namespace custom_str = utils::custom_string; uint32_t PerformInteractionRequest::pi_requests_count_ = 0; PerformInteractionRequest::PerformInteractionRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) -: CommandRequestImpl(message, application_manager), - interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM), - ui_response_recived_(false), - vr_response_recived_(false), - ui_result_(false), - vr_result_(false), - app_pi_was_active_before_(false), - vr_resultCode_(mobile_apis::Result::INVALID_ENUM), - ui_resultCode_(mobile_apis::Result::INVALID_ENUM) { + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM) + , ui_response_recived_(false) + , vr_response_recived_(false) + , ui_result_(false) + , vr_result_(false) + , app_pi_was_active_before_(false) + , vr_resultCode_(mobile_apis::Result::INVALID_ENUM) + , ui_resultCode_(mobile_apis::Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand); subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress); } -PerformInteractionRequest::~PerformInteractionRequest() { -} +PerformInteractionRequest::~PerformInteractionRequest() {} bool PerformInteractionRequest::Init() { /* Timeout in milliseconds. @@ -95,8 +92,7 @@ bool PerformInteractionRequest::Init() { void PerformInteractionRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -120,8 +116,9 @@ void PerformInteractionRequest::Run() { if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) && (mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) { - LOG4CXX_ERROR(logger_, "PerformInteraction contains InteractionMode" - "=VR_ONLY and interactionLayout=KEYBOARD"); + LOG4CXX_ERROR(logger_, + "PerformInteraction contains InteractionMode" + "=VR_ONLY and interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -132,15 +129,17 @@ void PerformInteractionRequest::Run() { if (0 == choice_set_id_list_length) { if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) { if (mobile_apis::InteractionMode::BOTH == interaction_mode_) { - LOG4CXX_ERROR(logger_,"interactionChoiceSetIDList is empty," - " InteractionMode=BOTH and" - " interactionLayout=KEYBOARD"); + LOG4CXX_ERROR(logger_, + "interactionChoiceSetIDList is empty," + " InteractionMode=BOTH and" + " interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } else { - LOG4CXX_ERROR(logger_,"interactionChoiceSetIDList is empty" - " and interactionLayout!=KEYBOARD"); + LOG4CXX_ERROR(logger_, + "interactionChoiceSetIDList is empty" + " and interactionLayout!=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -148,20 +147,22 @@ void PerformInteractionRequest::Run() { if (choice_set_id_list_length && (!CheckChoiceIDFromRequest( - app, choice_set_id_list_length, - msg_params[strings::interaction_choice_set_id_list]))) { - - LOG4CXX_ERROR(logger_,"PerformInteraction has choice sets with " - "duplicated IDs or application does not have choice sets"); + app, + choice_set_id_list_length, + msg_params[strings::interaction_choice_set_id_list]))) { + LOG4CXX_ERROR(logger_, + "PerformInteraction has choice sets with " + "duplicated IDs or application does not have choice sets"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } if (msg_params.keyExists(strings::vr_help)) { - if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( - msg_params[strings::vr_help], app, application_manager_)) { - LOG4CXX_ERROR(logger_, "Verification of " << strings::vr_help - << " failed."); + if (mobile_apis::Result::SUCCESS != + MessageHelper::VerifyImageVrHelpItems( + msg_params[strings::vr_help], app, application_manager_)) { + LOG4CXX_ERROR(logger_, + "Verification of " << strings::vr_help << " failed."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -177,8 +178,7 @@ void PerformInteractionRequest::Run() { switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); - if (!CheckChoiceSetVRSynonyms(app) || - !CheckChoiceSetMenuNames(app) || + if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; } @@ -186,8 +186,7 @@ void PerformInteractionRequest::Run() { } case mobile_apis::InteractionMode::MANUAL_ONLY: { LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || - !CheckChoiceSetMenuNames(app) || + if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; } @@ -195,8 +194,7 @@ void PerformInteractionRequest::Run() { } case mobile_apis::InteractionMode::VR_ONLY: { LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || - !CheckVrHelpItemPositions(app)) { + if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) { return; } break; @@ -225,15 +223,16 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_OnResetTimeout: { LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_PerformInteraction: { LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event"); ui_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); - ui_resultCode_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt())); + ui_resultCode_ = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt())); ProcessPerformInteractionResponse(event.smart_object(), msg_param); break; } @@ -241,8 +240,9 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction"); vr_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); - vr_resultCode_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt())); + vr_resultCode_ = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt())); ProcessVRResponse(event.smart_object(), msg_param); break; } @@ -270,13 +270,13 @@ void PerformInteractionRequest::onTimeOut() { CommandRequestImpl::onTimeOut(); } else { application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + connection_key(), correlation_id(), default_timeout()); } break; } case mobile_apis::InteractionMode::VR_ONLY: { application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); + connection_key(), correlation_id(), default_timeout()); break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { @@ -292,7 +292,6 @@ void PerformInteractionRequest::onTimeOut() { }; } - void PerformInteractionRequest::ProcessVRResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { @@ -302,8 +301,7 @@ void PerformInteractionRequest::ProcessVRResponse( using namespace smart_objects; using namespace helpers; - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -315,9 +313,7 @@ void PerformInteractionRequest::ProcessVRResponse( static_cast<int32_t>(TriggerSource::TS_VR); const bool is_vr_aborted_timeout = - Compare<Result::eType, EQ, ONE>(vr_resultCode_, - ABORTED, - TIMED_OUT); + Compare<Result::eType, EQ, ONE>(vr_resultCode_, ABORTED, TIMED_OUT); if (is_vr_aborted_timeout) { LOG4CXX_DEBUG(logger_, "VR response aborted"); @@ -328,17 +324,16 @@ void PerformInteractionRequest::ProcessVRResponse( return; } LOG4CXX_DEBUG(logger_, "Update timeout for UI"); - application_manager_. - updateRequestTimeout(connection_key(), - correlation_id(), - default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); return; } if (SUCCESS == vr_resultCode_ && InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, "VR response SUCCESS in MANUAL_ONLY mode " << - "Wait for UI response"); + LOG4CXX_DEBUG(logger_, + "VR response SUCCESS in MANUAL_ONLY mode " + << "Wait for UI response"); // in case MANUAL_ONLY mode VR.PI SUCCESS just return return; } @@ -349,7 +344,8 @@ void PerformInteractionRequest::ProcessVRResponse( if (!CheckChoiceIDFromResponse(app, choise_id)) { LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI"); TerminatePerformInteraction(); - SendResponse(false, GENERIC_ERROR,"Wrong choiceID was received from HMI"); + SendResponse( + false, GENERIC_ERROR, "Wrong choiceID was received from HMI"); return; } msg_params[strings::choice_id] = choise_id; @@ -375,29 +371,23 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( using namespace helpers; using namespace smart_objects; - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; } - ui_result_ = - Compare<mobile_api::Result::eType, EQ, ONE>( - ui_resultCode_, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS, - mobile_apis::Result::UNSUPPORTED_RESOURCE); + ui_result_ = Compare<mobile_api::Result::eType, EQ, ONE>( + ui_resultCode_, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS, + mobile_apis::Result::UNSUPPORTED_RESOURCE); - const bool is_pi_warning = - Compare<mobile_api::Result::eType, EQ, ONE>( - ui_resultCode_, - mobile_apis::Result::WARNINGS); + const bool is_pi_warning = Compare<mobile_api::Result::eType, EQ, ONE>( + ui_resultCode_, mobile_apis::Result::WARNINGS); - const bool is_pi_unsupported = - Compare<mobile_api::Result::eType, EQ, ONE>( - ui_resultCode_, - mobile_apis::Result::UNSUPPORTED_RESOURCE); + const bool is_pi_unsupported = Compare<mobile_api::Result::eType, EQ, ONE>( + ui_resultCode_, mobile_apis::Result::UNSUPPORTED_RESOURCE); std::string info; @@ -405,8 +395,8 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( if (is_pi_warning) { ui_resultCode_ = mobile_apis::Result::WARNINGS; info = "Unsupported phoneme type was sent in an item"; - if (message.keyExists(strings::params) - && message[strings::params].keyExists(strings::data)) { + if (message.keyExists(strings::params) && + message[strings::params].keyExists(strings::data)) { msg_params = message[strings::params][strings::data]; } } else if (is_pi_unsupported) { @@ -436,10 +426,7 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( DisablePerformInteraction(); - const SmartObject* response_params = - msg_params.empty() - ? NULL - : &msg_params; + const SmartObject* response_params = msg_params.empty() ? NULL : &msg_params; if (mobile_apis::InteractionMode::BOTH != interaction_mode_) { DisablePerformInteraction(); @@ -527,8 +514,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( (*message_)[strings::msg_params][hmi_request::interaction_layout] .asInt(); } - SendHMIRequest(hmi_apis::FunctionID::UI_PerformInteraction, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true); } void PerformInteractionRequest::SendVRPerformInteractionRequest( @@ -539,7 +526,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject& choice_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; + (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; if (mobile_apis::InteractionMode::MANUAL_ONLY != interaction_mode_) { msg_params[strings::grammar_id] = @@ -553,7 +540,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( LOG4CXX_WARN(logger_, "Couldn't found choiset"); continue; } - msg_params[strings::grammar_id][grammar_id_index++]= + msg_params[strings::grammar_id][grammar_id_index++] = (*choice_set)[strings::grammar_id].asUInt(); } } @@ -582,8 +569,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( // Since there is no custom data from application side, SDL should // construct prompt and append delimiter to each item item[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; - item[strings::text] = vr_commands[0].asString() + - application_manager_.get_settings().tts_delimiter(); + item[strings::text] = + vr_commands[0].asString() + + application_manager_.get_settings().tts_delimiter(); msg_params[strings::help_prompt][index++] = item; } } @@ -595,7 +583,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) { msg_params[strings::timeout_prompt] = - (*message_)[strings::msg_params][strings::timeout_prompt]; + (*message_)[strings::msg_params][strings::timeout_prompt]; } else { if (msg_params.keyExists(strings::help_prompt)) { msg_params[strings::timeout_prompt] = msg_params[strings::help_prompt]; @@ -603,8 +591,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( } if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { - msg_params[strings::initial_prompt] = - (*message_)[strings::msg_params][strings::initial_prompt]; + msg_params[strings::initial_prompt] = + (*message_)[strings::msg_params][strings::initial_prompt]; } mobile_apis::InteractionMode::eType mode = @@ -618,8 +606,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( msg_params[strings::timeout] = default_timeout_; } msg_params[strings::app_id] = app->app_id(); - SendHMIRequest(hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, - true); + SendHMIRequest( + hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true); } bool PerformInteractionRequest::CheckChoiceSetMenuNames( @@ -631,12 +619,12 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( for (size_t i = 0; i < choice_list.length(); ++i) { // choice_set contains SmartObject msg_params - smart_objects::SmartObject* i_choice_set = app->FindChoiceSet( - choice_list[i].asInt()); + smart_objects::SmartObject* i_choice_set = + app->FindChoiceSet(choice_list[i].asInt()); for (size_t j = 0; j < choice_list.length(); ++j) { - smart_objects::SmartObject* j_choice_set = app->FindChoiceSet( - choice_list[j].asInt()); + smart_objects::SmartObject* j_choice_set = + app->FindChoiceSet(choice_list[j].asInt()); if (i == j) { // skip check the same element @@ -662,7 +650,8 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( if (ii_menu_name == jj_menu_name) { LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name"); - SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, + SendResponse(false, + mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated menu name"); return false; } @@ -750,7 +739,8 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( for (size_t i = 0; i < vr_help.length(); ++i) { if (position != vr_help[i][strings::position].asInt()) { LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position"); - SendResponse(false, mobile_apis::Result::REJECTED, + SendResponse(false, + mobile_apis::Result::REJECTED, "Non-sequential vrHelp item position"); return false; } @@ -789,7 +779,6 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { return true; } - if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { const smart_objects::SmartArray* ip_array = (*message_)[strings::msg_params][strings::initial_prompt].asArray(); @@ -868,8 +857,8 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { void PerformInteractionRequest::TerminatePerformInteraction() { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[hmi_request::method_name] = "UI.PerformInteraction"; SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params); DisablePerformInteraction(); @@ -888,8 +877,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse( const PerformChoice& choice = choice_set_map_it->second; PerformChoice::const_iterator it = choice.begin(); for (; choice.end() != it; ++it) { - const smart_objects::SmartObject& choice_set = (*it->second).getElement( - strings::choice_set); + const smart_objects::SmartObject& choice_set = + (*it->second).getElement(strings::choice_set); for (size_t j = 0; j < choice_set.length(); ++j) { if (choice_id == choice_set.getElement(j).getElement(strings::choice_id).asInt()) { @@ -915,19 +904,22 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( for (size_t i = 0; i < choice_set_id_list_length; ++i) { choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt()); if (!choice_set) { - LOG4CXX_ERROR(logger_, "Couldn't find choiset_id = " - <<choice_set_id_list[i].asInt()); + LOG4CXX_ERROR( + logger_, + "Couldn't find choiset_id = " << choice_set_id_list[i].asInt()); return false; } choice_list_length = (*choice_set)[strings::choice_set].length(); const smart_objects::SmartObject& choices_list = (*choice_set)[strings::choice_set]; for (size_t k = 0; k < choice_list_length; ++k) { - ins_res = choice_id_set.insert(choices_list[k][strings::choice_id].asInt()); + ins_res = + choice_id_set.insert(choices_list[k][strings::choice_id].asInt()); if (!ins_res.second) { - LOG4CXX_ERROR(logger_, "Choise with ID " - << choices_list[k][strings::choice_id].asInt() - << " already exists"); + LOG4CXX_ERROR(logger_, + "Choise with ID " + << choices_list[k][strings::choice_id].asInt() + << " already exists"); return false; } } @@ -951,7 +943,7 @@ void PerformInteractionRequest::CheckResponseResultCode() { LOG4CXX_DEBUG(logger_, "VR had been rejected."); resultCode = mobile_apis::Result::REJECTED; } else if (mobile_apis::Result::WARNINGS == vr_resultCode_ || - mobile_apis::Result::UNSUPPORTED_REQUEST == vr_resultCode_) { + mobile_apis::Result::UNSUPPORTED_REQUEST == vr_resultCode_) { LOG4CXX_DEBUG(logger_, "VR response WARNINGS"); resultCode = mobile_api::Result::WARNINGS; result = true; @@ -975,21 +967,19 @@ void PerformInteractionRequest::SendBothModeResponse( UNSUPPORTED_RESOURCE != ui_resultCode_) { perform_interaction_result_code = vr_resultCode_; } else if (UNSUPPORTED_RESOURCE == vr_resultCode_ && - UNSUPPORTED_RESOURCE == ui_resultCode_) { + UNSUPPORTED_RESOURCE == ui_resultCode_) { result = false; } const bool is_error_code = (SUCCESS != perform_interaction_result_code || - WARNINGS != perform_interaction_result_code); + WARNINGS != perform_interaction_result_code); if (vr_resultCode_ == ui_resultCode_ && is_error_code) { result = false; } const smart_objects::SmartObject* response_params = - msg_param.empty() - ? NULL - : &msg_param; + msg_param.empty() ? NULL : &msg_param; TerminatePerformInteraction(); SendResponse(result, perform_interaction_result_code, NULL, response_params); diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc index 16a8e9616c..6003751669 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/perform_interaction_response.h" - namespace application_manager { namespace commands { PerformInteractionResponse::PerformInteractionResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -PerformInteractionResponse::~PerformInteractionResponse() { -} +PerformInteractionResponse::~PerformInteractionResponse() {} void PerformInteractionResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc index 9ff52da8f4..68e7ad60d1 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc @@ -43,25 +43,24 @@ namespace application_manager { namespace commands { -PutFileRequest::PutFileRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , offset_(0) - , sync_file_name_() - , length_(0) - , file_type_(mobile_apis::FileType::INVALID_ENUM) - , is_persistent_file_(false) { -} +PutFileRequest::PutFileRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , offset_(0) + , sync_file_name_() + , length_(0) + , file_type_(mobile_apis::FileType::INVALID_ENUM) + , is_persistent_file_(false) {} -PutFileRequest::~PutFileRequest() { -} +PutFileRequest::~PutFileRequest() {} void PutFileRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr application = application_manager_.application(connection_key()); - smart_objects::SmartObject response_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -71,12 +70,13 @@ void PutFileRequest::Run() { if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() && application_manager_.get_settings().put_file_in_none() <= - application->put_file_in_none_count()) { + application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed // PutFile request is limited by the configuration profile LOG4CXX_ERROR(logger_, "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, mobile_apis::Result::REJECTED, + SendResponse(false, + mobile_apis::Result::REJECTED, "Too many requests from the app with HMILevel HMI_NONE", &response_params); return; @@ -84,7 +84,8 @@ void PutFileRequest::Run() { if (!(*message_)[strings::params].keyExists(strings::binary_data)) { LOG4CXX_ERROR(logger_, "Binary data empty"); - SendResponse(false, mobile_apis::Result::INVALID_DATA, + SendResponse(false, + mobile_apis::Result::INVALID_DATA, "Binary data empty", &response_params); return; @@ -92,7 +93,8 @@ void PutFileRequest::Run() { if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) { LOG4CXX_ERROR(logger_, "No file name"); - SendResponse(false, mobile_apis::Result::INVALID_DATA, + SendResponse(false, + mobile_apis::Result::INVALID_DATA, "No file name", &response_params); return; @@ -100,24 +102,24 @@ void PutFileRequest::Run() { if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) { LOG4CXX_ERROR(logger_, "No file type"); - SendResponse(false, mobile_apis::Result::INVALID_DATA, + SendResponse(false, + mobile_apis::Result::INVALID_DATA, "No file type", &response_params); return; } sync_file_name_ = - (*message_)[strings::msg_params][strings::sync_file_name].asString(); - file_type_ = - static_cast<mobile_apis::FileType::eType>( + (*message_)[strings::msg_params][strings::sync_file_name].asString(); + file_type_ = static_cast<mobile_apis::FileType::eType>( (*message_)[strings::msg_params][strings::file_type].asInt()); const std::vector<uint8_t> binary_data = - (*message_)[strings::params][strings::binary_data].asBinary(); + (*message_)[strings::params][strings::binary_data].asBinary(); // Policy table update in json format is currently to be received via PutFile // TODO(PV): after latest discussion has to be changed if (mobile_apis::FileType::JSON == file_type_) { - application_manager_.GetPolicyHandler() - .ReceiveMessageFromSDK(sync_file_name_, binary_data); + application_manager_.GetPolicyHandler().ReceiveMessageFromSDK( + sync_file_name_, binary_data); } offset_ = 0; @@ -132,15 +134,13 @@ void PutFileRequest::Run() { offset_ = (*message_)[strings::msg_params][strings::offset].asInt(); } - if ((*message_)[strings::msg_params]. - keyExists(strings::persistent_file)) { + if ((*message_)[strings::msg_params].keyExists(strings::persistent_file)) { is_persistent_file_ = - (*message_)[strings::msg_params][strings::persistent_file].asBool(); + (*message_)[strings::msg_params][strings::persistent_file].asBool(); } - if ((*message_)[strings::msg_params]. - keyExists(strings::system_file)) { + if ((*message_)[strings::msg_params].keyExists(strings::system_file)) { is_system_file = - (*message_)[strings::msg_params][strings::system_file].asBool(); + (*message_)[strings::msg_params][strings::system_file].asBool(); } std::string file_path; @@ -155,39 +155,42 @@ void PutFileRequest::Run() { uint32_t space_available = application->GetAvailableDiskSpace(); if (binary_data.size() > space_available) { - response_params[strings::space_available] = static_cast<uint32_t>(space_available); LOG4CXX_ERROR(logger_, "Out of memory"); - SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY, - "Out of memory", &response_params); + SendResponse(false, + mobile_apis::Result::OUT_OF_MEMORY, + "Out of memory", + &response_params); return; } } if (!file_system::CreateDirectoryRecursively(file_path)) { LOG4CXX_ERROR(logger_, "Can't create folder"); - SendResponse(false, mobile_apis::Result::GENERIC_ERROR, - "Can't create folder.", &response_params); + SendResponse(false, + mobile_apis::Result::GENERIC_ERROR, + "Can't create folder.", + &response_params); return; } const std::string full_path = file_path + "/" + sync_file_name_; UNUSED(full_path); - LOG4CXX_DEBUG(logger_, "Wrtiting " << binary_data.size() << "bytes to " - << full_path << " (current size is" - << file_system::FileSize(full_path) << ")"); - - mobile_apis::Result::eType save_result = - application_manager_.SaveBinary(binary_data, file_path, - sync_file_name_, offset_); - - LOG4CXX_DEBUG(logger_, "New size of " - << full_path << " is " - << file_system::FileSize(full_path) << " bytes"); + LOG4CXX_DEBUG(logger_, + "Wrtiting " << binary_data.size() << "bytes to " << full_path + << " (current size is" + << file_system::FileSize(full_path) << ")"); + + mobile_apis::Result::eType save_result = application_manager_.SaveBinary( + binary_data, file_path, sync_file_name_, offset_); + + LOG4CXX_DEBUG(logger_, + "New size of " << full_path << " is " + << file_system::FileSize(full_path) << " bytes"); if (!is_system_file) { - response_params[strings::space_available] = static_cast<uint32_t>( - application->GetAvailableDiskSpace()); + response_params[strings::space_available] = + static_cast<uint32_t>(application->GetAvailableDiskSpace()); } sync_file_name_ = file_path + "/" + sync_file_name_; @@ -195,23 +198,25 @@ void PutFileRequest::Run() { case mobile_apis::Result::SUCCESS: { LOG4CXX_INFO(logger_, "PutFile is successful"); if (!is_system_file) { - AppFile file(sync_file_name_, is_persistent_file_, - is_download_compleate, file_type_); + AppFile file(sync_file_name_, + is_persistent_file_, + is_download_compleate, + file_type_); if (0 == offset_) { LOG4CXX_INFO(logger_, "New file downloading"); if (!application->AddFile(file)) { - LOG4CXX_INFO(logger_, "Couldn't add file to application (File already Exist" - << " in application and was rewritten on FS)"); + << " in application and was rewritten on FS)"); /* It can be first part of new big file, so we need to update information about it's downloading status and persistence */ if (!application->UpdateFile(file)) { LOG4CXX_ERROR(logger_, "Couldn't update file"); /* If it is impossible to update file, application doesn't know about existing this file */ - SendResponse(false, mobile_apis::Result::INVALID_DATA, + SendResponse(false, + mobile_apis::Result::INVALID_DATA, "Couldn't update file", &response_params); return; @@ -232,20 +237,21 @@ void PutFileRequest::Run() { break; } default: - LOG4CXX_WARN(logger_, "PutFile is unsuccessful. Result = " << save_result); + LOG4CXX_WARN(logger_, + "PutFile is unsuccessful. Result = " << save_result); SendResponse(false, save_result, "Can't save file", &response_params); break; } } void PutFileRequest::SendOnPutFileNotification() { - LOG4CXX_INFO(logger_, "SendOnPutFileNotification" ); - smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject( - smart_objects::SmartType_Map); + LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); + smart_objects::SmartObjectSPtr notification = + new smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = - hmi_apis::FunctionID::BasicCommunication_OnPutFile; + hmi_apis::FunctionID::BasicCommunication_OnPutFile; message[strings::params][strings::message_type] = MessageType::kNotification; message[strings::msg_params][strings::app_id] = connection_key(); diff --git a/src/components/application_manager/src/commands/mobile/put_file_response.cc b/src/components/application_manager/src/commands/mobile/put_file_response.cc index 08d936863a..50c62aef7f 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_response.cc @@ -35,22 +35,20 @@ #include "utils/file_system.h" #include "application_manager/application_impl.h" - namespace application_manager { namespace commands { -PutFileResponse::PutFileResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +PutFileResponse::PutFileResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -PutFileResponse::~PutFileResponse() { -} +PutFileResponse::~PutFileResponse() {} void PutFileResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = (*message_)[strings::params][strings::connection_key] - .asUInt(); + uint32_t app_id = + (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "Application not registered"); @@ -58,7 +56,6 @@ void PutFileResponse::Run() { return; } - SendResponse((*message_)[strings::msg_params][strings::success].asBool()); } diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc index f37e02bc7d..69885f9d40 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc @@ -41,22 +41,23 @@ namespace application_manager { namespace commands { -ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -ReadDIDRequest::~ReadDIDRequest() { -} +ReadDIDRequest::~ReadDIDRequest() {} void ReadDIDRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = (*message_)[strings::params][strings::connection_key] - .asUInt(); + uint32_t app_id = + (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); - LOG4CXX_INFO(logger_, "Correlation_id :" << (*message_)[strings::params][strings::correlation_id] - .asUInt()); + LOG4CXX_INFO( + logger_, + "Correlation_id :" + << (*message_)[strings::params][strings::correlation_id].asUInt()); if (!app) { LOG4CXX_ERROR(logger_, "An application is not registered."); @@ -65,8 +66,8 @@ void ReadDIDRequest::Run() { } if (app->IsCommandLimitsExceeded( - static_cast<mobile_apis::FunctionID::eType>(function_id()), - application_manager::TLimitSource::CONFIG_FILE)) { + static_cast<mobile_apis::FunctionID::eType>(function_id()), + application_manager::TLimitSource::CONFIG_FILE)) { LOG4CXX_ERROR(logger_, "ReadDID frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return; @@ -78,8 +79,8 @@ void ReadDIDRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); msg_params[strings::ecu_name] = (*message_)[strings::msg_params][strings::ecu_name]; @@ -104,7 +105,9 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) { const std::string return_info = message[strings::msg_params][hmi_response::message].asString(); - SendResponse(result, result_code, return_info.c_str(), + SendResponse(result, + result_code, + return_info.c_str(), &(message[strings::msg_params])); break; } diff --git a/src/components/application_manager/src/commands/mobile/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc index 1637f3e9bc..e54c4ba005 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_response.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/read_did_response.h" - namespace application_manager { namespace commands { -ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -ReadDIDResponse::~ReadDIDResponse() { -} +ReadDIDResponse::~ReadDIDResponse() {} void ReadDIDResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 23fba2edcc..eea2f443b7 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 @@ -187,8 +187,8 @@ void RegisterAppInterfaceRequest::Run() { const std::string& policy_app_id = msg_params[strings::app_id].asString(); - if (application_manager_.IsApplicationForbidden( - connection_key(), policy_app_id)) { + if (application_manager_.IsApplicationForbidden(connection_key(), + policy_app_id)) { SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); return; } @@ -230,16 +230,14 @@ void RegisterAppInterfaceRequest::Run() { return; } - application = - application_manager_.RegisterApplication(message_); + application = application_manager_.RegisterApplication(message_); if (!application) { LOG4CXX_ERROR(logger_, "Application hasn't been registered!"); return; } // For resuming application need to restore hmi_app_id from resumeCtrl - resumption::ResumeCtrl& resumer = - application_manager_.resume_controller(); + resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); const std::string& device_mac = application->mac_address(); // there is side affect with 2 mobile app with the same mobile app_id @@ -323,11 +321,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { application_manager_.hmi_capabilities(); const uint32_t key = connection_key(); - ApplicationSharedPtr application = - application_manager_.application(key); + ApplicationSharedPtr application = application_manager_.application(key); - resumption::ResumeCtrl& resumer = - application_manager_.resume_controller(); + resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); if (!application) { LOG4CXX_ERROR(logger_, @@ -338,9 +334,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { } response_params[strings::sync_msg_version][strings::major_version] = - major_version; // From generated file interfaces/generated_msg_version.h + major_version; // From generated file interfaces/generated_msg_version.h response_params[strings::sync_msg_version][strings::minor_version] = - minor_version; // From generated file interfaces/generated_msg_version.h + minor_version; // From generated file interfaces/generated_msg_version.h response_params[strings::language] = hmi_capabilities.active_vr_language(); response_params[strings::hmi_display_language] = @@ -534,9 +530,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { // in case application exist in resumption we need to send resumeVrgrammars if (false == resumption) { - resumption = resumer.IsApplicationSaved( - application->policy_app_id(), - application->mac_address()); + resumption = resumer.IsApplicationSaved(application->policy_app_id(), + application->mac_address()); } SendOnAppRegisteredNotificationToHMI( @@ -551,7 +546,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { // By default app subscribed to CUSTOM_BUTTON SendSubscribeCustomButtonNotification(); - MessageHelper::SendChangeRegistrationRequestToHMI(application, application_manager_); + MessageHelper::SendChangeRegistrationRequestToHMI(application, + application_manager_); } void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( @@ -621,8 +617,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } std::vector<std::string> request_types = - GetPolicyHandler().GetAppRequestTypes( - application_impl.policy_app_id()); + GetPolicyHandler().GetAppRequestTypes(application_impl.policy_app_id()); application[strings::request_type] = SmartObject(SmartType_Array); smart_objects::SmartObject& request_array = @@ -638,8 +633,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( application[strings::device_info] = SmartObject(SmartType_Map); smart_objects::SmartObject& device_info = application[strings::device_info]; const protocol_handler::SessionObserver& session_observer = - application_manager_.connection_handler() - .get_session_observer(); + application_manager_.connection_handler().get_session_observer(); std::string device_name; std::string mac_address; std::string transport_type; @@ -660,8 +654,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( policy::DeviceConsent::kDeviceAllowed == device_consent; device_info[strings::transport_type] = - application_manager_.GetDeviceTransportType( - transport_type); + application_manager_.GetDeviceTransportType(transport_type); DCHECK(application_manager_.ManageHMICommand(notification)); } @@ -1006,7 +999,8 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); } -policy::PolicyHandlerInterface& RegisterAppInterfaceRequest::GetPolicyHandler() { +policy::PolicyHandlerInterface& +RegisterAppInterfaceRequest::GetPolicyHandler() { return application_manager_.GetPolicyHandler(); } diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc index 576f842bf7..1d7f829a68 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc @@ -61,13 +61,14 @@ void RegisterAppInterfaceResponse::Run() { SendResponse(success, result_code, last_message); - if (mobile_apis::Result::SUCCESS != result_code) { return; } + if (mobile_apis::Result::SUCCESS != result_code) { + return; + } // Add registered application to the policy db right after response sent to // mobile to be able to check all other API according to app permissions application_manager::ApplicationSharedPtr application = - application_manager_.application( - connection_key()); + application_manager_.application(connection_key()); if (!application) { LOG4CXX_ERROR(logger_, "Application with connection key " << connection_key() @@ -83,7 +84,8 @@ void RegisterAppInterfaceResponse::Run() { // Sends OnPermissionChange notification to mobile right after RAI response // and HMI level set-up - application_manager_.GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id()); + application_manager_.GetPolicyHandler().OnAppRegisteredOnMobile( + application->policy_app_id()); } void RegisterAppInterfaceResponse::SetHeartBeatTimeout( @@ -94,8 +96,8 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout( if (policy_handler.PolicyEnabled()) { const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id); if (timeout > 0) { - application_manager_.connection_handler() - .SetHeartBeatTimeout(connection_key, timeout); + application_manager_.connection_handler().SetHeartBeatTimeout( + connection_key, timeout); } } else { LOG4CXX_INFO(logger_, "Policy is turn off"); diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index d394370658..e47ed01f51 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -44,23 +44,22 @@ namespace application_manager { namespace commands { ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - is_ui_send_(false), - is_tts_send_(false), - is_ui_received_(false), - is_tts_received_(false), - ui_result_(hmi_apis::Common_Result::INVALID_ENUM), - tts_result_(hmi_apis::Common_Result::INVALID_ENUM) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) + , is_ui_send_(false) + , is_tts_send_(false) + , is_ui_received_(false) + , is_tts_received_(false) + , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) + , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} -ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() { -} +ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {} void ResetGlobalPropertiesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); + uint32_t app_id = + (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { @@ -69,13 +68,12 @@ void ResetGlobalPropertiesRequest::Run() { return; } - size_t obj_length = (*message_)[strings::msg_params][strings::properties] - .length(); - //if application waits for sending ttsGlobalProperties need to remove this - //application from tts_global_properties_app_list_ + size_t obj_length = + (*message_)[strings::msg_params][strings::properties].length(); + // if application waits for sending ttsGlobalProperties need to remove this + // application from tts_global_properties_app_list_ LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList"); - application_manager_.RemoveAppFromTTSGlobalPropertiesList( - app_id); + application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id); bool helpt_promt = false; bool timeout_prompt = false; @@ -96,20 +94,23 @@ void ResetGlobalPropertiesRequest::Run() { } else if (mobile_apis::GlobalProperty::TIMEOUTPROMPT == global_property) { timeout_prompt = ResetTimeoutPromt(app); } else if (((mobile_apis::GlobalProperty::VRHELPTITLE == global_property) || - (mobile_apis::GlobalProperty::VRHELPITEMS == global_property)) && - (0 == number_of_reset_vr)) { + (mobile_apis::GlobalProperty::VRHELPITEMS == + global_property)) && + (0 == number_of_reset_vr)) { ++number_of_reset_vr; vr_help_title_items = ResetVrHelpTitleItems(app); } else if (mobile_apis::GlobalProperty::MENUNAME == global_property) { menu_name = true; } else if (mobile_apis::GlobalProperty::MENUICON == global_property) { menu_icon = true; - } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES == global_property) { + } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES == + global_property) { is_key_board_properties = true; } } - if (vr_help_title_items || menu_name || menu_icon || is_key_board_properties) { + if (vr_help_title_items || menu_name || menu_icon || + is_key_board_properties) { is_ui_send_ = true; } @@ -119,13 +120,14 @@ void ResetGlobalPropertiesRequest::Run() { app->set_reset_global_properties_active(true); - if (vr_help_title_items || menu_name || menu_icon || is_key_board_properties) { - - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + if (vr_help_title_items || menu_name || menu_icon || + is_key_board_properties) { + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); if (vr_help_title_items) { - smart_objects::SmartObjectSPtr vr_help = MessageHelper::CreateAppVrHelp(app); + smart_objects::SmartObjectSPtr vr_help = + MessageHelper::CreateAppVrHelp(app); if (!vr_help) { return; } @@ -135,19 +137,20 @@ void ResetGlobalPropertiesRequest::Run() { msg_params[hmi_request::menu_title] = ""; app->set_menu_title(msg_params[hmi_request::menu_title]); } - //TODO(DT): clarify the sending parameter menuIcon - //if (menu_icon) { + // TODO(DT): clarify the sending parameter menuIcon + // if (menu_icon) { //} if (is_key_board_properties) { - smart_objects::SmartObject key_board_properties = smart_objects:: - SmartObject(smart_objects::SmartType_Map); - key_board_properties[strings::language] = static_cast<int32_t> - (hmi_apis::Common_Language::EN_US); - key_board_properties[hmi_request::keyboard_layout] = static_cast<int32_t> - (hmi_apis::Common_KeyboardLayout::QWERTY); + smart_objects::SmartObject key_board_properties = + smart_objects::SmartObject(smart_objects::SmartType_Map); + key_board_properties[strings::language] = + static_cast<int32_t>(hmi_apis::Common_Language::EN_US); + key_board_properties[hmi_request::keyboard_layout] = + static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY); // Look for APPLINK-4432 for details. - /*smart_objects::SmartObject limited_character_list = smart_objects::SmartObject( + /*smart_objects::SmartObject limited_character_list = + smart_objects::SmartObject( smart_objects::SmartType_Array); limited_character_list[0] = ""; key_board_properties[hmi_request::limited_character_list] = @@ -158,14 +161,14 @@ void ResetGlobalPropertiesRequest::Run() { } msg_params[strings::app_id] = app->app_id(); - SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::UI_SetGlobalProperties, &msg_params, true); } if (timeout_prompt || helpt_promt) { // create ui request - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); if (helpt_promt) { msg_params[strings::help_prompt] = (*app->help_prompt()); @@ -177,8 +180,8 @@ void ResetGlobalPropertiesRequest::Run() { msg_params[strings::app_id] = app->app_id(); - SendHMIRequest(hmi_apis::FunctionID::TTS_SetGlobalProperties, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::TTS_SetGlobalProperties, &msg_params, true); } } @@ -189,8 +192,8 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt( SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } - smart_objects::SmartObject so_help_prompt = smart_objects::SmartObject( - smart_objects::SmartType_Array); + smart_objects::SmartObject so_help_prompt = + smart_objects::SmartObject(smart_objects::SmartType_Array); app->set_help_prompt(so_help_prompt); return true; } @@ -206,12 +209,12 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( const std::vector<std::string>& time_out_promt = application_manager_.get_settings().time_out_promt(); - smart_objects::SmartObject so_time_out_promt = smart_objects::SmartObject( - smart_objects::SmartType_Array); + smart_objects::SmartObject so_time_out_promt = + smart_objects::SmartObject(smart_objects::SmartType_Array); for (uint32_t i = 0; i < time_out_promt.size(); ++i) { - smart_objects::SmartObject timeoutPrompt = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject timeoutPrompt = + smart_objects::SmartObject(smart_objects::SmartType_Map); timeoutPrompt[strings::text] = time_out_promt[i]; timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; so_time_out_promt[i] = timeoutPrompt; @@ -243,34 +246,35 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); switch (event.id()) { - case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); - is_ui_received_ = true; - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - break; - } - case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); - is_tts_received_ = true; - tts_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } + case hmi_apis::FunctionID::UI_SetGlobalProperties: { + LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); + is_ui_received_ = true; + ui_result_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + break; + } + case hmi_apis::FunctionID::TTS_SetGlobalProperties: { + LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); + is_tts_received_ = true; + tts_result_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } } if (!IsPendingResponseExist()) { - bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_) - && (hmi_apis::Common_Result::SUCCESS == tts_result_ || - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_)) - || ((hmi_apis::Common_Result::SUCCESS == ui_result_) - && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_)) - || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) - && (hmi_apis::Common_Result::SUCCESS == tts_result_)); + bool result = + ((hmi_apis::Common_Result::SUCCESS == ui_result_) && + (hmi_apis::Common_Result::SUCCESS == tts_result_ || + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_)) || + ((hmi_apis::Common_Result::SUCCESS == ui_result_) && + (hmi_apis::Common_Result::INVALID_ENUM == tts_result_)) || + ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) && + (hmi_apis::Common_Result::SUCCESS == tts_result_)); mobile_apis::Result::eType result_code; const char* return_info = NULL; @@ -278,18 +282,21 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { if (result) { if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_) { result_code = mobile_apis::Result::WARNINGS; - return_info = std::string("Unsupported phoneme type sent in a prompt").c_str(); + return_info = + std::string("Unsupported phoneme type sent in a prompt").c_str(); } else { result_code = static_cast<mobile_apis::Result::eType>( - std::max(ui_result_, tts_result_)); + std::max(ui_result_, tts_result_)); } } else { result_code = static_cast<mobile_apis::Result::eType>( - std::max(ui_result_, tts_result_)); + std::max(ui_result_, tts_result_)); } - SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code), - return_info, &(message[strings::msg_params])); + SendResponse(result, + static_cast<mobile_apis::Result::eType>(result_code), + return_info, + &(message[strings::msg_params])); if (!application) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -304,7 +311,6 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { } } - bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_; } diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc index 6892543d78..c621977868 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/reset_global_properties_response.h" - namespace application_manager { namespace commands { ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() { -} +ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {} void ResetGlobalPropertiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index 6366ccefdc..89bd43fcd6 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -47,15 +47,13 @@ namespace commands { ScrollableMessageRequest::ScrollableMessageRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); } -ScrollableMessageRequest::~ScrollableMessageRequest() { -} +ScrollableMessageRequest::~ScrollableMessageRequest() {} bool ScrollableMessageRequest::Init() { - /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { @@ -80,11 +78,13 @@ void ScrollableMessageRequest::Run() { return; } - //ProcessSoftButtons checks strings on the contents incorrect character + // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager_.GetPolicyHandler(), application_manager_); + MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], + app, + application_manager_.GetPolicyHandler(), + application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); @@ -92,11 +92,12 @@ void ScrollableMessageRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[hmi_request::message_text][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::scrollableMessageBody); + static_cast<int32_t>( + hmi_apis::Common_TextFieldName::scrollableMessageBody); msg_params[hmi_request::message_text][hmi_request::field_text] = (*message_)[strings::msg_params][strings::scroll_message_body]; msg_params[strings::app_id] = app->app_id(); @@ -120,26 +121,24 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout(connection_key(), - correlation_id(), - default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_ScrollableMessage: { LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event"); mobile_apis::Result::eType result_code = - static_cast<mobile_apis::Result::eType> - (message[strings::params][hmi_response::code].asInt()); + static_cast<mobile_apis::Result::eType>( + message[strings::params][hmi_response::code].asInt()); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); if (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code && hmi_capabilities.is_ui_cooperating()) { @@ -150,7 +149,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); break; } } @@ -158,4 +157,3 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { } // namespace commands } // namespace application_manager - diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc index ccc8bafbb0..a5b16bdb70 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc @@ -41,17 +41,16 @@ namespace application_manager { namespace commands { ScrollableMessageResponse::ScrollableMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} void ScrollableMessageResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); - mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( - (*message_)[strings::msg_params][strings::result_code].asInt()); - ApplicationSharedPtr application = - application_manager_.application( - (*message_)[strings::params][strings::connection_key].asInt()); + mobile_apis::Result::eType result_code = + static_cast<mobile_apis::Result::eType>( + (*message_)[strings::msg_params][strings::result_code].asInt()); + ApplicationSharedPtr application = application_manager_.application( + (*message_)[strings::params][strings::connection_key].asInt()); if ((mobile_apis::Result::REJECTED != result_code) && application) { application->UnsubscribeFromSoftButtons( (*message_)[strings::params][strings::function_id].asInt()); 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 9237b59ee9..8225e8081f 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 @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -SendLocationRequest::SendLocationRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +SendLocationRequest::SendLocationRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -SendLocationRequest::~SendLocationRequest() { -} +SendLocationRequest::~SendLocationRequest() {} void SendLocationRequest::Run() { using namespace hmi_apis; @@ -56,8 +55,8 @@ void SendLocationRequest::Run() { if (!app) { LOG4CXX_ERROR(logger_, - "An application with connection key " << connection_key() - << " is not registered."); + "An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -83,7 +82,6 @@ void SendLocationRequest::Run() { return; } - if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Strings contain invalid characters"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -94,21 +92,23 @@ void SendLocationRequest::Run() { const utils::custom_string::CustomString& address = msg_params[strings::address].asCustomString(); if (address.empty()) { - msg_params.erase(strings::address); + msg_params.erase(strings::address); } } - if (!CheckFieldsCompatibility()){ - LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; + if (!CheckFieldsCompatibility()) { + LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; } if (msg_params.keyExists(strings::location_image)) { mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::location_image], app, application_manager_); + (*message_)[strings::msg_params][strings::location_image], + app, + application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); @@ -116,13 +116,11 @@ void SendLocationRequest::Run() { } } - - SmartObject request_msg_params = SmartObject( - smart_objects::SmartType_Map); + SmartObject request_msg_params = SmartObject(smart_objects::SmartType_Map); request_msg_params = msg_params; request_msg_params[strings::app_id] = app->hmi_app_id(); - SendHMIRequest(hmi_apis::FunctionID::Navigation_SendLocation, - &request_msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_SendLocation, &request_msg_params, true); } void SendLocationRequest::on_event(const event_engine::Event& event) { @@ -148,7 +146,8 @@ void SendLocationRequest::on_event(const event_engine::Event& event) { } bool SendLocationRequest::CheckFieldsCompatibility() { - const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + const smart_objects::SmartObject& msg_params = + (*message_)[strings::msg_params]; MessageHelper::PrintSmartObject(msg_params); const bool longitude_degrees_exist = msg_params.keyExists(strings::longitude_degrees); @@ -157,22 +156,25 @@ bool SendLocationRequest::CheckFieldsCompatibility() { const bool address_exist = msg_params.keyExists(strings::address); if (latitude_degrees_exist ^ longitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, "latitude and longitude should be provided only in pair"); + LOG4CXX_DEBUG(logger_, + "latitude and longitude should be provided only in pair"); return false; } if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, "address or latitude/longtitude should should be provided"); + LOG4CXX_DEBUG(logger_, + "address or latitude/longtitude should should be provided"); return false; } return true; } -void insert_if_contains(const smart_objects::SmartObject& msg_params, - const std::string& param_key, - std::vector<utils::custom_string::CustomString>& output_vector) { - if (msg_params.keyExists(param_key)) { - output_vector.push_back(msg_params[param_key].asCustomString()); - } +void insert_if_contains( + const smart_objects::SmartObject& msg_params, + const std::string& param_key, + std::vector<utils::custom_string::CustomString>& output_vector) { + if (msg_params.keyExists(param_key)) { + output_vector.push_back(msg_params[param_key].asCustomString()); + } } bool SendLocationRequest::IsWhiteSpaceExist() { @@ -222,15 +224,17 @@ bool SendLocationRequest::IsWhiteSpaceExist() { return false; } -bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFieldName::eType>& fields_names) { - LOG4CXX_AUTO_TRACE(logger_); +bool SendLocationRequest::CheckHMICapabilities( + std::list<hmi_apis::Common_TextFieldName::eType>& fields_names) { + LOG4CXX_AUTO_TRACE(logger_); using namespace smart_objects; using namespace hmi_apis; if (fields_names.empty()) { return true; } - const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + const HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); if (!hmi_capabilities.is_ui_cooperating()) { LOG4CXX_ERROR(logger_, "UI is not supported."); return false; @@ -238,12 +242,14 @@ bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFi if (hmi_capabilities.display_capabilities()) { const SmartObject disp_cap = (*hmi_capabilities.display_capabilities()); - const SmartObject& text_fields = disp_cap.getElement(hmi_response::text_fields); + const SmartObject& text_fields = + disp_cap.getElement(hmi_response::text_fields); const size_t len = text_fields.length(); for (size_t i = 0; i < len; ++i) { const SmartObject& text_field = text_fields[i]; const Common_TextFieldName::eType filed_name = - static_cast<Common_TextFieldName::eType>(text_field.getElement(strings::name).asInt()); + static_cast<Common_TextFieldName::eType>( + text_field.getElement(strings::name).asInt()); const std::list<Common_TextFieldName::eType>::iterator it = std::find(fields_names.begin(), fields_names.end(), filed_name); if (it != fields_names.end()) { diff --git a/src/components/application_manager/src/commands/mobile/send_location_response.cc b/src/components/application_manager/src/commands/mobile/send_location_response.cc index 756dfc16db..167642e390 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_response.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_response.cc @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -SendLocationResponse::SendLocationResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +SendLocationResponse::SendLocationResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SendLocationResponse::~SendLocationResponse() { -} +SendLocationResponse::~SendLocationResponse() {} void SendLocationResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index cbacbef612..40b708e30d 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -44,12 +44,14 @@ namespace application_manager { namespace commands { -SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) +SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) : CommandRequestImpl(message, application_manager) - , is_icons_saving_enabled_(false){ - const std::string path = application_manager_.get_settings().app_icons_folder(); - is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) && - file_system::IsReadingAllowed(path); + , is_icons_saving_enabled_(false) { + const std::string path = + application_manager_.get_settings().app_icons_folder(); + is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) && + file_system::IsReadingAllowed(path); } SetAppIconRequest::~SetAppIconRequest() {} @@ -57,8 +59,7 @@ SetAppIconRequest::~SetAppIconRequest() {} void SetAppIconRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -111,7 +112,9 @@ void SetAppIconRequest::Run() { void SetAppIconRequest::CopyToIconStorage( const std::string& path_to_file) const { - if (!application_manager_.protocol_handler().get_settings().enable_protocol_4()) { + if (!application_manager_.protocol_handler() + .get_settings() + .enable_protocol_4()) { LOG4CXX_WARN(logger_, "Icon copying skipped, since protocol ver. 4 is not enabled."); return; @@ -133,9 +136,8 @@ void SetAppIconRequest::CopyToIconStorage( LOG4CXX_ERROR(logger_, "Icon size (" << file_size << ") is bigger, than " " icons storage maximum size (" - << storage_max_size - << ")." - "Copying skipped."); + << storage_max_size << ")." + "Copying skipped."); return; } @@ -236,11 +238,10 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); if (result) { ApplicationSharedPtr app = @@ -251,9 +252,9 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { return; } - const std::string& path = (*message_)[strings::msg_params] - [strings::sync_file_name] - [strings::value].asString(); + const std::string& path = + (*message_)[strings::msg_params][strings::sync_file_name] + [strings::value].asString(); app->set_app_icon_path(path); LOG4CXX_INFO(logger_, diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc index 53d9fd9ea6..29f3950ffc 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/set_app_icon_response.h" - namespace application_manager { namespace commands { -SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SetAppIconResponse::~SetAppIconResponse() { -} +SetAppIconResponse::~SetAppIconResponse() {} void SetAppIconResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index dfca103b35..6cb6318791 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -35,18 +35,15 @@ #include "application_manager/application_impl.h" - namespace application_manager { namespace commands { SetDisplayLayoutRequest::SetDisplayLayoutRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + : CommandRequestImpl(message, application_manager) {} -SetDisplayLayoutRequest::~SetDisplayLayoutRequest() { -} +SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} void SetDisplayLayoutRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -61,8 +58,8 @@ void SetDisplayLayoutRequest::Run() { (*message_)[strings::msg_params][strings::app_id] = app->app_id(); SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout, - &((*message_)[strings::msg_params]), true); - + &((*message_)[strings::msg_params]), + true); } void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { @@ -74,8 +71,8 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event"); mobile_apis::Result::eType result_code = - static_cast<mobile_apis::Result::eType>( - message[strings::params][hmi_response::code].asInt()); + static_cast<mobile_apis::Result::eType>( + message[strings::params][hmi_response::code].asInt()); bool response_success = mobile_apis::Result::SUCCESS == result_code; smart_objects::SmartObject msg_params = message[strings::msg_params]; @@ -86,9 +83,13 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { // in case templates_available is empty copy from hmi capabilities if (msg_params.keyExists(hmi_response::display_capabilities)) { - if (0 == msg_params[hmi_response::display_capabilities][hmi_response::templates_available].length()) { - msg_params[hmi_response::display_capabilities][hmi_response::templates_available] = - hmi_capabilities.display_capabilities()->getElement(hmi_response::templates_available); + if (0 == + msg_params[hmi_response::display_capabilities] + [hmi_response::templates_available].length()) { + msg_params[hmi_response::display_capabilities] + [hmi_response::templates_available] = + hmi_capabilities.display_capabilities()->getElement( + hmi_response::templates_available); } } } @@ -96,7 +97,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc index 02a03b7b07..b5e53803c8 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc @@ -34,24 +34,20 @@ #include "application_manager/commands/mobile/set_display_layout_response.h" #include "application_manager/application_impl.h" - namespace application_manager { namespace commands { SetDisplayLayoutResponse::SetDisplayLayoutResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -SetDisplayLayoutResponse::~SetDisplayLayoutResponse() { -} +SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {} void SetDisplayLayoutResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); application_manager_.SendMessageToMobile(message_); - } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index f74e8a923c..171b902df1 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -45,17 +45,15 @@ namespace commands { SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager), - is_ui_send_(false), - is_tts_send_(false), - is_ui_received_(false), - is_tts_received_(false), - ui_result_(hmi_apis::Common_Result::INVALID_ENUM), - tts_result_(hmi_apis::Common_Result::INVALID_ENUM) { -} + : CommandRequestImpl(message, application_manager) + , is_ui_send_(false) + , is_tts_send_(false) + , is_ui_received_(false) + , is_tts_received_(false) + , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) + , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} -SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() { -} +SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {} void SetGlobalPropertiesRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -63,12 +61,12 @@ void SetGlobalPropertiesRequest::Run() { const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with connection key " - << connection_key()); + LOG4CXX_ERROR(logger_, + "No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -84,18 +82,23 @@ void SetGlobalPropertiesRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::menu_icon], app, application_manager_); + (*message_)[strings::msg_params][strings::menu_icon], + app, + application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return " - << verification_result); + LOG4CXX_ERROR( + logger_, "MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); return; } } // Check for image file(s) in vrHelpItem if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { - if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( - (*message_)[strings::msg_params][strings::vr_help], app, application_manager_)) { + if (mobile_apis::Result::SUCCESS != + MessageHelper::VerifyImageVrHelpItems( + (*message_)[strings::msg_params][strings::vr_help], + app, + application_manager_)) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; @@ -108,19 +111,19 @@ void SetGlobalPropertiesRequest::Run() { return; } - //if application waits for sending ttsGlobalProperties need to remove this - //application from tts_global_properties_app_list_ - application_manager_.RemoveAppFromTTSGlobalPropertiesList( - connection_key()); + // if application waits for sending ttsGlobalProperties need to remove this + // application from tts_global_properties_app_list_ + application_manager_.RemoveAppFromTTSGlobalPropertiesList(connection_key()); bool is_help_prompt_present = msg_params.keyExists(strings::help_prompt); - bool is_timeout_prompt_present = msg_params.keyExists( - strings::timeout_prompt); + bool is_timeout_prompt_present = + msg_params.keyExists(strings::timeout_prompt); bool is_vr_help_title_present = msg_params.keyExists(strings::vr_help_title); bool is_vr_help_present = msg_params.keyExists(strings::vr_help); // check VR params if (is_vr_help_title_present ^ is_vr_help_present) { - LOG4CXX_ERROR(logger_, "Reject because of vr_help or vr_help_title only provided"); + LOG4CXX_ERROR(logger_, + "Reject because of vr_help or vr_help_title only provided"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -129,8 +132,8 @@ void SetGlobalPropertiesRequest::Run() { if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) { LOG4CXX_ERROR(logger_, - "VR Help Items contains nonsequential positions" << - " (e.g. [1,2,4]) or not started from 1"); + "VR Help Items contains nonsequential positions" + << " (e.g. [1,2,4]) or not started from 1"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -177,14 +180,12 @@ void SetGlobalPropertiesRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Map); if (is_help_prompt_present) { - app->set_help_prompt( - msg_params.getElement(strings::help_prompt)); + app->set_help_prompt(msg_params.getElement(strings::help_prompt)); params[strings::help_prompt] = (*app->help_prompt()); } if (is_timeout_prompt_present) { - app->set_timeout_prompt( - msg_params.getElement(strings::timeout_prompt)); + app->set_timeout_prompt(msg_params.getElement(strings::timeout_prompt)); params[strings::timeout_prompt] = (*app->timeout_prompt()); } @@ -201,11 +202,13 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( DCHECK_OR_RETURN(vr_help_length > 0, false); for (size_t j = 0; j < vr_help_length; ++j) { - const size_t position = vr_help.getElement(j).getElement(strings::position).asUInt(); + const size_t position = + vr_help.getElement(j).getElement(strings::position).asUInt(); // Elements shall start from 1 and increment one by one if (position != (j + 1)) { - LOG4CXX_ERROR(logger_, "VR help items order is wrong" << - " at " << j << ", position value:" << position); + LOG4CXX_ERROR(logger_, + "VR help items order is wrong" + << " at " << j << ", position value:" << position); return false; } } @@ -245,56 +248,51 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { const bool is_tts_succeeded = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - tts_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - hmi_apis::Common_Result::WARNINGS); + tts_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, + hmi_apis::Common_Result::WARNINGS); - const bool is_ui_succeeded = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - hmi_apis::Common_Result::WARNINGS); + const bool is_ui_succeeded = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + ui_result_, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, + hmi_apis::Common_Result::WARNINGS); const bool is_ui_invalid_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + ui_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - bool result = - (is_tts_succeeded && is_ui_succeeded) || - (is_ui_succeeded && - hmi_apis::Common_Result::INVALID_ENUM == tts_result_) || - (is_ui_invalid_unsupported && is_tts_succeeded); + bool result = (is_tts_succeeded && is_ui_succeeded) || + (is_ui_succeeded && + hmi_apis::Common_Result::INVALID_ENUM == tts_result_) || + (is_ui_invalid_unsupported && is_tts_succeeded); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; const char* return_info = NULL; const bool is_ui_or_tts_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, - tts_result_, - ui_result_); + hmi_apis::Common_Result::WARNINGS, tts_result_, ui_result_); - if (result && - (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_ || - is_ui_or_tts_warning)) { + if (result && (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_ || + is_ui_or_tts_warning)) { result_code = mobile_apis::Result::WARNINGS; return_info = std::string("Unsupported phoneme type sent in a prompt").c_str(); } else { - result_code = MessageHelper::HMIToMobileResult( - std::max(ui_result_, tts_result_)); + result_code = + MessageHelper::HMIToMobileResult(std::max(ui_result_, tts_result_)); } - //TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse - ApplicationSharedPtr application = - application_manager_.application(connection_key()); + // TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse + ApplicationSharedPtr application = + application_manager_.application(connection_key()); - SendResponse(result, result_code, return_info, - &(message[strings::msg_params])); + SendResponse( + result, result_code, return_info, &(message[strings::msg_params])); if (!application) { LOG4CXX_DEBUG(logger_, "NULL pointer."); @@ -311,30 +309,28 @@ bool SetGlobalPropertiesRequest::ValidateVRHelpTitle( LOG4CXX_AUTO_TRACE(logger_); if (vr_help_so_ptr) { const std::string& vr_help = vr_help_so_ptr->asString(); - LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"'); + LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"'); return !vr_help.empty(); } return false; } void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( - const ApplicationSharedPtr app, const smart_objects::SmartObject &msg_params, - smart_objects::SmartObject &out_params) { + const ApplicationSharedPtr app, + const smart_objects::SmartObject& msg_params, + smart_objects::SmartObject& out_params) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - app->set_vr_help_title( - msg_params.getElement(strings::vr_help_title)); - app->set_vr_help( - msg_params.getElement(strings::vr_help)); + app->set_vr_help_title(msg_params.getElement(strings::vr_help_title)); + app->set_vr_help(msg_params.getElement(strings::vr_help)); out_params[strings::vr_help_title] = (*app->vr_help_title()); out_params[strings::vr_help] = (*app->vr_help()); } bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( - const ApplicationSharedPtr app, - smart_objects::SmartObject &out_params) { + const ApplicationSharedPtr app, smart_objects::SmartObject& out_params) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(app, false); @@ -345,7 +341,8 @@ bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( int32_t index = 0; smart_objects::SmartObject vr_help_items; for (CommandsMap::const_iterator command_it = cmdMap.begin(); - cmdMap.end() != command_it; ++command_it) { + cmdMap.end() != command_it; + ++command_it) { const smart_objects::SmartObject& command = *command_it->second; if (!command.keyExists(strings::vr_commands)) { LOG4CXX_ERROR(logger_, "VR synonyms are empty"); @@ -368,13 +365,16 @@ bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( } void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( - const ApplicationSharedPtr app, const smart_objects::SmartObject &msg_params, - smart_objects::SmartObject &out_params) { + const ApplicationSharedPtr app, + const smart_objects::SmartObject& msg_params, + smart_objects::SmartObject& out_params) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - const bool is_menu_title_present = msg_params.keyExists(hmi_request::menu_title); - const bool is_menu_icon_present = msg_params.keyExists(hmi_request::menu_icon); + const bool is_menu_title_present = + msg_params.keyExists(hmi_request::menu_title); + const bool is_menu_icon_present = + msg_params.keyExists(hmi_request::menu_icon); const bool is_keyboard_props_present = msg_params.keyExists(hmi_request::keyboard_properties); @@ -384,8 +384,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( app->set_menu_title(msg_params[hmi_request::menu_title]); } if (is_menu_icon_present) { - out_params[hmi_request::menu_icon] = - msg_params[hmi_request::menu_icon]; + out_params[hmi_request::menu_icon] = msg_params[hmi_request::menu_icon]; app->set_menu_icon(msg_params[hmi_request::menu_icon]); } if (is_keyboard_props_present) { @@ -396,18 +395,18 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( } void SetGlobalPropertiesRequest::SendTTSRequest( - const smart_objects::SmartObject ¶ms, bool use_events) { + const smart_objects::SmartObject& params, bool use_events) { LOG4CXX_AUTO_TRACE(logger_); - SendHMIRequest(hmi_apis::FunctionID::TTS_SetGlobalProperties, - ¶ms, use_events); + SendHMIRequest( + hmi_apis::FunctionID::TTS_SetGlobalProperties, ¶ms, use_events); is_tts_send_ = true; } void SetGlobalPropertiesRequest::SendUIRequest( - const smart_objects::SmartObject ¶ms, bool use_events) { + const smart_objects::SmartObject& params, bool use_events) { LOG4CXX_AUTO_TRACE(logger_); - SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties, - ¶ms, use_events); + SendHMIRequest( + hmi_apis::FunctionID::UI_SetGlobalProperties, ¶ms, use_events); is_ui_send_ = true; } @@ -418,13 +417,13 @@ bool SetGlobalPropertiesRequest::IsPendingResponseExist() { bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( const smart_objects::SmartObject& params) { LOG4CXX_AUTO_TRACE(logger_); - return params.keyExists(strings::help_prompt) - || params.keyExists(strings::timeout_prompt) - || params.keyExists(strings::vr_help_title) - || params.keyExists(strings::vr_help) - || params.keyExists(strings::menu_title) - || params.keyExists(strings::menu_icon) - || params.keyExists(strings::keyboard_properties); + return params.keyExists(strings::help_prompt) || + params.keyExists(strings::timeout_prompt) || + params.keyExists(strings::vr_help_title) || + params.keyExists(strings::vr_help) || + params.keyExists(strings::menu_title) || + params.keyExists(strings::menu_icon) || + params.keyExists(strings::keyboard_properties); } bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { @@ -484,11 +483,11 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { str = (*it_vh)[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); + "Invalid vr_help image value syntax check failed"); return true; } } // if image exists - } // for - vh_array iteration + } // for - vh_array iteration } if (msg_params.keyExists(strings::menu_icon)) { @@ -515,13 +514,12 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { } } - if (msg_params.keyExists(strings::keyboard_properties)) { - if (msg_params[strings::keyboard_properties]. - keyExists(strings::limited_character_list)) { + if (msg_params[strings::keyboard_properties].keyExists( + strings::limited_character_list)) { const smart_objects::SmartArray* lcl_array = msg_params[strings::keyboard_properties] - [strings::limited_character_list].asArray(); + [strings::limited_character_list].asArray(); smart_objects::SmartArray::const_iterator it_lcl = lcl_array->begin(); smart_objects::SmartArray::const_iterator it_lcl_end = lcl_array->end(); @@ -529,21 +527,24 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_lcl != it_lcl_end; ++it_lcl) { str = (*it_lcl).asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid keyboard_properties " - "limited_character_list syntax check failed"); + LOG4CXX_ERROR(logger_, + "Invalid keyboard_properties " + "limited_character_list syntax check failed"); return true; } } } - if (msg_params[strings::keyboard_properties]. - keyExists(strings::auto_complete_text)) { - str = msg_params[strings::keyboard_properties] - [strings::auto_complete_text].asCharArray(); + if (msg_params[strings::keyboard_properties].keyExists( + strings::auto_complete_text)) { + str = + msg_params[strings::keyboard_properties][strings::auto_complete_text] + .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid keyboard_properties " - "auto_complete_text syntax check failed"); + LOG4CXX_ERROR(logger_, + "Invalid keyboard_properties " + "auto_complete_text syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc index 9e4880e53d..5cfbcb2d58 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc @@ -33,19 +33,15 @@ #include "application_manager/commands/mobile/set_global_properties_response.h" - - namespace application_manager { namespace commands { SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() { -} +SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {} void SetGlobalPropertiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc index 0aa6e34488..85f34aead9 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc @@ -43,18 +43,16 @@ namespace application_manager { namespace commands { -SetIconRequest::SetIconRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +SetIconRequest::SetIconRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -SetIconRequest::~SetIconRequest() { -} +SetIconRequest::~SetIconRequest() {} void SetIconRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -77,22 +75,22 @@ void SetIconRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); - msg_params[strings::sync_file_name] = smart_objects::SmartObject( - smart_objects::SmartType_Map); + msg_params[strings::sync_file_name] = + smart_objects::SmartObject(smart_objects::SmartType_Map); -// Panasonic requres unchanged path value without encoded special characters - const std::string full_file_path_for_hmi = file_system::ConvertPathForURL( - full_file_path); + // Panasonic requres unchanged path value without encoded special characters + const std::string full_file_path_for_hmi = + file_system::ConvertPathForURL(full_file_path); msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi; // TODO(VS): research why is image_type hardcoded msg_params[strings::sync_file_name][strings::image_type] = - static_cast<int32_t> (SetIconRequest::ImageType::DYNAMIC); + static_cast<int32_t>(SetIconRequest::ImageType::DYNAMIC); // for further use in on_event function (*message_)[strings::msg_params][strings::sync_file_name] = @@ -117,9 +115,9 @@ void SetIconRequest::on_event(const event_engine::Event& event) { ApplicationSharedPtr app = application_manager_.application(connection_key()); - const std::string path = (*message_)[strings::msg_params] - [strings::sync_file_name] - [strings::value].asString(); + const std::string path = + (*message_)[strings::msg_params][strings::sync_file_name] + [strings::value].asString(); app->set_app_icon_path(path); LOG4CXX_INFO(logger_, diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_icon_response.cc index 92c0a666c9..c140d04f51 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_response.cc @@ -40,11 +40,9 @@ namespace commands { SetIconResponse::SetIconResponse(const MessageSharedPtr& message, ApplicationManager& app_man) - : CommandResponseImpl(message, app_man) { -} + : CommandResponseImpl(message, app_man) {} -SetIconResponse::~SetIconResponse() { -} +SetIconResponse::~SetIconResponse() {} void SetIconResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc index 444efdce86..a198ce63c3 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc @@ -41,18 +41,16 @@ namespace application_manager { namespace commands { -SetMediaClockRequest::SetMediaClockRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +SetMediaClockRequest::SetMediaClockRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -SetMediaClockRequest::~SetMediaClockRequest() { -} +SetMediaClockRequest::~SetMediaClockRequest() {} void SetMediaClockRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); @@ -67,14 +65,14 @@ void SetMediaClockRequest::Run() { } if (isDataValid()) { - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); // copy entirely msg msg_params = (*message_)[strings::msg_params]; msg_params[strings::app_id] = app->app_id(); - SendHMIRequest(hmi_apis::FunctionID::UI_SetMediaClockTimer, - &msg_params, true); + SendHMIRequest( + hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true); } else { SendResponse(false, mobile_apis::Result::INVALID_DATA); } @@ -110,7 +108,6 @@ bool SetMediaClockRequest::isDataValid() { if (update_mode == mobile_apis::UpdateMode::COUNTUP || update_mode == mobile_apis::UpdateMode::COUNTDOWN) { - if (!msg_params.keyExists(strings::start_time)) { LOG4CXX_INFO(logger_, "Invalid data"); return false; @@ -134,9 +131,9 @@ bool SetMediaClockRequest::isDataValid() { (msg_params[strings::end_time][strings::seconds].asUInt()); if (((end_time_in_seconds > start_time_in_seconds) && - (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || + (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || ((end_time_in_seconds < start_time_in_seconds) && - (update_mode == mobile_apis::UpdateMode::COUNTUP))) { + (update_mode == mobile_apis::UpdateMode::COUNTUP))) { LOG4CXX_INFO(logger_, "Invalid data"); return false; } diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc index e1d3259a23..30e802a1db 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/set_media_clock_timer_response.h" - namespace application_manager { namespace commands { SetMediaClockTimerResponse::SetMediaClockTimerResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SetMediaClockTimerResponse::~SetMediaClockTimerResponse() { -} +SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {} void SetMediaClockTimerResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 6d2deddc46..2d79e13582 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 @@ -45,12 +45,11 @@ namespace application_manager { namespace commands { -ShowConstantTBTRequest::ShowConstantTBTRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +ShowConstantTBTRequest::ShowConstantTBTRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -ShowConstantTBTRequest::~ShowConstantTBTRequest() { -} +ShowConstantTBTRequest::~ShowConstantTBTRequest() {} void ShowConstantTBTRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -70,8 +69,8 @@ void ShowConstantTBTRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params = (*message_)[strings::msg_params]; if (IsWhiteSpaceExist()) { @@ -81,12 +80,13 @@ void ShowConstantTBTRequest::Run() { return; } - //ProcessSoftButtons checks strings on the contents incorrect character + // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons( - msg_params, - app, application_manager_.GetPolicyHandler() , application_manager_); + MessageHelper::ProcessSoftButtons(msg_params, + app, + application_manager_.GetPolicyHandler(), + application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -94,9 +94,7 @@ void ShowConstantTBTRequest::Run() { return; } - - mobile_apis::Result::eType verification_result = - mobile_apis::Result::SUCCESS; + mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; if (msg_params.keyExists(strings::turn_icon)) { verification_result = MessageHelper::VerifyImage( msg_params[strings::turn_icon], app, application_manager_); @@ -119,8 +117,8 @@ void ShowConstantTBTRequest::Run() { msg_params[strings::app_id] = app->app_id(); - msg_params[hmi_request::navi_texts] = smart_objects::SmartObject( - smart_objects::SmartType_Array); + msg_params[hmi_request::navi_texts] = + smart_objects::SmartObject(smart_objects::SmartType_Array); int32_t index = 0; if (msg_params.keyExists(strings::navigation_text_1)) { @@ -160,24 +158,24 @@ void ShowConstantTBTRequest::Run() { } if (msg_params.keyExists(strings::time_to_destination)) { - // erase useless param - msg_params.erase(strings::time_to_destination); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::time_to_destination]; + // erase useless param + msg_params.erase(strings::time_to_destination); + msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = + static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination); + msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + (*message_)[strings::msg_params][strings::time_to_destination]; } if (msg_params.keyExists(strings::soft_buttons)) { - MessageHelper::SubscribeApplicationToSoftButton(msg_params, app, function_id()); + MessageHelper::SubscribeApplicationToSoftButton( + msg_params, app, function_id()); } app->set_tbt_show_command(msg_params); - SendHMIRequest(hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, - true); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, true); } - void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& message = event.smart_object(); @@ -191,24 +189,25 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt())); HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); + application_manager_.hmi_capabilities(); bool result = false; if (mobile_apis::Result::SUCCESS == result_code) { result = true; return_info = message[strings::msg_params][hmi_response::message].asString(); } else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) && - hmi_capabilities.is_ui_cooperating()) { + hmi_capabilities.is_ui_cooperating()) { result = true; } - SendResponse(result, result_code, + SendResponse(result, + result_code, return_info.empty() ? 0 : return_info.c_str(), &(message[strings::msg_params])); break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event" << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); break; } } @@ -219,8 +218,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) { - str = (*message_)[strings::msg_params] - [strings::turn_icon][strings::value].asCharArray(); + str = (*message_)[strings::msg_params][strings::turn_icon][strings::value] + .asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid turn_icon value syntax check failed"); return true; @@ -228,8 +227,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) { - str = (*message_)[strings::msg_params] - [strings::next_turn_icon][strings::value].asCharArray(); + str = (*message_)[strings::msg_params][strings::next_turn_icon] + [strings::value].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid next_turn_icon value syntax check failed"); @@ -238,8 +237,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_1)) { - str = (*message_)[strings::msg_params] - [strings::navigation_text_1].asCharArray(); + str = (*message_)[strings::msg_params][strings::navigation_text_1] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid navigation_text_1 value syntax check failed"); @@ -248,8 +247,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_2)) { - str = (*message_)[strings::msg_params] - [strings::navigation_text_2].asCharArray(); + str = (*message_)[strings::msg_params][strings::navigation_text_2] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid navigation_text_2 value syntax check failed"); @@ -266,8 +265,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } if ((*message_)[strings::msg_params].keyExists(strings::total_distance)) { - str = (*message_)[strings::msg_params] - [strings::total_distance].asCharArray(); + str = + (*message_)[strings::msg_params][strings::total_distance].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid total_distance value syntax check failed"); @@ -275,9 +274,10 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { } } - if ((*message_)[strings::msg_params].keyExists(strings::time_to_destination)) { - str = (*message_)[strings::msg_params] - [strings::time_to_destination].asCharArray(); + if ((*message_)[strings::msg_params].keyExists( + strings::time_to_destination)) { + str = (*message_)[strings::msg_params][strings::time_to_destination] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid time_to_destination value syntax check failed"); diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc index 3669159fb5..80a36129cf 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc @@ -42,11 +42,9 @@ namespace commands { ShowConstantTBTResponse::ShowConstantTBTResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -ShowConstantTBTResponse::~ShowConstantTBTResponse() { -} +ShowConstantTBTResponse::~ShowConstantTBTResponse() {} void ShowConstantTBTResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index 2684417a62..467d8d0236 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -43,26 +43,23 @@ namespace application_manager { namespace commands { -ShowRequest::ShowRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +ShowRequest::ShowRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -ShowRequest::~ShowRequest() { -} +ShowRequest::~ShowRequest() {} void ShowRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } - //SDLAQ-CRS-494, VC3.1 + // SDLAQ-CRS-494, VC3.1 if ((*message_)[strings::msg_params].empty()) { LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -70,19 +67,21 @@ void ShowRequest::Run() { } if (!CheckStringsOfShowRequest()) { - LOG4CXX_ERROR(logger_, "Incorrect characters in string"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } + LOG4CXX_ERROR(logger_, "Incorrect characters in string"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } - //ProcessSoftButtons checks strings on the contents incorrect character + // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = mobile_apis::Result::SUCCESS; - if(((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && + if (((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && ((*message_)[strings::msg_params][strings::soft_buttons].length() > 0)) { processing_result = MessageHelper::ProcessSoftButtons( (*message_)[strings::msg_params], - app, application_manager_.GetPolicyHandler(),application_manager_); + app, + application_manager_.GetPolicyHandler(), + application_manager_); } if (mobile_apis::Result::SUCCESS != processing_result) { @@ -91,13 +90,14 @@ void ShowRequest::Run() { return; } - mobile_apis::Result::eType verification_result = - mobile_apis::Result::SUCCESS; + mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; if (((*message_)[strings::msg_params].keyExists(strings::graphic)) && - ((*message_)[strings::msg_params] - [strings::graphic][strings::value].asString()).length()) { + ((*message_)[strings::msg_params][strings::graphic][strings::value] + .asString()).length()) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::graphic], app, application_manager_); + (*message_)[strings::msg_params][strings::graphic], + app, + application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "Image verification failed."); SendResponse(false, verification_result); @@ -107,7 +107,9 @@ void ShowRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::secondary_graphic], app, application_manager_); + (*message_)[strings::msg_params][strings::secondary_graphic], + app, + application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { LOG4CXX_ERROR(logger_, "Image verification failed."); SendResponse(false, verification_result); @@ -115,12 +117,12 @@ void ShowRequest::Run() { } } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::app_id] = app->app_id(); - msg_params[hmi_request::show_strings] = smart_objects::SmartObject( - smart_objects::SmartType_Array); + msg_params[hmi_request::show_strings] = + smart_objects::SmartObject(smart_objects::SmartType_Array); int32_t index = 0; if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { @@ -191,7 +193,7 @@ void ShowRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { msg_params[strings::secondary_graphic] = - (*message_)[strings::msg_params][strings::secondary_graphic]; + (*message_)[strings::msg_params][strings::secondary_graphic]; } if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { @@ -228,13 +230,12 @@ void ShowRequest::on_event(const event_engine::Event& event) { std::string response_info; mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( - message[strings::params][hmi_response::code].asInt()); + message[strings::params][hmi_response::code].asInt()); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); if (mobile_apis::Result::WARNINGS == result_code && message[strings::params].keyExists(hmi_response::message)) { @@ -242,13 +243,14 @@ void ShowRequest::on_event(const event_engine::Event& event) { message[strings::params][hmi_response::message].asString(); } - SendResponse(result, result_code, + SendResponse(result, + result_code, response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; } default: { - LOG4CXX_ERROR(logger_,"Received unknown event " << event.id()); + LOG4CXX_ERROR(logger_, "Received unknown event " << event.id()); break; } } @@ -262,7 +264,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid main_field_4 syntax check failed"); - return false; + return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { @@ -308,20 +310,20 @@ bool ShowRequest::CheckStringsOfShowRequest() { } } if ((*message_)[strings::msg_params].keyExists(strings::custom_presets)) { - smart_objects::SmartObject& custom_presets_array = - (*message_)[strings::msg_params][strings::custom_presets]; - for (size_t i = 0; i < custom_presets_array.length(); ++i) { - str = custom_presets_array[i].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed"); - return false; - } + smart_objects::SmartObject& custom_presets_array = + (*message_)[strings::msg_params][strings::custom_presets]; + for (size_t i = 0; i < custom_presets_array.length(); ++i) { + str = custom_presets_array[i].asCharArray(); + if (!CheckSyntax(str)) { + LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed"); + return false; } + } } if ((*message_)[strings::msg_params].keyExists(strings::graphic)) { - str = (*message_)[strings::msg_params] - [strings::graphic][strings::value].asCharArray(); + str = (*message_)[strings::msg_params][strings::graphic][strings::value] + .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { LOG4CXX_ERROR(logger_, "Invalid graphic value syntax check failed"); return false; @@ -329,11 +331,11 @@ bool ShowRequest::CheckStringsOfShowRequest() { } if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { - str = (*message_)[strings::msg_params] - [strings::secondary_graphic][strings::value].asCharArray(); + str = (*message_)[strings::msg_params][strings::secondary_graphic] + [strings::value].asCharArray(); if (!CheckSyntax(str)) { LOG4CXX_ERROR(logger_, - "Invalid secondary_graphic value syntax check failed"); + "Invalid secondary_graphic value syntax check failed"); return false; } } diff --git a/src/components/application_manager/src/commands/mobile/show_response.cc b/src/components/application_manager/src/commands/mobile/show_response.cc index 764f37d42c..8027c908f1 100644 --- a/src/components/application_manager/src/commands/mobile/show_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_response.cc @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -ShowResponse::ShowResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +ShowResponse::ShowResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -ShowResponse::~ShowResponse() { -} +ShowResponse::~ShowResponse() {} void ShowResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index 0c4b177d44..3920b49db3 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -42,16 +42,15 @@ namespace application_manager { namespace commands { -SliderRequest::SliderRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { +SliderRequest::SliderRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); } -SliderRequest::~SliderRequest() { -} +SliderRequest::~SliderRequest() {} bool SliderRequest::Init() { - /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { @@ -66,9 +65,8 @@ bool SliderRequest::Init() { void SliderRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr application = - application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); + ApplicationSharedPtr application = application_manager_.application( + (*message_)[strings::params][strings::connection_key].asUInt()); if (!application) { LOG4CXX_ERROR(logger_, "Application is not registered"); @@ -85,9 +83,8 @@ void SliderRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::slider_footer)) { if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) { - if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() - != (*message_)[strings::msg_params] - [strings::slider_footer].length()) { + if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() != + (*message_)[strings::msg_params][strings::slider_footer].length()) { LOG4CXX_ERROR(logger_, "INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; @@ -101,8 +98,8 @@ void SliderRequest::Run() { return; } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params = (*message_)[strings::msg_params]; msg_params[strings::app_id] = application->app_id(); @@ -124,9 +121,8 @@ void SliderRequest::on_event(const event_engine::Event& event) { const event_engine::Event::EventID event_id = event.id(); if (event_id == FunctionID::UI_OnResetTimeout) { LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout(connection_key(), - correlation_id(), - default_timeout()); + application_manager_.updateRequestTimeout( + connection_key(), correlation_id(), default_timeout()); return; } @@ -142,30 +138,25 @@ void SliderRequest::on_event(const event_engine::Event& event) { SmartObject response_msg_params = message[strings::msg_params]; - const bool is_timeout_aborted = - Compare<Common_Result::eType, EQ, ONE>( - response_code, - Common_Result::TIMED_OUT, - Common_Result::ABORTED); + const bool is_timeout_aborted = Compare<Common_Result::eType, EQ, ONE>( + response_code, Common_Result::TIMED_OUT, Common_Result::ABORTED); if (is_timeout_aborted) { - if (message[strings::params][strings::data] - .keyExists(strings::slider_position)) { - //Copy slider_position info to msg_params section + if (message[strings::params][strings::data].keyExists( + strings::slider_position)) { + // Copy slider_position info to msg_params section response_msg_params[strings::slider_position] = message[strings::params][strings::data][strings::slider_position]; } else { - LOG4CXX_ERROR(logger_, strings::slider_position << " field is absent" - " in response."); + LOG4CXX_ERROR(logger_, + strings::slider_position << " field is absent" + " in response."); response_msg_params[strings::slider_position] = 0; } } - const bool is_response_success = - Compare<Common_Result::eType, EQ, ONE>( - response_code, - Common_Result::SUCCESS, - Common_Result::WARNINGS); + const bool is_response_success = Compare<Common_Result::eType, EQ, ONE>( + response_code, Common_Result::SUCCESS, Common_Result::WARNINGS); SendResponse(is_response_success, MessageHelper::HMIToMobileResult(response_code), @@ -203,4 +194,3 @@ bool SliderRequest::IsWhiteSpaceExist() { } // namespace commands } // namespace application_manager - diff --git a/src/components/application_manager/src/commands/mobile/slider_response.cc b/src/components/application_manager/src/commands/mobile/slider_response.cc index dd9837ba7f..2cfcaf48fd 100644 --- a/src/components/application_manager/src/commands/mobile/slider_response.cc +++ b/src/components/application_manager/src/commands/mobile/slider_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/slider_response.h" - namespace application_manager { namespace commands { -SliderResponse::SliderResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +SliderResponse::SliderResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SliderResponse::~SliderResponse() { -} +SliderResponse::~SliderResponse() {} void SliderResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc index da65c8b57b..7e4731b569 100644 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/src/commands/mobile/speak_request.cc @@ -42,20 +42,18 @@ namespace application_manager { namespace commands { -SpeakRequest::SpeakRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { +SpeakRequest::SpeakRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); } -SpeakRequest::~SpeakRequest() { -} +SpeakRequest::~SpeakRequest() {} void SpeakRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -75,7 +73,8 @@ void SpeakRequest::Run() { (*message_)[strings::msg_params][hmi_request::speak_type] = hmi_apis::Common_MethodName::SPEAK; SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, - &message_->getElement(strings::msg_params), true); + &message_->getElement(strings::msg_params), + true); } void SpeakRequest::on_event(const event_engine::Event& event) { @@ -102,7 +101,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) { } void SpeakRequest::ProcessTTSSpeakResponse( - const smart_objects::SmartObject& message) { + const smart_objects::SmartObject& message) { LOG4CXX_AUTO_TRACE(logger_); using namespace helpers; @@ -116,36 +115,32 @@ void SpeakRequest::ProcessTTSSpeakResponse( hmi_apis::Common_Result::eType hmi_result_code = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + message[strings::params][hmi_response::code].asInt()); mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(hmi_result_code); + MessageHelper::HMIToMobileResult(hmi_result_code); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, mobile_api::Result::SUCCESS, mobile_api::Result::WARNINGS); (*message_)[strings::params][strings::function_id] = mobile_apis::FunctionID::SpeakID; const char* return_info = NULL; - const bool is_result_ok = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::UNSUPPORTED_RESOURCE, - mobile_api::Result::WARNINGS); + const bool is_result_ok = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::UNSUPPORTED_RESOURCE, + mobile_api::Result::WARNINGS); if (is_result_ok) { result_code = mobile_apis::Result::WARNINGS; - return_info = std::string( - "Unsupported phoneme type sent in a prompt").c_str(); + return_info = + std::string("Unsupported phoneme type sent in a prompt").c_str(); } - SendResponse(result, result_code, return_info, - &(message[strings::msg_params])); + SendResponse( + result, result_code, return_info, &(message[strings::msg_params])); } bool SpeakRequest::IsWhiteSpaceExist() { diff --git a/src/components/application_manager/src/commands/mobile/speak_response.cc b/src/components/application_manager/src/commands/mobile/speak_response.cc index 1deae79990..612d32c913 100644 --- a/src/components/application_manager/src/commands/mobile/speak_response.cc +++ b/src/components/application_manager/src/commands/mobile/speak_response.cc @@ -40,12 +40,11 @@ namespace application_manager { namespace commands { -SpeakResponse::SpeakResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +SpeakResponse::SpeakResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SpeakResponse::~SpeakResponse() { -} +SpeakResponse::~SpeakResponse() {} void SpeakResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc index 98d66d9311..7ec4e20fbd 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc @@ -33,25 +33,22 @@ #include "application_manager/commands/mobile/subscribe_button_request.h" - namespace application_manager { namespace commands { namespace str = strings; -SubscribeButtonRequest::SubscribeButtonRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +SubscribeButtonRequest::SubscribeButtonRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} -SubscribeButtonRequest::~SubscribeButtonRequest() { -} +SubscribeButtonRequest::~SubscribeButtonRequest() {} void SubscribeButtonRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); @@ -64,15 +61,16 @@ void SubscribeButtonRequest::Run() { (*message_)[str::msg_params][str::button_name].asUInt()); if (!IsSubscriptionAllowed(app, btn_id)) { - LOG4CXX_ERROR(logger_, "Subscribe on button " << btn_id - << " isn't allowed"); + LOG4CXX_ERROR(logger_, + "Subscribe on button " << btn_id << " isn't allowed"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (!CheckHMICapabilities(btn_id)) { - LOG4CXX_ERROR(logger_, "Subscribe on button " << btn_id - << " isn't allowed by HMI capabilities"); + LOG4CXX_ERROR(logger_, + "Subscribe on button " + << btn_id << " isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } @@ -96,11 +94,10 @@ void SubscribeButtonRequest::Run() { bool SubscribeButtonRequest::IsSubscriptionAllowed( ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) { - if (!app->is_media_application() && ((mobile_apis::ButtonName::SEEKLEFT == btn_id) || - (mobile_apis::ButtonName::SEEKRIGHT == btn_id)|| - (mobile_apis::ButtonName::TUNEUP == btn_id) || + (mobile_apis::ButtonName::SEEKRIGHT == btn_id) || + (mobile_apis::ButtonName::TUNEUP == btn_id) || (mobile_apis::ButtonName::TUNEDOWN == btn_id))) { return false; } @@ -126,8 +123,8 @@ bool SubscribeButtonRequest::CheckHMICapabilities( const size_t length = button_caps.length(); for (size_t i = 0; i < length; ++i) { const SmartObject& caps = button_caps[i]; - const ButtonName::eType name = - static_cast<ButtonName::eType>(caps.getElement(hmi_response::button_name).asInt()); + const ButtonName::eType name = static_cast<ButtonName::eType>( + caps.getElement(hmi_response::button_name).asInt()); if (name == button) { return true; } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc index 390a6811a4..a92e58b19a 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc @@ -39,11 +39,9 @@ namespace commands { SubscribeButtonResponse::SubscribeButtonResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -SubscribeButtonResponse::~SubscribeButtonResponse() { -} +SubscribeButtonResponse::~SubscribeButtonResponse() {} void SubscribeButtonResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index eab1ccbf26..485c5d0009 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -42,53 +42,67 @@ namespace commands { SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + : CommandRequestImpl(message, application_manager) {} -SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() { -} +SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {} #ifdef HMI_DBUS_API namespace { - struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; - }; - Subrequest subrequests[] = { - { hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State, strings::fuel_level_state}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption, strings::instant_fuel_consumption}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature, strings::external_temp}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin}, - { hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure, strings::tire_pressure}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus, strings::belt_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation, strings::body_information}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus, strings::device_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking, strings::driver_braking}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus, strings::wiper_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus, strings::head_lamp_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque, strings::engine_torque}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition, strings::acc_pedal_pos}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle, strings::steering_wheel_angle}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo, strings::e_call_info}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus, strings::airbag_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent, strings::emergency_event}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus, strings::cluster_mode_status}, - { hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key}, - }; +struct Subrequest { + hmi_apis::FunctionID::eType func_id; + const char* str; +}; +Subrequest subrequests[] = { + {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State, + strings::fuel_level_state}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption, + strings::instant_fuel_consumption}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature, + strings::external_temp}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin}, + {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure, + strings::tire_pressure}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus, + strings::belt_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation, + strings::body_information}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus, + strings::device_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking, + strings::driver_braking}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus, + strings::wiper_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus, + strings::head_lamp_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque, + strings::engine_torque}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition, + strings::acc_pedal_pos}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle, + strings::steering_wheel_angle}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo, + strings::e_call_info}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus, + strings::airbag_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent, + strings::emergency_event}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus, + strings::cluster_mode_status}, + {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key}, +}; } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API void SubscribeVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -104,11 +118,11 @@ void SubscribeVehicleDataRequest::Run() { const VehicleData& vehicle_data = MessageHelper::vehicle_data(); VehicleData::const_iterator it = vehicle_data.begin(); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject response_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); for (; vehicle_data.end() != it; ++it) { const std::string& key_name = it->first; @@ -119,9 +133,11 @@ void SubscribeVehicleDataRequest::Run() { VehicleDataType key_type = it->second; if (app->IsSubscribedToIVI(key_type)) { - LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key() - << " is subscribed already for VehicleDataType: " - << key_type); + LOG4CXX_DEBUG(logger_, + "App with connection key " + << connection_key() + << " is subscribed already for VehicleDataType: " + << key_type); ++subscribed_items; vi_already_subscribed_by_this_app_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -131,16 +147,21 @@ void SubscribeVehicleDataRequest::Run() { } if (IsSomeoneSubscribedFor(key_type)) { - LOG4CXX_DEBUG(logger_, "There are apps subscribed already for " - "VehicleDataType: " << key_type); + LOG4CXX_DEBUG(logger_, + "There are apps subscribed already for " + "VehicleDataType: " + << key_type); if (!app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { - LOG4CXX_ERROR(logger_, "Unable to subscribe for VehicleDataType: " - << key_type); + LOG4CXX_ERROR( + logger_, + "Unable to subscribe for VehicleDataType: " << key_type); continue; } - LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key() - << " have been subscribed for VehicleDataType: " - << key_type); + LOG4CXX_DEBUG( + logger_, + "App with connection key " + << connection_key() + << " have been subscribed for VehicleDataType: " << key_type); ++subscribed_items; vi_already_subscribed_by_another_apps_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -152,9 +173,11 @@ void SubscribeVehicleDataRequest::Run() { msg_params[key_name] = is_key_enabled; if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { - LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key() - << " have been subscribed for VehicleDataType: " - << key_type); + LOG4CXX_DEBUG( + logger_, + "App with connection key " + << connection_key() + << " have been subscribed for VehicleDataType: " << key_type); ++subscribed_items; } } @@ -164,14 +187,14 @@ void SubscribeVehicleDataRequest::Run() { bool is_everything_already_subscribed = static_cast<uint32_t>(items_to_subscribe) == vi_already_subscribed_by_another_apps_.size() + - vi_already_subscribed_by_this_app_.size(); + vi_already_subscribed_by_this_app_.size(); if (0 == items_to_subscribe) { if (HasDisallowedParams()) { SendResponse(false, mobile_apis::Result::DISALLOWED); } else { - SendResponse(false, mobile_apis::Result::INVALID_DATA, - "No data in the request"); + SendResponse( + false, mobile_apis::Result::INVALID_DATA, "No data in the request"); } return; } @@ -187,27 +210,23 @@ void SubscribeVehicleDataRequest::Run() { if (is_everything_already_subscribed) { mobile_apis::Result::eType result_code = vi_already_subscribed_by_this_app_.size() - ? mobile_apis::Result::IGNORED - : mobile_apis::Result::SUCCESS; + ? mobile_apis::Result::IGNORED + : mobile_apis::Result::SUCCESS; - const char* info = - vi_already_subscribed_by_this_app_.size() - ? "Already subscribed on some provided VehicleData." - : NULL; + const char* info = vi_already_subscribed_by_this_app_.size() + ? "Already subscribed on some provided VehicleData." + : NULL; - SendResponse(true, - result_code, - info, - &response_params); + SendResponse(true, result_code, info, &response_params); return; } #ifdef HMI_DBUS_API - //Generate list of subrequests + // Generate list of subrequests for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { const Subrequest& sr = subrequests[i]; - if (true == (*message_)[strings::msg_params].keyExists(sr.str) - && true == (*message_)[strings::msg_params][sr.str].asBool()) { + if (true == (*message_)[strings::msg_params].keyExists(sr.str) && + true == (*message_)[strings::msg_params][sr.str].asBool()) { HmiRequest hmi_request; hmi_request.str = sr.str; hmi_request.func_id = sr.func_id; @@ -215,17 +234,19 @@ void SubscribeVehicleDataRequest::Run() { hmi_requests_.push_back(hmi_request); } } - LOG4CXX_DEBUG(logger_, hmi_requests_.size() << - " requests are going to be sent to HMI"); + LOG4CXX_DEBUG( + logger_, hmi_requests_.size() << " requests are going to be sent to HMI"); - //Send subrequests + // Send subrequests for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) + it != hmi_requests_.end(); + ++it) SendHMIRequest(it->func_id, &msg_params, true); #else SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, - &msg_params, true); -#endif // #ifdef HMI_DBUS_API + &msg_params, + true); +#endif // #ifdef HMI_DBUS_API } void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { @@ -239,8 +260,8 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { return; } - ApplicationSharedPtr app = application_manager_.application( - CommandRequestImpl::connection_key()); + ApplicationSharedPtr app = + application_manager_.application(CommandRequestImpl::connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer."); @@ -249,23 +270,24 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { #ifdef HMI_DBUS_API for (HmiRequests::iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { - HmiRequest & hmi_request = *it; + it != hmi_requests_.end(); + ++it) { + HmiRequest& hmi_request = *it; if (hmi_request.func_id == event.id()) { - hmi_request.status = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) hmi_request.value = message[strings::msg_params][hmi_request.str]; hmi_request.complete = true; break; } } - bool all_complete = true; + bool all_complete = true; bool any_arg_success = false; mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS; for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { + it != hmi_requests_.end(); + ++it) { if (!it->complete) { all_complete = false; break; @@ -273,12 +295,14 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { if (hmi_apis::Common_Result::SUCCESS != it->status) { if (mobile_api::Result::SUCCESS == status) { status = static_cast<mobile_apis::Result::eType>(it->status); - } else if (status - != static_cast<mobile_apis::Result::eType>(it->status)) { + } else if (status != + static_cast<mobile_apis::Result::eType>(it->status)) { status = mobile_api::Result::eType::GENERIC_ERROR; } - LOG4CXX_TRACE(logger_, "Status from HMI: " << it->status << - ", so response status become " << status); + LOG4CXX_TRACE(logger_, + "Status from HMI: " << it->status + << ", so response status become " + << status); } else { any_arg_success = true; } @@ -288,7 +312,8 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { smart_objects::SmartObject response_params(smart_objects::SmartType_Map); if (any_arg_success) { for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { + it != hmi_requests_.end(); + ++it) { response_params[it->str] = it->value; } } @@ -306,12 +331,12 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { const bool is_result_no_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_result, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + hmi_result, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); - bool is_succeeded = is_result_no_error || - !vi_already_subscribed_by_another_apps_.empty(); + bool is_succeeded = + is_result_no_error || !vi_already_subscribed_by_another_apps_.empty(); mobile_apis::Result::eType result_code = MessageHelper::HMIToMobileResult(hmi_result); @@ -328,19 +353,17 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { if (!vi_already_subscribed_by_another_apps_.empty() || !vi_already_subscribed_by_this_app_.empty()) { - AddAlreadySubscribedVI(const_cast<smart_objects::SmartObject&>( - message[strings::msg_params])); + AddAlreadySubscribedVI( + const_cast<smart_objects::SmartObject&>(message[strings::msg_params])); } - SendResponse(is_succeeded, - result_code, - return_info, - &(message[strings::msg_params])); + SendResponse( + is_succeeded, result_code, return_info, &(message[strings::msg_params])); if (is_succeeded) { app->UpdateHash(); } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API } void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( @@ -349,7 +372,7 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( using namespace mobile_apis; VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_subscribed_by_this_app_.begin(); - for (;vi_already_subscribed_by_this_app_.end() != it_same_app; + for (; vi_already_subscribed_by_this_app_.end() != it_same_app; ++it_same_app) { msg_params[*it_same_app][strings::result_code] = VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED; @@ -357,7 +380,7 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( VehicleInfoSubscriptions::const_iterator it_another_app = vi_already_subscribed_by_another_apps_.begin(); - for (;vi_already_subscribed_by_another_apps_.end() != it_another_app; + for (; vi_already_subscribed_by_another_apps_.end() != it_another_app; ++it_another_app) { msg_params[*it_another_app][strings::result_code] = VehicleDataResultCode::VDRC_SUCCESS; @@ -374,13 +397,13 @@ void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions( for (; vehicle_data.end() != it; ++it) { if (msg_params.keyExists(it->first)) { if (msg_params[it->first][strings::result_code].asInt() != - hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) { - LOG4CXX_DEBUG(logger_, "Subscription for VehicleDataType " - << it->first - << " is unsuccessfull. " - "Unsubscribing app with connection key " - << connection_key() - << " from it."); + hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) { + LOG4CXX_DEBUG(logger_, + "Subscription for VehicleDataType " + << it->first + << " is unsuccessfull. " + "Unsubscribing app with connection key " + << connection_key() << " from it."); app->UnsubscribeFromIVI(it->second); } } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc index 454c7ad9f6..7ed16407a5 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc @@ -41,11 +41,9 @@ namespace commands { SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() { -} +SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {} void SubscribeVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 9b71b71aaa..e749d4f3db 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 @@ -6,7 +6,7 @@ namespace application_manager { namespace commands { SubscribeWayPointsRequest::SubscribeWayPointsRequest( - const MessageSharedPtr &message, ApplicationManager& application_manager) + const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandRequestImpl(message, application_manager) {} SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} @@ -14,13 +14,12 @@ SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} void SubscribeWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "An application with connection key " - << connection_key() << " is not registered."); + LOG4CXX_ERROR(logger_, + "An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -36,16 +35,14 @@ void SubscribeWayPointsRequest::Run() { return; } - SendHMIRequest(hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, - true); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, true); } -void SubscribeWayPointsRequest::on_event(const event_engine::Event &event) { +void SubscribeWayPointsRequest::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(); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event"); diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc index 51b213444d..c2e642619a 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc @@ -6,12 +6,10 @@ namespace application_manager { namespace commands { SubscribeWayPointsResponse::SubscribeWayPointsResponse( - const MessageSharedPtr &message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SubscribeWayPointsResponse::~SubscribeWayPointsResponse() { -} +SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {} void SubscribeWayPointsResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index 5c1231684e..93eab1ee1e 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -418,9 +418,9 @@ uint32_t SystemRequest::index = 0; const std::string kSYNC = "SYNC"; const std::string kIVSU = "IVSU"; -SystemRequest::SystemRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +SystemRequest::SystemRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} SystemRequest::~SystemRequest() {} @@ -442,8 +442,8 @@ void SystemRequest::Run() { const policy::PolicyHandlerInterface& policy_handler = application_manager_.GetPolicyHandler(); - if (!policy_handler.IsRequestTypeAllowed( - application->policy_app_id(), request_type)) { + if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(), + request_type)) { SendResponse(false, mobile_apis::Result::DISALLOWED); return; } @@ -470,15 +470,18 @@ void SystemRequest::Run() { std::string binary_data_folder; if ((*message_)[strings::params].keyExists(strings::binary_data)) { binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); - binary_data_folder = application_manager_.get_settings().system_files_path(); + binary_data_folder = + application_manager_.get_settings().system_files_path(); } else { - binary_data_folder = application_manager_.get_settings().app_storage_folder(); + binary_data_folder = + application_manager_.get_settings().app_storage_folder(); binary_data_folder += "/"; binary_data_folder += application->folder_name(); binary_data_folder += "/"; } - std::string file_dst_path = application_manager_.get_settings().system_files_path(); + std::string file_dst_path = + application_manager_.get_settings().system_files_path(); file_dst_path += "/"; file_dst_path += file_name; @@ -499,8 +502,7 @@ void SystemRequest::Run() { LOG4CXX_DEBUG(logger_, "Binary data is not present. Trying to find file " - << file_name - << " within previously saved app file in " + << file_name << " within previously saved app file in " << binary_data_folder); const AppFile* file = application->GetFile(app_full_file_path); @@ -579,14 +581,13 @@ void SystemRequest::on_event(const event_engine::Event& event) { GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); - const bool result = - Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); ApplicationSharedPtr application = - application_manager_.application(connection_key()); + application_manager_.application(connection_key()); if (!(application.valid())) { LOG4CXX_ERROR(logger_, "NULL pointer"); diff --git a/src/components/application_manager/src/commands/mobile/system_response.cc b/src/components/application_manager/src/commands/mobile/system_response.cc index 35b4d72ee2..f5bc03f4a5 100644 --- a/src/components/application_manager/src/commands/mobile/system_response.cc +++ b/src/components/application_manager/src/commands/mobile/system_response.cc @@ -33,17 +33,15 @@ #include "application_manager/commands/mobile/system_response.h" - namespace application_manager { namespace commands { -SystemResponse::SystemResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +SystemResponse::SystemResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -SystemResponse::~SystemResponse() { -} +SystemResponse::~SystemResponse() {} void SystemResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc index 3363eb854b..d7056a624e 100644 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc @@ -48,11 +48,13 @@ void UnregisterAppInterfaceRequest::Run() { return; } - application_manager_.ManageMobileCommand(MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - connection_key(), - mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM), commands::Command::ORIGIN_SDL); + application_manager_.ManageMobileCommand( + MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( + connection_key(), + mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM), + commands::Command::ORIGIN_SDL); application_manager_.UnregisterApplication(connection_key(), - mobile_apis::Result::SUCCESS); + mobile_apis::Result::SUCCESS); SendResponse(true, mobile_apis::Result::SUCCESS); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc index 478cc7881f..86df8fabb1 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc @@ -43,17 +43,14 @@ namespace str = strings; UnsubscribeButtonRequest::UnsubscribeButtonRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + : CommandRequestImpl(message, application_manager) {} -UnsubscribeButtonRequest::~UnsubscribeButtonRequest() { -} +UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} void UnsubscribeButtonRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); @@ -64,13 +61,15 @@ void UnsubscribeButtonRequest::Run() { const uint32_t btn_id = (*message_)[str::msg_params][str::button_name].asUInt(); - if (!app->IsSubscribedToButton(static_cast<mobile_apis::ButtonName::eType>(btn_id))) { + if (!app->IsSubscribedToButton( + static_cast<mobile_apis::ButtonName::eType>(btn_id))) { LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } - app->UnsubscribeFromButton(static_cast<mobile_apis::ButtonName::eType>(btn_id)); + app->UnsubscribeFromButton( + static_cast<mobile_apis::ButtonName::eType>(btn_id)); SendUnsubscribeButtonNotification(); const bool is_succedeed = true; diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc index f7999181a1..409579b294 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc @@ -33,18 +33,15 @@ #include "application_manager/commands/mobile/unsubscribe_button_response.h" - namespace application_manager { namespace commands { UnsubscribeButtonResponse::UnsubscribeButtonResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -UnsubscribeButtonResponse::~UnsubscribeButtonResponse() { -} +UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {} void UnsubscribeButtonResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 5e33edc226..4fcc04c7be 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -46,53 +46,68 @@ namespace commands { UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} + : CommandRequestImpl(message, application_manager) {} -UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() { -} +UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {} #ifdef HMI_DBUS_API namespace { - struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; - }; - Subrequest subrequests[] = { - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel, strings::fuel_level}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State, strings::fuel_level_state}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption, strings::instant_fuel_consumption}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature, strings::external_temp}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure, strings::tire_pressure}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus, strings::belt_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation, strings::body_information}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus, strings::device_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking, strings::driver_braking}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus, strings::wiper_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus, strings::head_lamp_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque, strings::engine_torque}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition, strings::acc_pedal_pos}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle, strings::steering_wheel_angle}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo, strings::e_call_info}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus, strings::airbag_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent, strings::emergency_event}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus, strings::cluster_mode_status}, - { hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key}, - }; +struct Subrequest { + hmi_apis::FunctionID::eType func_id; + const char* str; +}; +Subrequest subrequests[] = { + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel, + strings::fuel_level}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State, + strings::fuel_level_state}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption, + strings::instant_fuel_consumption}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature, + strings::external_temp}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure, + strings::tire_pressure}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus, + strings::belt_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation, + strings::body_information}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus, + strings::device_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking, + strings::driver_braking}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus, + strings::wiper_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus, + strings::head_lamp_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque, + strings::engine_torque}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition, + strings::acc_pedal_pos}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle, + strings::steering_wheel_angle}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo, + strings::e_call_info}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus, + strings::airbag_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent, + strings::emergency_event}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus, + strings::cluster_mode_status}, + {hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key}, +}; } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API void UnsubscribeVehicleDataRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application( - connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); @@ -106,11 +121,11 @@ void UnsubscribeVehicleDataRequest::Run() { const VehicleData& vehicle_data = MessageHelper::vehicle_data(); VehicleData::const_iterator it = vehicle_data.begin(); - smart_objects::SmartObject msg_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject response_params = smart_objects::SmartObject( - smart_objects::SmartType_Map); + smart_objects::SmartObject response_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); for (; vehicle_data.end() != it; ++it) { const std::string& key_name = it->first; @@ -130,21 +145,25 @@ void UnsubscribeVehicleDataRequest::Run() { } if (!app->UnsubscribeFromIVI(static_cast<uint32_t>(key_type))) { - LOG4CXX_ERROR(logger_, "Unable to unsubscribe from " - "VehicleDataType: " << key_type); + LOG4CXX_ERROR(logger_, + "Unable to unsubscribe from " + "VehicleDataType: " + << key_type); continue; } - LOG4CXX_DEBUG(logger_, "Unsubscribed app with connection key " - << connection_key() - << " from VehicleDataType: " - << key_type); + LOG4CXX_DEBUG(logger_, + "Unsubscribed app with connection key " + << connection_key() + << " from VehicleDataType: " << key_type); ++unsubscribed_items; if (IsSomeoneSubscribedFor(key_type)) { - LOG4CXX_DEBUG(logger_, "There are another apps still subscribed for " - "VehicleDataType: " << key_type); + LOG4CXX_DEBUG(logger_, + "There are another apps still subscribed for " + "VehicleDataType: " + << key_type); vi_still_subscribed_by_another_apps_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -161,48 +180,46 @@ void UnsubscribeVehicleDataRequest::Run() { bool is_everything_already_unsubscribed = static_cast<uint32_t>(items_to_unsubscribe) == vi_still_subscribed_by_another_apps_.size() + - vi_already_unsubscribed_by_this_app_.size(); + vi_already_unsubscribed_by_this_app_.size(); if (0 == items_to_unsubscribe) { if (HasDisallowedParams()) { SendResponse(false, mobile_apis::Result::DISALLOWED); } else { - SendResponse(false, mobile_apis::Result::INVALID_DATA, - "No data in the request."); + SendResponse( + false, mobile_apis::Result::INVALID_DATA, "No data in the request."); } return; } if (0 == unsubscribed_items) { - SendResponse(false, mobile_apis::Result::IGNORED, - "Was not subscribed on any VehicleData.", &response_params); + SendResponse(false, + mobile_apis::Result::IGNORED, + "Was not subscribed on any VehicleData.", + &response_params); return; } if (is_everything_already_unsubscribed) { mobile_apis::Result::eType result_code = vi_already_unsubscribed_by_this_app_.size() - ? mobile_apis::Result::IGNORED - : mobile_apis::Result::SUCCESS; + ? mobile_apis::Result::IGNORED + : mobile_apis::Result::SUCCESS; - const char* info = - vi_already_unsubscribed_by_this_app_.size() - ? "Already subscribed on some provided VehicleData." - : NULL; + const char* info = vi_already_unsubscribed_by_this_app_.size() + ? "Already subscribed on some provided VehicleData." + : NULL; - SendResponse(true, - result_code, - info, - &response_params); + SendResponse(true, result_code, info, &response_params); return; } #ifdef HMI_DBUS_API - //Generate list of subrequests + // Generate list of subrequests for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { const Subrequest& sr = subrequests[i]; - if (true == (*message_)[strings::msg_params].keyExists(sr.str) - && true == (*message_)[strings::msg_params][sr.str].asBool()) { + if (true == (*message_)[strings::msg_params].keyExists(sr.str) && + true == (*message_)[strings::msg_params][sr.str].asBool()) { HmiRequest hmi_request; hmi_request.str = sr.str; hmi_request.func_id = sr.func_id; @@ -213,14 +230,16 @@ void UnsubscribeVehicleDataRequest::Run() { LOG4CXX_INFO(logger_, hmi_requests_.size() << " requests are going to be sent to HMI"); - //Send subrequests + // Send subrequests for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) + it != hmi_requests_.end(); + ++it) SendHMIRequest(it->func_id, &msg_params, true); #else SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData, - &msg_params, true); -#endif // #ifdef HMI_DBUS_API + &msg_params, + true); +#endif // #ifdef HMI_DBUS_API } void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { @@ -236,12 +255,12 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { #ifdef HMI_DBUS_API for (HmiRequests::iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { - HmiRequest & hmi_request = *it; + it != hmi_requests_.end(); + ++it) { + HmiRequest& hmi_request = *it; if (hmi_request.func_id == event.id()) { - hmi_request.status = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) hmi_request.value = message[strings::msg_params][hmi_request.str]; hmi_request.complete = true; @@ -252,7 +271,8 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { bool any_arg_success = false; mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS; for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { + it != hmi_requests_.end(); + ++it) { if (!it->complete) { all_complete = false; break; @@ -260,20 +280,24 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { if (hmi_apis::Common_Result::SUCCESS != it->status) { if (mobile_api::Result::SUCCESS == status) { status = static_cast<mobile_apis::Result::eType>(it->status); - } else if (status - != static_cast<mobile_apis::Result::eType>(it->status)) { + } else if (status != + static_cast<mobile_apis::Result::eType>(it->status)) { status = mobile_api::Result::eType::GENERIC_ERROR; - } LOG4CXX_TRACE(logger_, "Status from HMI: " << it->status << - ", so response status become " << status); + } + LOG4CXX_TRACE(logger_, + "Status from HMI: " << it->status + << ", so response status become " + << status); } else { any_arg_success = true; } } - if (all_complete) { + if (all_complete) { smart_objects::SmartObject response_params(smart_objects::SmartType_Map); if (any_arg_success) { for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); ++it) { + it != hmi_requests_.end(); + ++it) { response_params[it->str] = it->value; } } @@ -286,17 +310,16 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { if (true == any_arg_success) { UpdateHash(); } - } + } #else hmi_apis::Common_Result::eType hmi_result = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - bool is_succeeded = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_result, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); + bool is_succeeded = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + hmi_result, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); mobile_apis::Result::eType result_code = MessageHelper::HMIToMobileResult(hmi_result); @@ -312,19 +335,19 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { if (!vi_still_subscribed_by_another_apps_.empty() || !vi_already_unsubscribed_by_this_app_.empty()) { - AddAlreadyUnsubscribedVI(const_cast<smart_objects::SmartObject&>( - message[strings::msg_params])); + AddAlreadyUnsubscribedVI( + const_cast<smart_objects::SmartObject&>(message[strings::msg_params])); } if (is_succeeded) { SetAllowedToTerminate(false); } - SendResponse(is_succeeded, result_code, return_info, - &(message[strings::msg_params])); + SendResponse( + is_succeeded, result_code, return_info, &(message[strings::msg_params])); if (is_succeeded) { UpdateHash(); } -#endif // #ifdef HMI_DBUS_API +#endif // #ifdef HMI_DBUS_API } struct SubscribedToIVIPredicate { @@ -352,7 +375,7 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( using namespace mobile_apis; VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_unsubscribed_by_this_app_.begin(); - for (;vi_already_unsubscribed_by_this_app_.end() != it_same_app; + for (; vi_already_unsubscribed_by_this_app_.end() != it_same_app; ++it_same_app) { response[*it_same_app][strings::result_code] = VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED; @@ -360,7 +383,7 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( VehicleInfoSubscriptions::const_iterator it_another_app = vi_still_subscribed_by_another_apps_.begin(); - for (;vi_still_subscribed_by_another_apps_.end() != it_another_app; + for (; vi_still_subscribed_by_another_apps_.end() != it_another_app; ++it_another_app) { response[*it_another_app][strings::result_code] = VehicleDataResultCode::VDRC_SUCCESS; @@ -374,13 +397,12 @@ void UnsubscribeVehicleDataRequest::UpdateHash() const { if (application) { application->UpdateHash(); } else { - LOG4CXX_ERROR(logger_, "Application with connection_key = " - << connection_key() <<" doesn't exist."); + LOG4CXX_ERROR(logger_, + "Application with connection_key = " << connection_key() + << " doesn't exist."); } - application_manager_.TerminateRequest(connection_key(), - correlation_id()); + application_manager_.TerminateRequest(connection_key(), correlation_id()); } - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc index 843a53682e..e06158e4eb 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc @@ -38,11 +38,9 @@ namespace commands { UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} + : CommandResponseImpl(message, application_manager) {} -UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() { -} +UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {} void UnsubscribeVehicleDataResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); 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 215d6dadc2..3a0363845d 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 @@ -6,7 +6,7 @@ namespace application_manager { namespace commands { UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest( - const MessageSharedPtr &message, ApplicationManager& application_manager) + const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandRequestImpl(message, application_manager) {} UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {} @@ -14,12 +14,12 @@ UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {} void UnSubscribeWayPointsRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "An application with connection key " - << connection_key() << " is not registered."); + LOG4CXX_ERROR(logger_, + "An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -29,15 +29,14 @@ void UnSubscribeWayPointsRequest::Run() { return; } - SendHMIRequest(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, - true); + SendHMIRequest( + hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); } -void UnSubscribeWayPointsRequest::on_event(const event_engine::Event &event) { +void UnSubscribeWayPointsRequest::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(); + ApplicationSharedPtr app = application_manager_.application(connection_key()); + const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event"); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc index 0e57fe410a..f6430d1f0d 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc @@ -6,7 +6,7 @@ namespace application_manager { namespace commands { UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( - const MessageSharedPtr &message, ApplicationManager& application_manager) + const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandResponseImpl(message, application_manager) {} UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {} 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 02c9e479b7..9b3b221446 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 @@ -47,9 +47,9 @@ namespace commands { namespace custom_str = utils::custom_string; -UpdateTurnListRequest::UpdateTurnListRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { -} +UpdateTurnListRequest::UpdateTurnListRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} UpdateTurnListRequest::~UpdateTurnListRequest() {} @@ -75,8 +75,10 @@ void UpdateTurnListRequest::Run() { // ProcessSoftButtons checks strings on the contents incorrect character mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app, - application_manager_.GetPolicyHandler(), application_manager_); + MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], + app, + application_manager_.GetPolicyHandler(), + application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { LOG4CXX_ERROR(logger_, "INVALID_DATA!"); @@ -91,7 +93,8 @@ void UpdateTurnListRequest::Run() { if ((turn_list_array[i].keyExists(strings::turn_icon)) && (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon], - app, application_manager_))) { + app, + application_manager_))) { LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -221,7 +224,6 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { return true; } } - } } return false; diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc index 005e0ad261..d40a4546fc 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc @@ -39,12 +39,11 @@ namespace application_manager { namespace commands { -UpdateTurnListResponse::UpdateTurnListResponse(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) { -} +UpdateTurnListResponse::UpdateTurnListResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} -UpdateTurnListResponse::~UpdateTurnListResponse() { -} +UpdateTurnListResponse::~UpdateTurnListResponse() {} void UpdateTurnListResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); |