-
Notifications
You must be signed in to change notification settings - Fork 75
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
Can't set both a listener with StatusMask::all() and waitset #499
Comments
The DDS spec has a very brief note on combining waitsets and listeners:
(2.2.4.2.2 is similar for "read communication status")
I think you're running into this. The listener gets invoked, therefore the status gets reset before the waitset gets a chance. Is that possible? (The Cyclone C API allows controlling whether the status is reset on invocation, the C++ binding uses this internally, but doesn't expose it. I believe that also allows it to skimp a bit on the various masks and listener combinations in the spec that are too confusing for me. I'll try to find the spec's bits about all of those combinations if you need me to: it'll be a good thing for me try again to wrap my head around the definitions ...) |
That sounds like it's what I'm seeing. Is there a way from C++ to avoid resetting the status (getting the C handles to call whatever relevant functions). Or since we're really only using most of the listener just for logging, can it be done without hitting this issue. template <typename T>
class WriterListener : public ::dds::pub::DataWriterListener<T> {
public:
void on_offered_deadline_missed(::dds::pub::DataWriter<T>& writer, const ::dds::core::status::OfferedDeadlineMissedStatus& status) override;
void on_offered_incompatible_qos(::dds::pub::DataWriter<T>& writer, const ::dds::core::status::OfferedIncompatibleQosStatus& status) override;
void on_liveliness_lost(::dds::pub::DataWriter<T>& writer, const ::dds::core::status::LivelinessLostStatus& status) override;
void on_publication_matched(::dds::pub::DataWriter<T>& writer, const ::dds::core::status::PublicationMatchedStatus& status) override;
};
template <typename T>
inline void WriterListener<T>::on_offered_deadline_missed(::dds::pub::DataWriter<T>& writer,
const ::dds::core::status::OfferedDeadlineMissedStatus&) {
if (Log::Logger::GlobalLogger() != nullptr) {
Log::Logger::GlobalLogger()->warning_tag({Log::TAGS::DDS}, "Writer Topic ({}): On Offered Deadline Missed", writer->topic_description().name());
}
}
template <typename T>
inline void WriterListener<T>::on_offered_incompatible_qos(::dds::pub::DataWriter<T>& writer,
const ::dds::core::status::OfferedIncompatibleQosStatus& status) {
if (Log::Logger::GlobalLogger() != nullptr) {
auto policy = status->last_policy_id();
Log::Logger::GlobalLogger()->error_tag({Log::TAGS::DDS}, "Writer Topic ({}): On Offered Incompatible QoS {}", writer->topic_description().name(),
policy);
}
}
template <typename T>
inline void WriterListener<T>::on_liveliness_lost(::dds::pub::DataWriter<T>& writer, const ::dds::core::status::LivelinessLostStatus& /*status*/) {
if (Log::Logger::GlobalLogger() != nullptr) {
Log::Logger::GlobalLogger()->trace_tag({Log::TAGS::DDS}, "Writer Topic ({}): On Liveliness lost", writer->topic_description().name());
}
}
template <typename T>
inline void WriterListener<T>::on_publication_matched(::dds::pub::DataWriter<T>& writer,
const ::dds::core::status::PublicationMatchedStatus& status) {
if (Log::Logger::GlobalLogger() != nullptr) {
Log::Logger::GlobalLogger()->trace_tag({Log::TAGS::DDS}, "Writer Topic ({}): On Publication Matched (currently matched: {}, change: {})",
writer->topic_description().name(), status.current_count(), status.current_count_change());
}
} |
Is it possible to have both a listener listening for all statuses and have a wait set waiting for just one. The WaitSet just times out when the listener has the all status, or a matching status. Should this be possible?
DataWriter setup:
Code with WaitSet:
The text was updated successfully, but these errors were encountered: