Hello,
Is it possible to use multiple condition values for one single datapoint (dpNamesWait) or is only one condition per datapoint?
I want to detect changes on this datapoint (changes to value "1" or "2") within a period of time (timeout).
With one datapoint and one condition it works as expected, it waits for the change of the datapoint that meets the conditions.
But If I try to use the same datapoint twice (dpNamesWait) with different conditions on the same dyn_anytype but it did not work as expected. It stops reacting to the changes.
Is there a workaround to do this?
I am also considering a solution of a dpConnect/dpDisconnect in a new thread using semaphore functions to control the timeout to kill the thread, and then check the value conditions in the callback, but I would like to know first if it is possible with dpWaitForValue.
Thanks a lot!
According to the info provided
dpWaitForValue()
int dpWaitForValue( dyn_string dpNamesWait, dyn_anytype conditions, dyn_string dpNamesReturn, dyn_anytype &returnValues, time timeout [,bool &timerExpired]);
conditions: (desired) values of any type and number, that must match the value types of dpNamesWait. The function waits for value changes which meet the conditions.
dpWaitForValue question
- gschijndel
- Posts:376
- Joined: Tue Jan 15, 2019 3:12 pm
Re: dpWaitForValue question
It is possible to use 'dpWaitForValue' without conditions, so it returns on the first change.
Instead of using 'dpConnect'/'dpDisconnect' and killing the timed out thread, you could start a 'dpWaitForValue' thread for each condition, and check if a condition has been met.
Instead of using 'dpConnect'/'dpDisconnect' and killing the timed out thread, you could start a 'dpWaitForValue' thread for each condition, and check if a condition has been met.