Skip to content

Commit

Permalink
Refs #20575: Implement missing callbacks
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
  • Loading branch information
JesusPoderoso committed Apr 2, 2024
1 parent d4825b1 commit 2a521df
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 2 deletions.
20 changes: 20 additions & 0 deletions examples/cpp/configuration/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,26 @@ void PublisherApp::on_offered_deadline_missed(
std::cout << "Deadline missed!" << std::endl;
}

void PublisherApp::on_offered_incompatible_qos(
DataWriter* /*writer*/,
const OfferedIncompatibleQosStatus& /*status*/)
{
std::cout << "Incompatible QoS detected!" << std::endl;
}

void PublisherApp::on_liveliness_lost(
DataWriter* /*writer*/,
const LivelinessLostStatus& /*status*/)
{
std::cout << "Liveliness lost!" << std::endl;
}

void PublisherApp::on_unacknowledged_sample_removed(
DataWriter* /*writer*/,
const InstanceHandle_t& /*instance*/)
{
std::cout << "Unacknowledged sample was removed!" << std::endl;
}
void PublisherApp::run()
{
while (!is_stopped() && ((samples_ == 0) || (configuration_.index() < samples_)))
Expand Down
19 changes: 17 additions & 2 deletions examples/cpp/configuration/PublisherApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,23 @@ class PublisherApp : public Application, public DataWriterListener

//! Sample deadline missed method
void on_offered_deadline_missed(
DataWriter* writer,
const OfferedDeadlineMissedStatus& status) override;
DataWriter* writer,
const OfferedDeadlineMissedStatus& status) override;

//! Incompatible QoS method
void on_offered_incompatible_qos(
DataWriter* writer,
const OfferedIncompatibleQosStatus& status) override;

//! Liveliness lost method
void on_liveliness_lost(
DataWriter* writer,
const LivelinessLostStatus& status) override;

//! Un-acked sample removed method
void on_unacknowledged_sample_removed(
DataWriter* writer,
const InstanceHandle_t& instance) override;

//! Run publisher
void run() override;
Expand Down
35 changes: 35 additions & 0 deletions examples/cpp/configuration/SubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,41 @@ void SubscriberApp::on_data_available(
}
}

void SubscriberApp::on_requested_deadline_missed(
DataReader* /*reader*/,
const RequestedDeadlineMissedStatus& /*status*/)
{
std::cout << "Requested deadline missed!" << std::endl;
}

void SubscriberApp::on_liveliness_changed(
DataReader* /*reader*/,
const LivelinessChangedStatus& /*status*/)
{
std::cout << "Liveliness changed!" << std::endl;
}

void SubscriberApp::on_sample_rejected(
DataReader* /*reader*/,
const SampleRejectedStatus& /*status*/)
{
std::cout << "Sample rejected!" << std::endl;
}

void SubscriberApp::on_requested_incompatible_qos(
DataReader* /*reader*/,
const RequestedIncompatibleQosStatus& /*status*/)
{
std::cout << "Incompatible QoS detected!" << std::endl;
}

void SubscriberApp::on_sample_lost(
DataReader* /*reader*/,
const SampleLostStatus& /*status*/)
{
std::cout << "Sample lost!" << std::endl;
}

void SubscriberApp::run()
{
std::unique_lock<std::mutex> lock_(mutex_);
Expand Down
27 changes: 27 additions & 0 deletions examples/cpp/configuration/SubscriberApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <mutex>

#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/subscriber/Subscriber.hpp>
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastdds/dds/subscriber/DataReaderListener.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>

Expand Down Expand Up @@ -57,6 +59,31 @@ class SubscriberApp : public Application, public DataReaderListener
DataReader* reader,
const SubscriptionMatchedStatus& info) override;

//! Sample deadline missed method
void on_requested_deadline_missed(
DataReader* reader,
const RequestedDeadlineMissedStatus& status) override;

//! Liveless changed method
void on_liveliness_changed(
DataReader* reader,
const LivelinessChangedStatus& status) override;

//! Sample rejected method
void on_sample_rejected(
DataReader* reader,
const SampleRejectedStatus& status) override;

//! Incompatible QoS method
void on_requested_incompatible_qos(
DataReader* reader,
const RequestedIncompatibleQosStatus& status) override;

//! Sample lost method
void on_sample_lost(
DataReader* reader,
const SampleLostStatus& status) override;

//! Run the subscriber
void run() override;

Expand Down

0 comments on commit 2a521df

Please sign in to comment.