CAPL Script

TestWaitForChangeFlag

Syntax

long TestWaitForChangeFlag(COValue value, dword timeoutMs)

Function

Waits for the change flag of a communication object value to be set. Each CO value has a change flag which is set when the value changes and reset through an explicit call tovalueEntity::ClearChangeFlagorvalueEntity::ResetValueState. Use this function instead ofTestWaitForChangeif an undetermined number of changes may occur between a point where you reset the flag and a point where at least one change must have occurred.

Parameters

COValue Value of a communication object.

timeoutMS

Timeout in milliseconds.

Return Values

-2: Resume due to constraint violation

-1: General error, for example, functionality is not available

0: Resume due to timeout

1: resume due to event occurred (change flag was set)

long ret;consumedEventRef * anEvent;anEvent = lookupConsumedEvent(path);anEvent.ClearChangeFlag();// ...ret = testWaitForChangeFlag(anEvent, 200);

[TestWaitForChange](/en/syntax/communication-objects/misc/testwaitforchange) | [TestWaitForUpdate](/en/syntax/communication-objects/misc/testwaitforupdate) | [TestWaitForUpdateFlag](/en/syntax/communication-objects/misc/testwaitforupdateflag)