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,119 @@
---
source_files:
- Common/DTS.Common/Classes/TestSetups/SimpleHardware.cs
- Common/DTS.Common/Classes/TestSetups/TestSetupHelper.cs
- Common/DTS.Common/Classes/TestSetups/ExtraProperties.cs
- Common/DTS.Common/Classes/TestSetups/ROIPeriodChannelRecord.cs
- Common/DTS.Common/Classes/TestSetups/TestSetupHardwareRecord.cs
- Common/DTS.Common/Classes/TestSetups/TestSetupROIsRecord.cs
- Common/DTS.Common/Classes/TestSetups/CalculatedChannelRecord.cs
- Common/DTS.Common/Classes/TestSetups/ISFFile.cs
- Common/DTS.Common/Classes/TestSetups/GraphRecord.cs
- Common/DTS.Common/Classes/TestSetups/RegionOfInterest.cs
- Common/DTS.Common/Classes/TestSetups/ISFSensorRecord.cs
generated_at: "2026-04-17T15:31:22.274945+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "061f25a4b5f73dbc"
---
# Documentation: DTS.Common.Classes.TestSetups
## 1. Purpose
This module provides the data structures and helper utilities for defining, serializing, and managing test configurations within the DTS system. It encompasses hardware definitions (`SimpleHardware`, `TestSetupHardwareRecord`), data processing configurations (`CalculatedChannelRecord`, `RegionOfInterest`), graph layouts (`GraphRecord`), and legacy file format handling (`ISFFile`, `ISFSensorRecord`). It serves as the domain model layer mapping database records and interface contracts to concrete classes used throughout the application.
## 2. Public Interface
### **SimpleHardware**
Inherits from `Tuple<string, string, int, int>`. A lightweight immutable container for hardware identification.
* `SimpleHardware(string serialNumber, string parentDAS, int dasId, int dasType)` — Constructor.
* `string SerialNumber` — Gets Item1.
* `string ParentDAS` — Gets Item2.
* `int DASId` — Gets Item3.
* `int DASType` — Gets Item4.
### **TestSetupHelper**
Abstract class providing static management of test setup names.
* `static void ClearTestSetupNames()` — Clears the internal dictionary.
* `static void SetTestSetupName(int id, string name)` — Maps an ID to a name.
* `static string GetTestSetupName(int Id)` — Retrieves a name by ID; returns `string.Empty` if not found.
### **ExtraProperty**
Implements `IExtraProperty`. A key-value pair supporting `INotifyPropertyChanged` and UI commands.
* `ExtraProperty()` — Default constructor.
* `ExtraProperty(string key, string value)` — Constructor initializing key/value.
* `ExtraProperty(IExtraProperty iep)` — Copy constructor.
* `string Key` — Gets or sets the property key.
* `string Value` — Gets or sets the property value.
* `ICommand PasteCommand` — Gets or sets a command for paste operations (ignored by JSON serialization).
* `UIItemStatus ItemStatus` — Gets or sets the UI status (ignored by JSON serialization).
* `event PropertyChangedEventHandler PropertyChanged` — Notification event.
### **ROIPeriodChannelRecord**
Implements `IROIPeriodChannelRecord`. Represents a channel within a Region of Interest period.
* `ROIPeriodChannelRecord(IDataReader reader, int storedProcedureVersionToUse)` — Constructs a record from a data reader.
* `int TestSetupROIId` — Foreign key to the ROI table.
* `string ChannelName` — Name of the channel.
* `long ChannelId` — ID of the channel; defaults to -1 if `storedProcedureVersionToUse` is below `Constants.ROIPERIODCHANNELS_CHANNELID_DB_VERSION`.
### **TestSetupHardwareRecord**
Implements `ITestSetupHardwareRecord`. Represents hardware configuration for a test setup.
* `TestSetupHardwareRecord()` — Default constructor.
* `TestSetupHardwareRecord(IDataReader reader, int storedProcedureVersionToUse)` — Constructs from database reader.
* `TestSetupHardwareRecord(ITestSetupHardwareRecord copy)` — Copy constructor.
* `int DASId`, `int TestSetupId`, `bool AddDAS`, `int SamplesPerSecond`, `bool IsClockMaster`, `byte PTPDomainId`, `int AntiAliasFilterRate` — Configuration properties.
### **TestSetupROIsRecord**
Implements `ITestSetupROIRecord`. Represents a Region of Interest definition.
* `TestSetupROIsRecord(IDataReader reader)` — Constructs from database reader.
* `int TestSetupROIId`, `int TestSetupId`, `string Suffix`, `double ROIStart`, `double ROIEnd`, `bool IsEnabled`, `bool IsDefault` — ROI properties.
### **CalculatedChannelRecord**
Implements `ICalculatedChannelRecord`. Defines a derived channel based on operations on other channels.
* `CalculatedChannelRecord()` — Default constructor.
* `CalculatedChannelRecord(ICalculatedChannelRecord record)` — Copy constructor.
* `CalculatedChannelRecord(IDataReader reader)` — Constructs from database reader.
* `string Name`, `string TestSetupName`, `int Id`, `Operations Operation`, `string CalculatedValueCode`, `string[] InputChannelIds`, `string CFCForInputChannels`, `string ChannelFilterClassForOutput`, `int TestSetupId`, `bool ViewInRealtime`, `int ClipLength` — Calculation definition properties.
### **ISFFile**
Handles reading/writing ISF (fixed-width) files.
* `ISFFile()` — Constructor initializing header lines with spaces.
* `char[] HeaderLine1`, `char[] TestSetupName`, `char[] NumberOfRecords`, `char[] TestType`, `char[] TestDivision`, `char[] TCFile` — Header metadata properties.
* `IISFSensorRecord[] Records` — Gets the list of sensor records.
* `void AddRecord(IISFSensorRecord record)` — Adds a sensor record and updates the record count.
* `void WriteToFile(string pathToFile)` — Writes the header and records to a binary file.
* `void AddSensors(ISensorData[] sensors)` — Converts `ISensorData` array to `ISFSensorRecord` and adds them.
### **ArrayExtensions** (Static class in ISFFile.cs)
* `void Fill<T>(this T[] sourceArray, T with)` — Fills array with a specific value.
* `void SubFill<T>(this T[] source, T with, int startIndex, int finalIndex)` — Fills a range of the array.
* `void SetValues<T>(this T[] source, T[] with, int startIndex, int length, T pad)` — Copies values into a range, padding if necessary.
* `T[] GetValues<T>(this T[] source, int startIndex, int length)` — Extracts a segment of the array.
### **GraphRecord**
Implements `IGraphRecord`. Defines a graph layout for a test setup.
* `GraphRecord()` — Default constructor.
* `GraphRecord(IGraphRecord copy)` — Copy constructor.
* `GraphRecord(IDataReader reader)` — Constructs from database reader.
* `int GraphId`, `int TestSetupId`, `string GraphName`, `string GraphDescription`, `string ChannelsString`, `string ThresholdsString` — Identification and content.
* `bool UseDomainMin`, `double DomainMin`, `bool UseDomainMax`, `double DomainMax` — Domain axis settings.
* `bool UseRangeMin`, `double RangeMin`, `bool UseRangeMax`, `double RangeMax` — Range axis settings.
* `bool LocalOnly` — Deprecated property for DB synchronization.
### **RegionOfInterest**
Implements `IRegionOfInterest`. A mutable ROI definition with validation and event aggregation.
* `static bool Deserializing` — Flag to suppress change notifications during deserialization.
* `RegionOfInterest()`, `RegionOfInterest(bool isDefault)`, `RegionOfInterest(string suffix, bool isDefault, double start, double end)` — Constructors.
* `string Suffix` — Automatically prepends "_" if missing.
* `double Start`, `double End` — Time boundaries; enforce `Start < End` via adjustment.
* `bool IsEnabled`, `bool IsDefault` — State flags.
* `string[] ChannelNames`, `long[] ChannelIds` — Associated channels.
* `void ResetSuffix()` — Clears the suffix.
* `void SetChannelNamesNoNotify(string[] names)`, `void SetChannelIdsNoNotify(long[] ids)` — Mutators that bypass `NotifyChanged`.
* `static string GetAnalogChanName(...)` — Formats channel names for specific hardware types.
* `static string GetChanName(...)` — Formats channel names based on serial number and hardware.
* `static string RemoveParentDASName(string entireChannelName)` — Strips parent DAS prefix.
* `static string RemoveAssignedByIDFromHardwareString(string chHardware)` — Cleans up hardware string formatting.
### **ISFSensorRecord**
Implements `IISFSensorRecord`. Represents a sensor in an ISF file (4 records of