Skip to content

Commit 356cca1

Browse files
committed
Print name of the incompatible entity instead of guid
Signed-off-by: Raul Sanchez-Mateos <raul@eprosima.com>
1 parent 9ae7e37 commit 356cca1

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

include/fastdds_monitor/backend/SyncBackendConnection.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ class SyncBackendConnection
116116
EntityKind get_type(
117117
backend::EntityId id);
118118

119+
//! Get entity by GUID in string format
120+
backend::EntityId get_entity_by_guid(
121+
const std::string& guid);
122+
119123
//! Get a summary of important data collected from the backend related with the entity with id \c id
120124
EntityInfo get_summary(
121125
backend::EntityId id);
@@ -211,6 +215,10 @@ class SyncBackendConnection
211215
std::string get_deserialized_guid(
212216
const backend::GUID_s& data);
213217

218+
//! Convert a given entity guid in string format to GUID_s
219+
backend::GUID_s get_serialize_guid(
220+
const std::string& guid_str);
221+
214222
//! Get info from an entity from the Backend
215223
std::vector<EntityId> get_entities(
216224
EntityKind entity_type,

src/Engine.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,23 @@ bool Engine::update_entity_status(
11931193
backend::policy_documentation_description(policy_id) +
11941194
std::string("\">here</a></html>"),
11951195
"", true);
1196+
std::string remote_entity;
1197+
backend::EntityId remote_entity_id = backend_connection_.get_entity_by_guid(remote_entity_guid);
1198+
if (remote_entity_id.is_valid())
1199+
{
1200+
EntityInfo entity_info = backend_connection_.get_info(remote_entity_id);
1201+
std::string remote_entity_kind = utils::to_string(
1202+
backend::entity_kind_to_QString(backend_connection_.get_type(remote_entity_id)));
1203+
std::stringstream ss;
1204+
ss << std::string(entity_info["alias"]) << " (" << remote_entity_kind << ")";
1205+
remote_entity = ss.str();
1206+
}
1207+
else
1208+
{
1209+
remote_entity = remote_entity_guid;
1210+
}
11961211
auto remote_entity_item = new models::StatusTreeItem(id, kind,
1197-
std::string("Remote entity: " + remote_entity_guid),
1212+
std::string("Remote entity: " + remote_entity),
11981213
sample.status, std::string(""), std::string(
11991214
""), remote_entity_guid, false);
12001215
entity_status_model_->addItem(incompatible_qos_item, policy_item);

src/backend/SyncBackendConnection.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,22 @@ EntityKind SyncBackendConnection::get_type(
555555
}
556556
}
557557

558+
backend::EntityId SyncBackendConnection::get_entity_by_guid(
559+
const std::string& guid)
560+
{
561+
try
562+
{
563+
return StatisticsBackend::get_entity_by_guid(guid);
564+
}
565+
catch (const Exception& e)
566+
{
567+
qWarning() << "Fail getting entity by guid " << e.what();
568+
static_cast<void>(e); // In release qWarning does not compile and so e is not used
569+
570+
return EntityId::invalid();
571+
}
572+
}
573+
558574
std::vector<EntityId> SyncBackendConnection::get_entities(
559575
EntityKind entity_type,
560576
EntityId entity_id)
@@ -940,6 +956,20 @@ std::string SyncBackendConnection::get_deserialized_guid(
940956
return StatisticsBackend::deserialize_guid(data);
941957
}
942958

959+
backend::GUID_s SyncBackendConnection::get_serialize_guid(
960+
const std::string& guid_str)
961+
{
962+
try
963+
{
964+
return StatisticsBackend::serialize_guid(guid_str);
965+
}
966+
catch(const std::exception& e)
967+
{
968+
qWarning() << "Error generating GUID from string " << e.what();
969+
}
970+
return backend::GUID_s();
971+
}
972+
943973
bool SyncBackendConnection::build_source_target_entities_vectors(
944974
DataKind data_kind,
945975
EntityId source_entity_id,

0 commit comments

Comments
 (0)