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

[21077] Update Fast DDS docs QoS examples #4842

Merged
merged 6 commits into from
Jun 20, 2024
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 examples/cpp/configuration/SubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ SubscriberApp::SubscriberApp(
reader_qos.resource_limits().max_samples_per_instance = config.max_samples_per_instance;
reader_qos.ownership().kind = config.ownership;
reader_qos.deadline().period = eprosima::fastdds::Duration_t(config.deadline * 1e-3);
reader_qos.reliable_reader_qos().disable_positive_ACKs.enabled = config.disable_positive_ack;
reader_qos.reliable_reader_qos().disable_positive_acks.enabled = config.disable_positive_ack;
reader_qos.lifespan().duration = eprosima::fastdds::Duration_t(config.lifespan * 1e-3);
reader_qos.liveliness().kind = config.liveliness;
reader_qos.liveliness().lease_duration = eprosima::fastdds::Duration_t(
Expand Down
5 changes: 5 additions & 0 deletions include/fastdds/dds/publisher/qos/DataWriterQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class RTPSReliableWriterQos
(this->disable_heartbeat_piggyback == b.disable_heartbeat_piggyback);
}

inline void clear()
{
*this = RTPSReliableWriterQos();
}

//!Writer Timing Attributes
fastdds::rtps::WriterTimes times;

Expand Down
7 changes: 3 additions & 4 deletions include/fastdds/dds/subscriber/qos/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ class RTPSReliableReaderQos
const RTPSReliableReaderQos& b) const
{
return (this->times == b.times) &&
(this->disable_positive_ACKs == b.disable_positive_ACKs);
(this->disable_positive_acks == b.disable_positive_acks);
}

inline void clear()
{
RTPSReliableReaderQos reset = RTPSReliableReaderQos();
std::swap(*this, reset);
*this = RTPSReliableReaderQos();
}

/*!
Expand All @@ -72,7 +71,7 @@ class RTPSReliableReaderQos
/*!
* @brief Control the sending of positive ACKs
*/
DisablePositiveACKsQosPolicy disable_positive_ACKs;
DisablePositiveACKsQosPolicy disable_positive_acks;
};

//! Qos Policy to configure the limit of the reader resources
Expand Down
6 changes: 6 additions & 0 deletions include/fastdds/rtps/attributes/PropertyPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class PropertyPolicy
(this->binary_properties_ == b.binary_properties_);
}

FASTDDS_EXPORTED_API bool operator !=(
const PropertyPolicy& b) const
{
return !(*this == b);
}

//!Get properties
FASTDDS_EXPORTED_API const PropertySeq& properties() const
{
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ bool DomainParticipantImpl::set_qos(
{
to.allocation() = from.allocation();
}
if (first_time && !(to.properties() == from.properties()))
if (first_time && (to.properties() != from.properties()))
{
to.properties() = from.properties();
}
Expand Down Expand Up @@ -1710,10 +1710,10 @@ bool DomainParticipantImpl::can_qos_be_updated(
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK,
"ParticipantResourceLimitsQos cannot be changed after the participant is enabled");
}
if (!(to.properties() == from.properties()))
if ((to.properties() != from.properties()))
{
updatable = false;
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK, "PropertyPolilyQos cannot be changed after the participant is enabled");
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK, "PropertyPolicyQos cannot be changed after the participant is enabled");
}
if (!(to.wire_protocol() == from.wire_protocol()))
{
Expand Down
6 changes: 6 additions & 0 deletions src/cpp/fastdds/publisher/DataWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,12 @@ bool DataWriterImpl::can_qos_be_updated(
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK,
"Only the period of Positive ACKs can be changed after the creation of a DataWriter.");
}
if (to.properties() != from.properties())
{
updatable = false;
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK, "PropertyPolicyQos cannot be changed after the DataWriter is enabled.");
}

return updatable;
}

Expand Down
15 changes: 10 additions & 5 deletions src/cpp/fastdds/subscriber/DataReaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ReturnCode_t DataReaderImpl::enable()
att.liveliness_kind = qos_.liveliness().kind;
att.matched_writers_allocation = qos_.reader_resource_limits().matched_publisher_allocation;
att.expects_inline_qos = qos_.expects_inline_qos();
att.disable_positive_acks = qos_.reliable_reader_qos().disable_positive_ACKs.enabled;
att.disable_positive_acks = qos_.reliable_reader_qos().disable_positive_acks.enabled;
att.data_sharing_listener_thread = qos_.data_sharing().data_sharing_listener_thread();

