diff options
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/send_location_request.cc')
-rw-r--r-- | src/components/application_manager/src/commands/mobile/send_location_request.cc | 44 |
1 files changed, 24 insertions, 20 deletions
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 975f7e43c3..e57f0e9605 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 @@ -51,14 +51,14 @@ SendLocationRequest::~SendLocationRequest() {} void SendLocationRequest::Run() { using namespace hmi_apis; using smart_objects::SmartObject; - LOG4CXX_AUTO_TRACE(logger_); + LOGGER_AUTO_TRACE(logger_); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + LOGGER_ERROR(logger_, + "An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -94,7 +94,7 @@ void SendLocationRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Strings contain invalid characters"); + LOGGER_ERROR(logger_, "Strings contain invalid characters"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -108,7 +108,7 @@ void SendLocationRequest::Run() { } if (!CheckFieldsCompatibility()) { - LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed"); + LOGGER_ERROR(logger_, "CheckFieldsCompatibility failed"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -121,7 +121,7 @@ void SendLocationRequest::Run() { app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); + LOGGER_ERROR(logger_, "VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -130,17 +130,18 @@ void SendLocationRequest::Run() { 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); } void SendLocationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + LOGGER_AUTO_TRACE(logger_); namespace Result = mobile_apis::Result; using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) { - LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event"); + LOGGER_INFO(logger_, "Received Navigation_SendLocation event"); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -153,7 +154,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) { SendResponse(result, result_code, NULL, &(message[strings::params])); return; } - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + LOGGER_ERROR(logger_, "Received unknown event" << event.id()); } bool SendLocationRequest::CheckFieldsCompatibility() { @@ -167,16 +168,16 @@ 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"); + LOGGER_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"); + LOGGER_DEBUG(logger_, + "address or latitude/longtitude should should be provided"); return false; } + return true; } void insert_if_contains( @@ -189,7 +190,7 @@ void insert_if_contains( } bool SendLocationRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + LOGGER_AUTO_TRACE(logger_); std::vector<utils::custom_string::CustomString> fields_to_check; const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -227,18 +228,21 @@ bool SendLocationRequest::IsWhiteSpaceExist() { for (; it != fields_to_check.end(); ++it) { const std::string& str = it->AsMBString(); if (!CheckSyntax(str, false)) { - LOG4CXX_ERROR(logger_, - "string '" << str << "'' contains invalid characters"); + LOGGER_ERROR(logger_, + "string '" << str << "'' contains invalid characters"); return true; } } + return false; } bool SendLocationRequest::CheckHMICapabilities( std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names) { + LOGGER_AUTO_TRACE(logger_); using namespace smart_objects; using namespace hmi_apis; + if (fields_names.empty()) { return true; } @@ -246,7 +250,7 @@ bool SendLocationRequest::CheckHMICapabilities( const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); if (!hmi_capabilities.is_ui_cooperating()) { - LOG4CXX_ERROR(logger_, "UI is not supported."); + LOGGER_ERROR(logger_, "UI is not supported."); return false; } @@ -269,7 +273,7 @@ bool SendLocationRequest::CheckHMICapabilities( } if (!fields_names.empty()) { - LOG4CXX_ERROR(logger_, "Some fields are not supported by capabilities"); + LOGGER_ERROR(logger_, "Some fields are not supported by capabilities"); return false; } return true; |