148 lines
12 KiB
Markdown
148 lines
12 KiB
Markdown
---
|
|
source_files:
|
|
- Common/DTS.Common.DataModel/Classes/TestTemplate/ICachedContainer.cs
|
|
- Common/DTS.Common.DataModel/Classes/TestTemplate/HardwareInclusionInstruction.cs
|
|
- Common/DTS.Common.DataModel/Classes/TestTemplate/TSRAIRGoTestSetup.cs
|
|
- Common/DTS.Common.DataModel/Classes/TestTemplate/DownloadEvent.cs
|
|
- Common/DTS.Common.DataModel/Classes/TestTemplate/BuildTestSetup.cs
|
|
generated_at: "2026-04-17T15:34:34.420183+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "f665cac25ac2572f"
|
|
---
|
|
|
|
# Documentation: TestTemplate Module
|
|
|
|
## 1. Purpose
|
|
|
|
This module provides the data model components for test template configuration and execution within the DTS (Data Acquisition System) application. It defines interfaces for hardware/sensor caching, classes for managing hardware inclusion rules, test setup construction from XML or template sources, download event configuration, and specialized test setup singletons. The module serves as a bridge between raw configuration data (XML or database templates) and the runtime test execution environment.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### `ICachedContainer` (Interface)
|
|
**Namespace:** `DataPROWin7.DataModel.Classes.TestTemplate`
|
|
|
|
| Method | Return Type | Description |
|
|
|--------|-------------|-------------|
|
|
| `GetCachedHardware(string serialNumber)` | `DASHardware` | Retrieves cached hardware by serial number. |
|
|
| `GetCachedSensor(string serialNumber)` | `SensorData` | Retrieves cached sensor data by serial number. |
|
|
| `GetCalibrations(string serialNumber)` | `SensorCalibration[]` | Retrieves calibration array for a sensor by serial number. |
|
|
| `GetAllCachedHardware()` | `IISOHardware[]` | Retrieves all cached hardware items. |
|
|
|
|
---
|
|
|
|
### `HardwareInclusionInstruction` (Class)
|
|
**Namespace:** `DataPROWin7.DataModel`
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| `HardwareId` | `public string HardwareId { get; }` | Read-only hardware identifier. |
|
|
| `Actions` | `public enum Actions { Remove, Add }` | Enumeration defining inclusion action. `Remove` excludes hardware that would otherwise be included; `Add` includes hardware not in groups. |
|
|
| `Action` | `public Actions Action { get; }` | Read-only action to perform. |
|
|
| Constructor | `public HardwareInclusionInstruction(string hardwareId, Actions action)` | Creates new instruction with specified hardware ID and action. |
|
|
| Copy Constructor | `public HardwareInclusionInstruction(HardwareInclusionInstruction copy)` | Creates a copy of an existing instruction. |
|
|
|
|
---
|
|
|
|
### `TSRAIRGoTestSetup` (Class)
|
|
**Namespace:** `DTS.Common.DataModel.Classes.TestTemplate`
|
|
**Base Class:** `DataPROWin7.DataModel.TestTemplate`
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| `TEST_NAME` | `public const string TEST_NAME = "TSRAIR_GO_TEST"` | Constant test name identifier. |
|
|
| `Name` | `public override string Name { get; set; }` | Returns `TEST_NAME`; setter is no-op. |
|
|
| `GetInstance` | `public static TSRAIRGoTestSetup GetInstance(int userId, bool useCache = true)` | Retrieves singleton instance. If cached instance exists and `useCache` is true, returns cached instance. Otherwise, loads template from `TestTemplatesList` or creates new from user defaults. |
|
|
|
|
---
|
|
|
|
### `DownloadEvent` (Class)
|
|
**Namespace:** `DataPROWin7.DataModel`
|
|
**Implements:** `IDownloadEvent`
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| Constructor | `public DownloadEvent()` | Initializes with `EventNumber = 0`, `IsEnabled = true`, `IsDefault = true`, `IsReadonly = true`. |
|
|
| Constructor | `public DownloadEvent(bool isDefault = false)` | Initializes with specified `isDefault` value. |
|
|
| Constructor | `public DownloadEvent(int eventNumber = 0, bool isDefault = false)` | Initializes with specified event number and default flag. |
|
|
| `EventNumber` | `public int EventNumber { get; set; }` | Event number; setter updates `EventNumberDisplay`. |
|
|
| `IsEnabled` | `public bool IsEnabled { get; set; }` | Whether event is enabled. |
|
|
| `IsDefault` | `public bool IsDefault { get; }` | Read-only default flag. |
|
|
| `EventNumberDisplay` | `public string EventNumberDisplay { get; set; }` | Formatted display string using `DTS.Common.Constants.EventNumber` format. |
|
|
| `TestItem` | `public string TestItem { get; set; }` | Stores `<TestSetup>:<TestId>:("<All or ROI">)` for export (per issue 43387). |
|
|
| `DTSFile` | `public string DTSFile { get; set; }` | Stores .DTS file path for export (per issue 43387). |
|
|
| `IsReadonly` | `public bool IsReadonly { get; set; }` | Whether event is read-only. |
|
|
| `EventLength` | `public TimeSpan EventLength { get; set; }` | Total time available for download event. |
|
|
| `ShouldDisplayLength` | `public bool ShouldDisplayLength { get; set; }` | Whether `EventLength` should be displayed. |
|
|
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
|
|
|
---
|
|
|
|
### `BuildTestSetup` (Class)
|
|
**Namespace:** `DataPROWin7.DataModel`
|
|
**Implements:** `IBuildTestSetup`
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, ExportFileXMLClass exportFileXML)` | Constructs from XML configuration. Extracts test setup fields from `exportFileXML.TestSetupsOuter[0].TestSetups[0]`. |
|
|
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, TestTemplate testTemplate)` | Constructs from `TestTemplate` object. Uses `StringResources.DefaultTestSetupName` if `testSetupName` is whitespace. |
|
|
| `DASSerialNumber` | `public string DASSerialNumber { get; set; }` | DAS device serial number. |
|
|
| `SetupName` | `public string SetupName { get; set; }` | Test setup name. |
|
|
| `SetupDescription` | `public string SetupDescription { get; set; }` | Test setup description. |
|
|
| `Groups` | `public List<GroupXMLClass> Groups { get; set; }` | List of groups with channels. |
|
|
| `LevelTriggers` | `public List<LevelTriggerXMLClass> LevelTriggers { get; set; }` | List of level trigger configurations. |
|
|
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
|
|
|
**Additional Properties (all `string` type):** `AutomaticMode`, `AutomaticModeDelay`, `WarnOnBatteryFail`, `ViewRealtime`, `RecordingMode`, `SamplesPerSecond`, `PreTriggerSeconds`, `PostTriggerSeconds`, `NumberOfEvents`, `WakeUpMotionTimeout`, `ScheduledStartDateTime`, `IntervalBetweenEventStartsMinutes`, `StartWithEvent`, `WakeUpWithMotion`, `StrictDiagnostics`, `RequireConfirmationOnErrors`, `AllowSensorIdToBlankChannel`, `PerformArmChecklist`, `CheckInputVoltage`, `CheckBatteryVoltage`, `CheckSquibResistance`, `CheckSensorIds`, `CheckStartEventLines`, `CheckTiltSensor`, `CheckTemperature`, `ExcitationWarmupTimeMS`, `RequireAllUnitsPassArmCheckList`, `ROIDownload`, `ViewROIDownload`, `DownloadAll`, `RealtimeCharts`, `ROIStart`, `ROIEnd`, `ViewDownloadAll`, `Export`, `ExportFolder`, `DownloadFolder`, `CommonStatusLine`, `UploadData`, `UploadDataFolder`, `UseLabDetails`, `UseCustomerDetails`, `AllowMissingSensors`, `LastModified`, `LastModifiedBy`, `PostTestDiagnostics`, `UserTags`, `CalibrationBehavior`, `SuppressMissingSensorsWarning`, `NotAllChannelsRealTime`, `NotAllChannelsViewer`, `TriggerCheckStep`, `QuitTestWithoutWarning`, `UseTestEngineerDetails`, `AutoArm`, `Streaming`, `MeasureSquibResistances`.
|
|
|
|
**Export Format Properties (all `string` type):** `ExportCh10FilteredEUDesired`, `ExportChryslerDDASDesired`, `ExportCSVADCDesired`, `ExportCSVFilteredDesired`, `ExportCSVMVDesired`, `ExportCSVUnfilteredDesired`, `ExportDiademADCDesired`, `ExportASCDesired`, `ExportHDFADCDesired`, `ExportHDFMVDesired`, `ExportHDFUnfilteredDesired`, `ExportISOFilteredDesired`, `ExportISOUnfilteredDesired`, `ExportRDFADCDesired`, `ExportTDASADCDesired`, `ExportTDMSADCDesired`, `ExportToyotaUnfilteredDesired`, `ExportTSVFilteredDesired`, `ExportTSVUnfilteredDesired`, `ExportXLSXFilteredDesired`, `ExportXLSXUnfilteredDesired`.
|
|
|
|
---
|
|
|
|
## 3. Invariants
|
|
|
|
- **`TSRAIRGoTestSetup`**: The singleton instance (`_setup`) is protected by `MY_LOCK` for thread safety. The `Name` property always returns `TEST_NAME` regardless of setter calls.
|
|
- **`HardwareInclusionInstruction`**: `HardwareId` and `Action` are immutable after construction (read-only properties).
|
|
- **`DownloadEvent`**: `IsDefault` is read-only after construction. Setting `EventNumber` automatically updates `EventNumberDisplay` with format `"{Constants.EventNumber} {value:00}"`.
|
|
- **`BuildTestSetup`**: All configuration properties are stored as `string` types regardless of original data types (e.g., booleans, integers, enums are converted to strings).
|
|
- **`BuildTestSetup`**: When constructing from `TestTemplate`, if `testSetupName` is null or whitespace, `StringResources.DefaultTestSetupName` is used.
|
|
- **`BuildTestSetup`**: Export format decoding via `DecodeExportFormats` uses bitwise AND operations against `SupportedExportFormatBitFlags` enum values.
|
|
|
|
---
|
|
|
|
## 4. Dependencies
|
|
|
|
### External Dependencies (from imports):
|
|
|
|
| Module | Depends On |
|
|
|--------|------------|
|
|
| `ICachedContainer` | `DTS.Common.Interface.DASFactory.Diagnostics` (for `DASHardware`), `DTS.SensorDB` (for `SensorData`, `SensorCalibration`) |
|
|
| `TSRAIRGoTestSetup` | `DTS.Slice.Users.UserSettings` (for `TestSetupDefaults`), `DataPROWin7.DataModel.TestTemplateList` |
|
|
| `DownloadEvent` | `DTS.Common.Interface.DownloadEvent` (for `IDownloadEvent`), `System.ComponentModel` |
|
|
| `BuildTestSetup` | `DTS.Common.Interface.BuildTestSetup` (for `IBuildTestSetup`), `DTS.Common.XMLUtils` (for `ExportFileXMLClass`, `GroupXMLClass`, `LevelTriggerXMLClass`, `ChannelXMLClass`, `HardwareListXMLClass`), `DTS.Common.Enums` (for `SupportedExportFormatBitFlags`), `DTS.Common.SharedResource.Strings` (for `StringResources`), `DTS.Common.Constants` |
|
|
|
|
### Inferred Dependents:
|
|
- Modules consuming `IBuildTestSetup`, `IDownloadEvent`, or `ICachedContainer` interfaces depend on this module.
|
|
- Code that creates test setups from templates or XML files depends on `BuildTestSetup`.
|
|
|
|
---
|
|
|
|
## 5. Gotchas
|
|
|
|
1. **`BuildTestSetup` stores all values as strings**: Despite source data being typed (int, bool, enum, TimeSpan), all properties in `BuildTestSetup` are `string`. Parsing/conversion is required when consuming these values.
|
|
|
|
2. **`BuildTestSetup` XML constructor assumes specific structure**: The constructor accesses `exportFileXML.TestSetupsOuter[0].TestSetups[0]` without null checks. If the XML structure differs, this will throw.
|
|
|
|
3. **`TSRAIRGoTestSetup.Name` setter is a no-op**: The setter `{ set {; } }` silently ignores assignments, which could cause confusion if code attempts to modify the name.
|
|
|
|
4. **`ParseSettings` uses magic number keys**: Settings are parsed using string prefixes like `"0="`, `"1="`, etc. The mapping between numbers and settings is not documented outside this method.
|
|
|
|
5. **`GetExports` has inconsistent case handling**: Export format string matching uses mixed case (e.g., `"csvunfiltered"` vs `"ChryslerDDAS"` vs `"CSVADC"`). The switch statement is case-sensitive.
|
|
|
|
6. **`DownloadEvent.EventNumberDisplay` references external constant**: The format string uses `DTS.Common.Constants.EventNumber`—the value of this constant is not visible in this source.
|
|
|
|
7. **`HardwareInclusionInstruction` comment mentions "dasless groups"**: The XML comment indicates this class exists to support groups without DAS hardware, but the mechanism for how this integrates with the broader system is not shown.
|
|
|
|
8. **`BuildTestSetup` has many commented-out property mappings**: Both constructors contain numerous commented assignments (e.g., `//InvertTrigger`, `//ViewDiagnostics`, `//ExportSomatFilteredDesired`). These may represent deprecated or unimplemented features. |