dpWaitForValue

Find and share HowTos to various installations / configurations!
2 posts • Page 1 of 1
lakefalos
Posts:27
Joined: Thu Feb 01, 2018 3:13 pm

dpWaitForValue

Post by lakefalos »

I am trying to use dpWaitForValue as shown below. It works for me but I notice that if the condition is already met before the dpWaitForValue function runs.it does Not recognize the value, and just sits and waits for it ..the only way I can get it to recognize is if I change back to false and make true again. Is there a way around this? I want the function to proceed running the script if the condition is already met.

Also can I OR and && dpWaitForValue funtions something like

(dpWaitForValue( dpNamesWait, conditions1, dpNamesReturn, returnValues, t ))||(dpWaitForValue( dpNamesWait, conditions2, dpNamesReturn, returnValues, t ));


Thank you.

Lori

///////////////////////////////////////////////////////////////////////////

main(mapping event)
{

DebugN("Running");
time t;
dyn_string dpNamesWait, dpNamesReturn;
dyn_anytype returnValues,condition3;
int status;
// assignment of the data points for dpNamesWait
dpNamesWait = makeDynString("System1:global_vars.OnlineStatus:_original.._value");
// indication of the condition that must be fulfilled

condition3=makeDynBool((bool)1);
// assignment of the data points for dpNamesReturn (data points
// of the child panel that is parameterised for buttons

t = 60;
// The child panel is opened

status=dpWaitForValue(dpNamesWait, condition3, dpNamesReturn, returnValues, t) ;
DebugN("I just waited for control mode to == 100 or 200", dpNamesReturn,returnValues);
}

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: dpWaitForValue

Post by leoknipp »

In the OR condition the return values of the function are compared.
It is not a comparison for the return values of dpWaitForValue.

dpWaitForValue() checks the conditions when a value is set, similar to a work function for a dpConnect().

You can probably do the following:
-- make a dpConnect for the dp element you want to wait for
-- write the result to a global variable
-- before starting dpWaitForValue read the global variable
-- if the value does not fit the condition you are waiting for the function dpWaitForValue is started

Best Regards
Leopold Knipp
Senior Support Specialist

2 posts • Page 1 of 1