1
0
Fork 0

Describe index meaning

This commit is contained in:
Michał Rudowicz 2024-03-03 14:25:34 +01:00
parent b19ae59a9c
commit d8e67643f5
2 changed files with 55 additions and 1 deletions

View File

@ -122,3 +122,57 @@ func (self MsgContent) FormatEvent() string {
} }
panic(fmt.Sprint("Unknown event received: ", self.SatelEvent)) panic(fmt.Sprint("Unknown event received: ", self.SatelEvent))
} }
func (self MsgContent) IndexDesc() string {
switch self.SatelEvent.Type {
case satel.ZoneViolation:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneTamper:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneAlarm:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneTamperAlarm:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneAlarmMemory:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneTamperAlarmMemory:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneBypass:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneNoViolationTrouble:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ZoneLongViolationTrouble:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
case satel.ArmedPartitionSuppressed:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.ArmedPartition:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionArmedInMode2:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionArmedInMode3:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionWith1stCodeEntered:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionEntryTime:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionExitTimeOver10s:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionExitTimeUnder10s:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionTemporaryBlocked:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionBlockedForGuardRound:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionAlarm:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionFireAlarm:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionAlarmMemory:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.PartitionFireAlarmMemory:
return fmt.Sprintf("Partition %d", self.SatelEvent.Index)
case satel.ZoneIsolate:
return fmt.Sprintf("Zone %d", self.SatelEvent.Index)
}
return fmt.Sprintf("Unknown index: %d", self.SatelEvent.Index)
}

View File

@ -2,7 +2,7 @@ package main
const TelegramMessageTemplate = `Received following changes: const TelegramMessageTemplate = `Received following changes:
{{- range .Messages}} {{- range .Messages}}
:: {{.SatelEvent.Index}}: {{.FormatEvent}} :: {{.IndexDesc}}: {{.FormatEvent}}
{{- else -}} {{- else -}}
Huh, no messages - this is a bug Huh, no messages - this is a bug
{{- end}}` {{- end}}`