From c3c218d497627d8ea1c515a94a806b2339df9f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93mar=20H=C3=B6gni=20Gu=C3=B0marsson?= Date: Wed, 12 Jun 2024 12:50:11 +0000 Subject: [PATCH 1/3] Inital draft --- docs/design/snitch.md | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 docs/design/snitch.md diff --git a/docs/design/snitch.md b/docs/design/snitch.md new file mode 100644 index 0000000000..03bc21587c --- /dev/null +++ b/docs/design/snitch.md @@ -0,0 +1,62 @@ +# Alarm system ( Themis ) + +## Introduction +Handle the registration, activation level and notification of alarms. + +## Alarm template +Alarm messages have the requirement of being translateable, dynamic sections +of the message shall be marked with a fmt::formatable string. +Example of message strings +```txt +"Temperture out of bounds it is greater then {}" +"Actuation time out of bounds {}ms expected took {}ms" +"Frequency drive {} not reaching speed {} current {}" +``` +Please note that for the short and long text associated with an alarm the +dynamic variable count must be the same. + +## DBUS API +The alarm system is exposed through the `com.skaginn3x.Alarm` interface. + +### Methods + RegisterAlarm (s: alarm_name, i: alarm_level, b: non_latching) -> i: alarm_id Note errors can only be latched + ListAlarms (s: locale, i: start_count, i: count, i: alarm_level, i: active, x: startunixTimestamp, x: endUnixTimestamp) -> a(ssbib) Note active = -1 for all, alarm_level = -1 for all a max size of 100 alarms will be sent at a time + SetAlarm(i: alarm_id, as: variables) + ResetAlarm(i: alarm_id) + AckAlarm(i: alarm_id) + AckAllAlarms() +### Signals + AlarmChanged(i: alarm_id, b: current_activation, b: ack_status) +### Properties + As of now there are no properties +## Database schema +``` +Alarms +|alarm_id|exe.id.component|sha1sum|alarm_level|template_short_en|template_en|alarm_latching| + +SHA1SUM is the SHA1SUM of both alarm_template_short_en and alarm_template_en +Combined primary key of exe.id.component and SHA1SUM +this combination shall be unique + +Alarm translation +|sha1sum|locale|alarm_template_short|alarm_template + +Alarm activations +|activation_id|alarm_id|timestamp|activation_level| + +Alarm acks +|activation_id|ack_timestamp| + +Alarm variables +|activation_id|variable_index|variable_string| +``` + + +## Policy +Executables must register their alarms on construction. Unregistered alarms cannot be notified. + +Once an alarm is registered the Alarm with Themis he will monitor the NameLost signal for the +name that registered the alarm. If the name is lost the alarm will be deactivated. + +If an alarm is registered having changed the level or latching attributes the alarm shall be +updated in the database \ No newline at end of file From ca64b244580a228d22490d5bcf9e4ee8198816cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Bjarni?= Date: Thu, 13 Jun 2024 13:56:30 +0000 Subject: [PATCH 2/3] Update docs/design/snitch.md --- docs/design/snitch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/snitch.md b/docs/design/snitch.md index 03bc21587c..504e8d767f 100644 --- a/docs/design/snitch.md +++ b/docs/design/snitch.md @@ -4,7 +4,7 @@ Handle the registration, activation level and notification of alarms. ## Alarm template -Alarm messages have the requirement of being translateable, dynamic sections +Alarm messages have the requirement of being translatable, dynamic sections of the message shall be marked with a fmt::formatable string. Example of message strings ```txt From 22cfc74e1a08e135b689df47c23ba510147d9fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Bjarni?= Date: Thu, 13 Jun 2024 13:57:07 +0000 Subject: [PATCH 3/3] Update docs/design/snitch.md --- docs/design/snitch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/snitch.md b/docs/design/snitch.md index 504e8d767f..0eec63682c 100644 --- a/docs/design/snitch.md +++ b/docs/design/snitch.md @@ -5,7 +5,7 @@ Handle the registration, activation level and notification of alarms. ## Alarm template Alarm messages have the requirement of being translatable, dynamic sections -of the message shall be marked with a fmt::formatable string. +of the message shall be marked with a fmt formattable string. Example of message strings ```txt "Temperture out of bounds it is greater then {}"