# AlarmManagerHandler

## `AlarmManagerHandler` (FB)

FUNCTION\_BLOCK AlarmManagerHandler

This function block provides an alarm buffer list for each alarm configured in the configuration list. It is independent of the alarm state; even inactive alarms and alarms in the normal state are shown.

The "AlarmTraversalConsumer" is used to retrieve all alarm data. The data is not read directly via this function block itself; the "AlarmTraversalConsumer" can be understood as a listener. The data is accessed exclusively via the pointer to the "AlarmManagerBuffer". This pointer is returned by the "AlarmTraversalConsumer", which provides a get method for this purpose.

All data for each alarm row is held in the "stAlarmRowStructure", and each row is stored in the buffer array "m\_paAlarmBuffer". The buffer can be accessed via the "ppaFilterAlarms" pointer. Only the filtered data is provided in this buffer.

Please note that only the data within the maximum configured number of alarms is read. This results in a significant performance gain. The data is also stored only once in the "AlarmManagerBuffer"; the buffer is addressed exclusively via the pointer.

With this function block, all alarms are accessible via IEC code, giving you the possibility to use them for other purposes or to define behavior rules. There are some standard rules that can be used. Different field information can be used to filter all alarms. "IMessageExecution" can be implemented to define custom alarm rules.

InOut:

| Scope  | Name                            | Type                                                                                                                     | Comment                                                                                                                                      |
| ------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Input  | `xForceDeactivateAlarmMessages` | `BOOL`                                                                                                                   | <p>Deactivate Alarm Messages (deactivates all alarm messages<br>and ignores the last state of them)</p>                                      |
| Input  | `itfMessageExecution`           | IMessageExecution                                                                                                        | Interface to define message execution rules.                                                                                                 |
| Input  | `paPolicyList`                  | <p>POINTER TO ARRAY<br>\[0..ConstantParameters.gc\_iMaxPolicyRules]<br>OF stPolicy</p>                                   | The list which holds all policy rules.                                                                                                       |
| Input  | `paGroupList`                   | <p>POINTER TO ARRAY<br>\[0..ConstantParameters.gc\_iMaxGroupRules]<br>OF stGroup</p>                                     | The list which holds all groups.                                                                                                             |
| Input  | `xCreateFilterList`             | `BOOL`                                                                                                                   | <p>On rising edge the "ppaFilteredAlarms" list will be created<br>with the configured parameters "sFilterByType" and<br>"sFilterString".</p> |
| Input  | `sFilterByType`                 | eFilterType                                                                                                              | Filter by type (e.g.: "AlarmClass" or "AlarmGroup")                                                                                          |
| Input  | `sFilterString`                 | `STRING`                                                                                                                 | <p>Filter the list with the configured type and the matching<br>filter string</p>                                                            |
| Inout  | `ppaFilteredAlarms`             | <p>POINTER TO POINTER TO<br>ARRAY<br>\[0..ConstantParameters.gc\_iMaxAlarms]<br>OF POINTER TO<br>stAlarmRowStructure</p> | <p>The filtered list, which is dynamically created by the given<br>filter parameters.</p>                                                    |
| Output | `iFilteredAlarmRows`            | `INT`                                                                                                                    | <p>the upper bound for the size of the filtered alarm buffer<br>list.</p>                                                                    |
| Output | `eError`                        | ERROR                                                                                                                    |                                                                                                                                              |
| Output | `stEmailStateInfo`              | stEmailState                                                                                                             |                                                                                                                                              |
| Output | `sAlarmTextPortal`              | `STRING(255)`                                                                                                            |                                                                                                                                              |
