Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/src/mavsdk/core/cli_arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ bool CliArg::parse_serial(const std::string_view rest, bool flow_control_enabled
return false;
}
} else {
LogErr("serial port needs to start with / or COM on Windows");
LogErr("Serial port needs to start with / or COM on Windows");
return false;
}

Expand Down Expand Up @@ -305,7 +305,7 @@ bool CliArg::parse_raw(const std::string_view rest)
{
// raw:// connection has no parameters
if (!rest.empty()) {
LogErr("raw:// connection should not have parameters");
LogErr("A raw:// connection should not have parameters");
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/mavsdk/core/hostname_to_ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ std::optional<std::string> resolve_hostname_to_ip(const std::string& hostname)
int res = getaddrinfo(hostname.c_str(), nullptr, &hints, &result);
if (res != 0) {
#if defined(WINDOWS)
LogErr("getaddrinfo failed: {}", WSAGetLastError());
LogErr("Call getaddrinfo failed: {}", WSAGetLastError());
WSACleanup();
#else
LogErr("getaddrinfo failed: {}", gai_strerror(res));
LogErr("Call getaddrinfo failed: {}", gai_strerror(res));
#endif
return {};
}
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/mavsdk/core/mavlink_command_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void MavlinkCommandSender::receive_command_ack(const mavlink_message_t& message)

case MAV_RESULT_DENIED:
if (_command_debugging) {
LogDebug("command denied ({}).", work->identification.command);
LogDebug("Command denied ({}).", work->identification.command);
if (work->identification.command == 512) {
LogDebug("(message {})", work->identification.maybe_param1);
}
Expand All @@ -239,7 +239,7 @@ void MavlinkCommandSender::receive_command_ack(const mavlink_message_t& message)

case MAV_RESULT_UNSUPPORTED:
if (_command_debugging) {
LogDebug("command unsupported ({}).", work->identification.command);
LogDebug("Command unsupported ({}).", work->identification.command);
}
_system_impl.unregister_timeout_handler(work->timeout_cookie);
temp_result = {Result::Unsupported, NAN};
Expand All @@ -248,7 +248,7 @@ void MavlinkCommandSender::receive_command_ack(const mavlink_message_t& message)

case MAV_RESULT_TEMPORARILY_REJECTED:
if (_command_debugging) {
LogDebug("command temporarily rejected ({}).", work->identification.command);
LogDebug("Command temporarily rejected ({}).", work->identification.command);
}
_system_impl.unregister_timeout_handler(work->timeout_cookie);
temp_result = {Result::TemporarilyRejected, NAN};
Expand All @@ -257,7 +257,7 @@ void MavlinkCommandSender::receive_command_ack(const mavlink_message_t& message)

case MAV_RESULT_FAILED:
if (_command_debugging) {
LogDebug("command failed ({}).", work->identification.command);
LogDebug("Command failed ({}).", work->identification.command);
}
_system_impl.unregister_timeout_handler(work->timeout_cookie);
temp_result = {Result::Failed, NAN};
Expand Down Expand Up @@ -289,7 +289,7 @@ void MavlinkCommandSender::receive_command_ack(const mavlink_message_t& message)

case MAV_RESULT_CANCELLED:
if (_command_debugging) {
LogDebug("command cancelled ({}).", work->identification.command);
LogDebug("Command cancelled ({}).", work->identification.command);
}
_system_impl.unregister_timeout_handler(work->timeout_cookie);
temp_result = {Result::Cancelled, NAN};
Expand Down Expand Up @@ -360,7 +360,7 @@ void MavlinkCommandSender::receive_timeout(const CommandIdentification& identifi
}

if (!send_mavlink_message(work->command)) {
LogErr("connection send error in retransmit ({}).", work->identification.command);
LogErr("Connection send error in retransmit ({}).", work->identification.command);
temp_callback = work->callback;
temp_result = {Result::ConnectionError, NAN};
_work_queue.erase(it);
Expand Down Expand Up @@ -455,7 +455,7 @@ void MavlinkCommandSender::do_work()

{
if (!send_mavlink_message(work->command)) {
LogErr("connection send error ({})", work->identification.command);
LogErr("Connection send error ({})", work->identification.command);
// In this case we try again after the timeout. Chances are slim it will work next
// time though.
} else {
Expand Down
16 changes: 8 additions & 8 deletions cpp/src/mavsdk/core/mavlink_component_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ MavlinkComponentMetadata::~MavlinkComponentMetadata()
std::error_code ec;
std::filesystem::remove_all(_tmp_download_path, ec);
if (ec) {
LogErr("failed to remove directory: {}", ec.message());
LogErr("Failed to remove directory: {}", ec.message());
}
}

Expand Down Expand Up @@ -439,34 +439,34 @@ void MavlinkComponentMetadata::parse_component_metadata_general(
}

if (!metadata.contains("version") || !metadata["version"].is_number_integer()) {
LogErr("version not found");
LogErr("Version not found");
return;
}

if (metadata["version"].get<int>() != 1) {
LogWarn("version {} not supported", metadata["version"].get<int>());
LogWarn("Version {} not supported", metadata["version"].get<int>());
return;
}

if (!metadata.contains("metadataTypes") || !metadata["metadataTypes"].is_array()) {
LogErr("metadataTypes not found");
LogErr("Field metadataTypes not found");
return;
}

for (const auto& metadata_type : metadata["metadataTypes"]) {
if (!metadata_type.is_object() || !metadata_type.contains("type") ||
!metadata_type["type"].is_number_integer()) {
LogErr("type missing");
LogErr("Type missing");
continue;
}
auto type = static_cast<COMP_METADATA_TYPE>(metadata_type["type"].get<int>());
auto& components = _mavlink_components[compid].components;
if (components.find(type) != components.end()) {
LogErr("component type already added: {}", static_cast<int>(type));
LogErr("Component type already added: {}", static_cast<int>(type));
continue;
}
if (!metadata_type.contains("uri")) {
LogErr("uri missing");
LogErr("URI missing");
continue;
}

Expand Down Expand Up @@ -625,7 +625,7 @@ std::optional<std::filesystem::path>& MetadataComponent::current_metadata_path()
case State::Init:
break;
}
LogErr("current_metadata_path() called in invalid state");
LogErr("Function current_metadata_path() called in invalid state");
return _metadata;
}
} // namespace mavsdk
2 changes: 1 addition & 1 deletion cpp/src/mavsdk/core/mavlink_ftp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ bool MavlinkFtpClient::list_dir_continue(Work& work, ListDirItem& item, PayloadH
++item.offset;

if (_debugging) {
LogDebug("list_dir raw entry: '{}'", entry);
LogDebug("Raw entry from list_dir: '{}'", entry);
}

if (entry.empty()) {
Expand Down
7 changes: 4 additions & 3 deletions cpp/src/mavsdk/core/mavlink_ftp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ void MavlinkFtpServer::_work_remove_directory(const PayloadHeader& payload)
return;
}
if (ec) {
LogErr("fs::exists for {} returned error: {}", path.string(), ec.message());
LogErr("Call fs::exists for {} returned error: {}", path.string(), ec.message());
response.opcode = Opcode::RSP_NAK;
response.size = 1;
response.data[0] = ServerResult::ERR_FAIL;
Expand All @@ -1054,7 +1054,7 @@ void MavlinkFtpServer::_work_remove_directory(const PayloadHeader& payload)
}

if (!fs::remove(path, ec)) {
LogErr("fs::remove returned error: {}", ec.message());
LogErr("Call fs::remove returned error: {}", ec.message());
response.opcode = Opcode::RSP_NAK;
response.size = 1;
response.data[0] = ServerResult::ERR_FAIL;
Expand Down Expand Up @@ -1192,7 +1192,8 @@ void MavlinkFtpServer::_work_rename(const PayloadHeader& payload)

fs::rename(old_name, new_name, ec);
if (ec) {
LogErr("fs::rename from {} to {} returned error: {}", old_name, new_name, ec.message());
LogErr(
"Call fs::rename from {} to {} returned error: {}", old_name, new_name, ec.message());
response.opcode = Opcode::RSP_NAK;
response.size = 1;
response.data[0] = ServerResult::ERR_FAIL;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/mavsdk/core/mavlink_mission_transfer_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,13 @@ void MavlinkMissionTransferClient::UploadWorkItem::process_mission_request_int(
if (_next_sequence < request_int.seq) {
// We should not go back to a previous one.
// TODO: figure out if we should error here.
LogWarn("mission_request_int: sequence incorrect");
LogWarn("In mission_request_int: sequence incorrect");
return;

} else if (_next_sequence > request_int.seq) {
// We have already sent that one before.
if (_retries_done >= retries) {
LogWarn("mission_request_int: retries exceeded");
LogWarn("In mission_request_int: retries exceeded");
_timeout_handler.remove(_cookie);
callback_and_reset(Result::Timeout);
return;
Expand All @@ -447,7 +447,7 @@ void MavlinkMissionTransferClient::UploadWorkItem::process_mission_request_int(
void MavlinkMissionTransferClient::UploadWorkItem::send_mission_item()
{
if (_next_sequence >= _items.size()) {
LogErr("send_mission_item: sequence out of bounds");
LogErr("In send_mission_item: sequence out of bounds");
return;
}

Expand Down Expand Up @@ -561,7 +561,7 @@ void MavlinkMissionTransferClient::UploadWorkItem::process_timeout()
}

if (_retries_done >= retries) {
LogWarn("timeout: retries exceeded");
LogWarn("Timeout: retries exceeded");
callback_and_reset(Result::Timeout);
return;
}
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/mavsdk/core/mavlink_mission_transfer_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,13 @@ void MavlinkMissionTransferServer::SendOutgoingMission::process_mission_request_
if (_next_sequence < request_int.seq) {
// We should not go back to a previous one.
// TODO: figure out if we should error here.
LogWarn("mission_request_int: sequence incorrect");
LogWarn("In mission_request_int: sequence incorrect");
return;

} else if (_next_sequence > request_int.seq) {
// We have already sent that one before.
if (_retries_done >= retries) {
LogWarn("mission_request_int: retries exceeded");
LogWarn("In mission_request_int: retries exceeded");
_timeout_handler.remove(_cookie);
callback_and_reset(Result::Timeout);
return;
Expand All @@ -528,7 +528,7 @@ void MavlinkMissionTransferServer::SendOutgoingMission::process_mission_request_
void MavlinkMissionTransferServer::SendOutgoingMission::send_mission_item()
{
if (_next_sequence >= _items.size()) {
LogErr("send_mission_item: sequence out of bounds");
LogErr("In send_mission_item: sequence out of bounds");
return;
}

Expand Down Expand Up @@ -641,7 +641,7 @@ void MavlinkMissionTransferServer::SendOutgoingMission::process_timeout()
}

if (_retries_done >= retries) {
LogWarn("timeout: retries exceeded");
LogWarn("Timeout: retries exceeded");
callback_and_reset(Result::Timeout);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/mavsdk/core/mavlink_parameter_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ MavlinkParameterCache::param_by_index(uint16_t param_index, bool including_exten
{
const auto& params = all_parameters(including_extended);
if (param_index >= params.size()) {
LogErr("param at {} out of bounds ({})", (int)param_index, params.size());
LogErr("Param at {} out of bounds ({})", (int)param_index, params.size());
return {};
}

Expand Down
18 changes: 9 additions & 9 deletions cpp/src/mavsdk/core/mavlink_parameter_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void MavlinkParameterClient::process_param_value(const mavlink_message_t& messag
item.param_name);

if (!send_set_param_message(item)) {
LogErr("connection send error in retransmit ({}).", item.param_name);
LogErr("Connection send error in retransmit ({}).", item.param_name);
_work_queue.pop_front();
if (!_work_queue.empty()) {
asio::post(_io_context, [this] { do_work(); });
Expand Down Expand Up @@ -965,7 +965,7 @@ void MavlinkParameterClient::process_param_ext_value(const mavlink_message_t& me
}

if (_parameter_debugging) {
LogDebug("process param_ext_value: {} {}", safe_param_id, received_value.get_string());
LogDebug("Process param_ext_value: {} {}", safe_param_id, received_value.get_string());
}

if (_work_queue.empty()) {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ void MavlinkParameterClient::process_param_ext_ack(const mavlink_message_t& mess
const auto safe_param_id = extract_safe_param_id(param_ext_ack.param_id);

if (_parameter_debugging) {
LogDebug("process param_ext_ack: {} {}", safe_param_id, (int)param_ext_ack.param_result);
LogDebug("Process param_ext_ack: {} {}", safe_param_id, (int)param_ext_ack.param_result);
}

if (_work_queue.empty()) {
Expand Down Expand Up @@ -1141,7 +1141,7 @@ void MavlinkParameterClient::process_param_error(const mavlink_message_t& messag
const auto safe_param_id = extract_safe_param_id(param_error.param_id);

if (_parameter_debugging) {
LogDebug("process param_error: {} error code: {}", safe_param_id, (int)param_error.error);
LogDebug("Process param_error: {} error code: {}", safe_param_id, (int)param_error.error);
}

if (_work_queue.empty()) {
Expand Down Expand Up @@ -1241,7 +1241,7 @@ void MavlinkParameterClient::receive_timeout()
item.param_name);

if (!send_set_param_message(item)) {
LogErr("connection send error in retransmit ({}).", item.param_name);
LogErr("Connection send error in retransmit ({}).", item.param_name);
_work_queue.pop_front();
if (!_work_queue.empty()) {
asio::post(_io_context, [this] { do_work(); });
Expand Down Expand Up @@ -1269,9 +1269,9 @@ void MavlinkParameterClient::receive_timeout()
[&](WorkItemGet& item) {
if (work->retries_to_do > 0) {
// We're not sure the command arrived, let's retransmit.
LogWarn("sending again, retries to do: {}", work->retries_to_do);
LogWarn("Sending again, retries to do: {}", work->retries_to_do);
if (!send_get_param_message(item)) {
LogErr("connection send error in retransmit ");
LogErr("Connection send error in retransmit ");
_work_queue.pop_front();
if (!_work_queue.empty()) {
asio::post(_io_context, [this] { do_work(); });
Expand All @@ -1286,7 +1286,7 @@ void MavlinkParameterClient::receive_timeout()
}
} else {
// We have tried retransmitting, giving up now.
LogErr("retrying failed");
LogErr("Retrying failed");
_work_queue.pop_front();
if (!_work_queue.empty()) {
asio::post(_io_context, [this] { do_work(); });
Expand Down Expand Up @@ -1372,7 +1372,7 @@ bool MavlinkParameterClient::request_next_missing(uint16_t count)

auto next_missing_indices = _param_cache.next_missing_indices(count, chunk_size);
if (next_missing_indices.empty()) {
LogErr("logic error, there should a missing index");
LogErr("Logic error, there should a missing index");
return false;
}

Expand Down
Loading
Loading