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

6.1 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Enums/TTS/TTSEnums.cs
2026-04-16T02:43:11.533810+00:00 Qwen/Qwen3-Coder-Next-FP8 1 f097505e03f0c09d

TTS

Documentation: DTS.Common.Enums.TTS.TTSEnums

1. Purpose

This module defines enumerations and supporting attributes used to manage field-level metadata for TTS (likely Test & Test System or Transducer Test System) import configurations, specifically addressing legacy column mapping issues (e.g., issue #18396). It provides a structured way to classify fields by their current relevance (RequiredParameter, RemainedButNotUsed, RemovedParameter) and supports parsing and validation of TTS import data through the FieldSupportAttribute. The enums ToyotaFieldOrder, ToyotaBridgeType, and ToyotaZeroMethods model domain-specific configuration options for sensor/channel setup.


2. Public Interface

FieldSupportLevel enum

  • Values:
    • RequiredParameter: Field is actively used and required.
    • RemainedButNotUsed: Field exists in legacy data but is ignored in processing.
    • RemovedParameter: Field is obsolete and no longer present in current data formats.

FieldSupportAttribute class

  • Inherits: Attribute
  • Usage: Applied to enum fields to declare their support status.
  • Properties:
    • SupportLevel: Gets or sets the FieldSupportLevel value assigned to the attributed enum member.
  • Methods:
    • FieldSupportAttribute(FieldSupportLevel value): Constructor setting SupportLevel.
    • static FieldSupportLevel GetSupportLevel(Enum genericEnum):
      • Returns the FieldSupportLevel associated with the given enum value via its FieldSupportAttribute.
      • If no attribute is present, returns FieldSupportLevel.RemovedParameter as default.

ToyotaFieldOrder enum

  • Purpose: Represents ordered column indices for TTS import (e.g., CSV/Excel), with each member annotated with FieldSupportAttribute.
  • Key Members:
    • ChannelNumber, ChannelCode, JCodeOrDescription, ChannelRange, ChannelFilterHz, SensorSerialNumber, SensorExcitationVolts, SensorPolarity: Marked RequiredParameter.
    • SensorID, SensorSensitivity, SensorCapacity, SensorEU, ChannelType, Description, ProportionalToExcitation, BridgeResistance, InitialOffsetVoltage, RemoveOffset, ZeroMethod: Marked RemainedButNotUsed.
    • InitialOffsetVoltageTolerance, CableCompensationMultiplier, InitialEUInMV, InitialEUInEU, IRTRACCExponent, PolynomialConstant, PolynomialCoefficentC/B/A/Alpha, ISOCode, ISODescription, ISOPolarity, KyowaSpecificField_1: Marked RemovedParameter.

ToyotaBridgeType enum

  • Purpose: Defines supported bridge configurations for sensors.
  • Values:
    • FullBridge, HalfBridge, Voltage, PotentionmeterFullBridge, PotentionmeterHalfBridge, IRTRACC, LinearChestPot.
  • Notes: Each value has a [Description] attribute (from System.ComponentModel), but no custom attribute or behavior is defined for it in this file.

ToyotaZeroMethods enum

  • Purpose: Specifies zeroing methods for sensor calibration.
  • Values:
    • None = 0 (Description: "0"),
    • AverageOverTime = 1 (Description: "1"),
    • UsePreEventDiagnosticsZero = 2 (Description: "2").
  • Notes: Only [Description] attributes are present; no custom support-level metadata.

3. Invariants

  • FieldSupportAttribute.GetSupportLevel behavior:
    • For any Enum value, if the field lacks a FieldSupportAttribute, the method always returns FieldSupportLevel.RemovedParameter.
    • The method relies on reflection (GetMember, GetCustomAttributes) and is not optimized; performance may degrade with frequent use.
  • ToyotaFieldOrder ordering:
    • Values are explicitly assigned sequential integer indices starting at 0, implying strict positional semantics (e.g., column order in an import file).
    • The FieldSupportLevel annotations are static metadata and do not affect runtime behavior unless explicitly consumed elsewhere.
  • No validation logic is defined in this module: The enums and attribute serve as declarative metadata; enforcement of support levels occurs in dependent code.

4. Dependencies

  • Dependencies on other modules:
    • System (core runtime types), System.ComponentModel (for DescriptionAttribute), System.Linq (for Any(), ElementAt() in GetSupportLevel).
  • Used by:
    • Not specified in this file, but FieldSupportAttribute.GetSupportLevel is clearly designed for use in TTS import/parsing logic (e.g., to filter columns during data loading).
    • ToyotaFieldOrder is likely referenced by import handlers to map columns to properties.
    • ToyotaBridgeType and ToyotaZeroMethods are likely used in sensor configuration classes or UI components.

5. Gotchas

  • GetSupportLevel default behavior:
    • Missing FieldSupportAttribute on an enum field silently defaults to RemovedParameter, which may mask omissions during refactoring.
  • Typos in ToyotaBridgeType:
    • PotentionmeterFullBridge and PotentionmeterHalfBridge are misspelled (should be Potentiometer). This is preserved in the source.
  • ToyotaZeroMethods descriptions are numeric strings:
    • Descriptions ("0", "1", "2") match the underlying values but provide no semantic clarity. This may cause confusion if used in UI or logs.
  • No runtime enforcement of FieldSupportLevel:
    • The enum and attribute are metadata-only; consumers must explicitly check GetSupportLevel to act on support status.
  • Historical context:
    • The KyowaSpecificField_1 comment references an internal Fogbugz link (http://fogbugz/fogbugz/default.asp?5433), suggesting legacy vendor-specific handling that may be obsolete or poorly documented.
  • Reflection overhead:
    • GetSupportLevel uses reflection on every call; caching is not implemented. Repeated use in hot paths may impact performance.