Files
2026-04-17 14:55:32 -04:00

5.6 KiB
Raw Permalink Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Enums/TTS/TTSEnums.cs
2026-04-16T03:21:01.092126+00:00 Qwen/Qwen3-Coder-Next-FP8 1 d044aea8e131ba46

Documentation: DTS.Common.Enums.TTS.TTSEnums

1. Purpose

This module defines enumerations and a custom attribute used to manage field-level metadata for TTS (likely Test & Test System or Twin-Tee Sensor) import configurations, specifically in the context of Toyota-specific sensor channel definitions. It addresses issue #18396, where TTS import files contain a large number of columns, leading to confusion about which fields are actively used. The FieldSupportLevel enum and FieldSupportAttribute allow developers to declaratively mark enum fields as RequiredParameter, RemainedButNotUsed, or RemovedParameter, enabling runtime introspection to filter or validate fields during import processing.

2. Public Interface

FieldSupportLevel

Type: enum
Values:

  • RequiredParameter: Field is actively required and used.
  • RemainedButNotUsed: Field exists in the data model/import but is not currently used.
  • RemovedParameter: Field has been deprecated and should be ignored.

FieldSupportAttribute

Type: class (custom attribute)
Namespace: DTS.Common.Enums.TTS
Usage: [FieldSupport(FieldSupportLevel)] applied to enum fields.
Properties:

  • SupportLevel (FieldSupportLevel): Gets or sets the support level assigned to the attributed field.
    Methods:
  • FieldSupportAttribute(FieldSupportLevel value): Constructor.
  • static FieldSupportLevel GetSupportLevel(Enum genericEnum): Returns the FieldSupportLevel for a given enum value by reflecting on its FieldSupportAttribute. If no attribute is present, defaults to FieldSupportLevel.RemovedParameter.

ToyotaFieldOrder

Type: enum
Purpose: Defines the column order (0-based index) for fields in Toyota TTS import files. Each field is annotated with a FieldSupportAttribute indicating its current support status.
Key Fields (selected):

  • ChannelNumber (0) → RequiredParameter
  • SensorID (5) → RemainedButNotUsed
  • InitialOffsetVoltageTolerance (17) → RemovedParameter
  • KyowaSpecificField_1 (32) → RemovedParameter (with FogBugz reference)

ToyotaBridgeType

Type: enum
Purpose: Represents supported bridge configurations for sensors.
Values:

  • FullBridge, HalfBridge, Voltage, PotentionmeterFullBridge, PotentionmeterHalfBridge, IRTRACC, LinearChestPot
    Note: Values use [Description] attributes (from System.ComponentModel) but no FieldSupportAttribute; support level is not explicitly declared here.

ToyotaZeroMethods

Type: enum
Purpose: Defines zeroing methods for sensor calibration.
Values:

  • None (0)
  • AverageOverTime (1)
  • UsePreEventDiagnosticsZero (2)
    Note: Values use [Description] attributes (e.g., "0", "1") but no FieldSupportAttribute; support level is not explicitly declared here.

3. Invariants

  • FieldSupportAttribute.GetSupportLevel(Enum) behavior:
    • Always returns a valid FieldSupportLevel.
    • If the provided enum value has no FieldSupportAttribute applied, returns FieldSupportLevel.RemovedParameter as a safe default.
  • ToyotaFieldOrder fields:
    • Each field must have exactly one FieldSupportAttribute (enforced by design, though not compile-time validated).
    • The integer values are fixed and correspond to column indices in the TTS import file (032).
  • ToyotaBridgeType and ToyotaZeroMethods:
    • No FieldSupportAttribute is applied to any of their fields. Their support status is not managed by this module and must be handled elsewhere (e.g., in documentation or other attributes).

4. Dependencies

Dependencies of this module:

  • System (core runtime)
  • System.ComponentModel (for [Description] attribute used in ToyotaBridgeType and ToyotaZeroMethods)
  • System.Linq (used in FieldSupportAttribute.GetSupportLevel via .Any() and .ElementAt())

Dependencies on this module:

  • Not specified in source, but implied usage:
    • TTS import logic (e.g., a parser or validator) likely consumes FieldSupportAttribute.GetSupportLevel() to filter columns.
    • UI or configuration tools may use ToyotaFieldOrder to map UI controls to import columns.
    • ToyotaBridgeType and ToyotaZeroMethods are likely used in sensor configuration classes (not shown here).

5. Gotchas

  • Default support level: FieldSupportAttribute.GetSupportLevel(Enum) silently defaults to RemovedParameter for enums without the attribute—this may mask missing annotations.
  • Reflection overhead: GetSupportLevel uses reflection (GetMember, GetCustomAttributes) on every call. Not suitable for high-frequency use without caching.
  • ToyotaBridgeType/ToyotaZeroMethods lack FieldSupportAttribute: Their support status is undefined in this module. Developers must infer or document separately.
  • Typos in enum names: PotentionmeterFullBridge and PotentionmeterHalfBridge are misspelled (should be Potentiometer).
  • Historical references: KyowaSpecificField_1 includes a FogBugz URL (http://fogbugz/fogbugz/default.asp?5433), which may be internal-only and inaccessible externally.
  • No validation of FieldSupportAttribute placement: The attribute is only valid on fields (AttributeTargets.Field), but misuse (e.g., on properties) will compile but fail at runtime in GetSupportLevel.