dpSetWait()
Assigns data point attributes and waits for an answer from the event manager.
Synopsis
int dpSetWait(string dp1, <type1> var1 [, string dp2, <type2>
var2, ...] );
int dpSetWait(dyn_string dpnames, dyn_anytype values);
Parameters
Parameter | Meaning |
---|---|
dp1, dp2, ... |
original attributes NOTE: Do not use data points of different systems! The function dpSetWait()t only works for one system. If the dpSetWait() is used for at least two systems, it does not work and the following error message is shown: WCCOAui (1), 2006.09.26 14:11:19.266, PARAM,SEVERE, 175, this request cannot address more than one system, DP: dist_789:ExampleDP_Arg1.:_original.._value WCCOAui (1), 2006.09.26 14:11:19.266, CTRL, WARNING, 76, Invalid argument in function, |
val1, val2, ... | values to be assigned |
Return Value
The function dpSetWait() returns 0 when it was successfully executed and in the event of a failure -1.
Errors
Errors can be retrieved with getLastError(). The return value is then the appropriate error code. An alert is issued in the event of non-existent data points, incorrect parameter transfers or spelling errors.
Description
The function dpSetWait() assigns the values var1, var2, ... to the data point attributes dp1, dp2 ... Any number of pairs of data point attributes and values can be transferred to the function dpSetWait(). The data point attributes are transferred as a string , the data type of the value depends on the attribute in question. Unlike with the function dpSet(), with dpSetWait() the execution of the script is blocked and the program waits for an answer from the event manager.
It has to be considered that the function does not wait for the execution of callbacks that are connected to changes of the data point attribute, e.g. using dpConnect().
In case that the dpSetWait() function addresses a data point element on another (distributed) system, the function waits for an answer of the event manager of the other system. This answer message is sent back (via the dist manager and the event manager of the first system) to the manager which has executed dpSetWait().
In one dpSetWait() function it is not allowed to assign a value to the same data point attribute several times. In this event only the first assignment is accepted and the other ones are discarded.
If there exists no definition for a config or attribute, the following defaults are used and added internal:
Function | Default |
---|---|
dpSet*() | _original.._value |
dpGet() | _online.._value |
dpGetAsynch() | _offline.._value |
dpGetPeriod() | _offline.._value |
dpConnect() | _online.._value |
dpDisconnect() | _online.._value |
Note that it is not possible to set values of data points on two different systems via one dpSetWait() function , for example, dpSetWait("dist_1:00001.value", 3, "system2:MyAi.value", 4); ! The values of the data points on dist_1 and on system2 have to be set via two different dpSetWait() functions.
Example
main()
{
´ int rc;
rc=dpSetWait("Valve17.opening:_default.._type",
DPCONFIG_DEFAULTVALUE);
DebugN(rc);
if ( dynlen(getLastError()) ) ... errorhandling ...
}
Assignment
Data point function, waiting control function
Availability
UI, CTRL