Skip to content

Commit

Permalink
Add app_id and app_metadata attributes (#72)
Browse files Browse the repository at this point in the history
* Add app_id and app_metadata to discovery properties

Signed-off-by: Jesus Perez <[email protected]>

* Set default app data values

Signed-off-by: Jesus Perez <[email protected]>

* Uncrustify

Signed-off-by: Jesus Perez <[email protected]>

* Default participant config test

Signed-off-by: Jesus Perez <[email protected]>

* Uncrustify

Signed-off-by: Jesus Perez <[email protected]>

---------

Signed-off-by: Jesus Perez <[email protected]>
  • Loading branch information
jepemi authored Nov 16, 2023
1 parent 6fa64b8 commit 621ad13
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ struct ParticipantConfiguration : public core::IConfiguration
//! Participant Id associated with this configuration.
core::types::ParticipantId id {};

//! Participant app properties.
std::string app_id = "UNKNOWN_APP";
std::string app_metadata = "";

//! Whether this Participant should connect its readers with its writers.
bool is_repeater {false};

Expand Down
10 changes: 10 additions & 0 deletions ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_()
"fastdds.ignore_local_endpoints",
"true");

// Set app properties
qos.properties().properties().emplace_back(
"fastdds.application.id",
configuration_->app_id,
"true");
qos.properties().properties().emplace_back(
"fastdds.application.metadata",
configuration_->app_metadata,
"true");

return qos;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ void DynTypesParticipant::initialize_internal_dds_participant_()
eprosima::fastdds::dds::DomainParticipantQos pqos;
pqos.name(this->id());

// Set app properties
pqos.properties().properties().emplace_back(
"fastdds.application.id",
configuration->app_id,
"true");
pqos.properties().properties().emplace_back(
"fastdds.application.metadata",
configuration->app_metadata,
"true");

// Set Type LookUp to ON
pqos.wire_protocol().builtin.typelookup_config.use_server = false;
pqos.wire_protocol().builtin.typelookup_config.use_client = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,16 @@ CommonParticipant::reckon_participant_attributes_(
"fastdds.ignore_local_endpoints",
"true");

// Set app properties
params.properties.properties().emplace_back(
"fastdds.application.id",
participant_configuration->app_id,
"true");
params.properties.properties().emplace_back(
"fastdds.application.metadata",
participant_configuration->app_metadata,
"true");

return params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set(TEST_SOURCES
)

set(TEST_LIST
default_configuration
creation_trivial
ddspipe_all_creation_builtin_topic
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <ddspipe_participants/participant/auxiliar/EchoParticipant.hpp>
#include <ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp>
#include <ddspipe_participants/participant/rtps/SimpleParticipant.hpp>
#include <ddspipe_participants/participant/rtps/CommonParticipant.hpp>
#include <ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp>
#include <ddspipe_participants/participant/dds/XmlParticipant.hpp>
#include <ddspipe_participants/testing/entities/mock_entities.hpp>
Expand All @@ -39,6 +40,21 @@ constexpr const unsigned int N_THREADS = 2;

} // test

/**
* Test to check default participant configuration values.
*/
TEST(ParticipantsCreationgTest, default_configuration)
{
// Common configuration
{
participants::ParticipantConfiguration conf;
EXPECT_EQ(conf.app_id, "UNKNOWN_APP");
EXPECT_EQ(conf.app_metadata, "");
EXPECT_TRUE(conf.id.empty());
EXPECT_FALSE(conf.is_repeater);
}
}

/**
* Test to create a participant of each kind and check it does not fail.
*
Expand Down

0 comments on commit 621ad13

Please sign in to comment.