98 lines
2.5 KiB
C#
98 lines
2.5 KiB
C#
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.RFTelegrams
|
|
{
|
|
public class LogContent
|
|
{
|
|
private readonly byte[] bits = new byte[16];
|
|
|
|
public LogContent(ushort value = 0)
|
|
=> this.bits = value.GetBitsLE();
|
|
|
|
public bool ForwardCounter
|
|
{
|
|
get => this.bits[12] == 1;
|
|
set => this.bits[12] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool TimeOfMinimumFlow
|
|
{
|
|
get => this.bits[11] == 1;
|
|
set => this.bits[11] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool MinimumFlow
|
|
{
|
|
get => this.bits[10] == 1;
|
|
set => this.bits[10] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool TimeOfBrokenPipe
|
|
{
|
|
get => this.bits[9] == 1;
|
|
set => this.bits[9] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool BrokenPipeFlow
|
|
{
|
|
get => this.bits[8] == 1;
|
|
set => this.bits[8] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool CurrentFlow
|
|
{
|
|
get => this.bits[7] == 1;
|
|
set => this.bits[7] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool TimeOfPeakFlow
|
|
{
|
|
get => this.bits[6] == 1;
|
|
set => this.bits[6] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool PeakFlow
|
|
{
|
|
get => this.bits[5] == 1;
|
|
set => this.bits[5] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool TimeOfMaximumFlow
|
|
{
|
|
get => this.bits[4] == 1;
|
|
set => this.bits[4] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool MaximumFlow
|
|
{
|
|
get => this.bits[3] == 1;
|
|
set => this.bits[3] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool BackwardVolume
|
|
{
|
|
get => this.bits[2] == 1;
|
|
set => this.bits[2] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool Counter
|
|
{
|
|
get => this.bits[1] == 1;
|
|
set => this.bits[1] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public bool AlarmState
|
|
{
|
|
get => this.bits[0] == 1;
|
|
set => this.bits[0] = (byte)(value ? 1 : 0);
|
|
}
|
|
|
|
public override string ToString()
|
|
=> string.Join(string.Empty, this.bits);
|
|
|
|
public static implicit operator LogContent(ushort value)
|
|
=> new LogContent(value);
|
|
|
|
public static implicit operator ushort(LogContent value)
|
|
=> value.bits.ToUIint16LEFromBits();
|
|
}
|
|
}
|