create_readcondition issue

1 post / 0 new
Offline
Last seen: 4 years 2 months ago
Joined: 04/07/2016
Posts: 8
create_readcondition issue

Hello

Now when i apply condition on my topic using create_contentfilteredtopic_with_filter()

Then my code works as per condition which i have applied to my topic.

 

But when i tried to apply the same condition on my topic using create_querycondition()

then the returncode returned by read_w_condition() is     "DDS_RETCODE_PRECONDITION_NOT_MET"

even create_querycondition() returns not null value which means create_querycondition() works perfectly fine. there might be some problem in read_w_condition

I have written both my code contentfiltertopic as well as create_querycondition() below.

 


DDS_StringSeq parameters(2);
const char *param_list[] = {" '1' "," '9' "};
parameters.from_array(param_list,2);

DDSContentFilteredTopic *cft = NULL;

 

cft = participant->create_contentfilteredtopic_with_filter(
"ContentFilteredTopic", topic, "(latdeg > %0 AND latdeg < %1)", parameters);

dl = new CMSDataListener();
reader = subscriber->create_datareader(
cft, DDS_DATAREADER_QOS_DEFAULT, dl,
DDS_STATUS_MASK_ALL);

 

 

DDS_StringSeq qc_parameters(2);
const char *qc_param_list[] = {" '1' "," '9' "};
qc_parameters.from_array(qc_param_list,2);
mQueryCondition = mDDSReader1->create_querycondition(DDS_NOT_READ_SAMPLE_STATE,
DDS_ANY_VIEW_STATE,
DDS_ALIVE_INSTANCE_STATE,
"latdeg > %0 AND latdeg < %1",
qc_parameters);
if (mQueryCondition == NULL)
{
std::cout<<"create_query_condition error"<<std::endl;
//exit(1);
}


retcode = mDDSReader->read_w_condition(data_seq, info_seq,
DDS_LENGTH_UNLIMITED,
mQueryCondition);
if (retcode == DDS_RETCODE_NO_DATA) {
return;
} else if (retcode != DDS_RETCODE_OK) {
printf("take error %d\n", retcode);
return;
}else if(retcode == DDS_RETCODE_PRECONDITION_NOT_MET)
{
std::cout<<"precondition not met"<<std::endl;
}

 

please let me know the issue

 

Thanks

Bhawna Popli

Organization: