Implement event trigger when Data change

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

Hi,

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?

 

Thanks.

Keywords:
Howard's picture
Offline
Last seen: 7 hours 26 min ago
Joined: 11/29/2012
Posts: 570

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.