small fixes in program Salimax
This commit is contained in:
parent
89492a76e2
commit
dd19222728
|
@ -51,8 +51,8 @@ internal static class Program
|
||||||
|
|
||||||
private const String VpnServerIp = "194.182.190.208";
|
private const String VpnServerIp = "194.182.190.208";
|
||||||
|
|
||||||
private static IPAddress? _controllerIpAddress;
|
private static IPAddress? _controllerIpAddress;
|
||||||
private static UdpClient _udpListener;
|
private static UdpClient _udpListener = null!;
|
||||||
private static ConnectionFactory? _factory ;
|
private static ConnectionFactory? _factory ;
|
||||||
private static IConnection ? _connection;
|
private static IConnection ? _connection;
|
||||||
private static IModel? _channel;
|
private static IModel? _channel;
|
||||||
|
@ -219,8 +219,8 @@ internal static class Program
|
||||||
Watchdog.NotifyAlive();
|
Watchdog.NotifyAlive();
|
||||||
|
|
||||||
var record = ReadStatus();
|
var record = ReadStatus();
|
||||||
var currentSalimaxState = GetSalimaxStateAlarm(record);
|
|
||||||
|
|
||||||
|
var currentSalimaxState = GetSalimaxStateAlarm(record);
|
||||||
|
|
||||||
SendSalimaxStateAlarm(currentSalimaxState);
|
SendSalimaxStateAlarm(currentSalimaxState);
|
||||||
|
|
||||||
|
@ -300,11 +300,14 @@ internal static class Program
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_factory = new ConnectionFactory { HostName = VpnServerIp };
|
_factory = new ConnectionFactory { HostName = VpnServerIp };
|
||||||
_connection = _factory.CreateConnection();
|
_connection = _factory.CreateConnection();
|
||||||
_channel = _connection.CreateModel();
|
_channel = _connection.CreateModel();
|
||||||
_channel.QueueDeclare(queue: "statusQueue", durable: false, exclusive: false, autoDelete: false, arguments: null);
|
|
||||||
|
_channel.QueueDeclare(queue: "statusQueue", durable: true, exclusive: false, autoDelete: false, arguments: null);
|
||||||
|
|
||||||
Console.WriteLine("The controller sends its status to the middleware for the first time");
|
Console.WriteLine("The controller sends its status to the middleware for the first time");
|
||||||
|
|
||||||
if (s3Bucket != null) InformMiddleware(s3Bucket, (Int32)currentSalimaxState);
|
if (s3Bucket != null) InformMiddleware(s3Bucket, (Int32)currentSalimaxState);
|
||||||
|
|
||||||
_subscribedToQueue = true;
|
_subscribedToQueue = true;
|
||||||
|
@ -375,12 +378,14 @@ internal static class Program
|
||||||
|
|
||||||
var salimaxAlarmsState = (record.Battery is not null && record.Battery.Warnings.Any())
|
var salimaxAlarmsState = (record.Battery is not null && record.Battery.Warnings.Any())
|
||||||
| record.AcDc.Warnings.Any()
|
| record.AcDc.Warnings.Any()
|
||||||
|
| record.AcDc.SystemControl.Warnings.Any()
|
||||||
| record.DcDc.Warnings.Any()
|
| record.DcDc.Warnings.Any()
|
||||||
? SalimaxAlarmState.Orange
|
? SalimaxAlarmState.Orange
|
||||||
: SalimaxAlarmState.Green; // this will be replaced by LedState
|
: SalimaxAlarmState.Green; // this will be replaced by LedState
|
||||||
|
|
||||||
salimaxAlarmsState = (record.Battery is not null && record.Battery.Alarms.Any())
|
salimaxAlarmsState = (record.Battery is not null && record.Battery.Alarms.Any())
|
||||||
| record.AcDc.Alarms.Any()
|
| record.AcDc.Alarms.Any()
|
||||||
|
| record.AcDc.SystemControl.Alarms.Any()
|
||||||
| record.DcDc.Alarms.Any()
|
| record.DcDc.Alarms.Any()
|
||||||
| alarmCondition is not null
|
| alarmCondition is not null
|
||||||
? SalimaxAlarmState.Red
|
? SalimaxAlarmState.Red
|
||||||
|
|
Loading…
Reference in New Issue