Skip to content

Status mask is not effective if it is previously set to none #891

@sumanth-nirmal

Description

@sumanth-nirmal

Required information

Operating system:
Ubuntu 18.04 LTS

Compiler version:

Observed result or behaviour:

When we create a status condition for a reader and set the status mask to none first, and then set the status mask to some status (for eg. requested_incompatible_qos) and attach it to a waitset, then the wait set doesn't get triggered for this status condition. The below example should show the behavior

TEST(tooch, event)
{
  using DDSType = test_msgs::msg::dds_::Strings_;
  dds::domain::DomainParticipant dp(0);
  dds::pub::Publisher pub(dp);
  dds::sub::Subscriber sub(dp);
  dds::topic::Topic<DDSType> topic(dp, "test");
  dds::pub::qos::DataWriterQos dw_qos{};
  dw_qos.policy<dds::core::policy::Durability>().kind(
    dds::core::policy::DurabilityKind::VOLATILE);
  dds::pub::DataWriter<DDSType> dw(pub, topic, dw_qos);
  dds::sub::qos::DataReaderQos dr_qos{};
  dr_qos.policy<dds::core::policy::Durability>().kind(
    dds::core::policy::DurabilityKind::TRANSIENT_LOCAL);
  dds::sub::DataReader<DDSType> dr(sub, topic, dr_qos);

  dds::sub::cond::ReadCondition rc(dr,
    dds::sub::status::SampleState::not_read());
  dds::core::cond::StatusCondition sc_w(dw);
  sc_w.enabled_statuses(dds::core::status::StatusMask::offered_incompatible_qos());
  dds::core::cond::StatusCondition sc_r(dr);
  sc_r.enabled_statuses(dds::core::status::StatusMask::none());
  sc_r.enabled_statuses(dds::core::status::StatusMask::requested_incompatible_qos());

  DDSType msg{};
  msg.string_value_("tooch");
  //dw.write(msg);

  dds::core::cond::WaitSet ws{};
  //ws.attach_condition(rc);
  ws.attach_condition(sc_w);
  ws.attach_condition(sc_r);

  auto attched_conds = ws.conditions();
  auto conds = ws.wait(dds::core::Duration{3, 0});

  EXPECT_EQ(conds.size(), 2);
  EXPECT_EQ(conds[0]->get_ddsc_entity(), sc_w->get_ddsc_entity());
  EXPECT_EQ(conds[1]->get_ddsc_entity(), sc_r->get_ddsc_entity());

  EXPECT_EQ(dr.requested_incompatible_qos_status().total_count(), 1);
  EXPECT_EQ(dw.offered_incompatible_qos_status().total_count(), 1);
}

Expected result or behaviour:

Is this expected behavior or I am miss using the API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions