Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info: add legacy uid (uid1) #1427

Merged
merged 2 commits into from
May 5, 2021
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
2 changes: 1 addition & 1 deletion proto
Submodule proto updated 1 files
+1 −0 protos/info/info.proto
102 changes: 66 additions & 36 deletions src/mavsdk_server/src/generated/info/info.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/mavsdk_server/src/generated/info/info.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/mavsdk_server/src/plugins/info/info_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class InfoServiceImpl final : public rpc::info::InfoService::Service {

rpc_obj->set_hardware_uid(identification.hardware_uid);

rpc_obj->set_legacy_uid(identification.legacy_uid);

return rpc_obj;
}

Expand All @@ -77,6 +79,8 @@ class InfoServiceImpl final : public rpc::info::InfoService::Service {

obj.hardware_uid = identification.hardware_uid();

obj.legacy_uid = identification.legacy_uid();

return obj;
}

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/info/include/plugins/info/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class Info : public PluginBase {
std::string
hardware_uid{}; /**< @brief UID of the hardware. This refers to uid2 of MAVLink. If the
system does not support uid2 yet, this is all zeros. */
uint64_t legacy_uid{}; /**< @brief Legacy UID of the hardware, referred to as uid in MAVLink
(formerly exposed during system discovery as UUID). */
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/info/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ std::ostream& operator<<(std::ostream& str, Info::FlightInfo const& flight_info)

bool operator==(const Info::Identification& lhs, const Info::Identification& rhs)
{
return (rhs.hardware_uid == lhs.hardware_uid);
return (rhs.hardware_uid == lhs.hardware_uid) && (rhs.legacy_uid == lhs.legacy_uid);
}

std::ostream& operator<<(std::ostream& str, Info::Identification const& identification)
{
str << std::setprecision(15);
str << "identification:" << '\n' << "{\n";
str << " hardware_uid: " << identification.hardware_uid << '\n';
str << " legacy_uid: " << identification.legacy_uid << '\n';
str << '}';
return str;
}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/info/info_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void InfoImpl::process_autopilot_version(const mavlink_message_t& message)
_identification.hardware_uid =
translate_binary_to_str(autopilot_version.uid2, sizeof(autopilot_version.uid2));

_identification.legacy_uid = autopilot_version.uid;

_information_received = true;
}

Expand Down