Hi Dojo,
Does someone has example code for getting all the active alarms for all elements using a specific connector in Automation?
Hi Jens,
To start you can use the FindElementsByProtocol call to retrieve your elements.
You can use it with just a connector name
Element[] elements = engine.FindElementsByProtocol("Protocol Name");
or with the version as well
Element[] elements = engine.FindElementsByProtocol("Connector Name", "Connector Version");
You can then use the GetActiveAlarmMessage to request the alarms for each of your elements in a loop
var request = new GetActiveAlarmsMessage(dmaId, elemId);
var response = (ActiveAlarmsResponseMessage)engine.SendSLNetSingleResponseMessage(request);
AlarmEventMessage[] alarms = response.ActiveAlarms;
This will return you a collection with the alarms for that given element.
This should work for your use case but I do have to add a disclaimer here that these kinds of SLNet calls are internal calls and typically not recommended to use since there is no official support and may be subject to change in the future.
If you only need the alarm count but not the alarm content itself then you could use Class Library and the GetActiveAlarmCount call.