Cicode Programming Reference > Cicode Function Categories > Alarm Functions > AlarmDisableRec

AlarmDisableRec

Disables alarms by record number on both the Primary and Standby Alarms Servers. This function can be called from 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 AlarmDisableRec(LONG Record [, STRING ClusterName [, INT EndTime [, STRING Comment]]] )

Record:

The alarm record number, returned from any of the following alarm functions:

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 "".

EndTime:

A date/time variable that indicates when the alarm will no longer be disabled. If this parameter is omitted or set to 0, the alarm will be disabled indefinitely.

Comment:

An optional comment limited to 200 characters explaining why the alarm is disabled. If the comment exceeds 200 characters, hardware error 274 ("Invalid argument passed") will be displayed.

Return Value

0 (zero) if successful, otherwise an error code is returned.

Related Functions

AlarmFirstTagRec, AlarmNextTagRec, AlarmDisable

Examples

/* Disable/enable the specified "Pump" alarm. Flag determines 
whether the alarm is disabled (Flag=0) or enabled (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);
END
Current=Next;
END
END

// Disable alarm  for the next 60 minutes
Current=AlarmFirstTagRec(sTag,"Pump","");
nEndTime = DateAdd(TimeCurrent(), 3600);
AlarmDisableRec(Current, "Cluster1", nEndTime, "Shelve alarm for 60 minutes.");

// Disable alarm until 20 Dec 2016 6:30am local time
Current=AlarmFirstTagRec(sTag,"Pump","");
nEndTime = DateAdd(StrToDate("20/12/2016"), StrToTime("6:30"));
AlarmDisableRec(Current, "Cluster1", nEndTime, "Shelve alarms until 20 Dec 2016 6:30am");

See Also

Alarm Functions

Published June 2018