Files
DP44/Common/DTS.Common/Enums/TTS/TTSEnums.cs

148 lines
5.7 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
using System;
using System.ComponentModel;
using System.Linq;
namespace DTS.Common.Enums.TTS
{
/// <summary>
/// used to indicate the current support for the field
/// 18396 TTS import has too many columns and it makes confusion
/// </summary>
public enum FieldSupportLevel
{
RequiredParameter,
RemainedButNotUsed,
RemovedParameter
}
/// <summary>
/// an attribute that can be used to mark fields as required, ignore, or removed
/// used in 18396 but could be applied to other enums pretty easily
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class FieldSupportAttribute : Attribute
{
public FieldSupportLevel SupportLevel { get; set; }
/// <summary>
/// constructs a <see cref="ExcitationVoltageOptions.VoltageMagnitudeAttribute" />
/// with a given value
/// </summary>
/// <param name="value"></param>
public FieldSupportAttribute(FieldSupportLevel value) { SupportLevel = value; }
/// <summary>
/// returns the support level for the enum value
/// </summary>
/// <param name="genericEnum"></param>
/// <returns></returns>
public static FieldSupportLevel GetSupportLevel(Enum genericEnum)
{
Type genericEnumType = genericEnum.GetType();
var memberInfo = genericEnumType.GetMember(genericEnum.ToString());
if ((memberInfo != null && memberInfo.Length > 0))
{
var attribs = memberInfo[0].GetCustomAttributes(typeof(FieldSupportAttribute), false);
if (attribs != null && attribs.Any())
{
return ((FieldSupportAttribute)attribs.ElementAt(0)).SupportLevel;
}
}
return FieldSupportLevel.RemovedParameter;
}
}
public enum ToyotaFieldOrder
{
[FieldSupport(FieldSupportLevel.RequiredParameter)]
ChannelNumber = 0,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
ChannelCode = 1,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
JCodeOrDescription = 2,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
ChannelRange = 3,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
ChannelFilterHz = 4,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
SensorID = 5,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
SensorSerialNumber = 6,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
SensorSensitivity = 7,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
SensorExcitationVolts = 8,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
SensorCapacity = 9,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
SensorEU = 10,
[FieldSupport(FieldSupportLevel.RequiredParameter)]
SensorPolarity = 11,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
ChannelType = 12,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
Description = 13,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
ProportionalToExcitation = 14,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
BridgeResistance = 15,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
InitialOffsetVoltage = 16,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
InitialOffsetVoltageTolerance = 17,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
RemoveOffset = 18,
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
ZeroMethod = 19,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
CableCompensationMultiplier = 20,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
InitialEUInMV = 21,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
InitialEUInEU = 22,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
IRTRACCExponent = 23,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
PolynomialConstant = 24,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
PolynomialCoefficentC = 25,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
PolynomialCoefficentB = 26,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
PolynomialCoefficentA = 27,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
PolynomialCoefficentAlpha = 28,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
ISOCode = 29,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
ISODescription = 30,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
ISOPolarity = 31,
[FieldSupport(FieldSupportLevel.RemovedParameter)]
KyowaSpecificField_1 = 32, //http://fogbugz/fogbugz/default.asp?5433
}
public enum ToyotaBridgeType
{
[Description("Full Bridge")]
FullBridge,
[Description("Half Bridge")]
HalfBridge,
[Description("Voltage")]
Voltage,
[Description("PotentiometerFB")]
PotentionmeterFullBridge,
[Description("PotentiometerHB")]
PotentionmeterHalfBridge,
[Description("IRTRACC")]
IRTRACC,
[Description("LinearChestPot")]
LinearChestPot
}
public enum ToyotaZeroMethods
{
[Description("0")]
None = 0,
[Description("1")]
AverageOverTime = 1,
[Description("2")]
UsePreEventDiagnosticsZero = 2
}
}