// TODO(Ricardo) Remove in future
Expand Down Expand Up @@ -1633,8 +1633,8 @@ bool DataReaderImpl::can_qos_be_updated(
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK,
"Unique network flows request cannot be changed after the creation of a DataReader.");
}
if (to.reliable_reader_qos().disable_positive_ACKs.enabled !=
from.reliable_reader_qos().disable_positive_ACKs.enabled)
if (to.reliable_reader_qos().disable_positive_acks.enabled !=
from.reliable_reader_qos().disable_positive_acks.enabled)
{
updatable = false;
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK,
Expand All @@ -1644,7 +1644,12 @@ bool DataReaderImpl::can_qos_be_updated(
{
updatable = false;
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK,
"data_sharing_listener_thread cannot be changed after the DataReader is enabled");
"data_sharing_listener_thread cannot be changed after the DataReader is enabled.");
}
if (to.properties() != from.properties())
{
updatable = false;
EPROSIMA_LOG_WARNING(RTPS_QOS_CHECK, "PropertyPolicyQos cannot be changed after the DataReader is enabled.");
}
return updatable;
}
Expand Down Expand Up @@ -1744,7 +1749,7 @@ void DataReaderImpl::set_qos(
to.expects_inline_qos(from.expects_inline_qos());
}

if (first_time && !(to.properties() == from.properties()))
if (first_time && (to.properties() != from.properties()))
{
to.properties() = from.properties();
}
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/subscriber/qos/DataReaderQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ReaderQos DataReaderQos::get_readerqos(
qos.m_lifespan = lifespan();
//qos.m_topicData --> TODO: Fill with TopicQos info
qos.m_durabilityService = durability_service();
qos.m_disablePositiveACKs = reliable_reader_qos().disable_positive_ACKs;
qos.m_disablePositiveACKs = reliable_reader_qos().disable_positive_acks;
qos.type_consistency = type_consistency();
qos.representation = representation();
qos.data_sharing = data_sharing();
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/utils/QosConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void set_qos_from_attributes(
qos.endpoint().user_defined_id = attr.getUserDefinedID();
qos.endpoint().entity_id = attr.getEntityID();
qos.reliable_reader_qos().times = attr.times;
qos.reliable_reader_qos().disable_positive_ACKs = attr.qos.m_disablePositiveACKs;
qos.reliable_reader_qos().disable_positive_acks = attr.qos.m_disablePositiveACKs;
qos.durability() = attr.qos.m_durability;
qos.durability_service() = attr.qos.m_durabilityService;
qos.deadline() = attr.qos.m_deadline;
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox/api/dds-pim/PubSubReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,8 @@ class PubSubReader
PubSubReader& keep_duration(
const eprosima::fastdds::Duration_t duration)
{
datareader_qos_.reliable_reader_qos().disable_positive_ACKs.enabled = true;
datareader_qos_.reliable_reader_qos().disable_positive_ACKs.duration = duration;
datareader_qos_.reliable_reader_qos().disable_positive_acks.enabled = true;
datareader_qos_.reliable_reader_qos().disable_positive_acks.duration = duration;
return *this;
}

Expand Down
12 changes: 6 additions & 6 deletions test/unittest/dds/subscriber/SubscriberTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ TEST(SubscriberTests, ChangeDefaultDataReaderQos)
qos.reliable_reader_qos().times.initial_acknack_delay.nanosec = 32u;
qos.reliable_reader_qos().times.heartbeat_response_delay.seconds = 432;
qos.reliable_reader_qos().times.heartbeat_response_delay.nanosec = 43u;
qos.reliable_reader_qos().disable_positive_ACKs.enabled = true;
qos.reliable_reader_qos().disable_positive_ACKs.duration.seconds = 13;
qos.reliable_reader_qos().disable_positive_ACKs.duration.nanosec = 320u;
qos.reliable_reader_qos().disable_positive_acks.enabled = true;
qos.reliable_reader_qos().disable_positive_acks.duration.seconds = 13;
qos.reliable_reader_qos().disable_positive_acks.duration.nanosec = 320u;
// .type_consistency
qos.representation().m_value.push_back(XML_DATA_REPRESENTATION);
qos.representation().m_value.push_back(XCDR_DATA_REPRESENTATION);
Expand Down Expand Up @@ -428,9 +428,9 @@ TEST(SubscriberTests, ChangeDefaultDataReaderQos)
EXPECT_EQ(32u, rqos.reliable_reader_qos().times.initial_acknack_delay.nanosec);
EXPECT_EQ(432, rqos.reliable_reader_qos().times.heartbeat_response_delay.seconds);
EXPECT_EQ(43u, rqos.reliable_reader_qos().times.heartbeat_response_delay.nanosec);
EXPECT_TRUE(rqos.reliable_reader_qos().disable_positive_ACKs.enabled);
EXPECT_EQ(13, rqos.reliable_reader_qos().disable_positive_ACKs.duration.seconds);
EXPECT_EQ(320u, rqos.reliable_reader_qos().disable_positive_ACKs.duration.nanosec);
EXPECT_TRUE(rqos.reliable_reader_qos().disable_positive_acks.enabled);
EXPECT_EQ(13, rqos.reliable_reader_qos().disable_positive_acks.duration.seconds);
EXPECT_EQ(320u, rqos.reliable_reader_qos().disable_positive_acks.duration.nanosec);
// .type_consistency
EXPECT_EQ(XML_DATA_REPRESENTATION, rqos.representation().m_value.at(0));
EXPECT_EQ(XCDR_DATA_REPRESENTATION, rqos.representation().m_value.at(1));
Expand Down
Loading