Files
DP44/Common/DTS.Common/Classes/DASFactory/CanDiagnostics.cs
2026-04-17 14:55:32 -04:00

81 lines
2.3 KiB
C#

using DTS.Common.Interface.DASFactory.Diagnostics;
using System;
namespace DTS.Common.Classes.DASFactory
{
public class CanDiagnostics : Base.BasePropertyChanged, ICanDiagnosticResult
{
private bool _Active = false;
public bool Active
{
get => _Active;
set => SetProperty(ref _Active, value);
}
private int _ChannelIndex = -1;
public int ChannelIndex
{
get => _ChannelIndex;
set => SetProperty(ref _ChannelIndex, value);
}
private int _Data = 0;
public int Data
{
get => _Data;
set => SetProperty(ref _Data, value);
}
private int _ErrorFrame = 0;
public int ErrorFrame
{
get => _ErrorFrame;
set
{
SetProperty(ref _ErrorFrame, value);
OnPropertyChanged("Errors");
}
}
private double _Load;
public double Load
{
get => _Load;
set => SetProperty(ref _Load, value);
}
private int _Overruns = 0;
public int Overruns
{
get => _Overruns;
set
{
SetProperty(ref _Overruns, value);
OnPropertyChanged("Errors");
}
}
private DateTime _LastUpdate = DateTime.MinValue;
public DateTime LastUpdate
{
get => _LastUpdate;
set => SetProperty(ref _LastUpdate, value);
}
public int Errors
{
get => _ErrorFrame != 0 ? 1 + Overruns : Overruns;
}
private string _ChannelName = string.Empty;
public string ChannelName
{
get => _ChannelName;
set => SetProperty(ref _ChannelName, value);
}
public void Copy(ICanDiagnosticResult source)
{
Active = source.Active;
ChannelIndex = source.ChannelIndex;
Data = source.Data;
ErrorFrame = source.ErrorFrame;
Load = source.Load;
Overruns = source.Overruns;
LastUpdate = source.LastUpdate;
ChannelName = source.ChannelName;
}
}
}