How to debug data reader listener callbacks?

3 posts / 0 new
Last post
frgo's picture
Offline
Last seen: 6 years 1 month ago
Joined: 12/28/2011
Posts: 20
How to debug data reader listener callbacks?

Hi all !
I am implementing a dynamic type data writer and data reader application based on the Hello_dynamic example in C.

Unfortunately I can't get my application's callbacks in the datareader listener getting called when sending samples created by the Hello executable from the example. I am now looking for extended debugging possibilities for datareader listener callbacks. I am already using NDDS_CONFIG_LOG_CATEGORY_API with a NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL settings for logging …

Thanks for any hints.

Kind regards

Frank

Offline
Last seen: 3 years 1 month ago
Joined: 01/15/2013
Posts: 94

Hi Frank,

What callbacks are you hoping to instrument? Do you have any code snippet that you could share?

Thanks,

Juanlu

frgo's picture
Offline
Last seen: 6 years 1 month ago
Joined: 12/28/2011
Posts: 20

Hi Juanlu,

thank you for your reply. I need liveliness changed, subscription matched, data available and sample lost callbacks to fire.
See attached code snippets (these are directly taken from the Hello_dynamic example!):

Example callback:

void on_subscription_matched( void* listener_data,
DDS_DataReader* reader,
const struct DDS_SubscriptionMatchedStatus *status)
{
CallbackData *me = (CallbackData *) listener_data;
if (me->verbose)
{
printf("->Callback: subscription matched.\n");
}
}

Setting up the data reader:

char *topic_name = "CCAG.torus";
DDS_DataReader *data_reader = NULL;
struct DDS_DataReaderListener listener = DDS_DataReaderListener_INITIALIZER;
CallbackData callback_data;

CallbackData_initialize(&callback_data);
callback_data.verbose = 3;
callback_data.sample_rcvd_max = 100;

listener.as_listener.listener_data = &callback_data;
listener.on_requested_deadline_missed = NULL;
listener.on_requested_incompatible_qos = NULL;
listener.on_sample_rejected = NULL;
listener.on_liveliness_changed = on_liveliness_changed;
listener.on_sample_lost = on_sample_lost;
listener.on_subscription_matched = on_subscription_matched;
listener.on_data_available = on_data_available;

data_reader = DDS_DomainParticipant_create_datareader(
participant,
DDS_Topic_as_topicdescription(topic),
&DDS_DATAREADER_QOS_DEFAULT,
&listener,
DDS_STATUS_MASK_ALL);

QoS Profile file is the one from the Hello_dynamic example.
I can provide the whole code if that helps - but what I really want to know is if there is a possibility to see if the data reader sees the samples as they are sent somehow. Is there a specific flag I could set? As I do have the source code of Connext DDS I could try to find the source location where a data reader is waiting for udp packets…

TIA!

Kind regards

Frank