8.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||
|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:31:59.768999+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 2101fc7191561021 |
Common
Documentation: DTS.Common.DataModel.Common Module
Purpose
This module provides utility helpers for managing test setup metadata, channel naming conventions, and status reporting within the DTS data modeling layer. It centralizes logic for caching and refreshing test setup lists (with staleness detection via CRC and time-based invalidation), generating warning channel display names, and exposing legacy TOM channel filter constants. It acts as a coordination layer between data persistence (via SQL queries), UI eventing (via Prism’s IEventAggregator), and domain-specific constants, enabling consistent behavior across UI and background processes.
Public Interface
StatusHelpers class
-
SetProgressValueDelegatedelegatepublic delegate void SetProgressValueDelegate(IDASCommunication idas, double progressValue, TSRAIRGoStatus.StatusTypes? status);Signature for a callback used to set progress and status on a DAS communication interface.
-
SetStatus2methodpublic static void SetStatus2(IDASCommunication das, int progressValue, TSRAIRGoStatus.StatusTypes? status, SetProgressValueDelegate setProgressValue)Invokes the provided
setProgressValuedelegate with the givendas,progressValue, andstatus. This is a thin wrapper—no validation or transformation is performed on inputs.
TestObjectHelper class
-
TDC_LEGACY_TOM_CUTOFF_SPSconstantpublic const double TDC_LEGACY_TOM_CUTOFF_SPS = 8000;Threshold sampling rate (samples per second) used to determine TOM channel filter selection in legacy TDC systems. Channels ≥ 8000 SPS use
TDC_LEGACY_TOM_HIGH_FILTER. -
TDC_LEGACY_TOM_HIGH_FILTERconstantpublic const double TDC_LEGACY_TOM_HIGH_FILTER = 1650D;Default high-pass filter frequency (in Hz) applied to TOM channels recorded at >8000 SPS in legacy TDC (CFC1000 equivalent). Note: Values ≤8000 SPS are not handled in this module.
ChannelHelper class
GetWarningChannelNamemethodGenerates a human-readable warning label for a channel, using the following logic:public static string GetWarningChannelName(IGroupChannel groupChannel)- Uses
TestSetupOrderif ≥ 0; otherwise usesGroupChannelOrder. - If
GetChannelName(SerializedSettings.ISOViewMode)returns a non-empty string, uses that quoted (e.g.,'MyChannel'). - Otherwise, appends empty string
'', then optionally appends sensor info (ifSensorValid) and hardware info (ifHardwareValid), e.g.,1, '', (SensorA) DAS1.
- Uses
TestSetupCollection class
-
TestSetupIdspropertypublic static List<string> TestSetupIds { get; }Returns a copy of the internal
_testSetupList(as aList<string>), containing names of test setups. Access is thread-safe viaTestSetupListLock. -
TestSetupListpropertypublic static string[] TestSetupList { get; }Returns an array of test setup names (only complete tests if called directly, but behavior differs based on context—see Gotchas). Triggers full refresh if
_testSetupListis null/empty. UsesProgressBarEventto report progress during refresh. -
TestSetupspropertypublic static TestTemplate[] TestSetups { get; }Returns a snapshot of
_actualTestTemplates(asTestTemplate[]), containing all loaded test templates (not filtered by completeness). -
UpdateTestSetupListIfStale()methodpublic static void UpdateTestSetupListIfStale()Conditionally triggers
UpdateTestSetupList()if:- Last update was >30 minutes ago (
MIN_TESTS_UPDATEINTERVAL_MINUTES), or - CRC of the underlying
TestSetupstable in SQL has changed.
- Last update was >30 minutes ago (
-
UpdateTestSetupList(TestTemplate test)methodpublic static void UpdateTestSetupList(TestTemplate test)Updates the cached list for a single
test:- If
test.IsDirtyand!test.IsComplete, removestest.Namefrom_testSetupList. - If
!test.IsDirtyand!test.IsComplete, does nothing. - Otherwise, adds
test.Nameto_testSetupList(if not already present).
- If
-
UpdateTestSetupList(Action onCompleteAction = null)methodpublic static void UpdateTestSetupList(Action onCompleteAction = null)Performs a full refresh of
_testSetupListand_actualTestTemplates:- Fetches all templates via
TestTemplateList.TestTemplatesList.AllTemplates. - Publishes
ProgressBarEventwith percentage updates. - Adds all templates to
_testSetupList(regardless ofIsComplete). - Computes CRC over
TestSetupsDB table and stores in_crc. - Invokes
onCompleteActionif provided.
- Fetches all templates via
-
TestSetupListLockpropertypublic static object TestSetupListLock { get; }Lock object used to synchronize access to
_testSetupList,_actualTestTemplates,_crc, and_lastUpdateTime.
Invariants
- Thread Safety: All public static properties/methods accessing
_testSetupList,_actualTestTemplates,_crc, or_lastUpdateTimeare guarded byTestSetupListLock. - Staleness Policy:
_testSetupListis considered stale if:- Time since
_lastUpdateTime> 30 minutes (MIN_TESTS_UPDATEINTERVAL_MINUTES), or - CRC of the
TestSetupsDB table (GetCRC()) differs from stored_crc.
- Time since
- CRC Computation: CRC is computed over a byte list derived from
TestSetupstable columns:[TestSetupName],[Dirty],[Complete],[LastModified](binary representation). - Progress Reporting: Full refresh operations (
UpdateTestSetupList()andTestSetupListgetter) publishProgressBarEventwith percentage updates; partial updates (e.g.,UpdateTestSetupList(TestTemplate)) do not.
Dependencies
Imports/References
DTS.Common.Interface.DASFactory.IDASCommunication– Used byStatusHelpers.SetStatus2.DTS.Common.Enums.TSRAIRGo.TSRAIRGoStatus.StatusTypes– Status enum used inSetStatus2.DataPROWin7.Common– Referenced inChannelHelper(viaSerializedSettings.ISOViewMode).DTS.Common.Interface.Channels.IGroupChannel– Used inChannelHelper.GetWarningChannelName.DataPROWin7.DataModel– ProvidesTestTemplate,TestTemplateList.Prism.Ioc.IContainerLocator,Prism.Events.IEventAggregator– Used for eventing and service resolution.System.Windows.Threading.Dispatcher,System.Windows.Application– Used to check dispatcher access before resolving services.DTS.Utilities.Crc32– Custom CRC32 implementation used inGetCRC().
External Dependencies
- SQL Database:
Storage.DbOperations.GetSQLCommand()queries[TestSetups]table. - Prism Event Aggregator: Relies on
ProgressBarEventbeing registered and subscribed to.
Gotchas
-
TestSetupListbehavior is context-dependent:- When accessed after a full
UpdateTestSetupList()call, it returns all test names (including incomplete ones). - When accessed initially (empty cache), it filters to only complete tests (
if (!t.IsComplete) { continue; }).
→ This inconsistency may cause unexpected omissions or inclusions depending on call order.
- When accessed after a full
-
UpdateTestSetupList(TestTemplate)silently fails ifContainerLocator.ContainerorIEventAggregatoris unavailable (e.g., during cmdline import), returning early without updating the list. -
TestSetupIdsreturns aList<string>but is documented asList<string>in source—however,TestSetupListreturnsstring[]. Ensure callers do not assume mutability or shared references. -
SetStatus2is a trivial wrapper: It does not validateidas,progressValue, orstatus. Misuse (e.g., null delegate) will throw at runtime. -
TDC_LEGACY_TOM_CUTOFF_SPSis a legacy constant: The comment explicitly states that channels ≤8000 SPS are not handled in this module. Do not assume support for lower sampling rates. -
TestSetupListgetter may block indefinitely ifContainerLocator.Container.Resolve<IEventAggregator>()fails (e.g., in headless/test environments), since it does not guard against nulleventAggregatorin the fallback path (unlikeUpdateTestSetupList()methods). -
CRC computation is expensive:
GetCRC()performs a full table scan and byte marshaling. Avoid calling it frequently outsideUpdateTestSetupListIfStale(). -
No validation of
progressValueinSetStatus2: The delegate may expectdoublein [0,100] range, but the method accepts anyint(e.g., negative or >100).