#ifndef FAST_DDS_GENERATED__SUBSCRIBERAPP_HPP #define FAST_DDS_GENERATED__SUBSCRIBERAPP_HPP #include #include #include #include #include #include "WeighingDDSType.hpp" #include "MsgHandler.hpp" class SubscriberApp : public eprosima::fastdds::dds::DataReaderListener { public: SubscriberApp( const int& domain_id); virtual ~SubscriberApp(); //! Subscription callback void on_data_available( eprosima::fastdds::dds::DataReader* reader) override; //! Subscriber matched method void on_subscription_matched( eprosima::fastdds::dds::DataReader* reader, const eprosima::fastdds::dds::SubscriptionMatchedStatus& info) override; //! Run subscriber void run(std::shared_ptr handler); //! Trigger the end of execution void stop(); private: //! Return the current state of execution bool is_stopped(); std::shared_ptr factory_; eprosima::fastdds::dds::DomainParticipant* participant_; eprosima::fastdds::dds::Subscriber* subscriber_; eprosima::fastdds::dds::Topic* topic_; eprosima::fastdds::dds::DataReader* reader_; eprosima::fastdds::dds::TypeSupport type_; uint16_t samples_received_; std::atomic stop_; uint32_t period_ms_ = 100; mutable std::mutex terminate_cv_mtx_; std::condition_variable terminate_cv_; }; #endif // FAST_DDS_GENERATED__SUBSCRIBERAPP_HPP