using System; using System.Text; namespace DTS.Common.Classes.Sensors { /// /// helper class for the calmode in SIFs which is actually a 3 character sequence for shunt/bridge/filter /// 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(); } } }