Files
DP44/Common/DTS.Common/Classes/Sensors/CalMode.cs

66 lines
1.9 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
using System;
using System.Text;
namespace DTS.Common.Classes.Sensors
{
/// <summary>
/// helper class for the calmode in SIFs which is actually a 3 character sequence for shunt/bridge/filter
/// </summary>
public class CalMode
{
public bool ShuntCheck { get; set; }
public bool FullBridge { get; set; }
public bool Filter { get; set; }
public CalMode(string value)
{
switch (value[0])
{
case 'S':
ShuntCheck = true;
break;
case 'I':
ShuntCheck = false;
break;
default:
throw new NotSupportedException("TDAS::CalMode Invalid calmode position 0: " + value);
}
switch (value[1])
{
case 'D':
FullBridge = true;
break;
case 'S':
FullBridge = false;
break;
default:
throw new NotSupportedException("TDAS::CalMode Invalid calmode position 1: " + value);
}
switch (value[2])
{
case 'F':
Filter = true;
break;
case 'B':
Filter = false;
break;
default:
throw new NotSupportedException("TDAS::CalMode Invalid calmode position 2: " + value);
}
}
public CalMode() { }
public override string ToString()
{
var sb = new StringBuilder();
sb.Append(ShuntCheck ? 'S' : 'I');
sb.Append(FullBridge ? 'D' : 'S');
sb.Append(Filter ? 'F' : 'B');
return sb.ToString();
}
}
}