Implement event trigger when Data change

2 posts / 0 new
Last post
Last seen: 3 years 10 months ago
Joined: 08/11/2019
Posts: 28
Implement event trigger when Data change


I want to implement event trigger when Data change in c code,

I don't want to set a fix trigger_value, 

does anyone know that how can I use privious data to compare current data?

or any suggestion?



Howard's picture
Last seen: 6 days 10 hours ago
Joined: 11/29/2012
Posts: 559

Sorry, there is nothing in DDS that does this for you.  You will have to write use code to directly compare an old value of data to a new value of data and implement a triggering mechanism.

You can use a listener callback and then store the old value in the callback and then when called compare the new value with the old value and then either callback a different function registered with the callback or signal a semaphore to wake up a processing thread when the value of data changes.

What I describe is general programming and has nothing specific to do with DDS.