Skip to main content

WEBfactory 2010

Working with WFAlarmConnector Interface

Abstract

Check out this article and learn how to work with the WFAlarm Connector Interface and which are the available management options.

This chapter shows how to use the methods of the WFAlarmConnector interface.

Creating a WFAlarmConnector instance

To create an instance of the alarm connector you should call the parameter less constructor like in the sample below:

IWFAlarmConnector alarmConnector = new WFAlarmConnector();
Raising a custom alarm

To raise a custom alarm you should call the RaiseCustomAlarm method like in the sample below:

int result = alarmConnector.RaiseCustomAlarm(
	"someServerName",
	"someSignalName",
	"someAlarmTag",
	DateTime.Now,
	new List<object>() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20});

The combination of the server name, signal name, and the alarm tag uniquely identifies the alarm that will be raised.

The values of the 20 alarm parameters can be of any type and it can even contain null values. If the list of parameters has more than 20 elements than only the first 20 elements will be considered. The rest of the alarm parameters will be ignored.

Deactivating a custom alarm

To deactivate a custom alarm you should call the DeactivateCustomAlarm like in the sample below:

int result = alarmConnector.DeactivateCustomAlarm(
	"someServerName",
	"someSignalName",
	"someAlarmTag",
	DateTime.Now);

The combination of the server name, signal name, and the alarm tag uniquely identifies the alarm that will be deactivated.

AlarmAcknowledged event

Register to the event like in the sample below;

alarmConnector.AlarmAcknowledged += new AlarmAcknowledgedEventHandler(alarmConnector_AlarmAcknowledged);

where

void alarmConnector_AlarmAcknowledged(object sender, AlarmAcknowledgedEventArgs e)
{
	// Do something with e.Acknowledgments here
}