Files
DP44/docs/ai/DataPRO/DataPRO/CollectDataSubControls.md
2026-04-17 14:55:32 -04:00

16 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/DataPRO/CollectDataSubControls/PreTestDiagnostics.cs
DataPRO/DataPRO/CollectDataSubControls/AssignSensorsSLICE.xaml.cs
DataPRO/DataPRO/CollectDataSubControls/ListViewTemplateSelector.cs
DataPRO/DataPRO/CollectDataSubControls/SupportClasses.cs
DataPRO/DataPRO/CollectDataSubControls/PostTestDiagnostics.cs
DataPRO/DataPRO/CollectDataSubControls/SensorLayout.xaml.cs
DataPRO/DataPRO/CollectDataSubControls/SquibResistanceCheck.xaml.cs
2026-04-17T15:46:20.834722+00:00 zai-org/GLM-5-FP8 1 b36d85328f88f945

Documentation: DataPRO CollectDataSubControls Module

1. Purpose

This module provides UI components and supporting infrastructure for the data collection workflow in the DataPRO application. It handles pre-test and post-test diagnostics, sensor-to-channel assignment, squib resistance verification, and dynamic list view templating. The module serves as the user-facing layer for hardware interaction during test execution, bridging the DataModel, DASLib services, and WPF presentation layer.


2. Public Interface

PreTestDiagnostics

Namespace: DataPROWin7.SubControls

A thin wrapper around DiagnosticsBase for pre-test diagnostic operations.

Member Signature Description
Constructor public PreTestDiagnostics() Default constructor, calls base constructor.
Constructor public PreTestDiagnostics(DataPROPage page) Initializes with a DataPROPage and DiagnosticsType.PRE.

PostTestDiagnostics

Namespace: DataPROWin7.SubControls

Extends DiagnosticsBase with post-test-specific behavior, including mixed-system warnings and low-power mode transitions.

Member Signature Description
Constructor public PostTestDiagnostics() Default constructor.
Constructor public PostTestDiagnostics(DataPROPage page) Initializes with DiagnosticsType.POST.
RunCurStep public override void RunCurStep() Intercepts execution to warn if mixed hardware (e.g., G5 units) cannot run post-test diagnostics. Calls base.RunCurStep() after warning or if no warning needed.
UnSet public override void UnSet(Action OnComplete = null) Transitions hardware to low-power mode when leaving post-test diagnostics (FB14214). Disables navigation, then calls GoToLowPower.

Private Methods:

  • RunsPostTestDiagnostics(IDASCommunication das) — Returns false if the DAS is a G5 unit (cannot run post-test diagnostics).
  • DoWarning() — Displays StringResources.PostTestDiagnosticsSomeWarn message box, then invokes base.RunCurStep() on the dispatcher.
  • GoToLowPower(Action OnComplete) — Sets ApplicationStatusTypes.LowPowerMode, marks app busy with name "PostTestDiagLowPower", and calls SetLowPowerMode on the parent RunTestBase.

AssignSensorsSLICE

Namespace: DataPROWin7.SubControls

A minimal UserControl for sensor assignment (SLICE-specific).

Member Signature Description
Constructor public AssignSensorsSLICE() Calls InitializeComponent().

ListViewTemplateSelector

Namespace: DataPROWin7.SubControls

A DataTemplateSelector that switches between large and small item templates based on available client space and item count. Implements INotifyPropertyChanged.

Member Signature Description
LargeItemListTemplate public DataTemplate { get; set; } Template used when Mode is LargeList.
SmallItemListTemplate public DataTemplate { get; set; } Template used when Mode is SmallList.
Mode public Modes { get; set; } Current display mode (SmallList or LargeList).
NumberOfItems public int { get; set; } Sets item count; triggers mode recalculation.
ClientSize public Size { get; set; } Client area size; triggers mode recalculation. Default is Size(1000, 800).
SelectTemplate public override DataTemplate SelectTemplate(object item, DependencyObject container) Returns LargeItemListTemplate or SmallItemListTemplate based on Mode. Defaults to SmallItemListTemplate.

Nested Enum:

  • Modes { SmallList, LargeList }

Constants:

  • LargeItemHeight = 110
  • LargeItemWidth = 600

Support Classes

Namespace: DataPROWin7.SubControls

Thread Data Classes

Class Properties Purpose
RunArmThreadData ManualResetEvent DoneEvent Thread synchronization for arm operations.
BasicInfoThreadData ManualResetEvent DoneEvent Thread synchronization for basic info.
HardwareThreadData ManualResetEvent DoneEvent Thread synchronization for hardware operations.
AutoProgressionThreadData DoneEvent, CancelEvent, DelayMilliSeconds Thread data for automatic test progression.
GenericThreadData DAS, ResetEvent, CancelEvent, MissingHardwareEvent, CurrentStatus, CtrlStatusRibbon, DASList, CheckTrigger, DoneAction, TTSImport, SuppressWarning General-purpose thread data for validation and hardware operations.

