AlarmEnableRec
- Last UpdatedJul 18, 2023
- 2 minute read
Enables alarms by record number on both the primary and standby alarms servers. This function can be called from an alarm server or client and should not be used with a MsgRPC call to the alarm server.
This is a blocking function. If the function is called from a foreground task that is unable to block, an error will be returned.
Syntax
INT AlarmEnableRec(INT Record [, STRING ClusterName [, INT bAcknowledge]])
Record:
The alarm record number, returned from any of the following alarm functions:
• AlarmFirstCatRec() or AlarmNextCatRec() — used to search for a record by alarm category, area, and type (acknowledged, disabled, etc.).
• AlarmFirstPriRec() or AlarmNextPriRec() — used to search for a record by alarm priority, area, and type (acknowledged, disabled, etc.).
• AlarmFirstTagRec() or AlarmNextTagRec() — used to search for a record by alarm tag, name, and description.
• AlarmGetDsp() — used to find the record that is displayed at a specified AN, for either an alarm list or alarm summary entry. Set the sField argument in AlarmGetDsp() to "RecNo".
To store this value, use data type Int in Cicode or Long for variable tags (Long needs 4 bytes).
ClusterName:
Specifies the name of the cluster in which the Alarm Server resides. This is optional if you have one cluster or are resolving the alarm server via the current cluster context. The argument is enclosed in quotation marks " ".
bAcknowledge:
Forces acknowledgment of an alarm after it is enabled. The accepted values are:
0 — (default) enforced acknowledgment will not be applied.
1 — alarm will be acknowledged when enabled.
Return Value
0 (zero) if successful, otherwise an error code is returned.
Related Functions
AlarmFirstTagRec, AlarmNextTagRec, AlarmEnable, AlarmDisableRec, AlarmGetDsp
Examples
/* Disable/enable the specified "Pump" alarm. Flag determines
whether the alarm is disabled (Flag=0) or enabled and acknowledged (Flag=1). */
FUNCTION
DisablePumps(STRING sTag, INT Flag)
INT Current;
INT Next;
Current=AlarmFirstTagRec(sTag,"Pump","");
WHILE Current<>-1 DO
Next=AlarmNextTagRec(Current,sTag,"Pump","");
IF Flag=0 THEN
AlarmDisableRec(Current);
ELSE
AlarmEnableRec(Current,"",1);
END
Current=Next;
END
END