Skip to content

Commit ea083bb

Browse files
author
jparisu
committed
Refs #11770: Databroker implementation
Signed-off-by: jparisu <javierparis@eprosima.com>
1 parent 4db8a45 commit ea083bb

4 files changed

Lines changed: 57 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ option(IS_FASTDDS_SH_USING_FASTDDS_EXTERNALPROJECT
3333

3434
option(BUILD_LIBRARY "Compile the Fast DDS SystemHandle" ON)
3535

36+
###################################################################################
37+
# Set Aliases for FastDDS SH
38+
###################################################################################
39+
set (ALIASES "databroker")
40+
3641
###################################################################################
3742
# Load external CMake Modules.
3843
###################################################################################
@@ -224,6 +229,8 @@ if(BUILD_LIBRARY)
224229
fastdds
225230
TARGET
226231
is-fastdds
232+
ALIAS
233+
${ALIASES}
227234
)
228235
endif()
229236

src/Participant.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,11 @@ void Participant::build_participant(
7575
// Check if domain_id exists in config
7676
eprosima::fastdds::dds::DomainId_t domain_id(0);
7777

78-
// Check if domain_id tag is under other tag
78+
// Check if domain_id tag is present inconfiguration, if not 0 as default
7979
if (config["domain_id"])
8080
{
8181
domain_id = config["domain_id"].as<uint32_t>();
8282
}
83-
else if (config["participant"] && config["participant"]["domain_id"])
84-
{
85-
domain_id = config["participant"]["domain_id"].as<uint32_t>();
86-
}
87-
else if (config["databroker"] && config["databroker"]["domain_id"])
88-
{
89-
domain_id = config["databroker"]["domain_id"].as<uint32_t>();
90-
}
9183

9284
logger_ << utils::Logger::Level::DEBUG << "Creating new fastdds Participant in domain " << domain_id << std::endl;
9385

src/Participant.hpp

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Participant
6969
* in the *YAML* configuration file.
7070
*
7171
* @param[in] config The configuration provided by the user.
72-
* It must contain two keys in the *YAML* map:
72+
* In case of fastdds type it can contain two keys in the *YAML* map:
7373
*
7474
* - `file_path`: Specifies the path to the XML profile that will be used to configure the
7575
* *DomainParticipant*. More information on how to write these XML profiles can be found
@@ -80,6 +80,19 @@ class Participant
8080
* that corresponds to the configuration profile that we want this Participant
8181
* to be configured with.
8282
*
83+
* In case of databroker type it can contain three keys in the *YAML* map:
84+
*
85+
* - `server_id`: Specifies the Discovery Server id in order to generate a GUID to it.
86+
*
87+
* - `listening_addresses`: Specifies a list of TCP listening addresses.
88+
* - `ip`: Public IP where the Server will be listening.
89+
* - `port`: Port where the Server will be listening.
90+
*
91+
* - `connection_addresses`: Specifies a list of TCP connection addresses.
92+
* - `ip`: Public IP to the Server to connect with.
93+
* - `port`: Port to the Server to connect with.
94+
* - `server_id`: Id of the remote server to connect.
95+
*
8396
* @throws DDSMiddlewareException If the XML profile was incorrect and, thus, the
8497
* *DomainParticipant* could not be created.
8598
*/
@@ -94,7 +107,7 @@ class Participant
94107
/**
95108
* @brief Construct a *Fast DDS DomainParticipant*, given its DDS domain ID.
96109
*
97-
* @param[in] domain_id The DDS domain ID for this participant.
110+
* @param[in] config The configuration provided by the user.
98111
*
99112
* @throws DDSMiddlewareException If the *DomainParticipant* could not be created.
100113
*/
@@ -199,16 +212,41 @@ class Participant
199212

200213
protected:
201214

202-
//! Get Participant QoS using config file
215+
/**
216+
* @brief Get Participant QoS using config file.
217+
*
218+
* Set all default values to QoS and then use specific FastSH tags to configure the participant:
219+
* Tags: file_path, profile_name
220+
*
221+
* @param[in] config The configuration provided by the user.
222+
*
223+
* @return Specific QoS by user configuration.
224+
*/
203225
eprosima::fastdds::dds::DomainParticipantQos get_participant_qos(
204226
const YAML::Node& config);
205227

206-
//! Get Integration Service Participant default Qos
228+
/**
229+
* @brief Get Integration Service Participant default Qos
230+
*
231+
* @return Defult SystemHandler Participant QoS
232+
*/
207233
eprosima::fastdds::dds::DomainParticipantQos get_default_participant_qos();
208234

209-
//! Get Databroker DomainParticipantQos with TCP enable in WAN
210-
//! It uses \c get_participant_qos to reuse std participant tags
211-
//! tags: server_id, listening_addresses, connection_addresses
235+
/**
236+
* @brief Get Databroker DomainParticipantQos with TCP enable in WAN
237+
*
238+
* It uses \c get_participant_qos to reuse std participant tags and the uses specific databroker tags:
239+
* Databroker tags:
240+
* server_id : id of the Discovery Server [0:256)
241+
* listening_addresses : Listening addresses (public) for Discovery Server to listen in TCP
242+
* fields : ip, port
243+
* connection_addresses : Connection addresses for Discovery Server to connect with other servers
244+
* fields : ip, port, server_id
245+
*
246+
* @param config The configuration provided by the user.
247+
*
248+
* @return Specific QoS by user configuration.
249+
*/
212250
eprosima::fastdds::dds::DomainParticipantQos get_databroker_qos(
213251
const YAML::Node& config);
214252

src/SystemHandle.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
* Copyright 2021 Proyectos y Sistemas de Mantenimiento SL (eProsima).
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ class SystemHandle : public virtual FullSystem
7474
}
7575
catch (DDSMiddlewareException& e)
7676
{
77-
logger_ << utils::Logger::Level::ERROR << "Error parsing configuration" << std::endl;
77+
logger_ << utils::Logger::Level::ERROR << "Error creating participant" << std::endl;
7878
e.from_logger << utils::Logger::Level::ERROR << e.what() << std::endl;
7979
return false;
8080
}
@@ -261,4 +261,6 @@ class SystemHandle : public virtual FullSystem
261261
} // namespace is
262262
} // namespace eprosima
263263

264+
// TODO aliases must come from CMAKE
264265
IS_REGISTER_SYSTEM("fastdds", eprosima::is::sh::fastdds::SystemHandle)
266+
IS_REGISTER_SYSTEM("databroker", eprosima::is::sh::fastdds::SystemHandle)

0 commit comments

Comments
 (0)