TestIDFixedPrefixSuffixValues (Enum)

Values: NOT_FIXED = -1, None = 0, TimeStamp = 1, TestSetupName = 2

TestIDPreFixSuffix

Member Signature Description
FixedValue public TestIDFixedPrefixSuffixValues { get; } Returns the fixed value type.
Constructor public TestIDPreFixSuffix(TestIDFixedPrefixSuffixValues fixedPrefixSuffix) Creates with enum value; stores string as "TESTID_PREFIX_SUFFIX_" + value.
Constructor public TestIDPreFixSuffix(string dbPrefixSuffix) Creates with custom string.
ToString public override string ToString() Returns the internal string.

TestIDPreFixSuffixHelper (extends BasePropertyChanged)

Member Signature Description
Constructor public TestIDPreFixSuffixHelper(string testIDPreFixSuffix) Wraps a string-based prefix/suffix.
Constructor public TestIDPreFixSuffixHelper(TestIDFixedPrefixSuffixValues testIdPreFixSuffix) Wraps an enum-based prefix/suffix.
ToString public override string ToString() Returns localized string from StringResources.ResourceManager, or falls back to raw string.
Equals public override bool Equals(object obj) Compares FixedValue; if NOT_FIXED, compares string values.
GetHashCode public override int GetHashCode() Returns base implementation.

SensorLayout

Namespace: DataPROWin7.SubControls

A UserControl for assigning sensors to hardware channels. Implements INotifyPropertyChanged.

Member Signature Description
Channels public DataModel.HardwareChannel[] { get; set; } Channels from the current Hardware.
DASType public string { get; } Returns Hardware.HardwareType or "N/A".
DASSerial public string { get; } Returns Hardware.SerialNumber or "N/A".
ModuleSerialNumber public string { get; } Currently returns empty string (commented-out module logic).
ModuleNumberText public string { get; } Currently returns empty string (commented-out module logic).
Hardware public DataModel.DASHardware { get; set; } The hardware device being configured.
TestObject public DataModel.TestObject { get; set; } The test object containing sensors and hardware.
Sensors public Sensor[] { get; set; } Unassigned sensors from TestObject.
AssignButtonVisibility public Visibility { get; set; } Controls visibility of assign buttons; propagates to all sensors.
RepopulateSensors public void RepopulateSensors() Clears cached sensor list and raises OnPropertyChanged("Sensors").

Nested Class: Sensor (extends BasePropertyChanged)

Member Signature Description
Selected public bool { get; set; } Selection state; changes BackgroundColor.
BackgroundColor public Color { get; } Colors.Yellow if selected, Colors.AliceBlue otherwise.
DataModelSensor public DTS.SensorDB.SensorData { get; } The underlying sensor data.
SerialNumber public string { get; } Sensor serial number.
Description public string { get; } Sensor comment.
EngineeringUnits public string { get; } Display unit.
SensorRanges public string { get; } Formatted as "{RangeLow}/{RangeMedium}/{RangeHigh}/{Capacity}".
AssignButtonVisibility public Visibility { get; set; } Visibility for the assign button.

Event Handlers:

  • HardwareChannelList_SelectionChanged — Manages channel selection state and sensor list synchronization.
  • btnSensorAssign_Click — Assigns selected sensor to selected channel.
  • HardwareUnassign_Click — Unassigns sensor from a channel.

SquibResistanceCheck

Namespace: DataPROWin7.SubControls

Implements IPageContent for performing squib resistance checks. Handles configuration, execution, bypass, and reporting.

Member Signature Description
Constructor public SquibResistanceCheck(DataPROPage page) Initializes with page reference, creates SquibResistanceTable.
AggregateStatusColor public override Color { get; set; } Sets both base and ctrlStatusRibbon.AggregateStatusColor.
AggregateStatusText public override string { get; set; } Sets both base and ctrlStatusRibbon status text.
StartSearch public void StartSearch(string term) Empty implementation.
OnSetActive public void OnSetActive() Empty implementation.
SetPermissions public void SetPermissions(User.UserPermissionLevels actualPermission, User.UserPermissionLevels requiredPermission) Empty implementation.
Validate public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow) Returns true always.
GetPageContent public object GetPageContent() Resets state and returns this.
UnSet public override void UnSet(Action OnComplete = null) Calls base, resets RunNow and _bFactoryChanged.
RunCurStep public override void RunCurStep() Sets RunNow = true and calls Reset().
Reset public void Reset() Prepares UI, checks for running operations, queues WorkFunc on thread pool.
Bypass public void Bypass(BypassCompleteDelegate bypassComplete) Cancels operation, sets status to Cancelled, turns excitation back on, invokes callback.
SetStatus public override void SetStatus(ApplicationStatusTypes status) Updates UI based on status (IDLE, Cancelled, SettingConfiguration, Passed, FailedArmCheckListSetConfig, Failed, Validating).
DummyArm protected override bool DummyArm Returns true if CurrentTest.CheckoutMode is set.

