This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,314 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Model/WorkFunctionThreadData.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/SummaryChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/ChannelSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DasSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/HardwareSummaryRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSTestSetup.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSLevelTriggerRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DASChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSChannelRecord.cs
generated_at: "2026-04-16T04:50:55.201620+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7bc3f89b4437f095"
---
# Model
**Documentation: TTS Import Model Layer**
---
### 1. Purpose
This module provides core data models for representing test setup configurations, hardware channel assignments, and sensor metadata in the TTS (Toyota Test System) import workflow. It serves as the domain model layer for parsing, editing, and serializing TTS test configurations—primarily from CSV files or hardware scans—while supporting real-time UI binding via `INotifyPropertyChanged`. The models encapsulate channel definitions (`TTSChannelRecord`), hardware channel wrappers (`DASChannel`), level trigger logic (`TTSLevelTriggerRecord`), and summary data structures (`ChannelSummary`, `DasSummary`, `SummaryChannel`, `HardwareSummaryRecord`). These classes are used by UI view models and import/export logic to manage sensor-to-hardware assignments, trigger thresholds, and validation rules.
---
### 2. Public Interface
#### `WorkFunctionThreadData`
- **`ManualResetEvent CancelEvent { get; }`**
Signal to request cancellation of a background operation.
- **`ManualResetEvent DoneEvent { get; }`**
Signal to indicate completion of a background operation.
*Constructor initializes both events to non-signaled state.*
#### `SummaryChannel`
- **`string ChannelType { get; set; }`**
Gets/sets the channel type string; raises `PropertyChanged` on change.
- **`int Assigned { get; set; }`**
Gets/sets the count of assigned channels; raises `PropertyChanged`.
- **`string Unassigned { get; set; }`**
Gets/sets the unassigned channel list string; raises `PropertyChanged`.
#### `ChannelSummary`
- **`string ChannelType { get; set; }`**
Channel type identifier; raises `PropertyChanged`.
- **`int Requested { get; set; }`**
Number of channels requested for this type; raises `PropertyChanged`.
- **`int Assigned { get; set; }`**
Number of channels assigned; raises `PropertyChanged`.
- **`int Unassigned { get; set; }`**
Number of channels unassigned; raises `PropertyChanged`.
#### `DasSummary`
- **`string DASSerial { get; set; }`**
DAS unit serial number; raises `PropertyChanged`.
- **`string EIDFound { get; set; }`**
EID status string (e.g., "Found"/"Missing"); raises `PropertyChanged`.
- **`string BatteryVoltageStatus { get; set; }`**
Battery voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }`**
Brush for UI color coding of battery status; raises `PropertyChanged`.
- **`string InputVoltageStatus { get; set; }`**
Input voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }`**
Brush for UI color coding of input voltage status; raises `PropertyChanged`.
#### `HardwareSummaryRecord`
- **`uint DOut { get; set; }`**
Count of digital output channels; raises `PropertyChanged`.
- **`uint DIn { get; set; }`**
Count of digital input channels; raises `PropertyChanged`.
- **`uint Squib { get; set; }`**
Count of squib channels; raises `PropertyChanged`.
- **`uint Analog { get; set; }`**
Count of analog channels; raises `PropertyChanged`.
- **`uint SPS { get; set; }`**
Count of SPS modules; raises `PropertyChanged`.
- **`uint SPD { get; set; }`**
Count of SPD modules; raises `PropertyChanged`.
- **`uint SPT { get; set; }`**
Count of SPT modules; raises `PropertyChanged`.
- **`uint ECM { get; set; }`**
Count of ECM modules; raises `PropertyChanged`.
- **`uint Rack { get; set; }`**
Count of rack units; raises `PropertyChanged`.
- **`uint G5 { get; set; }`**
Count of G5 modules; raises `PropertyChanged`.
- **`uint Total { get; private set; }`**
Sum of `Analog + Squib + DIn + DOut`; *only updated via `UpdateTotal()`*.
- **`void UpdateTotal()`**
Recalculates `Total` as sum of analog, squib, digital input, and digital output counts.
- **`void Update(uint analog, uint squib, uint din, uint dout, uint ecm, uint sps, uint spt, uint spd, uint g5, uint rack)`**
Sets all module counts and calls `UpdateTotal()`.
#### `TTSTestSetup`
- **`double SampleRate { get; set; }`**
Sampling rate in Hz.
- **`RecordingModes Mode { get; set; }`**
Recording mode enum (e.g., Circular, File).
- **`double TestLength { get; }`**
Computed as `PreTrigger + PostTrigger`.
- **`double PreTrigger { get; set; }`**
Pre-trigger time in seconds.
- **`double PostTrigger { get; set; }`**
Post-trigger time in seconds.
- **`double ROIStart { get; set; }`**
Region of interest start time (seconds).
- **`double ROIEnd { get; set; }`**
Region of interest end time (seconds).
- **`string Filename { get; set; }`**
Path to the imported CSV file.
- **`string TestId { get; set; }`**
Test identifier string.
- **`string Line1 { get; set; }`**, **`Line2 { get; set; }`**, **`Line3 { get; set; }`**, **`Line4 { get; set; }`**
First four lines of the CSV header (used when generating new CSVs).
- **`string[] DummyList { get; set; }`**
Array of 8 strings (purpose unclear from source).
- **`ITTSChannelRecord[] Channels { get; set; }`**
Array of channel records.
- **`ILevelTrigger[] LevelTriggers { get; }`**
Fixed-size array of 6 `ILevelTrigger` instances (initialized in constructor).
- **`string OriginalImportFile { get; set; }`**
Path of the original imported file.
- **`bool AllowAdvancedRecordingModes { get; set; }`**
Enables HybridRecorder mode.
- **`bool AllowActiveRecordingModes { get; set; }`**
Enables Active RAM and Active RAM Multiple modes.
- **`bool AllowTSRAIRRecordingModes { get; set; }`**
Enables TSRAIR modes.
- **`bool RequireEIDFound { get; set; }`**
If `true`, sensors without EIDs are excluded.
- **`string DefaultDigitalInputMode { get; set; }`**
Default digital input mode from config.
- **`ISquibSettingDefaults SquibDefaults { get; set; }`**
Default squib settings.
- **`double DefaultSquibFireDurationMs { get; set; }`**
Default squib fire duration (ms) from config.
- **`Tuple<string, string>[] PreAssignedSensorIdAndHwId { get; set; }`**
Pre-existing sensor-to-hardware assignments (from XML import).
- **`string GetHashCode()`**
Computes SHA-256 hash over key properties and channel/trigger data; *note: overrides `object.GetHashCode()` but is named `GetHashCode()` (not `override`)*.
#### `TTSLevelTriggerRecord`
- **`string Code { get; }`**
Channel code of associated `Channel` (`""` if none).
- **`string JCode { get; }`**
JCode/Description of associated `Channel` (`""` if none).
- **`double ValuePercent { get; set; }`**
Threshold as % of full scale; triggers `RecalculateEUValue()`.
- **`double ValueEU { get; set; }`**
Threshold in engineering units; triggers `RecalculatePercent()`.
- **`string EULabel { get; }`**
Engineering unit label from `Channel.SensorEU`.
- **`string HWSerialNumber { get; }`**
Hardware module serial number from `Channel.HardwareChannel`.
- **`int ChannelNumber { get; }`**
TTS channel number from `Channel.ChannelNumber`.
- **`ITTSChannelRecord Channel { get; set; }`**
Sensor channel assignment; setter triggers `Refresh()` on *all other level triggers*.
- **`ITTSSetup TestSetup { get; }`**
Parent test setup instance.
- **`ITTSChannelRecord[] AvailableChannels { get; }`**
Read-only array of channels eligible for assignment, enforcing uniqueness of channel codes, SIMs (for TDASRack), and max 2 per G5.
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and not an empty record.
- **`bool IsModified { get; set; }`**
Flag indicating user modification.
- **`byte[] GetBytes()`**
Serializes active trigger data (code, JCode, ValueEU, HWSerialNumber).
- **`void Refresh()`**
Rebuilds `AvailableChannels`, revalidates current assignment, and raises `PropertyChanged("AvailableChannels")`.
- **`void Add(ITTSChannelRecord channel)`**
Raises `PropertyChanged("AvailableChannels")`.
- **`void Remove(ITTSChannelRecord channel)`**
Unassigns `Channel` if it matches, then raises `PropertyChanged("AvailableChannels")`.
#### `DASChannel`
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Gets/sets digital output mode; auto-adds/removes channel from `TestSetup.Channels`.
- **`double DigitalOutputDelayMs { get; set; }`**
Delay (ms) from trigger to output start.
- **`double DigitalOutputDurationMs { get; set; }`**
Duration (ms) of output pulse.
- **`string Polarity { get; set; }`**
`"+"` or `"-"`; maps to `Channel.SensorPolarity`.
- **`SquibFireMode SquibFireMode { get; set; }`**
Gets/sets squib fire mode (`CAP` or `CONSTANT`).
- **`bool Disabled { get; set; }`**
Dependency property for UI styling; reflects `Channel.Disabled`.
- **`ITTSChannelRecord Channel { get; private set; }`**
Associated TTS channel record (can be `null`).
- **`string DASChannelString { get; }`**
Hardware channel string representation (e.g., `[SPS00001] ch 13`).
- **`string ToyotaCode { get; set; }`**
Gets/sets `Channel.ChannelCode`.
- **`string EID { get; set; }`**
Electronic ID of sensor (if any).
- **`string Name { get; set; }`**
Gets/sets `Channel.JCodeOrDescription`.
- **`string SerialNumber { get; }`**
`Channel.SensorSerialNumber`.
- **`double Sensitivity { get; }`**
`Channel.SensorSensitivity`.
- **`string SensitivityString { get; }`**
Formatted sensitivity string (`N12`).
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and (not digital output or has non-`NONE` mode).
- **`double Capacity { get; }`**
`Channel.SensorCapacity`.
- **`double Range { get; set; }`**
Gets/sets `Channel.ChannelRange`.
- **`double CableMultiplier { get; set; }`**
Gets/sets `Channel.CableMultiplier`.
- **`double SquibFireDelayMs { get; set; }`**
Gets/sets `Channel.SquibFireDelayMs`.
- **`double SquibFireCurrent { get; set; }`**
Gets/sets `Channel.SquibFireCurrent`.
- **`bool LimitDuration { get; set; }`**
Gets/sets `Channel.LimitDuration`.
- **`double SquibFireDurationMs { get; set; }`**
Gets/sets `Channel.SquibFireDurationMs` (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceLowOhm`.
- **`double SquibFireResistanceHighOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceHighOhm`.
- **`IHardwareChannel HardwareChannel { get; }`**
Wrapped hardware channel instance.
- **`void SetITTSChannelRecord(ITTSChannelRecord channel)`**
Assigns/unassigns sensor to hardware; updates all dependent properties.
#### `TTSChannelRecord`
- **`int ChannelNumber { get; set; }`**
TTS channel number.
- **`string ChannelCode { get; set; }`**
Channel code (e.g., `"1650"`); raises validation flags in `Parent`.
- **`string JCodeOrDescription { get; set; }`**
J-code or description; sets `IsJCodeValid`.
- **`double ChannelRange { get; set; }`**
Channel range (e.g., 05V); sets `IsRangeValid`.
- **`string ChannelRangeString { get; set; }`**
String representation of `ChannelRange`; parses to `ChannelRange`.
- **`int ChannelFilterHz { get; set; }`**
Filter cutoff in Hz (e.g., 1650, 1000, 300, 100, 17); sets `IsFilterValid`.
- **`string FilterString { get; set; }`**
String representation of filter; validates against known values.
- **`string SensorSerialNumber { get; set; }`**
Sensor serial number.
- **`string SensorEID { get; set; }`**
Electronic ID of sensor.
- **`double SensorSensitivity { get; set; }`**
Sensor sensitivity.
- **`double SensorExcitationVolts { get; set; }`**
Excitation voltage.
- **`double SensorCapacity { get; set; }`**
Sensor capacity.
- **`string SensorEU { get; set; }`**
Engineering unit label.
- **`bool SensorPolarity { get; set; }`**
`true` = positive polarity.
- **`ToyotaBridgeType ChannelType { get; set; }`**
Channel type enum (e.g., `FullBridge`, `HalfBridge`, `IRTRACC`).
- **`string Description { get; set; }`**
Sensor description.
- **`bool ProportionalToExcitation { get; set; }`**
Whether sensitivity is proportional to excitation.
- **`double BridgeResistance { get; set; }`**
Bridge resistance (ohms).
- **`double InitialOffsetVoltage { get; set; }`**, **`InitialOffsetVoltageTolerance { get; set; }`**
Offset voltage and tolerance.
- **`bool RemoveOffset { get; set; }`**
Whether to remove initial offset.
- **`ToyotaZeroMethods ZeroMethod { get; set; }`**
Zeroing method enum.
- **`double CableMultiplier { get; set; }`**
Cable gain multiplier.
- **`double InitialEUInMV { get; set; }`**, **`InitialEUInEU { get; set; }`**
Initial offset in mV and EU.
- **`double IRTraccExponent { get; set; }`**, **`PolynomialConstant { get; set; }`**, etc.
Non-linear calibration coefficients.
- **`string ISOCode { get; set; }`**, **`ISODescription { get; set; }`**, **`ISOPolarity { get; set; }`**
ISO 14229-related fields.
- **`bool IsSquib { get; set; }`**, **`IsDigitalInput { get; set; }`**, **`IsDigitalOutput { get; set; }`**
Channel type flags.
- **`IHardwareChannel HardwareChannel { get; set; }`**
Assigned hardware channel.
- **`bool IsEmptyRecord { get; }`**
`true` if `ChannelCode == "None"` and `SensorSerialNumber` is whitespace.
- **`bool IsChannelCodeValid { get; set; }`**, **`IsJCodeValid { get; set; }`**, **`IsRangeValid { get; set; }`**, **`IsFilterValid { get; set; }`**
Validation flags.
- **`bool Disabled { get; set; }`**
Channel disabled flag.
- **`SquibFireMode SquibFireMode { get; set; }`**
Squib fire mode.
- **`double SquibFireDelayMs { get; set; }`**
Squib fire delay.
- **`double SquibFireCurrent { get; set; }`**
Squib current limit.
- **`bool LimitDuration { get; set; }`**
Squib duration limiting flag.
- **`double SquibFireDurationMs { get; set; }`**
Squib fire duration (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**, **`SquibFireResistanceHighOhm { get; set; }`**
Squib resistance tolerance.
- **`DigitalInputModes DigitalInputMode { get; set; }`**
Digital input mode.
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Digital output mode.
- **`double DigitalOutputDelay { get; set; }`**, **`DigitalOutputDuration { get; set; }`**
Digital output timing.
- **`bool DiagnosticsMode { get; set; }`**
Diagnostics

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Properties/AssemblyInfo.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Properties/Settings.Designer.cs
generated_at: "2026-04-16T04:50:04.681006+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "dad870cb48725e31"
---
# Properties
## Documentation: TTSImport Module (Assembly)
### 1. Purpose
This module (`TTSImport`) is an assembly responsible for handling test setup import functionality—specifically for TTS (presumably *Test Template System* or a domain-specific acronym)—within the DataPRO platform. It provides configuration storage for user-scoped settings (e.g., default import method) and is structured as a .NET class library with standard assembly metadata (title, version, COM visibility control). Its role is foundational: it enables consistent configuration management for downstream import logic (not included in these files), likely consumed by other modules in the `DataPRO.Modules.TestSetups.Imports.TTS` namespace.
### 2. Public Interface
The module exposes only one public type:
- **`TTSImport.Properties.Settings`**
- *Type*: `internal sealed partial class` inheriting from `System.Configuration.ApplicationSettingsBase`.
- *Access*: Accessed via the static property `Settings.Default`.
- *Behavior*: Provides user-scoped application settings. Currently defines one setting:
- `int DefaultTestImportMethod { get; set; }`
- Default value: `"0"` (as specified by `DefaultSettingValueAttribute`).
- Marked with `UserScopedSettingAttribute`, meaning it persists per-user (e.g., in user.config).
- Notable: The class is `internal`, so it is only accessible within the same assembly. External consumers would need to reference the assembly and access it via reflection or if exposed by another public type (not present here).
### 3. Invariants
- The `Settings.Default` instance is lazily initialized and synchronized via `ApplicationSettingsBase.Synchronized`, ensuring thread-safe access to the default instance.
- The `DefaultTestImportMethod` value is guaranteed to be an `int` (no validation beyond type safety); its semantics (e.g., what values are valid) are not defined in this file.
- Assembly version is fixed at `1.0.0.0` (both `AssemblyVersion` and `AssemblyFileVersion`).
- `ComVisible(false)` ensures no types in this assembly are exposed to COM by default.
### 4. Dependencies
- **Dependencies *of* this module**:
- `System.Configuration` (for `ApplicationSettingsBase`, `UserScopedSettingAttribute`, etc.)
- `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`, `System.Diagnostics` (for attributes)
- **Dependencies *on* this module**:
- Not inferable from these files alone. However, given the path `DataPRO/Modules/TestSetups/Imports/TTS/`, it is likely consumed by other modules in the `DataPRO.Modules.TestSetups.Imports` hierarchy (e.g., a main TTS import handler).
- The `Guid` (`a8ff540f-f22a-45ae-a63b-4984ed74c654`) suggests potential COM interop usage, though `ComVisible(false)` disables it.
### 5. Gotchas
- The `Settings` class is `internal`, so external assemblies cannot directly reference `Settings.Default` without reflection or an additional public wrapper.
- The `DefaultTestImportMethod` setting has no documented valid range or semantic meaning (e.g., is `0` a "manual" mode? `1` "auto"?). This must be determined from consuming code or external documentation.
- Auto-generated comment in `Settings.Designer.cs` warns that manual changes will be lost on regeneration—likely triggered by Visual Studios settings designer.
- `AssemblyVersion("1.0.0.0")` with `AssemblyFileVersion("1.0.0.0")` suggests this is an initial release; no versioning strategy is evident here.
- No public API surface beyond `Settings.Default`; the modules primary functionality (test import logic) resides elsewhere.

View File

@@ -0,0 +1,81 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.ja.Designer.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/TranslateExtension.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:49:54.783331+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "977bda595f1f1bda"
---
# Resources
## Documentation: TTS Import Localization Resources
### 1. Purpose
This module provides localized string resources and a WPF `MarkupExtension` for internationalization within the TTS (Test Setup) import functionality. It enables UI elements and messages to be displayed in the users preferred language (currently Japanese, based on the `StringResources.ja.Designer.cs` file name) by retrieving localized strings from embedded `.resx`-generated resources. The `TranslateExtension` allows declarative binding of localized text in XAML, while `StringResources` provides strongly-typed access to all localized strings used in the import pipeline.
### 2. Public Interface
#### `TranslateExtension` class
- **Namespace**: `TTSImport`
- **Inherits**: `MarkupExtension`
- **Constructor**:
```csharp
public TranslateExtension(string key)
```
Initializes the extension with a resource key.
- **Fields**:
```csharp
public const string NotFound = "#stringnotfound#";
```
Fallback value returned when a resource lookup fails.
- **Method**:
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
Returns the localized string corresponding to `_key`, or `NotFound` if `_key` is null/empty, or `NotFound + " " + _key` if the key exists but has no value in the resource manager.
#### `StringResources` class
- **Namespace**: `TTSImport.Resources`
- **Type**: Internal, auto-generated strongly-typed resource class
- **Properties**: All are `internal static string` properties with `get` accessors that call `ResourceManager.GetString(key, resourceCulture)`. Examples include:
- `string AAF_SLICE { get; }`
- `string Added { get; }`
- `string ImportTestSetup_DuplicateChannelCode { get; }`
- `string SensorNotFound { get; }`
*(Full list of keys is extensive; see `StringResources.Designer.cs` for all ~150 entries.)*
- **Static Properties**:
```csharp
internal static ResourceManager ResourceManager { get; }
internal static CultureInfo Culture { get; set; }
```
Provide access to the underlying resource manager and override culture for lookups.
### 3. Invariants
- **Resource key must be non-null/non-empty** for successful lookup; otherwise, `TranslateExtension.ProvideValue` returns `NotFound`.
- **Missing resource values** result in `NotFound + " " + _key` (e.g., `"#stringnotfound# MyKey"`), not `null`.
- **`StringResources` is auto-generated**; manual edits are overwritten. Changes must be made via `.resx` files.
- **Thread-safety**: `ResourceManager` and `Culture` are managed with static fields and lazy initialization; no explicit synchronization is present in the generated code.
- **No validation** is performed on resource keys; invalid keys silently return `NotFound` or the fallback string.
### 4. Dependencies
- **Depends on**:
- `System.Resources.ResourceManager` (for resource lookup)
- `System.Globalization.CultureInfo` (for culture-specific lookups)
- `System.Windows.Markup.MarkupExtension` (for `TranslateExtension`)
- `System` and `System.ComponentModel` (via attributes)
- **Used by**:
- WPF XAML UI elements via `{tts:Translate KeyName}` bindings (inferred from `MarkupExtension` usage).
- Other modules in `TTSImport` namespace (e.g., import logic, error handlers) via `StringResources.PropertyName` access.
- **No external dependencies beyond .NET Framework 4.0+** (based on runtime version in header comment).
### 5. Gotchas
- **Hardcoded fallback format**: `NotFound + " " + _key` is used for missing values, which may produce confusing output (e.g., `"#stringnotfound# MyKey"`). No logging or telemetry is included.
- **No support for parameterized strings in `TranslateExtension`**: While `StringResources` properties like `SensorNotFound` contain format placeholders (e.g., `{0}`), `TranslateExtension` does not support passing arguments—consumers must manually format strings (e.g., `string.Format(StringResources.SensorNotFound, sensorName)`).
- **Culture override via `StringResources.Culture`** affects *all* subsequent lookups globally; misuse may cause inconsistent localization.
- **Japanese-only resource file is present** (`StringResources.ja.Designer.cs`), but no other language variants are visible in the provided files. Localization for other languages may be missing or managed elsewhere.
- **`StringResources.ja.Designer.cs` is empty** in the provided source—this may indicate incomplete localization or a build artifact issue. The Japanese resource strings are actually in `StringResources.Designer.cs` (which lacks language-specific suffix), suggesting the `.ja.` file may be a placeholder or legacy artifact.
- **No null-safety for `ResourceManager.GetString`**: Returns `null` if key is missing, which `TranslateExtension` converts to the fallback string. However, if `ResourceManager` itself is misconfigured, lookups may fail silently.
- **No compile-time validation of resource keys**: Typos in XAML (e.g., `{tts:Translate MyKye}`) will only surface at runtime as `#stringnotfound#`.

View File

@@ -0,0 +1,66 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/View/LevelTriggerView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/HardwareScanView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/TOMChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/AnalogChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/ReadFileView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/DigitalInputChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/DigitalOutputChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/SummaryView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/EditFileView.xaml.cs
generated_at: "2026-04-16T04:50:32.534964+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e6043d62e08504ef"
---
# `TTSImport` View Layer Documentation
## 1. Purpose
This module provides WPF user interface views for the TTS (Test Tool Suite) import workflow within the DataPRO test setup system. Each view implements a corresponding interface from the `DTS.Common.Interface` hierarchy and serves as the presentation layer for specific configuration steps—such as hardware scanning, channel selection (analog, digital input/output, TOM), level triggering, file editing/reading, and summary display. These views are lightweight containers that delegate logic to associated view models via data binding and explicit method calls, following a standard MVVM pattern adapted for the existing codebase.
## 2. Public Interface
All classes are `public partial` and inherit from WPF `UserControl` (implied by `InitializeComponent()` usage), implementing interfaces defined in `DTS.Common.Interface` and sub-namespaces.
| Class | Interface | Signature | Behavior |
|-------|-----------|-----------|----------|
| `LevelTriggerView` | `ILevelTriggerView` | `public LevelTriggerView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `HardwareScanView` | `IHardwareScanView` | `public HardwareScanView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `TOMChannelsView` | `ITOMChannelsView` | `public TOMChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `AnalogChannelsView` | `IAnalogChannelsView` | `public AnalogChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `ReadFileView` | `IReadFileView` | `public ReadFileView()`<br>`public void Connect(int connectionId, object target)` | Constructor initializes XAML UI. `Connect()` is a no-op stub (empty body). |
| `DigitalInputChannelsView` | `IDigitalInputChannelsView` | `public DigitalInputChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `DigitalOutputChannelsView` | `IDigitalOutputChannelsView` | `public DigitalOutputChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `SummaryView` | `ISummaryView` | `public SummaryView()`<br>`public void UpdateTestIds(string[] serializedValues)`<br>`public void SetTestName(string testName)`<br>`public string GetTestId()` | Constructor initializes XAML UI. `UpdateTestIds()` delegates to `ctrlTestId.PopulateAllTestIdPrefixSuffixValues()`. `SetTestName()` sets `TestName` and `TestSetupLabel` on `ctrlTestId`. `GetTestId()` returns result of `ctrlTestId.GetTestId()`. |
| `EditFileView` | `IEditFileView` | `public EditFileView()`<br>`private void TextBox_TextChanged(object sender, TextChangedEventArgs e)` | Constructor initializes XAML UI. `TextBox_TextChanged` event handler extracts text from the changed `TextBox`, casts `DataContext` to `IEditFileViewModel`, and invokes `Search(text)` on it. |
> **Note**: All views reference a control named `ctrlTestId` (in `SummaryView.xaml.cs`) and `TextBox` controls (in `EditFileView.xaml.cs`). Their exact types and interfaces (`PopulateAllTestIdPrefixSuffixValues`, `GetTestId`, etc.) are not defined in this module and must be inferred from `DTS.Common.Interface` or related XAML definitions.
## 3. Invariants
- All views are instantiated with parameterless constructors only (no dependency injection via constructor).
- Each views `InitializeComponent()` must be called first in the constructor (standard WPF practice).
- `EditFileView.TextBox_TextChanged` assumes its `DataContext` is assignable to `IEditFileViewModel`; failure to satisfy this will cause a runtime `InvalidCastException`.
- `ReadFileView.Connect()` is present but has no effect—its parameters (`connectionId`, `target`) are unused.
- All views belong to the `TTSImport` namespace, and their interfaces reside under `DTS.Common.Interface` (with sub-namespaces for digital channels and TTS-specific interfaces).
## 4. Dependencies
### Dependencies *of* this module:
- `DTS.Common.Interface` (core interfaces: `ILevelTriggerView`, `IHardwareScanView`, `IReadFileView`, `ISummaryView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS` (interfaces: `ITOMChannelsView`, `IEditFileView`, `IAnalogChannelsView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS.DIChannels` (`IDigitalInputChannelsView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels` (`IDigitalOutputChannelsView`)
- WPF framework types: `System.Windows.Controls.TextBox`, `System.Windows.Controls.UserControl`, `System.Windows.RoutedEventArgs` (via `TextChangedEventArgs`)
### Dependencies *on* this module:
- Unknown from source alone. These views are likely consumed by a view model layer or a navigation/controller module (e.g., `TTSImport` modules view models or a parent test setup wizard).
## 5. Gotchas
- **Namespace mismatch**: All view classes are in the `TTSImport` namespace, but their XML documentation comments incorrectly reference `HardwareScanView.xaml` for *all* views (including `ReadFileView`, `SummaryView`, etc.). This may indicate copy-paste errors in comments or incorrect XAML file names.
- **Unused `Connect` method**: `ReadFileView.Connect()` is declared but empty—likely a placeholder for future connection logic or legacy code.
- **Assumed control names**: `SummaryView` relies on a control named `ctrlTestId`, and `EditFileView` on a `TextBox` named `sender`. If XAML names differ, runtime errors will occur.
- **No validation in `EditFileView`**: The `TextBox_TextChanged` handler blindly casts `DataContext` to `IEditFileViewModel`. If the view is reused or bound to a non-conforming view model, it will crash.
- **Missing interface definitions**: The interfaces (e.g., `ISummaryView`, `IEditFileView`) are referenced but not defined here; their exact contracts (e.g., whether `UpdateTestIds` or `Search` are required) must be verified in `DTS.Common.Interface`.
- **No error handling**: None of the views include try/catch blocks or logging—failures in `InitializeComponent()` or casting will propagate unhandled exceptions.

View File

@@ -0,0 +1,232 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/DigitalOutputChannelsViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/LevelTriggerViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/DigitalInputChannelsViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/TOMChannelsViewModel.cs
generated_at: "2026-04-16T04:50:15.817999+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "a0d4b98d2d85c9f6"
---
# Documentation: TTS Import Channel ViewModels
## 1. Purpose
This module provides view models for managing hardware channel assignments in TTS (Test Technology Suite) import workflows, specifically for digital output (DO), digital input (DI), TOM (Twin Oscillator Module, i.e., squib channels), and level trigger configurations. Each view model acts as a bridge between the UI and the underlying test setup data (`ITTSSetup`), hardware scan results (`IDASHardware`), and sensor-to-channel mapping (`EIDMappingEvent`). They handle real-time updates via Prism events, support interactive channel assignment/removal/enable/disable operations, and maintain UI state such as busy indicators and selection states. The module exists to decouple UI logic from core test setup management and to provide a consistent, event-driven pattern for channel configuration across different channel types.
## 2. Public Interface
### `DigitalOutputChannelsViewModel`
- **`DigitalOutputChannelsViewModel(IDigitalOutputChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions, UI interaction requests, and view binding.
- **`IDigitalOutputChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for displaying notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmation dialogs.
- **`ObservableCollection<DASChannel> DASChannels { get; set; }`**
Collection of digital output channels discovered during hardware scan, with optional sensor assignments.
- **`DASChannel SelectedDASChannel { get; set; }`**
Currently selected channel in the UI.
- **`string EnableOrDisableText { get; }`**
UI text for the enable/disable button (e.g., “Enable” or “Disable”) based on channel state.
- **`bool IsBusy { get; set; }`**
Indicates whether a background operation is in progress.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags (not used in logic).
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs; no cleanup logic implemented.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs; initialization is handled via constructor event subscriptions.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `LevelTriggerViewModel`
- **`LevelTriggerViewModel(ILevelTriggerView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`ILevelTriggerView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ILevelTrigger[] LevelTriggers { get; }`**
Exposes `_setup.LevelTriggers` (read-only).
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `DigitalInputChannelsViewModel`
- **`DigitalInputChannelsViewModel(IDigitalInputChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`IDigitalInputChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ObservableCollection<DASChannel> DASChannels { get; set; }`**
Collection of digital input channels discovered during hardware scan.
- **`ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; }`**
Channels from the test setup that are not yet assigned to hardware.
- **`ITTSChannelRecord SelectedRemainingChannel { get; set; }`**
Currently selected unassigned channel.
- **`DASChannel SelectedDASChannel { get; set; }`**
Currently selected hardware channel.
- **`bool AssignEnabled`, `RemoveEnabled`, `EnableOrDisableEnabled { get; set; }`**
UI state flags for command buttons (set via `DetermineRemoveEnableStatus()`).
- **`string EnableOrDisableText { get; }`**
Button text for enable/disable operation.
- **`DelegateCommand AssignCommand { get; }`**
Command to assign a `RemainingChannels` item to a `DASChannel`.
- **`DelegateCommand RemoveCommand { get; }`**
Command to remove a hardware assignment from a `DASChannel`.
- **`DelegateCommand EnableOrDisableCommand { get; }`**
Command to toggle channel disabled state.
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `TOMChannelsViewModel`
- **`TOMChannelsViewModel(ITOMChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`ITOMChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ObservableCollection<Model.DASChannel> DASChannels { get; set; }`**
Collection of TOM (squib) channels discovered during hardware scan (every 2nd channel in hardware list).
- **`ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; }`**
Unassigned TOM channels from the test setup.
- **`ITTSChannelRecord SelectedRemainingChannel { get; set; }`**
Currently selected unassigned channel.
- **`Model.DASChannel SelectedDASChannel { get; set; }`**
Currently selected hardware channel.
- **`bool AssignEnabled`, `RemoveEnabled`, `EnableOrDisableEnabled { get; set; }`**
UI state flags for command buttons.
- **`string EnableOrDisableText { get; }`**
Button text for enable/disable operation.
- **`DelegateCommand AssignCommand { get; }`**
Command to assign a `RemainingChannels` item to a `DASChannel`.
- **`DelegateCommand RemoveCommand { get; }`**
Command to remove a hardware assignment.
- **`DelegateCommand EnableOrDisableCommand { get; }`**
Command to toggle channel disabled state.
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
## 3. Invariants
- **`_setup` and `_hardware` must be non-null** before `OnAssignedChannelsChangedEvent` (or equivalent) logic executes; otherwise, the method returns early.
- **`DASChannel` instances are constructed with an `IHardwareChannel` and optionally an `ITTSSetup`** (e.g., `new DASChannel(ch, _setup)` in `DigitalOutputChannelsViewModel`).
- **`DASChannel.SetITTSChannelRecord(ITTSChannelRecord)`** is used to associate a hardware channel with a logical channel record; passing `null` removes the association.
- **`DASChannel.EID` is populated from `_hardwareChannelIdToSensorId` (or `_sensorIdToChannelId` in `LevelTriggerViewModel`) only if the hardware channel ID exists as a key.**
- **`IsBusy` is updated only via `OnBusyIndicatorNotification(bool)`**, triggered by `BusyIndicatorChangeNotification` event.
- **`IsMenuIncluded` and `IsNavigationIncluded` are UI flags only; they do not affect business logic.**
- **`IsDirty` is declared but never set; it remains `false` throughout the lifetime of the view model.**
- **`EnableOrDisableText` is computed from `SelectedDASChannel?.Channel?.Disabled` and `StringResources` constants.**
- **`LevelTriggers` is read-only and derived from `_setup.LevelTriggers`; no direct modification is performed in `LevelTriggerViewModel`.**
- **`TOMChannelsViewModel` only processes hardware channels where `ch.IsSquib` is true, and iterates hardware channels in pairs (`i += 2`) to select squib channels.**
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` share identical command logic (`Assign`, `Remove`, `EnableOrDisable`) and state management (`DetermineRemoveEnableStatus`).**
## 4. Dependencies
### Internal Dependencies (from source)
- **`DTS.Common.Events.TTSImport`**
Events: `AssignedChannelsChangedEvent`, `TTSImportHardwareScanFinishedEvent`, `TTSImportReadFileStatusEvent`, `EIDMappingEvent`, `TTSImportSavedChangesStatusEvent`, `TTSImportTestSetupChangedEvent`, `RaiseNotification`, `BusyIndicatorChangeNotification`.
- **`DTS.Common.Interface.TestSetups.Imports.TTS.*`**
Interfaces: `IDigitalOutputChannelsView`, `IDigitalInputChannelsView`, `ITOMChannelsView`, `ILevelTriggerView`, `IDigitalOutputChannelsViewModel`, `IDigitalInputChannelsViewModel`, `ITOMChannelsViewModel`, `ILevelTriggerViewModel`.
- **`DTS.Common.Interface.DataRecorders`**
Interfaces: `IDASHardware`, `IHardwareChannel`.
- **`DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile`**
Interfaces: `ITTSSetup`, `ITTSChannelRecord`.
- **`TTSImport.Model`**
Classes: `DASChannel`, `TTSChannelRecord`.
- **`TTSImport.Resources`**
Static resources: `StringResources` (e.g., `Analog_Enable`, `AssignSensorPrompt`).
- **`Prism.Events`**
`IEventAggregator`, `PubSubEvent<T>`.
- **`Prism.Regions`**
`IRegionManager`.
- **`Unity`**
`IUnityContainer`.
- **`Prism.Commands`**
`DelegateCommand`.
- **`DTS.Common.DAS.Concepts`**
`DASChannel` (in `LevelTriggerViewModel`).
- **`DTS.Common.Enums`**
`ExcitationVoltageOptions`, `DigitalInputModes`.
- **`DTS.DASLib.Service`**
Referenced in `TOMChannelsViewModel` (no direct usage in provided code).
### External Dependencies
- **WPF (`System.Windows`, `System.Windows.Data`)**
Used for `ICollectionView`, `CollectionViewSource`, `Dispatcher`, `MessageBox`.
- **.NET Core/Standard libraries**
`System.Collections.ObjectModel`, `System.ComponentModel`, `System.Threading.Tasks`, `System.Linq`.
### Inferred Usage
- **`DigitalOutputChannelsViewModel`** is used when configuring digital output channels after hardware scan and EID mapping.
- **`DigitalInputChannelsViewModel`** and **`TOMChannelsViewModel`** are used for interactive assignment of unassigned channels to hardware, with similar UI patterns.
- **`LevelTriggerViewModel`** is used for level trigger configuration and relies on `TTSImportReadFileStatusEvent` and `TTSImportSavedChangesStatusEvent` to trigger `UpdateLevelTriggers()`.
- All view models depend on `AssignedChannelsChangedEvent` to refresh channel lists when assignments change elsewhere in the system.
## 5. Gotchas
- **`IsDirty` is never set to `true`** — it is declared but unused. Any change detection must be handled externally (e.g., via `TTSImportTestSetupChangedEvent`).
- **`Cleanup()` and `Initialize()` methods are no-ops** — no resource cleanup or initialization logic is implemented in these methods.
- **`LevelTriggers` is read-only** — `LevelTriggerViewModel` does not support creating or deleting level triggers; it only exposes existing ones.
- **`TOMChannelsViewModel` assumes squib channels are paired** — it iterates hardware channels in steps of 2 (`i += 2`) to select squib channels, which may not hold if hardware layout changes.
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` use `SelectedRemainingChannel` and `SelectedDASChannel` to control button states**, but selection changes may not trigger `DetermineRemoveEnableStatus()` if not handled via property setters (e.g., programmatic selection may require manual `OnPropertyChanged`).
- **`AssignWork()` in `DigitalInputChannelsViewModel` and `TOMChannelsViewModel` modifies `RemainingChannels` and `DASChannels` collections directly**, which may cause UI flicker or require `CollectionViewSource.GetDefaultView(...).Refresh()` to update.
- **`OnAssignedChannelsChangedEvent` in `DigitalOutputChannelsViewModel` creates new `TTSChannelRecord` instances for unassigned channels**, but does not add them to `_setup.Channels` — only the `DASChannel` is updated. This may lead to inconsistencies if `_setup.Channels` is expected to be authoritative.
- **`OnEIDComplete` in `DigitalOutputChannelsViewModel` inverts the sensor-to-channel mapping**, but only if the input dictionary is non-empty. If empty, `_hardwareChannelIdToSensorId` remains an empty dictionary.
- **`VoltageIsValid` in `LevelTriggerViewModel` catches all exceptions from `GetExcitationVoltageEnumFromMagnitude`**, which may hide invalid voltage inputs (e.g., negative or unsupported values).
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` use `MessageBox.Show` for confirmation prompts**, which is synchronous and may block the UI thread. The use of `Task.Run` around `MessageBox.Show` is unnecessary and misleading (UI calls must be on the UI thread).
- **`EnableOrDisableText` uses `StringResources.Analog_Enable` and `StringResources.Analog_Disable`** — misleading naming for digital channels.
- **`DASChannel.EID` is only set if the hardware channel ID exists in `_hardwareChannelIdToSensorId`** — if the mapping is incomplete, EID may be missing even if a sensor is physically present.
- **No validation is performed on `SelectedDASChannel` or `SelectedRemainingChannel` before assignment** — null checks are present in command handlers but not in property setters.
- **`LevelTriggerViewModel` does not expose `DASChannels` or `RemainingChannels`** — it only exposes `LevelTriggers`, making it impossible to view or edit channel assignments directly in this view model.