-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c73046a
commit ad8811b
Showing
4 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
/* | ||
Global definition area of "Scheduled Tasks" | ||
*/ | ||
import { AlarmManager } from 'Alarming'; | ||
import * as module_alarmline from 'Alarmline'; | ||
|
||
|
||
//Alarmfilter string for Alarmlines configured like Alarm Control Filter | ||
export const alarmlineFilter = "AlarmClassName <> 'SystemNotification' AND AlarmClassName <> 'SystemAlarm' AND AlarmClassName <> 'SystemAlarmWithoutClearEvent' AND AlarmClassName <> 'SystemInformation' AND AlarmClassName <> 'SystemWarning' AND AlarmClassName <> 'SystemWarningWithoutClearEvent'"; | ||
let alMgr = undefined; | ||
|
||
/** | ||
* Task to update the alarms. | ||
* This function is responsible for starting the alarm-subscription based on the system activation state. | ||
*/ | ||
export function Task_AlarmsUpdate_Update() { | ||
export function Task_AlarmUpdate_Update() { | ||
if (Tags('@SystemActivationState').Read() === 2) { | ||
//on startup, start the alarm subscription | ||
if (!alMgr) { | ||
const alarmlineFilter = ''; //"AlarmClassName <> 'SystemNotification' AND AlarmClassName <> 'SystemAlarm' AND AlarmClassName <> 'SystemAlarmWithoutClearEvent' AND AlarmClassName <> 'SystemInformation' AND AlarmClassName <> 'SystemWarning' AND AlarmClassName <> 'SystemWarningWithoutClearEvent'"; | ||
alMgr = new AlarmManager({ | ||
language: 127, // default language | ||
alMgr = new module_alarmline.AlarmManager({ | ||
language: 1033, | ||
filter: alarmlineFilter, | ||
sortOrderDescending: false, | ||
callback: (allAlarms) => { Tags('AlarmsCount').Write(allAlarms.length); }, | ||
sortOrderDescending: Tags('SortOrderDescending').Read(), | ||
callback: module_alarmline.UpdateActiveAlarms, | ||
delayInMilliseconds: 250 | ||
}); | ||
alMgr.StartSubscription(); | ||
} else { | ||
//if alarm subscription was already started, update on the sort order | ||
alMgr.SetSortOrder(Tags('SortOrderDescending').Read()); | ||
} | ||
} | ||
} |