Delegate:

  • public delegate void BypassCompleteDelegate() — Callback for bypass completion.

Key Private Fields:

  • _cancelEvent, _doneEvent, _cancelConfigEventManualResetEvent for thread synchronization.
  • _squibTable — Instance of SquibResistanceTable.
  • _armcheckDASErrorsList<string> holding per-DAS exceptions.
  • _bFactoryChanged — Flag indicating factory configuration changed during operation.

Private Methods:

  • PrepareForResistanceCheck() — Sets up ArmCheckActions, populates squib table.
  • WorkFunc(object o) — Main background worker; handles configuration, arm switch check, squib resistance measurement via DiagnosticsService.PerformArmCheck, and ArmingService.CheckAlreadyLevelTriggered.
  • DoneHandler(bool exception) — Handles configuration completion.
  • DoDoneCalculations() — Updates squib table, generates report, sets pass/fail status.
  • TurnExcitationBackOnIfNeeded — Referenced but implementation not visible in source.

3. Invariants

  1. PostTestDiagnostics Low-Power Transition: UnSet always attempts to transition to low-power mode via GoToLowPower, using the busy name "PostTestDiagLowPower".

  2. ListViewTemplateSelector Mode Calculation: Mode is set to SmallList whenever NumberOfItems > maxUnits (where maxUnits = floor(Height/LargeItemHeight) * floor(Width/LargeItemWidth)). Otherwise, LargeList is used.

  3. SensorLayout Sensor Filtering: The Sensors property only returns sensors that are not already assigned to any channel in the TestObject.Hardware collection.

  4. SquibResistanceCheck Thread Safety: _doneEvent must be set before WorkFunc exits (guaranteed in finally block). _cancelEvent must be checked periodically for cancellation requests.

  5. TestIDPreFixSuffixHelper Equality: Two helpers are equal if their FixedValue matches and is not NOT_FIXED, or if both are NOT_FIXED and their string representations match.

  6. SquibResistanceCheck Factory Change: If _bFactoryChanged becomes true during execution, the operation throws StringResources.FactoryHasChanged and exits without reporting errors.


4. Dependencies

This Module Depends On:

  • DTS.Common.BaseBasePropertyChanged
  • DTS.Common.Interface.DASFactoryIDASCommunication
  • DTS.DASLib.ServiceArmCheckActions, ConfigurationService, DiagnosticsService, ArmingService, ServiceBase
  • DTS.Common.SharedResource.StringsStringResources
  • DTS.Common.EnumsApplicationStatusTypes
  • DTS.Common.Utilities.LoggingAPILogger
  • DTS.Slice.UsersUser.UserPermissionLevels
  • DTS.CommonBrushesAndColors, ServiceCall, ServiceQueue
  • DTS.SensorDBSensorData, SensorModelCollection, SensorsCollection
  • DTS.ReportsReportBase
  • DataPROWin7.DataModelDASHardware, HardwareChannel, TestObject
  • DataPROWin7.ControlsStatusRibbon, HardwareDiscoveryControl

What Depends On This Module:

  • Unclear from source alone — The module appears to be consumed by the main DataPRO application and RunTestBase page orchestration, but exact consumers are not visible in these files.

5. Gotchas

  1. PostTestDiagnostics G5 Exclusion: The RunsPostTestDiagnostics method explicitly excludes G5 hardware from post-test diagnostics. This is hardcoded and may need extension for future hardware types (noted in comments referencing issue #10304).

  2. SensorLayout Module Logic Disabled: ModuleSerialNumber and ModuleNumberText properties have their implementation commented out and always return empty strings. The Sensors getter also has commented-out module iteration logic that could cause NullReferenceException if uncommented (variable modules is initialized to null then iterated).

  3. SquibResistanceCheck DAS Retry Logic: WorkFunc contains multiple retry loops waiting for DAS devices (while (das.Count == 0 && count < maxTries)). These loops can block for up to 60 seconds in one case.

  4. ListViewTemplateSelector Default ClientSize: The default ClientSize of (1000, 800) may not reflect actual UI dimensions if not explicitly set, potentially causing incorrect mode selection.

  5. SquibResistanceCheck Bypass Does Not Wait: The Bypass method calls TurnExcitationBackOnIfNeeded but does not wait for completion before invoking _onBypassComplete.

  6. GenericThreadData.DoneAction Limited Use: The DoneAction property documentation states it is "only used currently by ResolveChannels.StartAutoResolution" — suggesting incomplete integration.

  7. TestIDPreFixSuffixHelper.GetHashCode: Returns base.GetHashCode(), which does not incorporate the wrapped value. This violates the standard GetHashCode/Equals contract when Equals is overridden.