alertSetTimedWait()
Allows data point attributes to be set in a similar way to dpSet(). Additionally the timestamp can be set manually.
Synopsis
int alertSetTimedWait(time alerttime, time t1,
int count1, string dp1, anytype value1[, time
t2, ... ] );
Parameters
Parameter | Meaning |
---|---|
alerttime | Time which shall be used for the timestamp. |
t1 | Time of occurrence |
count 1 | Serial number |
dp1 | Data point name |
value1 | Value to be set |
Return Value
Returns 0, in the event of a failure returns -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
Works in a similar way to dpSet(), with certain attributes being able to be set to an alert (to the value valueX). As alerts are not only identified by the associated data point dpX, but also by the time of their occurrence tX, this must also be transferred. It is also possible that several alarms are issued at the same time (for example: group alarm). Alarms of this kind are also assigned a serial number countX.
The parameter alerttime allows to specify the time used for the timestamp.
Unlike with the function alertSetTimed(), with alertSetTimedWait() the execution of the script is blocked and the program waits for an answer from the event manager.
The attributes and their constants which can be set using alertSet() are described in the chapter _alert_hdl.
Examples
main()
{
string dpe = "System1:ExampleDP_Arg1.";
int range;
time alerttime;
time acktime;
atime At;
//get range of the alert
dpGet(dpe+":_alert_hdl.._act_range", range);
//get time of the alert
dpGet(dpe+":_online.._stime", alerttime);
//make time that shall be used for the acknowledge timestamp
acktime = makeTime(2012, 12, 22, 12, 12, 12);
//make time to be of type "atime"
At = makeATime(alerttime, 0, dpe);
//make sure acknowledging is needed
if(range != 0)
{
//single-acknowledge alert
alertSetTimedWait(acktime, alerttime, getACount(At), dpe+":_alert_hdl."+range+"._ack_state",
DPATTR_ACKTYPE_SINGLE);
}
}
Assignment
Data point function
Availability
CTRL