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

HwAlarmQue

Returns the handle of the hardware alarm queue. The Alarms Server writes hardware alarm information into this queue as each hardware alarm occurs. To read events from this queue, use the QueRead() or QuePeek() functions. The data written into the queue is the hardware alarm format, and is stored in the Str field.

To use this function, you need to enable the hardware alarm queue by specifying the [Alarm]HwAlarmQueMax parameter. This parameter specifies the maximum length that the queue can grow to. The [Alarm]HwAlarmFmt parameter defines the format of the data placed into the string field. If HwAlarmFmt is not specified then the format defaults to "Time: {Time,12} Date:{Date,11} Desc:{Desc,40}".

The following format fields are relevant to hardware alarms:

For a description of the fields see the "Alarm Display Fields" help page.

The number of buffers available for user queues is controlled by the [Code]Queue parameter. Each entry in any user queue consumes one buffer. When all buffers have been used the Alarms Server will not be able to add new hardware alarms to the queue, and the error message "Out Of Buffers Usr.Que" will be written to syslog.dat.

Note:When similar hardware alarms are triggered, for example "Tag not found" alarms, the hardware alarm page and hardware alarm queue show the last invalid entry. The previous entry of the same description is overwritten.

Syntax

HwAlarmQue()

Return Value

The handle of the hardware alarm queue, or -1 if the queue cannot be opened.

Related Functions

QueRead(), QuePeek()

Example

	hQue = HwAlarmQue()
	WHILE TRUE DO
	QueRead(hQue, nAlarmType, sHwAlarmString, 1);
	/* do what ever with the alarm information */
	....
	Sleep(0);
	END
			

See Also

Alarm Functions

Published June 2018