init
This commit is contained in:
65
Common/DTS.Common/Classes/Sensors/CalMode.cs
Normal file
65
Common/DTS.Common/Classes/Sensors/CalMode.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user