// Line number // Account number // Code // Zone // Area // User // Timestamp // New/Old // ASCII public static SiaAlarm Process(string data) { var alarm = new SiaAlarm { Interface = GetInterface(data.Substring(0, 4)) //Line number }; AlarmFormat(alarm, data); return(alarm); }
private static string GetEventString(SiaAlarm alrm) { var s = $"Event: {alrm.Code} - {alrm.Ascii}"; if (!string.IsNullOrEmpty(alrm.Zone)) { s += $"\tZone: {alrm.Zone}"; } if (!string.IsNullOrEmpty(alrm.Area)) { s += $"\tArea: {alrm.Area}"; } if (!string.IsNullOrEmpty(alrm.User)) { s += $"\tUser: {alrm.User}"; } return(s); }
public async Task SendToWebhook(SiaAlarm alarm) => await SendToWebhook(accountsHandler.GetUsername(alarm.AccountNumber), SiaAlarm.GetWebhookAlarmString(alarm));
public void LogAlarm(SiaAlarm alarm) { lock (logLock) alarms.Add(alarm); }
public static string GetWebhookAlarmString(SiaAlarm alrm) => $"Account: {alrm.AccountNumber} ({alrm.Interface})\n{GetEventString(alrm)}\n";