--- source_files: - Common/DTS.Common.DataModel/ApplicationProperties.cs - Common/DTS.Common.DataModel/CollectDataProcess.cs - Common/DTS.Common.DataModel/SysBuiltObjectType.cs - Common/DTS.Common.DataModel/DataModelSettings.cs - Common/DTS.Common.DataModel/DataFiles.cs - Common/DTS.Common.DataModel/ChannelRepresentation.cs - Common/DTS.Common.DataModel/DASFactory.cs generated_at: "2026-04-16T11:36:27.833103+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "d315c00965ab6aef" --- # DTS.Common.DataModel Module Documentation ## 1. Purpose This module provides the core data model and application-wide state management for the DTS DataPRO system. It contains global application properties, configuration settings, data file management, channel representation logic for hardware abstraction, and the DAS (Data Acquisition System) factory wrapper for device discovery and communication. The module serves as the central hub connecting hardware abstraction, user context, ISO standards integration, and test data management. --- ## 2. Public Interface ### ApplicationProperties (static class) Global application state container. | Property | Type | Description | |----------|------|-------------| | `CurrentUser` | `User` | Gets or sets the currently logged-in user. | | `DASFactory` | `DASFactory` | Gets or sets the DAS factory instance for device management. | | `CurrentView` | `User` | Gets or sets the current view context (distinct from CurrentUser). | | `IsoDb` | `ISO13499FileDb` | Gets or sets the ISO 13499 database reference. | | `LicenseValidationResult` | `ValidationResult` | Gets or sets the license validation state. | | `CanCurrentUserCommitChannelCodes` | `bool` | Gets or sets whether the current user has permission to commit channel codes. | --- ### CollectDataProcess : BasePropertyChanged Represents a data collection process with visual properties. | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `CollectDataProcess(string name, Color color)` | Initializes with name and background color. | | `Name` | `string` | Gets or sets the process name. | | `BackgroundColor` | `Color` | Gets or sets the background color. | | `IsEnabled` | `bool` | Gets or sets whether the process is enabled. | --- ### SysBuiltObjectType Container for Dynamic Groups of a given test object type (Vehicle 1, Vehicle 2, Sled, etc.). | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `SysBuiltObjectType(string testObjectType)` | Initializes with a test object type string. | | `TestObject` | `MMETestObjects` | Gets or sets the test object via ISO database lookup. Setter stores `value.Test_Object` internally. | | `ISOTestObjectType` | `string` | Gets `TestObject.Text_L1`. | | `ToString()` | `override string` | Returns `TestObject.Text_L1`. | --- ### DataModelSettings (static class) Application-wide configuration with default values. **Hardware/Signal Settings:** - `UseISOCodeForDiadem200`: `bool` (default: `false`) - `SampleRateAAFilterRatio`: `byte` (default: `5`) - `RealtimeSampleRateAAFilterRatio`: `byte` (default: `1`) - `SLICETurnOffAAFRealtime`: `bool` (default: `true`) - `ShowCompactHardware`: `bool` (default: `true`) **Error Tolerance Settings:** - `AllowedVoltageInsertionErrorPercent`: `double` (default: `1`) - `AllowedExcitationErrorPercent`: `double` (default: `2`) - `AllowedShuntErrorPercent`: `double` (default: `5`) - `ShuntToleranceHighOhmPercent`: `double` (default: `10`) - `AllowedGainErrorPercent`: `double` (default: `2`) - `AllowedGainErrorPercent_SLICE6andSLICE6A`: `double` (default: `5`) - `AutoZeroPercentDeviationAllowed`: `double` (default: `5`) - `ShuntToleranceHighOhmResistance`: `double` (default: `4000`) **Timing/Network Settings:** - `CheckUnitsIntervalMillisecond`: `int` (default: `50`) - `SemaphoreDelay`: `double` (default: `10`) - `SemaphoreSpots`: `int` (default: `3`) - `SLICEConcurrentSpots`: `int` (default: `999`) - `SLICEConcurrentDelayMs`: `int` (default: `0`) - `MulticastAutoDiscoveryReceiveTimeoutMS`: `int` (default: `1500`) - `LocalKeepAliveRetryIntervalMS`: `uint` (default: `1000`) - `LocalKeepAliveTimeOutMS`: `uint` (default: `5000`) - `RemoteKeepAliveRetryIntervalSeconds`: `uint` (default: `5`) - `RemoteKeepAliveSeconds`: `uint` (default: `60`) - `ReceiveBufferSizeBytes`: `int` (default: `65536`) - `SendBufferSizeBytes`: `int` (default: `65536`) - `HeartbeatAsyncConnectTimeoutMS`: `int` (default: `10000`) **File/Path Settings:** - `DownloadFolder`: `string` (default: `"..\\..\\Data"`) - `DefaultTDCSensorDatabaseFolder`: `string` (default: `"..\\SensorDatabase"`) - `DefaultTDCSensorDatabaseFile`: `string` (default: `"SensorDatabase.CSV"`) - `TDCSensorDatabaseImportEncoding`: `string` (default: `"Shift-JIS"`) **Other Settings:** - `SupportedSquibFireModes`: `string` (default: `"CAP,CONSTANT"`) - `RequireXCrashCompatibilityForISOExports`: `bool` (default: `true`) - `DisplayDuplicateUDPStreamOutWarning`: `bool` (default: `true`) - `UseTestChannelOrder`: `bool` (default: `false`) - `ArmChecklistRequiredIfTOM`: `bool` (default: `true`) - `TestsRequireLevelTriggers`: `bool` (default: `false`) - `TDCSensorDatabaseExportUseCurrentLocale`: `bool` (default: `false`) --- ### DataFiles : BasePropertyChanged Represents metadata for a test data file. | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `DataFiles(string expandCollapse, string testName, string id, string allOrROI, string lab, string customer, DateTime dateCreated, string description, string numberOfChannels, string testEngineer, bool isTSRAIR, string roiSuffix = "")` | Initializes all metadata fields. | | `ExpandCollapse` | `string` | UI state for expand/collapse. | | `TestName` | `string` | Name of the test. | | `TestId` | `string` | Unique test identifier. | | `AllOrROI` | `string` | Indicates "All" or "ROI" data type. | | `Lab` | `string` | Lab name. | | `Customer` | `string` | Customer name. | | `DateCreated` | `DateTime` | Creation timestamp. | | `Description` | `string` | Test description. | | `NumberOfChannels` | `string` | Channel count as string. | | `TestEngineer` | `string` | Test engineer name. | | `ROISuffix` | `string` | ROI suffix identifier. | | `DTSFile` | `string` | Location of DTS file (populated in export tab). | | `IsTSRAIR` | `bool` | Indicates TSR AIR test (default: `false`). | | `TestSelected` | `bool` | Selection state. | | `LongString` | `string` | Extended string representation. | --- ### DataFilesList : BasePropertyChanged Manages discovery and listing of test data files. | Member | Signature | Description | |--------|-----------|-------------| | `DataFileList` | `static DataFilesList` | Singleton instance accessor. | | `DataFiles` | `DataFiles[]` | Gets or sets the list of data files. | | `GetAllDataFiles()` | `DataFiles[]` | Returns top-level test folders with file counts. | | `GetAllFiles(string testName)` | `DataFiles[]` | Returns all data files for a specific test name. | | `Contract(DataFiles df)` | `DataFiles[]` | Collapses expanded test entries in the list. | | `DownloadFolder` | `string` | Field storing the download folder path. | --- ### ChannelRepresentation Handles channel number conversion and display representation for various hardware types. | Member | Signature | Description | |--------|-----------|-------------| | `ChannelTypeEnum` | `enum` | Values: `SQUIB`, `TOMDigital`, `DigitalInput`, `Other`. | | Constructor | `ChannelRepresentation(DASHardware h, DASChannel c, int startingChannelNumber)` | Creates representation from DAS hardware and channel. | | Constructor | `ChannelRepresentation(HardwareChannel c, int startingChannelNumber, IDASHardware[] hardwares = null)` | Creates representation from hardware channel. | | `DASSerialNumber` | `string` | Gets or sets the DAS serial number. | | `SerialNumber` | `string` | Gets or sets the module serial number. | | `ChannelNumberString` | `string` | Gets formatted channel display string (e.g., "CH01", "SQ02"). | | `ChannelNumber` | `int` | Gets the numeric channel number. | --- ### DASFactory Wrapper around `DTS.DASLib.DASFactory.DASFactory` for device discovery and management. | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `DASFactory()` | Initializes factory, semaphores, keep-alive settings, and event handlers. | | `StartMulticastAutoDiscovery()` | `void` | Starts auto-discovery process if not running. | | `StopMulticastAutoDiscovery()` | `void` | Stops auto-discovery process. | | `GetDiscoveredDevices()` | `IDiscoveredDevice[]` | Returns discovered devices. | | `GetDASFactory()` | `IDASFactory` | Returns the underlying DAS factory interface. | | `TakeOwnership()` | `void` | Takes ownership of devices. | | `DetachAllDevices(bool detachUSB = false)` | `void` | Detaches all devices; USB detaching is conditional. | | `DisposeFactory()` | `void` | Disposes the underlying factory. | | `Refresh(bool wait)` | `void` | Refreshes device list; optionally waits for completion. | | `GetActiveDevices()` | `List` | Returns list of active DAS communications. | | `GetReportedConnections()` | `string[]` | Returns all reported connections from distributors. | | `AutoDiscoverIfNecessary()` | `void` | Runs auto-discovery for SLICE6/SLICE6Db downstream MAC addresses. | | `AutoDiscoverMulticast()` | `SortableBindingList` | Performs multicast auto-discovery. | | `DiscoveryThread(...)` | `void` | Background thread for continuous discovery with filtering. | | `StartQATSListening()` / `StopQATSListening()` | `void` | Controls QATS UDP listening. | | `SendQATSRequest()` | `void` | Sends UDP QATS request. | | `GetQATS()` | `IUDPQATSEntry[]` | Returns and clears waiting QATS entries. | | `IsStreaming(IDASCommunication das)` | `static bool` | Returns true if SLICE6 Air is streaming. | | `IsInRealtime(IDASCommunication das)` | `static bool` | Returns true if unit is in realtime or streaming. | | `AnyInRealtime(List das)` | `static bool` | Returns true if any unit is in realtime or streaming. | **Properties:** - `TDASHostNames`: `string[]` - TDAS host names with deduplication on set. - `SPFDHostNames`: `string[]` - SPFD host names. - `SDBHostNames`: `string[]` - Slice DB host names. - `MulticastAutoDiscoveryReceiveTimeoutMS`: `int` - Timeout for multicast discovery. - `MulticastAutoDiscoveryAddress`: `string` - Multicast address. - `MulticastAutoDiscoveryPort`: `int` - Transmit port. - `MulticastAutoDiscoveryResponsePort`: `int` - Receive port. - `S6ConnectNewTimeout`: `double` - SLICE6 connection timeout. **Events:** - `OnDeviceArrived`: `DASFactoryEventHandler` - Fired when a device arrives. - `OnFactoryChanged`: `DASFactoryEventHandler` - Fired on device arrival, failure, or removal. - `DiscoveredDAS`: `DiscoveredDASEventHandler` - Fired with discovered devices. --- ## 3. Invariants 1. **ApplicationProperties Global State**: All properties are static and globally accessible. Consumers must ensure `DASFactory` and `IsoDb` are initialized before use. 2. **DataFilesList Singleton**: The `DataFileList` property uses lazy initialization and always returns the same instance. 3. **DASFactory Refresh Concurrency**: The `_bInRefresh` flag guards against overlapping refresh calls. Only one refresh can execute at a time; overlapping calls are logged but do not execute. 4. **ChannelRepresentation Hardware Type Handling**: The `ConvertChannelNumbers` method must receive valid `HardwareTypes` enum values. Unknown types fall through to a default case that uses the starting channel number directly. 5. **Data Folder Structure**: `GetFoldersWithData` expects folders containing both `.dts` and `.chn` files to be considered valid data folders. 6. **SysBuiltObjectType ISO Lookup**: The `TestObject` getter calls `ApplicationProperties.IsoDb.GetTestObjectByIso()` — `IsoDb` must be initialized before accessing this property. --- ## 4. Dependencies ### This module depends on: - `DTS.Slice.Users` - User types - `DTS.Common.ISO` - ISO 13499 database and test objects (`ISO13499FileDb`, `MMETestObjects`) - `DTS.Common.Licensing.Messages` - `ValidationResult` - `DTS.Common.Base` - `BasePropertyChanged` for MVVM pattern - `DTS.DASLib.DASFactory` - Underlying DAS factory implementation - `DTS.DASLib.Service` - Channel and communication types - `DTS.Common.Utilities.Logging` - `APILogger` - `DTS.Common.Interface.DASFactory` - `IDASFactory`, `IDiscoveredDevice` - `DTS.Common.Interface.DataRecorders` - `IDASHardware` - `DTS.Common.Enums.Hardware` - `HardwareTypes` - `DTS.Common.Enums.Sensors` - Sensor enums - `DTS.Common.Constant.DASSpecific` - `SensorConstants`, `DFConstantsAndEnums` - `DTS.Common.Converters` - `EnumDescriptionTypeConverter` - `DTS.Common.SharedResource.Strings` - Localized strings - `DTS.Serialization` - File reading utilities - `DTS.Common.Utils` - Utility classes - `DTS.Common.DataModel.Classes.TestTemplate` - `TSRAIRGoTestSetup` - `System.Windows.Media` - `Color` type - `System.Xml.Linq` - XML parsing ### What depends on this module: - Unclear from source alone — this appears to be a foundational module likely consumed by UI components, test management, and hardware configuration modules. --- ## 5. Gotchas 1. **ApplicationProperties Static State**: All properties are mutable static state with no thread-safety mechanisms. Concurrent access from multiple threads could cause race conditions. 2. **SysBuiltObjectType Null Risk**: The `TestObject` getter calls `ApplicationProperties.IsoDb.GetTestObjectByIso()` without null checks. If `IsoDb` is null, this will throw. 3. **DASFactory Constructor Blocking**: The constructor performs a synchronous `WaitOne()` on a `ManualResetEvent` during refresh, which could block the calling thread indefinitely if the refresh callback never fires. 4. **ChannelRepresentation Type Casting**: The first constructor casts `c` to `DAS.DASLib.Service.AnalogInputDASChannel` without checking type first, which will throw for non-analog channels. 5. **DataFilesList.GetTestInfo Silent Failure**: Returns `false` on any exception during XML parsing, logging the exception but not propagating the error. Callers may receive empty strings without knowing parsing failed. 6. **Hardcoded Strings**: `TSRAIRGoTestSetup.TEST_NAME` is used for TSR AIR detection but the class definition is not in the provided source. 7. **Namespace Inconsistency**: `ApplicationProperties` is in `DTS.Common.DataModel` namespace, while `CollectDataProcess`, `SysBuiltObjectType`, `DataFiles`, and `DASFactory` are in `DataPROWin7.DataModel` namespace. 8. **Refresh Overlap Handling**: When `Refresh` is called while already refreshing, the second call is silently ignored (only logged if `LOG_DEBUG_REFRESH` is defined). This could lead to stale device lists if callers expect refresh to