init
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASSettings.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/HardwareChannel.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASHardwareList.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASHardware.cs
|
||||
generated_at: "2026-04-16T04:31:49.040833+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d546885c144cb09e"
|
||||
---
|
||||
|
||||
# Hardware
|
||||
|
||||
## Documentation: DAS Hardware Module (`DatabaseImport.Classes.Hardware`)
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides data structures and utilities for representing and managing Data Acquisition System (DAS) hardware configurations within the `DatabaseImporter` module. It encapsulates hardware metadata (e.g., serial number, type, channels, settings) and supports persistence into the database (specifically `tblTestSetupDASSettings` for `DASSettings`). It serves as a bridge between raw database records (via `ISO.Hardware` and `ISO.HardwareChannel`) and higher-level application logic, enabling consistent handling of DAS hardware during test import and processing.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `DASSettings`
|
||||
- **`public string DASSerialNumber { get; set; }`**
|
||||
Serial number of the DAS device associated with these settings.
|
||||
- **`public double SampleRate { get; set; }`**
|
||||
Sample rate (in Hz) configured for the DAS.
|
||||
- **`public int ExcitationWarmupTimeMS { get; set; }`**
|
||||
Excitation warm-up time in milliseconds.
|
||||
- **`public double HardwareAAF { get; set; }`**
|
||||
Hardware anti-aliasing filter (AAF) cutoff frequency (in Hz).
|
||||
- **`public double PreTriggerSeconds { get; set; }`**
|
||||
Duration (in seconds) of pre-trigger buffer.
|
||||
- **`public double PostTriggerSeconds { get; set; }`**
|
||||
Duration (in seconds) of post-trigger buffer.
|
||||
- **`public bool StatusLineCheck { get; set; }`**
|
||||
Flag indicating whether status line checking is enabled.
|
||||
- **`public bool BatteryCheck { get; set; }`**
|
||||
Flag indicating whether battery voltage checking is enabled.
|
||||
- **`public double InputVoltageMin { get; set; }`**
|
||||
Minimum acceptable input voltage (V).
|
||||
- **`public double InputVoltageMax { get; set; }`**
|
||||
Maximum acceptable input voltage (V).
|
||||
- **`public double BatteryVoltageMin { get; set; }`**
|
||||
Minimum acceptable battery voltage (V).
|
||||
- **`public double BatteryVoltageMax { get; set; }`**
|
||||
Maximum acceptable battery voltage (V).
|
||||
|
||||
> **Note**: This class is intended for serialization into `tblTestSetupDASSettings`. No custom logic or validation is present in the class itself.
|
||||
|
||||
---
|
||||
|
||||
#### `HardwareChannel`
|
||||
- **`public HardwareChannel(HardwareChannel copy)`**
|
||||
Copy constructor. Copies `ChannelNumber`, `Sensor`, `_testObjectChannel`, `Hardware`, and `_isoChannel` from `copy`.
|
||||
- **`public HardwareChannel(ISO.HardwareChannel channel, DASHardware hardware)`**
|
||||
Constructor initializing from an `ISO.HardwareChannel` and its parent `DASHardware`.
|
||||
- **`public int CompareTo(HardwareChannel right)`**
|
||||
Compares two `HardwareChannel` instances first by `DASDisplayOrder`, then by `ChannelIdx` (0-based index). Returns `0` if either operand is `null` or reference-equal.
|
||||
- **`public string GetId()`**
|
||||
Returns a unique identifier string in the format `{HardwareId}x{ChannelNumber+1}` (1-based channel index).
|
||||
- **`public bool IsSupportedBridgeType(Test.Module.Channel.Sensor.BridgeType bridgeType)`**
|
||||
Returns `true` if the underlying `ISO.HardwareChannel.SupportedBridges` bitmask includes the specified `bridgeType`.
|
||||
- **`public int ChannelNumber { get; }`**
|
||||
0-based channel index (`ISO.HardwareChannel.ChannelIdx`).
|
||||
- **`public DASHardware Hardware { get; }`**
|
||||
Parent `DASHardware` instance.
|
||||
- **`public SensorData Sensor { get; set; }`**
|
||||
Optional sensor configuration associated with this channel.
|
||||
- **`public ISO.HardwareChannel GetISOChannel()`**
|
||||
Returns the underlying `ISO.HardwareChannel` instance.
|
||||
|
||||
---
|
||||
|
||||
#### `DASHardware`
|
||||
- **`public DASHardware(Hardware hardware)`**
|
||||
Constructor initializing from a `Hardware` instance. Populates `Channels` by wrapping each `ISO.HardwareChannel` in a `HardwareChannel`.
|
||||
- **`public DASHardware(DASHardware copy, DASHardware parentDAS)`**
|
||||
Constructor for creating a child DAS from a `copy`, with `parentDAS` as its logical parent. Copies `Channels` (deep copy via `HardwareChannel` copy constructor) and `DbTimeStamp`.
|
||||
- **`public bool IsPseudoRack()`**
|
||||
Returns `true` if the hardware type is `SLICE_LabEthernet`, `SLICE_EthernetController`, or `SLICE6DB`, indicating it should be UI-rendered as a rack despite not physically being one.
|
||||
- **`public bool IsDummy()`**
|
||||
Returns `true` if `SerialNumber` contains the substring `"Dummy"`.
|
||||
- **`public int CompareTo(DASHardware right)`**
|
||||
Implements ordering logic:
|
||||
- `null` → `1`
|
||||
- Same reference or `SerialNumber` match → `0`
|
||||
- Parent/child relationship → child sorts after parent
|
||||
- Same parent and `PositionOnDistributor` → sort by `PositionOnDistributor`
|
||||
- Otherwise → lexicographic sort on `SerialNumber`.
|
||||
- **`public string SerialNumber { get; set; }`**
|
||||
Serial number of the DAS.
|
||||
- **`public string ParentDAS { get; set; }`**
|
||||
Serial number of the parent DAS (if any).
|
||||
- **`public int PositionOnDistributor { get; set; }`**
|
||||
Position index on a distributor rack (used for ordering).
|
||||
- **`public HardwareChannel[] Channels { get; set; }`**
|
||||
Array of channels. Setter sorts the list using `HardwareChannel.CompareTo()` before assignment.
|
||||
- **`public int GetHardwareTypeInt()`**
|
||||
Returns the raw integer type (`_hardware.DASType`).
|
||||
- **`public HardwareTypes GetHardwareTypeEnum()`**
|
||||
Casts `GetHardwareTypeInt()` to `HardwareTypes` enum.
|
||||
- **`public long GetMaxMemoryLong()`**
|
||||
Returns `_hardware.MaxMemory`.
|
||||
- **`public Hardware GetHardware()`**
|
||||
Returns the underlying `Hardware` instance.
|
||||
|
||||
---
|
||||
|
||||
#### `DASHardwareList`
|
||||
- **`public static DASHardwareList GetList()`**
|
||||
Singleton accessor. Returns the cached instance if present; otherwise instantiates and caches a new one. (Note: `PopulateHardware()` is commented out in both constructor and `GetList()`.)
|
||||
- **`public void ReloadAll()`**
|
||||
Intended to reload hardware definitions, but current implementation is commented out.
|
||||
- **`public DASHardware GetHardware(string id, bool bUseCache = true)`**
|
||||
Convenience overload of the 4-parameter version with `bThrowExceptionIfChanged = true`, `changed = out bool` ignored.
|
||||
- **`public DASHardware GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed, bool bUseCache = true)`**
|
||||
Retrieves a `DASHardware` by `id`. Uses `_cachedHardware` if available and `bUseCache` is `true`. Falls back to `Hardware.GetAllDAS(id, null)`. Returns `null` if not found.
|
||||
**Note**: Legacy logic for detecting hardware type changes (including `HardwareTypeChangedException`) is commented out and not active.
|
||||
- **`public class HardwareTypeChangedException : Exception`**
|
||||
Placeholder exception type for hardware type mismatch, but **not used** in current implementation.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`HardwareChannel.ChannelNumber`** is always non-negative and corresponds to `ISO.HardwareChannel.ChannelIdx`.
|
||||
- **`HardwareChannel.GetId()`** produces a 1-based channel index (i.e., `ChannelNumber + 1`).
|
||||
- **`DASHardware.Channels`** is always sorted by `HardwareChannel.CompareTo()` after assignment (via setter).
|
||||
- **`DASHardware.CompareTo()`** enforces a partial order where:
|
||||
- Parent DAS sorts before its children.
|
||||
- Siblings under the same parent sort by `PositionOnDistributor`.
|
||||
- Otherwise, lexicographic by `SerialNumber`.
|
||||
- **`DASSettings`** is a pure data container with no runtime validation or normalization. Values are assumed valid per database schema.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Internal Dependencies
|
||||
- **`ISO.Hardware`** and **`ISO.HardwareChannel`**
|
||||
Core data models representing raw database records. Used in `HardwareChannel` and `DASHardware` constructors.
|
||||
- **`SensorData`**
|
||||
Referenced in `HardwareChannel.Sensor`. Must be defined elsewhere in the codebase.
|
||||
- **`Test.Module.Channel.Sensor.BridgeType`**
|
||||
Referenced in `HardwareChannel.IsSupportedBridgeType()`.
|
||||
- **`HardwareTypes`**
|
||||
Enum used in `DASHardware.GetHardwareTypeEnum()`. Must be defined externally.
|
||||
- **`DbTimeStampBase`**
|
||||
Base class for `DASHardware`. Provides timestamping functionality.
|
||||
|
||||
#### External Dependencies
|
||||
- **`System`** (core .NET types)
|
||||
- **`DatabaseImport.Hardware`** (static class)
|
||||
Used in `DASHardwareList.GetHardware()` via `Hardware.GetAllDAS(id, null)`. Must be defined elsewhere.
|
||||
|
||||
#### Dependencies on This Module
|
||||
- Likely consumed by higher-level modules handling test setup, import, or configuration (e.g., `DatabaseImporter` entry points, UI layers).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Singleton caching is non-functional**: `GetList()` instantiates `_list`, but `_list.PopulateHardware()` is commented out. Similarly, `ReloadAll()` and caching logic in `GetHardware()` are commented out. As written, `DASHardwareList` does not cache hardware data beyond the initial instantiation.
|
||||
- **`HardwareTypeChangedException` is unused**: The exception class exists but is never thrown—legacy logic for detecting hardware type changes is disabled.
|
||||
- **`CompareTo()` returns `0` for `null`**: In `HardwareChannel.CompareTo()`, passing `null` returns `0`, which violates the `IComparable<T>` contract (should throw `ArgumentException` or return non-zero). This may cause unexpected behavior in sorting or collections.
|
||||
- **`GetHardware()` in `DASHardwareList` silently returns `null`**: No exception or warning is raised if hardware is not found or if type changes occur (legacy checks are commented out).
|
||||
- **Channel ID is 1-based in string but 0-based internally**: `HardwareChannel.GetId()` uses `ChannelNumber + 1`, which may cause off-by-one confusion if `ChannelNumber` is assumed to be 1-based elsewhere.
|
||||
- **No validation in `DASSettings`**: All properties are auto-implemented with no guards. Invalid values (e.g., negative sample rate) are permitted.
|
||||
- **`DASHardware.IsDummy()` is substring-based**: Relies on `"Dummy"` appearing anywhere in `SerialNumber`, which may yield false positives (e.g., `"Dummy123"` vs `"MyDummyDAS"`).
|
||||
- **`DASHardwareList.GetHardware()` does not handle duplicate IDs**: If `Hardware.GetAllDAS()` returns multiple records, only the first is used—no conflict resolution or logging.
|
||||
|
||||
> **None identified from source alone** for additional gotchas beyond those explicitly visible in the code.
|
||||
@@ -0,0 +1,187 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/Zone.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/RegionAdorner.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/Region.cs
|
||||
generated_at: "2026-04-16T04:32:32.660920+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cd00dc5bfe396de9"
|
||||
---
|
||||
|
||||
# RegionsAndZones
|
||||
|
||||
## Documentation: Regions and Zones Module
|
||||
|
||||
### 1. Purpose
|
||||
This module provides data structures and UI adorning capabilities for defining and managing spatial regions and zones within test object templates, primarily for ISO-compliant test configuration. It enables users to define named zones (e.g., anatomical or functional areas) containing one or more rectangular regions, each associated with metadata (e.g., direction, filter class, transducer location) used to generate ISO codes and filter available channels. The module bridges raw template data (`TemplateZone`, `TemplateRegion`) with WPF-based UI interaction (via `RegionAdorner`) and supports bidirectional conversion between in-memory objects and ISO database representations.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `Zone` class
|
||||
- **`Zone(Zone copy, TestObjectTemplate template)`**
|
||||
Copy constructor. Initializes a new `Zone` by copying properties (`Description`, `Image`, `Regions`) from an existing `Zone`, preserving `ISODllZone`, and preloading picture filenames.
|
||||
- **`Zone(TemplateZone z, TestObjectTemplate template)`**
|
||||
Constructor from ISO `TemplateZone`. Loads `Description`, `Image`, and `Regions` (converted to `Region` objects). Attempts to load and cache the zone picture as a `BitmapImage` if the file exists.
|
||||
- **`string Name { get; set; }`**
|
||||
Zone name, sourced from `ISODllZone.ZoneName`.
|
||||
- **`string Description { get; set; }`**
|
||||
Zone description, sourced from `ISODllZone.Description` (defaults to `""`).
|
||||
- **`string Image { get; set; }`**
|
||||
Filename of the zone picture, sourced from `ISODllZone.Picture`.
|
||||
- **`TemplateZone ISODllZone { get; }`**
|
||||
Read-only reference to the underlying ISO `TemplateZone` object.
|
||||
- **`string[] AllPictures { get; }`**
|
||||
Thread-safe array of filenames (not full paths) in the `ZonePictures` subdirectory of the app base directory. Populates on first access.
|
||||
- **`void PopulateFilenamesIfNeeded()`**
|
||||
Ensures `_fileNames` is populated (only if empty), using a lock to prevent concurrent population.
|
||||
- **`int PictureIndex { get; set; }`**
|
||||
Index into `AllPictures` for the currently selected picture. Setting triggers loading of the corresponding image into `PictureSource`. Index `-1` sets `PictureSource` to `null`.
|
||||
- **`string GetPictureName()`**
|
||||
Returns the filename of the currently selected picture (empty string if `PictureIndex < 0`).
|
||||
- **`System.Windows.Media.ImageSource PictureSource { get; set; }`**
|
||||
The WPF `ImageSource` for the currently selected picture.
|
||||
- **`Region[] Regions { get; set; }`**
|
||||
Array of `Region` objects in this zone. `get` returns a copy; `set` replaces the internal list.
|
||||
|
||||
#### `RegionAdorner` class
|
||||
- **`RegionAdorner(UIElement adornedElement, TestObjectTemplate template, Contexts context)`**
|
||||
Constructor. Creates a new adorner for an `Image` (or other `UIElement`). Initializes `_region`, sets up mouse event handlers, and configures visual path (AliceBlue stroke, 60% opacity, initially hidden).
|
||||
- **`Point GetUpperLeft()`**
|
||||
Returns the upper-left corner of `SelectRect`, adjusted for scaling between the adorned element’s `RenderSize` and its `Source` dimensions.
|
||||
- **`Point GetLowerRight()`**
|
||||
Returns the lower-right corner of `SelectRect`, similarly scaled.
|
||||
- **`bool IsNew { get; set; }`**
|
||||
Controls visibility of region add/delete UI: `true` → `RegionAddVisibility=Visible`, `RegionDeleteVisibility=Hidden`; `false` → vice versa.
|
||||
- **`Rect SelectRect { get; set; }`**
|
||||
Bounding rectangle of the region in adorner coordinates. Setting it updates `MyRegion.RegionUpperLeft`/`RegionBottomRight` via `GetUpperLeft()`/`GetLowerRight()`.
|
||||
- **`Region MyRegion { get; set; }`**
|
||||
Reference to the associated `Region` object.
|
||||
- **`Contexts Context { get; set; }`**
|
||||
Context enum (`EditTestObject` or `EditTestObjectTemplate`) indicating usage mode.
|
||||
- **`event RegionSelectedHandler OnRegionSelected`**
|
||||
Raised on `MouseLeftButtonDown`.
|
||||
- **`event EndSelectionHandler OnEndSelection`**
|
||||
Raised on `MouseLeftButtonUp` (via `EndSelection()`).
|
||||
- **`void DrawSelection(...)`**
|
||||
Updates `SelectRect` to a rectangle defined by `AnchorPoint` and current mouse position (used during region creation).
|
||||
- **`void MoveSelection(...)`**
|
||||
Updates `SelectRect` by translating it by the mouse delta (used during region movement).
|
||||
|
||||
#### `Region` class
|
||||
- **`Region(RegionAdorner adorner, TestObjectTemplate template)`**
|
||||
Constructor for a *new* region. Sets default name/description, assigns `Template`, initializes `RegionChannels`/`RegionUIChannels` from template, and calls `DetermineAvailableISOSettings()`.
|
||||
- **`Region(TestObjectTemplate template, TemplateRegion r)`**
|
||||
Constructor from ISO `TemplateRegion`. Populates all properties from `r` (e.g., `RegionUpperLeft`, `RegionDirection`, `ISOCode`) and calls `FilterRegionChannels()` and `SetISOCode()`.
|
||||
- **`string RegionName { get; set; }`**
|
||||
User-facing region name.
|
||||
- **`string RegionDescription { get; set; }`**
|
||||
User-facing region description.
|
||||
- **`Point RegionUpperLeft { get; set; }`**
|
||||
Upper-left coordinate (WPF `Point`) of the region.
|
||||
- **`Point RegionBottomRight { get; set; }`**
|
||||
Lower-right coordinate (WPF `Point`) of the region.
|
||||
- **`MMEDirections RegionDirection { get; set; }`**
|
||||
Direction metadata (e.g., "Anterior", "Posterior"). Setting updates `_directionIndex` and calls `SetISOCode()`.
|
||||
- **`MMEFilterClasses RegionFilterClass { get; set; }`**
|
||||
Filter class metadata. Setting updates `_filterClassIndex` and calls `SetISOCode()`.
|
||||
- **`MMEFineLocations1 RegionFineLocation1 { get; set; }`**
|
||||
Fine location 1 metadata. Setting updates `_fineLocation1Index` and calls `SetISOCode()`.
|
||||
- **`MMEFineLocations2 RegionFineLocation2 { get; set; }`**
|
||||
Fine location 2 metadata. Setting updates `_fineLocation2Index` and calls `SetISOCode()`.
|
||||
- **`MMEFineLocations3 RegionFineLocation3 { get; set; }`**
|
||||
Fine location 3 metadata. Setting calls `SetISOCode()`.
|
||||
- **`MMETransducerMainLocation RegionMainLocation { get; set; }`**
|
||||
Main transducer location metadata. Setting updates `_mainLocationIndex` and calls `SetISOCode()`.
|
||||
- **`MMEPhysicalDimensions RegionPhysicalDimension { get; set; }`**
|
||||
Physical dimension metadata. Setting updates `_physicalDimensionIndex` and calls `SetISOCode()`.
|
||||
- **`MMEPositions RegionPosition { get; set; }`**
|
||||
Position metadata. Setting updates `_positionIndex` and calls `SetISOCode()`.
|
||||
- **`MMETestObjects RegionTestObject { get; set; }`**
|
||||
Test object type (e.g., "Breast", "Brain").
|
||||
- **`TestObjectTemplate Template { get; set; }`**
|
||||
Reference to the parent template. Setting triggers `DetermineAvailableISOSettings()`.
|
||||
- **`string[] AllDirections { get; set; }`**
|
||||
Available direction options (from template). `set` also populates `AllDirectionsStrings`.
|
||||
- **`string[] AllDirectionsStrings { get; }`**
|
||||
Human-readable direction names (e.g., `"Anterior"`).
|
||||
- **`MMEFilterClasses[] AllFilterClasses { get; set; }`**
|
||||
Available filter classes. `set` populates `AllFilterClassStrings`.
|
||||
- **`string[] AllFilterClassStrings { get; }`**
|
||||
Human-readable filter class names.
|
||||
- **`MMEFineLocations1[] AllFineLocations1 { get; set; }`**
|
||||
Available fine location 1 options. `set` populates `AllFineLocations1Strings`.
|
||||
- **`string[] AllFineLocations1Strings { get; }`**
|
||||
Human-readable fine location 1 names (`"??"` for null).
|
||||
- **`MMEFineLocations2[] AllFineLocations2 { get; set; }`**
|
||||
Available fine location 2 options. `set` populates `AllFineLocations2Strings`.
|
||||
- **`string[] AllFineLocations2Strings { get; }`**
|
||||
Human-readable fine location 2 names.
|
||||
- **`int FineLocation2Index { get; set; }`**
|
||||
Index into `AllFineLocations2`. Setting updates `RegionFineLocation2` and calls `FilterRegionChannels()`.
|
||||
- **`MMEFineLocations3[] AllFineLocations3 { get; set; }`**
|
||||
Available fine location 3 options. `set` populates `AllFineLocations3Strings`.
|
||||
- **`string[] AllFineLocations3Strings { get; }`**
|
||||
Human-readable fine location 3 names.
|
||||
- **`MMETransducerMainLocation[] AllMainLocations { get; set; }`**
|
||||
Available main location options. `set` populates `AllMainLocationsStrings`.
|
||||
- **`string[] AllMainLocationsStrings { get; }`**
|
||||
Human-readable main location names (`"????"` for null).
|
||||
- **`MMEPhysicalDimensions[] AllPhysicalDimensions { get; set; }`**
|
||||
Available physical dimension options. `set` populates `AllPhysicalDimensionStrings`.
|
||||
- **`string[] AllPhysicalDimensionStrings { get; }`**
|
||||
Human-readable physical dimension names (`"??"` for null).
|
||||
- **`MMEPositions[] AllPositions { get; set; }`**
|
||||
Available position options. `set` populates `AllPositionStrings`.
|
||||
- **`string[] AllPositionStrings { get; }`**
|
||||
Human-readable position names.
|
||||
- **`string ISOCode { get; set; }`**
|
||||
16-character ISO code string (e.g., `"BREAST?ANTERIOR???????"`). Generated by `SetISOCode()` from metadata fields.
|
||||
- **`TestObjectTemplateChannel[] RegionChannels { get; set; }`**
|
||||
List of channels *available* for this region (filtered by `RegionMainLocation`, `RegionDirection`, etc.). `set` triggers `DetermineAvailableISOSettings()`.
|
||||
- **`TemplateChannelUI[] RegionUIChannels { get; set; }`**
|
||||
UI-friendly channel list (mirrors `RegionChannels`).
|
||||
- **`Visibility RegionAddVisibility { get; set; }`**
|
||||
UI visibility flag for "add region" controls.
|
||||
- **`Visibility RegionDeleteVisibility { get; set; }`**
|
||||
UI visibility flag for "delete region" controls.
|
||||
- **`TemplateRegion ToISORegion(TestObjectTemplate template, Zone zone, int number)`**
|
||||
Converts this `Region` to a `TemplateRegion` for ISO export. Uses `RegionUpperLeft`/`RegionBottomRight` (converted to `System.Drawing.Point`), and maps null metadata to ISO defaults (`"?"`, `"??"`, `"????"`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **Picture filename consistency**: `PictureIndex` must be in `[0, AllPictures.Length-1]` or `-1`. Setting `PictureIndex` to `-1` sets `PictureSource` to `null`.
|
||||
- **ISO code format**: `ISOCode` is always 16 characters, with `"?"`, `"??"`, or `"????"` used for missing metadata fields.
|
||||
- **Channel filtering**: `RegionChannels` is always a subset of `Template.TemplateAllChannels`, filtered by `RegionMainLocation`, `RegionDirection`, `RegionFilterClass`, `RegionFineLocation1/2/3`, `RegionPhysicalDimension`, and `RegionPosition`.
|
||||
- **Metadata consistency**: `RegionDirection`, `RegionFilterClass`, etc., are always `null` or a valid object from their respective `All*` arrays.
|
||||
- **Thread safety**: `_fileNames` population is guarded by a static lock (`MyLock`), and `AllPictures` always accesses `_fileNames` under this lock.
|
||||
- **Region bounds**: `RegionUpperLeft` and `RegionBottomRight` are WPF `Point` coordinates relative to the adorned image.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Imports/References**:
|
||||
- `System`, `System.Collections.Generic`, `System.Linq` (core .NET)
|
||||
- `System.Windows`, `System.Windows.Controls`, `System.Windows.Documents`, `System.Windows.Input`, `System.Windows.Media`, `System.Windows.Shapes` (WPF)
|
||||
- `System.ComponentModel` (`INotifyPropertyChanged`)
|
||||
- `App` (from `Application.Current`), `IsoDb`, `TestObjectTemplate`, `TemplateZone`, `TemplateRegion`, `MMEDirections`, `MMEFilterClasses`, `MMEFineLocations1/2/3`, `MMETransducerMainLocation`, `MMEPhysicalDimensions`, `MMEPositions`, `MMETestObjects`, `TestObjectTemplateChannel`, `TemplateChannelUI` (all inferred from usage).
|
||||
- **External resources**:
|
||||
- `ZonePictures` subdirectory in `AppDomain.CurrentDomain.BaseDirectory` (for zone images).
|
||||
- **Depended on by**:
|
||||
- UI layers (e.g., WPF adorner layers using `RegionAdorner`).
|
||||
- Database import/export logic (via `ToISORegion` and `Zone` constructors).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Picture loading failure**: If `Image` is set but the file does not exist at `ZonePictures/<Image>`, `PictureIndex` is set to `-1` silently (no exception thrown).
|
||||
- **Scaling assumptions**: `GetUpperLeft()`/`GetLowerRight()` assume the adorned element is an `Image` with a `BitmapImage` source. Scaling logic may be incorrect if `Source` dimensions are unavailable or non-integer.
|
||||
- **`FineLocation2Index` setter**: Only updates `RegionFineLocation2` and calls `FilterRegionChannels()`; does *not* update `_fineLocation2Index` directly (relies on `RegionFineLocation2` setter).
|
||||
- **`RegionFineLocation3` setter**: Does not update `_fineLocation3Index` (empty `else` block), unlike other fine location properties.
|
||||
- **`AllPictures` thread safety**: While `_fileNames` population is thread-safe, `AllPictures` returns a *snapshot* array. Concurrent modifications to `_fileNames` (e.g., via `PopulateFilenames()`) during enumeration could cause `IndexOutOfRangeException` if not for the lock (but `AllPictures` itself is safe).
|
||||
- **`Region` constructor from `TemplateRegion`**: Uses `((App)Application.Current).IsoDb` for lookups. If `IsoDb` is not initialized, this will throw a `NullReferenceException`.
|
||||
- **`RegionChannels`/`RegionUIChannels`**: The `set` accessor for `RegionChannels` calls `DetermineAvailableISOSettings()`, which may overwrite previously set values (e.g., `RegionDirection`, `RegionFilterClass`).
|
||||
- **ISO code generation**: `SetISOCode()` uses `"?"` for null `RegionTestObject`, but `"???"` for null `RegionMainLocation` (inconsistent padding).
|
||||
@@ -0,0 +1,132 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/ZeroMethod.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/InitialOffset.cs
|
||||
generated_at: "2026-04-16T04:31:39.106411+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f3a6aea6102ad03a"
|
||||
---
|
||||
|
||||
# Sensors
|
||||
|
||||
## Documentation: Sensor Calibration Offset Classes
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module defines two core data structures—`ZeroMethod` and `InitialOffset`—used to represent sensor calibration parameters within the database import pipeline. `ZeroMethod` encodes the *zeroing procedure* applied to a sensor (e.g., how and over what range the zero offset was determined), while `InitialOffset` encodes the *initial offset correction* applied to raw sensor data, supporting legacy single-value EU offsets as well as modern calibrated offsets specified in engineering units (EU) at a known millivolt (mV) input. Together, they enable accurate reconstruction of calibrated sensor readings from raw data during import.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ZeroMethod` class
|
||||
|
||||
- **`public event PropertyChangedEventHandler PropertyChanged;`**
|
||||
Implements `INotifyPropertyChanged`—raised when any property (`Method`, `Start`, `End`) is modified.
|
||||
|
||||
- **`protected bool SetProperty<T>(ref T storage, T value, string propertyName = null) → bool`**
|
||||
Updates the backing field if the new value differs, raises `PropertyChanged`, and returns `true`; otherwise returns `false`. Used internally by property setters (not shown in source but implied by usage pattern).
|
||||
|
||||
- **`protected void OnPropertyChanged(string propertyName = null)`**
|
||||
Raises the `PropertyChanged` event for the specified property name (or `null` for all properties).
|
||||
|
||||
- **`public ZeroMethodType Method { get; set; }`**
|
||||
The zeroing method used (e.g., `ZeroMethodType.Average`, `ZeroMethodType.LinearFit`). *Type is referenced but not defined in this source file.*
|
||||
|
||||
- **`public double Start { get; set; }`**
|
||||
Start index or time of the zeroing window/range.
|
||||
|
||||
- **`public double End { get; set; }`**
|
||||
End index or time of the zeroing window/range.
|
||||
|
||||
- **`public ZeroMethod(ZeroMethodType zm, double start, double end)`**
|
||||
Primary constructor: initializes `Method`, `Start`, and `End` directly.
|
||||
|
||||
- **`public ZeroMethod(string zm)`**
|
||||
Deserialization constructor: parses a comma-separated string `zm` of the form `"Method,Start,End"` (e.g., `"Average,100.0,200.0"`), using `InvariantCulture`. Throws no exception on failure—invalid input silently leaves properties at default values.
|
||||
|
||||
- **`public ZeroMethod(ZeroMethod copy)`**
|
||||
Copy constructor: performs deep copy of all fields (`Method`, `Start`, `End`).
|
||||
|
||||
#### `InitialOffset` class
|
||||
|
||||
- **`public enum Forms { None = 0, EU = 1, EUAtMV = 2 }`**
|
||||
Indicates the format of the offset:
|
||||
- `None`: No offset applied.
|
||||
- `EU`: Single offset value in engineering units.
|
||||
- `EUAtMV`: Offset specified as EU value measured at a known mV input (requires additional context to compute full offset).
|
||||
|
||||
- **`public Forms Form { get; set; }`**
|
||||
Current format of this offset instance.
|
||||
|
||||
- **`public double EU { get; set; } = 0;`**
|
||||
Engineering unit value. Interpretation depends on `Form`:
|
||||
- `EU`: Direct offset to add to raw data.
|
||||
- `EUAtMV`: EU value observed at `MV`.
|
||||
- `None`: Unused.
|
||||
|
||||
- **`public double MV { get; set; } = 0;`**
|
||||
Millivolt input at which `EU` was measured. Only meaningful when `Form == EUAtMV`.
|
||||
|
||||
- **`public InitialOffset(InitialOffset copy)`**
|
||||
Copy constructor: copies `EU`, `MV`, and `Form`. Safely handles `null` input (no-op).
|
||||
|
||||
- **`public InitialOffset()`**
|
||||
Default constructor: sets `Form = Forms.None`, `EU = 0`, `MV = 0`.
|
||||
|
||||
- **`public InitialOffset(double d)`**
|
||||
Legacy constructor: creates an `EU`-form offset with `EU = d`, `MV = 0`, `Form = Forms.EU`.
|
||||
|
||||
- **`public void FromDbSerializeString(string input)`**
|
||||
Deserializes from a database string (e.g., `"EUAtMV,12.5,45.3"` using `InvariantCulture` list separator).
|
||||
- Throws `InvalidDataException` if fewer than 3 tokens or invalid `Forms` enum value.
|
||||
- Throws `FormatException` if `EU` or `MV` token is not parseable as `double`.
|
||||
- Sets `Form = Forms.None`, `EU = 0`, `MV = 0` on empty/whitespace input.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`ZeroMethod`**
|
||||
- `Start` and `End` may be in any order (no guarantee `Start ≤ End` is enforced).
|
||||
- `Method` must be a valid `ZeroMethodType` enum value (enforced only if constructed via `ZeroMethodType` constructor; string constructor does not validate enum parsing).
|
||||
- After deserialization via string constructor, if parsing fails (e.g., fewer than 3 tokens), properties retain their default values (`Method = default(ZeroMethodType)`, `Start = End = 0.0`).
|
||||
|
||||
- **`InitialOffset`**
|
||||
- `Form == Forms.None` ⇔ `EU = 0` and `MV = 0` (enforced by constructors and `FromDbSerializeString` on empty input).
|
||||
- `Form == Forms.EU` ⇒ `MV` is irrelevant (but not reset); `EU` holds the offset in EU.
|
||||
- `Form == Forms.EUAtMV` ⇒ `EU` is the observed EU at `MV` (both must be non-zero in practice, though not enforced).
|
||||
- `FromDbSerializeString` requires exactly 3 tokens; otherwise throws.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **`ZeroMethod`**
|
||||
- **Depends on**: `System.ComponentModel` (for `INotifyPropertyChanged`), `System` (for `Equals`, `Convert`, `Enum.Parse`, `PropertyChangedEventArgs`).
|
||||
- **References**: `ZeroMethodType` (enum, not defined in this file—must be defined elsewhere in `DatabaseImport` namespace).
|
||||
- **Used by**: Likely sensor configuration/import logic (inferred from namespace `DatabaseImport.Sensors`).
|
||||
|
||||
- **`InitialOffset`**
|
||||
- **Depends on**: `System` (for `Enum.TryParse`, `double.TryParse`, `InvalidDataException`, `FormatException`).
|
||||
- **References**: `Forms` nested enum (defined in this file).
|
||||
- **Used by**: Sensor calibration/offset application logic during data import.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **`ZeroMethod` string constructor is non-throwing on failure**: If the input string has fewer than 3 comma-separated tokens, the constructor silently leaves properties uninitialized (default values). Callers must validate or assume success only for well-formed inputs.
|
||||
|
||||
- **`ZeroMethodType` is undefined here**: Its possible values and semantics (e.g., `Average`, `LinearFit`) are not documented in this source—must be referenced externally.
|
||||
|
||||
- **`InitialOffset.EU` meaning is context-dependent**: In `EUAtMV` mode, `EU` is *not* the final offset—it is the EU value *at* `MV`. The actual offset calculation requires additional calibration data (e.g., sensor sensitivity), which is not provided in this class.
|
||||
|
||||
- **`FromDbSerializeString` uses list separator from `InvariantCulture`**: While `InvariantCulture` is used for number parsing, the list separator (`TextInfo.ListSeparator`) is *not* guaranteed to be a comma—it is culture-specific (though `InvariantCulture`’s is `,`). This may cause issues if the DB string uses a different delimiter.
|
||||
|
||||
- **No validation of `Start`/`End` ranges**: `ZeroMethod` allows `Start > End` or negative values without error.
|
||||
|
||||
- **`InitialOffset` copy constructor does not throw on `null`**: It silently returns with default values if `copy == null`.
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/LabratoryDetails.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/CustomerDetails.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/TestEngineerDetails.cs
|
||||
generated_at: "2026-04-16T04:31:55.181756+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6aa688c6b66d13f9"
|
||||
---
|
||||
|
||||
# TestMetaData
|
||||
|
||||
## Documentation: Test Metadata Wrappers Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module provides thin managed wrappers around low-level `ISO.*` data entities (`LabratoryDetails`, `CustomerDetails`, `TestEngineerDetails`) to support database import operations within the DataPRO system. It exposes simplified, namespaced access to metadata entities used during test configuration and reporting, including CRUD-like operations (e.g., `DeleteAll`) and instance management (e.g., singleton list for engineers). The module exists to decouple the import pipeline from direct dependencies on the `ISO` layer, enabling testability and future flexibility in metadata handling.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `LabratoryDetails`
|
||||
- **`public string Name { get; set; }`**
|
||||
Gets or sets the laboratory name by delegating to the underlying `_lab.Name` field.
|
||||
|
||||
#### `LabratoryDetailsList`
|
||||
- **`public static void DeleteAll()`**
|
||||
Invokes `ISO.LabratoryDetails.DeleteLabratoryDetails()` to remove all laboratory detail records from persistent storage.
|
||||
|
||||
#### `CustomerDetails`
|
||||
- **`public string Name { get; set; }`**
|
||||
Gets or sets the customer name by delegating to `_customerDetails.Name`.
|
||||
|
||||
#### `CustomerDetailsList`
|
||||
- **`public static void DeleteAll()`**
|
||||
Invokes `ISO.CustomerDetails.DeleteCustomerDetails()` to delete all customer detail records.
|
||||
|
||||
#### `TestEngineerDetails`
|
||||
- **`public TestEngineerDetails()`**
|
||||
Default constructor initializes `_testEngineerDetails` to a new `ISO.TestEngineerDetails` instance with `Name` set to `"(none)"`.
|
||||
- **`public TestEngineerDetails(ISO.TestEngineerDetails testEngineerDetails)`**
|
||||
Copy constructor: initializes `_testEngineerDetails` by constructing a new `ISO.TestEngineerDetails` from the provided instance.
|
||||
- **`public string Name { get; set; }`**
|
||||
Gets or sets the engineer’s name via `_testEngineerDetails.Name`.
|
||||
|
||||
#### `TestEngineerDetailsList`
|
||||
- **`public static TestEngineerDetailsList TestEngineerList { get; }`**
|
||||
Static singleton accessor for the single `TestEngineerDetailsList` instance.
|
||||
- **`public void ReloadAll()`**
|
||||
Thread-safely repopulates the internal `_testEngineers` dictionary by calling `GetAllTestEngineers()` and caching entries keyed by `Name`.
|
||||
- **`public static void DeleteAll()`**
|
||||
Clears the in-memory `_testEngineers` dictionary and invokes `ISO.TestEngineerDetails.DeleteAllTestEngineerDetails()` to purge persisted records.
|
||||
- **`private TestEngineerDetails[] GetAllTestEngineers()`**
|
||||
Returns an array of `TestEngineerDetails` objects: first a sentinel `"(none)"` entry (via default constructor), then one entry per record returned by `ISO.TestEngineerDetails.GetAllTestEngineerDetails()`.
|
||||
|
||||
> **Note**: `GetAllTestEngineers()` is `private`, but used internally by `ReloadAll()` and implicitly by the `PopulateEngineers()` method.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **`Name` is the only mutable property** exposed via the public interface for all three detail classes (`LabratoryDetails`, `CustomerDetails`, `TestEngineerDetails`).
|
||||
- **`TestEngineerDetailsList` is a singleton** — only one instance exists (`_testEngineerList`), accessed via `TestEngineerList`.
|
||||
- **Thread safety for `ReloadAll()`** is enforced via `lock (_testEngineerLock)` around `PopulateEngineers()`.
|
||||
- **`"(none)"` sentinel entry** is always the first element in the list returned by `GetAllTestEngineers()`.
|
||||
- **Duplicate names are prevented** in `_testEngineers` dictionary: `PopulateEngineers()` only adds an entry if `!_testEngineers.ContainsKey(t.Name)`.
|
||||
- **`_testEngineers` is nullified on `DeleteAll()`**, forcing a full reload on next access.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- `ISO.LabratoryDetails` (type with static methods `DeleteLabratoryDetails()`)
|
||||
- `ISO.CustomerDetails` (type with static method `DeleteCustomerDetails()`)
|
||||
- `ISO.TestEngineerDetails` (type with static methods `GetAllTestEngineerDetails()`, `DeleteAllTestEngineerDetails()`, and constructors)
|
||||
- `System.Collections.Generic.Dictionary<string, TestEngineerDetails>` (used in `TestEngineerDetailsList`)
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Not explicitly stated in source, but given the naming and structure, this module is likely consumed by:
|
||||
- `DatabaseImport` pipeline components (e.g., importers that populate or validate test metadata).
|
||||
- UI or service layers that require test metadata (e.g., selecting engineer or lab for a test run).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Typo in class names**: All classes use `Labratory` (misspelled) instead of `Laboratory`. This is preserved from the underlying `ISO` layer and must be maintained for compatibility.
|
||||
- **`TestEngineerDetails` is *not* thread-safe for concurrent mutation** — while `ReloadAll()` is synchronized, direct access to `_testEngineerDetails.Name` (via `Name` property) is not guarded.
|
||||
- **`_testEngineerDetails` field in `TestEngineerDetails` is *not* `readonly`**, unlike the others — implying potential reassignment (though not observed in current code).
|
||||
- **`GetAllTestEngineers()` silently ignores duplicate names** — only the first occurrence is retained in `_testEngineers`.
|
||||
- **No validation on `Name` values** — empty strings or duplicates are allowed at the wrapper level (though duplicates are deduped in `TestEngineerDetailsList`).
|
||||
- **`CustomerDetailsList` and `LabratoryDetailsList` have no instance members beyond `DeleteAll()`** — they are effectively static namespaces.
|
||||
- **`TestEngineerDetailsList` caches in-memory state** — changes made directly to `ISO.*` entities outside this module may not be reflected until `ReloadAll()` is called.
|
||||
|
||||
None identified beyond those above.
|
||||
@@ -0,0 +1,263 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TemplateChannelUI.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectTemplateCollection.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectList.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestTestObject.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectTemplate.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObject.cs
|
||||
generated_at: "2026-04-16T04:33:08.085586+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d8ddaddf5f4cb968"
|
||||
---
|
||||
|
||||
# TestObject
|
||||
|
||||
**Documentation Page: Test Object & Template Management Module**
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides in-memory wrappers and management abstractions for test object and template data originating from the `ISO.TestObject` and `ISO.TestObjectTemplate` types in the underlying `ISO` namespace. It serves as the data-access and UI-binding layer for test object configurations, templates, and associated channel/sensor metadata within the `DatabaseImporter` module. Its primary role is to decouple UI and business logic from raw database structures (`ISO13499FileDb`) while supporting both ISO-compliant and non-ISO (custom) test object types, and enabling template reuse, inheritance, and zone-based channel organization.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `TemplateChannelUI`
|
||||
- **`TemplateChannelUI(TestObjectTemplateChannel channel)`**
|
||||
Constructor wrapping a `TestObjectTemplateChannel`. No public properties or methods exposed beyond the internal `_channel` field.
|
||||
|
||||
#### `TestObjectTemplateCollection`
|
||||
- **`static TestObjectTemplateCollection TemplateCollection { get; }`**
|
||||
Singleton accessor for the global collection of test object templates.
|
||||
- **`TestObjectTemplate GetTemplate(string templateId)`**
|
||||
Retrieves a `TestObjectTemplate` by ID from the database (`IsoDb`) and wraps it in a `TestObjectTemplate` instance. Returns `null` if not found.
|
||||
- **`TestObjectTemplate SysBuiltTestObjectTemplate { get; }`**
|
||||
Returns the system-built template (currently uninitialized in source; `_sysBuiltTestObjectTemplate` is `null`).
|
||||
- **`void ReloadAll(bool loadSubComponents)`**
|
||||
Stubbed out (all logic commented out). Intended to refresh templates and subcomponents.
|
||||
- **`static void DeleteAll()`**
|
||||
Deletes all templates in the database via `ISO.TestObjectTemplate.DeleteAllTemplates()`, then resets the singleton collection.
|
||||
|
||||
#### `TestObjectList`
|
||||
- **`static TestObjectList TestObjectsList { get; }`**
|
||||
Singleton accessor for the main list of test objects (non-system-built).
|
||||
- **`static TestObjectList AddedGroupsList { get; }`**
|
||||
Singleton accessor for a separate list used for user-added groups (system-built).
|
||||
- **`void ReloadAll(bool bLoadSubComponents)`**
|
||||
Stubbed out (empty body). Intended to reload all test objects and subcomponents.
|
||||
- **`TestObject GetTestObject(string serialNumber, bool bSysBuilt)`**
|
||||
Retrieves a test object by serial number and `bSysBuilt` flag. Returns `null` if not found.
|
||||
- **`TestObject GetTestObject(string serialNumber)`**
|
||||
Convenience overload: tries non-system-built first, then system-built.
|
||||
- **`TestObject GetAddedGroup(string serialNumber)`**
|
||||
Alias for `GetTestObject(serialNumber, true)`.
|
||||
- **`void DeleteAll()`**
|
||||
Deletes all test objects in the database via `ISO.TestObject.DeleteAllTestObjects()`.
|
||||
|
||||
#### `TestTestObject`
|
||||
- **`TestTestObject(TestObject obj)`**
|
||||
Constructor wrapping a `TestObject`.
|
||||
- **`MMEPositions Position { get; set; }`**
|
||||
Gets/sets the group position. Setting to `UserSetKey` (`"@"`) hides the combo box and shows the position button; otherwise, vice versa. Also propagates position to all required sensors.
|
||||
- **`string ChannelDefaultsKey { get; }`**
|
||||
Constant `"#"` representing the default channel position.
|
||||
- **`string UserSetKey { get; }`**
|
||||
Constant `"@"` representing a user-defined position.
|
||||
- **`Visibility GroupPositionComboBoxVisible { get; set; }`**
|
||||
Controls visibility of the position combo box. Collapsed if `ISO13499` support is disabled (`NO_ISO`).
|
||||
- **`Visibility GroupPositionButtonVisible { get; set; }`**
|
||||
Controls visibility of the position button. Collapsed if `ISO13499` support is disabled.
|
||||
- **`MMETestObjects TestObject { get; set; }`**
|
||||
Gets/sets the test object for the group. Setting it propagates the change to all required sensors.
|
||||
- **`int ChannelTypesIndex { get; set; }`**
|
||||
Index into a list of channel types (used for UI binding).
|
||||
- **`int ExcitationWarmupTimeMS { get; set; }`**
|
||||
Excitation warm-up time in milliseconds.
|
||||
- **`double TargetSampleRate { get; set; }`**
|
||||
Target sample rate.
|
||||
- **`double PreTriggerSeconds { get; set; }`**
|
||||
Pre-trigger duration in seconds.
|
||||
- **`double PostTriggerSeconds { get; set; }`**
|
||||
Post-trigger duration in seconds.
|
||||
- **`MMEPositions[] AvailablePositions { get; }`**
|
||||
Returns available positions from `IsoDb`.
|
||||
- **`MMEPositions[] AvailableGroupPositions { get; }`**
|
||||
Returns combined list: `ChannelDefaultsKey` position first, then `AvailablePositions`.
|
||||
- **`void SetTestObject(string s)`**
|
||||
Sets `_testObject` and raises `TestObject` property change.
|
||||
- **`void SetPosition(string s)`**
|
||||
Sets `_position` and raises `Position` change; updates UI visibility flags.
|
||||
|
||||
#### `TestObjectTemplate`
|
||||
- **`TestObjectTemplate()`**
|
||||
Default constructor. Initializes `TestObject` based on `SerializedSettings.ISOSupportLevel`. For `NO_ISO`, creates a non-ISO test object and sets channel type to `Constants.NON_ISO_TESTOBJECT_CHANNEL_TYPE`.
|
||||
- **`TestObjectTemplate(ISO.TestObjectTemplate template, ref ISO13499FileDb db)`**
|
||||
Wraps an `ISO.TestObjectTemplate` instance.
|
||||
- **`TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)`**
|
||||
Copy constructor.
|
||||
- **`string TemplateName { get; set; }`**
|
||||
Template name.
|
||||
- **`string TemplateDescription { get; set; }`**
|
||||
Template description.
|
||||
- **`string TemplateParent { get; set; }`**
|
||||
Parent template name (for inheritance).
|
||||
- **`bool SysBuilt { get; set; }`**
|
||||
Whether the template is system-built.
|
||||
- **`bool Embedded { get; set; }`**
|
||||
Whether the template is embedded.
|
||||
- **`string OriginalTemplateName { get; set; }`**
|
||||
Original template name (preserved for tracking).
|
||||
- **`MMETestObjects TestObject { get; set; }`**
|
||||
Test object associated with the template.
|
||||
- **`string TestObjectType { get; set; }`**
|
||||
Test object type (e.g., channel type).
|
||||
- **`int TestObjectTypeIndex { get; set; }`**
|
||||
Index into `AvailableTestObjectTypes`.
|
||||
- **`string[] AvailableTestObjectTypes { get; set; }`**
|
||||
List of test object types compatible with current `TestObject`.
|
||||
- **`TestObjectTemplateChannel[] RequiredChannels { get; }`**
|
||||
List of required channels for the template.
|
||||
- **`TestObjectTemplateChannel[] TemplateAllChannels { get; set; }`**
|
||||
All channels (required + optional), sorted by `DisplayOrder`.
|
||||
- **`TemplateChannelUI[] TemplateAllUIChannels { get; set; }`**
|
||||
UI wrapper list for `TemplateAllChannels`.
|
||||
- **`Zone[] TemplateZones { get; set; }`**
|
||||
List of zones defined in the template.
|
||||
- **`int CurrentZoneIndex { get; set; }`**
|
||||
Index of the currently selected zone. Updates `CurrentZone`.
|
||||
- **`Zone CurrentZone { get; set; }`**
|
||||
Currently selected zone. Controls `AreZoneControlsEnabled`.
|
||||
- **`bool AreZoneControlsEnabled { get; }`**
|
||||
`true` if `CurrentZone` is non-null.
|
||||
- **`DateTime LastModified { get; set; }`**
|
||||
Last modification timestamp.
|
||||
- **`string LastModifiedBy { get; set; }`**
|
||||
User who last modified the template.
|
||||
- **`static MMETestObjects GetNonISOTestObject()`**
|
||||
Retrieves or creates a non-ISO test object (name: `Constants.NON_ISO_TESTOBJECT_NAME`). Tries letters A–Z, then digits 0–9.
|
||||
- **`ISO.TestObjectTemplate ToISOTestObjectTemplate()`**
|
||||
Converts the wrapper to an `ISO.TestObjectTemplate` instance for persistence.
|
||||
|
||||
#### `TestObject`
|
||||
- **`TestObject()`**
|
||||
Default constructor. Initializes empty `_isoTestObject` and `Template`.
|
||||
- **`TestObject(ISO.TestObject to, bool sysBuilt)`**
|
||||
Wraps an `ISO.TestObject`. Initializes `Template` and hardware.
|
||||
- **`TestObject(TestObject copy)`**
|
||||
Copy constructor.
|
||||
- **`string SerialNumber { get; set; }`**
|
||||
Unique serial number.
|
||||
- **`string SerialNumberConverted { get; set; }`**
|
||||
Human-readable serial number (e.g., stripped prefix for system-built).
|
||||
- **`string DisplaySerialNumber { get; set; }`**
|
||||
Serial number used for display. Setting it updates `SerialNumber`, `OriginalSerialNumber`, and template name.
|
||||
- **`string TestSetupName { get; set; }`**
|
||||
Name prefix for user-added groups.
|
||||
- **`string TestObjectType { get; set; }`**
|
||||
Type of the test object (from template).
|
||||
- **`string ParentObject { get; set; }`**
|
||||
Parent test object (for hierarchy).
|
||||
- **`bool SysBuilt { get; set; }`**
|
||||
Whether the test object is system-built.
|
||||
- **`TestObjectTemplate Template { get; set; }`**
|
||||
Template associated with the test object.
|
||||
- **`void SetTemplateDontResetISOObject(TestObjectTemplate value)`**
|
||||
Sets template without resetting underlying `ISO.TestObject.Template`.
|
||||
- **`string[] ZoneNames { get; set; }`**
|
||||
Names of zones in the current template.
|
||||
- **`string TemplateType { get; }`**
|
||||
`Template.TestObjectType`, or `""` if no template.
|
||||
- **`DASHardware[] Hardware { get; }`**
|
||||
List of attached hardware devices, sorted.
|
||||
- **`void SetHardwareFromISO()`**
|
||||
Refreshes `_hardware` from `ISO.TestObject.HardwareIds`.
|
||||
- **`void SetHardware(DASHardware[] hardware)`**
|
||||
Sets hardware list in memory and updates `ISO.TestObject.HardwareIds`.
|
||||
- **`void AddHardware(DASHardware hardware)`**
|
||||
Adds hardware, handling dummy hardware naming collisions.
|
||||
- **`bool ContainsHardware(DASHardware h)`**
|
||||
Checks if hardware is attached.
|
||||
- **`SensorData GetSensor(string channelId, string serialNumber, string alternateChannelId = null)`**
|
||||
Retrieves sensor settings for a given channel and serial number. Applies ISO channel defaults and overrides from `ISO.TestObject.SensorSettings`.
|
||||
- **`void SetSensor(string channelName, SensorData sensor)`**
|
||||
Persists sensor settings to the underlying `ISO.TestObject`.
|
||||
- **`ISO.TestObject GetISOTestObject()`**
|
||||
Returns the underlying `ISO.TestObject` instance.
|
||||
- **`void RefreshHardware()`**
|
||||
Alias for `SetHardwareFromISO()`.
|
||||
- **`string SerialNumberOrOriginalSerialNumber { get; }`**
|
||||
Returns `OriginalSerialNumber` if embedded, else `SerialNumberConverted` or `SerialNumber`.
|
||||
- **`SerializedSettings.ISOSupportLevels GetObjectISOLevel()`**
|
||||
Returns `NO_ISO` if template type contains `NON_ISO_TESTOBJECT_CHANNEL_TYPE` or `NONISOCHANNELTYPE`, else `ISO_ONLY`.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Singleton consistency**:
|
||||
`TestObjectTemplateCollection.TemplateCollection` and `TestObjectList.TestObjectsList`/`AddedGroupsList` are lazily initialized singletons. Thread-safety is ensured via `volatile` and `lock(MyLock)` (in `TestObjectList`).
|
||||
- **Template ↔ ISO mapping**:
|
||||
Every `TestObjectTemplate` wraps exactly one `ISO.TestObjectTemplate`, and vice versa. The `ToISOTestObjectTemplate()` method must produce a valid `ISO.TestObjectTemplate` with all fields populated.
|
||||
- **Sensor settings precedence**:
|
||||
`TestObject.GetSensor()` applies ISO channel defaults *first*, then overlays `SensorSettings` from `ISO.TestObject`. If `FilterClassIso` is `"?"`, it is normalized to `"P"`.
|
||||
- **Channel ordering**:
|
||||
`TemplateAllChannels` is sorted by `DisplayOrder` (via `CompareChannels`).
|
||||
- **Non-ISO test object uniqueness**:
|
||||
`GetNonISOTestObject()` ensures a single non-ISO test object exists, using letters A–Z first, then digits 0–9 if needed.
|
||||
- **Template type consistency**:
|
||||
`TestObject.TemplateType` is derived from `Template.TestObjectType`. If `Template` is `null`, it returns `""`.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### **Internal Dependencies**
|
||||
- `ISO.TestObject`, `ISO.TestObjectTemplate`, `ISO13499FileDb` (from `ISO` namespace).
|
||||
- `App.IsoDb` (accessed via `Application.Current as App`).
|
||||
- `DASHardware`, `DASHardwareList`, `SensorData`, `SensorsCollection.SensorsList`.
|
||||
- `MMEPositions`, `MMETestObjects`, `MMEPossibleChannels`.
|
||||
- `SerializedSettings`, `Constants` (e.g., `NON_ISO_TESTOBJECT_NAME`, `NON_ISO_TESTOBJECT_CHANNEL_TYPE`).
|
||||
- `Zone`, `TemplateZone`, `TestObjectTemplateChannel`.
|
||||
- `DbTimeStampBase` (base class for `TestObject`).
|
||||
- `Tags` enum (used for property change notifications).
|
||||
|
||||
#### **External Dependencies**
|
||||
- `System.Windows` (for `Visibility`, `Application`, `Guid.NewGuid()`).
|
||||
- `System.Globalization` (for `CultureInfo.InvariantCulture` parsing).
|
||||
- `System.Linq` (for LINQ queries in `GetNonISOTestObject()` and `TestObjectTemplate` initialization).
|
||||
|
||||
#### **Dependents**
|
||||
- UI layers (e.g., WPF views binding to `TemplateChannelUI`, `TestObject`, `TestTestObject`).
|
||||
- Import/export logic (e.g., TDM imports calling `DeleteAll()` on `TestObjectList` or `TestObjectTemplateCollection`).
|
||||
- Template management UI (e.g., zone editing, channel assignment).
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **`SysBuiltTestObjectTemplate` is uninitialized**:
|
||||
`_sysBuiltTestObjectTemplate` is declared but never assigned. `SysBuiltTestObjectTemplate` will always return `null`.
|
||||
- **`ReloadAll` stubbed out**:
|
||||
Both `TestObjectTemplateCollection.ReloadAll()` and `TestObjectList.ReloadAll()` have no implementation (all logic commented out). This may cause stale data if callers assume reload occurs.
|
||||
- **`TemplateAllChannels` setter triggers side effects**:
|
||||
Setting `TemplateAllChannels` in `TestObjectTemplate` instantiates `TemplateAllUIChannels` and updates `_channels` and `_availableTestObjectTypes`. This may cause unexpected behavior if called multiple times.
|
||||
- **`TestObject.GetSensor()` uses ambiguous channel lookup**:
|
||||
The method tries `channelId` first, then `alternateChannelId` (often `channelId` again). The comment notes historical inconsistency between channel name vs. ID usage.
|
||||
- **`DisplaySerialNumber` setter mutates multiple fields**:
|
||||
Setting `DisplaySerialNumber` on a user-added group updates `SerialNumber`, `SerialNumberConverted`, `OriginalSerialNumber`, and template names. This may cause unintended side effects if used on system-built objects.
|
||||
- **`TestTestObject.Position` setter propagates to sensors**:
|
||||
Changing `Position` updates *all* required sensors’ positions, but only if `Position != UserSetKey`. This may be unexpected if the UI allows switching to `UserSetKey` mid-edit.
|
||||
- **`GetNonISOTestObject()` may throw**:
|
||||
If no available letters/digits remain, `GetNonISOTestObject()` throws `NotSupportedException`. No fallback or logging is present.
|
||||
- **`TemplateType` may be `"?"`**:
|
||||
`TestObject.TestObjectType` defaults to `"?"`, and `TemplateType` inherits this. Consumers must handle this sentinel value.
|
||||
- **No explicit `INotifyPropertyChanged` implementation visible**:
|
||||
Classes reference `SetProperty` and `OnPropertyChanged`, but no base class (`BasePropertyChanged`) is included in the source. Behavior assumes a working implementation elsewhere.
|
||||
|
||||
---
|
||||
|
||||
*End of Documentation.*
|
||||
@@ -0,0 +1,124 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/ICachedContainer.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/HardwareInclusionInstruction.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/TestTemplateLite.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/RegionOfInterest.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/TestTemplateList.cs
|
||||
generated_at: "2026-04-16T04:32:24.918567+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d58cccdbb5baf57a"
|
||||
---
|
||||
|
||||
# Documentation: TestTemplate Module
|
||||
|
||||
## 1. Purpose
|
||||
This module provides foundational data structures and utilities for representing and manipulating test templates within the DatabaseImporter subsystem. It defines lightweight and extensible models for test configurations (e.g., `TestTemplateLite`), hardware inclusion/exclusion rules (`HardwareInclusionInstruction`), time-domain regions of interest (`RegionOfInterest`), and a caching interface (`ICachedContainer`) for hardware lookups. It also includes helper methods in `TestTemplateList` for serializing/deserializing sensor settings and managing system-wide test template state. The module exists to decouple test template representation from full database persistence, enabling in-memory manipulation, validation, and deferred commit—particularly useful during test import workflows where DAS hardware may be excluded via group-based rules (e.g., for "DASless" tests).
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ICachedContainer` (Interface)
|
||||
- **`DASHardware GetCachedHardware(string serialNumber)`**
|
||||
Retrieves a cached `DASHardware` instance by serial number. Returns `null` if not found (behavior inferred from usage context).
|
||||
- **`IISOHardware[] GetAllCachedHardware()`**
|
||||
Returns all cached hardware items as an array of `IISOHardware`.
|
||||
|
||||
### `HardwareInclusionInstruction` (Class)
|
||||
- **Constructor `HardwareInclusionInstruction(string hardwareId, Actions action)`**
|
||||
Initializes a new instruction to add or remove hardware from a test, overriding group-derived inclusion.
|
||||
- `hardwareId`: Identifier for the hardware item (e.g., serial number).
|
||||
- `action`: Either `Actions.Remove` (exclude despite group membership) or `Actions.Add` (include despite absence from groups).
|
||||
- **Properties**
|
||||
- `HardwareId`: Read-only string identifier.
|
||||
- `Action`: Read-only `Actions` enum value (`Remove` or `Add`).
|
||||
|
||||
### `TestTemplateLite` (Class)
|
||||
- **Properties**
|
||||
- `Name`: `string` — Name of the test template.
|
||||
- `Description`: `string` — Optional description (defaults to `""`).
|
||||
- `RecordingMode`: `RecordingModes` — Determines pre-trigger behavior.
|
||||
- `PreTriggerSeconds`: `double` —
|
||||
- Returns `0` for `Recorder` or `HybridRecorder` modes.
|
||||
- Returns stored `_preTriggerSeconds` for `CircularBuffer` or other modes.
|
||||
- Setter updates `_preTriggerSeconds` unconditionally.
|
||||
- `ErrorMessage`: `string` — Raw error message (defaults to `string.Empty`).
|
||||
- `CompletionErrorMessage`: `string` — Truncated error message (max 250 chars).
|
||||
- `PostTriggerSeconds`: `double` — Post-trigger duration.
|
||||
- `LastModified`: `DateTime` — Timestamp of last modification.
|
||||
- `LastModifiedBy`: `string` — User who last modified the template.
|
||||
- `IsComplete`: `bool` — Indicates if the template is fully configured.
|
||||
|
||||
### `RegionOfInterest` (Class)
|
||||
- **Constructors**
|
||||
- `RegionOfInterest()` — Default: `Suffix=""`, `Start=-1`, `End=1`, `IsEnabled=true`, `IsDefault=true`.
|
||||
- `RegionOfInterest(bool isDefault)` — Sets `IsDefault`.
|
||||
- `RegionOfInterest(string suffix, bool isDefault, double start, double end)` — Full initialization.
|
||||
- **Properties**
|
||||
- `Suffix`: `string` — Auto-normalized to start with `_` (e.g., `"foo"` → `"_foo"`; `""` remains `""`).
|
||||
- `Start`: `double` — Clamped to `[PreTrigger, End - 0.01]`.
|
||||
- `End`: `double` — Clamped to `[Start + 0.01, PostTrigger]`.
|
||||
- `PreTrigger`: `double` — Setter updates `Start` if `Start < PreTrigger`.
|
||||
- `PostTrigger`: `double` — Setter updates `End` if `End > PostTrigger`.
|
||||
- `IsEnabled`: `bool` — Default `true`.
|
||||
- `IsDefault`: `bool` — Read-only; set only via constructor.
|
||||
- **Events**
|
||||
- `PropertyChanged`: Implements `INotifyPropertyChanged` for UI binding.
|
||||
|
||||
### `TestTemplateList` (Class)
|
||||
- **Static Properties**
|
||||
- `TestTemplatesList`: Singleton instance (thread-safe via `lock`).
|
||||
- **Instance Properties**
|
||||
- `TemporaryTemplate`: `TestTemplate` — Holds a template in memory without DB persistence.
|
||||
- **Static Methods**
|
||||
- `GetSensorFromSettings(string settings, string serial, Dictionary<string, SensorData> lookup)`:
|
||||
Parses `settings` (comma-separated `key=value` pairs) to populate a `SensorData` object. Falls back to `SensorsCollection.SensorsList.GetSensorBySerialNumber(serial)` if `lookup` is `null` or missing `serial`. Returns `null` if `serial` is null/empty or no `SensorData` found.
|
||||
- `GetSensorFromSettings(string settings, string serial)`: Overload with `lookup=null`.
|
||||
- `GetSensorSettings(SensorData sd)`: Serializes `sd` into a comma-separated `key=value` string. Only includes settings with non-default values (e.g., omits `Delay` if `DelayMS` is `0`).
|
||||
- `SysBuiltObject(string serialNumber)`: Calls stored procedure `sp_TestObjectsGet` to determine if `serialNumber` corresponds to a system-built test object. Returns `bool`.
|
||||
- `ConvertToDictionary(DataTable dt, ref Dictionary<string, List<Dictionary<string, object>>> lookup, string key)`: Populates `lookup` by grouping `dt` rows on `key`. Each row becomes a `Dictionary<string, object>` of column values.
|
||||
- **Instance Methods**
|
||||
- `Reload()`: Refreshes all related data collections (ISO DB, sensors, DAS hardware, etc.) and calls `Load()` (currently a no-op).
|
||||
- `DeleteAll()`: Executes stored procedure `sp_TestSetupsDeleteAll` to clear all test setups. Handles output parameters for error info (logging suppressed in source).
|
||||
|
||||
## 3. Invariants
|
||||
- **`RegionOfInterest`**:
|
||||
- `Start < End` always holds (enforced via setter clamping).
|
||||
- `Start ≥ PreTrigger` and `End ≤ PostTrigger` always hold (enforced via setter clamping and `PreTrigger`/`PostTrigger` setters).
|
||||
- `Suffix` is normalized to start with `_` if non-empty and non-whitespace.
|
||||
- **`TestTemplateLite`**:
|
||||
- `PreTriggerSeconds` is `0` for `Recorder`/`HybridRecorder` modes regardless of stored `_preTriggerSeconds`.
|
||||
- `CompletionErrorMessage` truncates `ErrorMessage` to 250 characters if longer.
|
||||
- **`HardwareInclusionInstruction`**:
|
||||
- `HardwareId` is never `null` or empty (enforced by constructor).
|
||||
- **`TestTemplateList`**:
|
||||
- `TestTemplatesList` is a singleton (lazy-initialized under lock).
|
||||
- `GetSensorFromSettings` returns `null` if `serial` is null/empty or no matching sensor exists.
|
||||
|
||||
## 4. Dependencies
|
||||
### Internal Dependencies
|
||||
- **`DatabaseImport` namespace**: All types are internal to this module.
|
||||
- **`ISO.TestObject.SensorSettings`**: Used in `GetSensorFromSettings`/`GetSensorSettings` (enum values drive parsing/serialization).
|
||||
- **`SensorData`**: Core data type for sensor configuration (used in `GetSensorFromSettings`, `GetSensorSettings`).
|
||||
- **`DASHardware`, `IISOHardware`**: Referenced in `ICachedContainer` (concrete types not defined in provided sources).
|
||||
- **`RecordingModes`**: Enum used in `TestTemplateLite.PreTriggerSeconds` (concrete definition not provided).
|
||||
- **`DigitalOutputModes`, `SquibFireMode`, `DigitalInputModes`**: Referenced in `GetSensorFromSettings` (enum definitions not provided).
|
||||
- **Database Abstraction**:
|
||||
- `DbOperations`, `DbOperationsEnum.StoredProcedure`, `SqlDbType`, `CommandType`, `SqlParameter`, `DataRow`, `DataTable` (from `System.Data`).
|
||||
- Stored procedures: `sp_TestObjectsGet`, `sp_TestSetupsDeleteAll`.
|
||||
- **UI Framework**: `Application.Current` (WPF `App` type) in `Reload()`.
|
||||
- **Singleton Collections**: `SensorsCollection.SensorsList`, `CustomChannelList.List`, `SensorCalibrationList`, `DASHardwareList`, `TestEngineerDetailsList.TestEngineerList`, `TestObjectTemplateCollection.TemplateCollection`, `TestObjectList.TestObjectsList` (referenced in `Reload()`).
|
||||
|
||||
### External Dependencies
|
||||
- `System`, `System.ComponentModel`, `System.Data`, `System.Data.SqlClient`, `System.Linq`, `System.Text`, `System.Windows` (WPF).
|
||||
|
||||
## 5. Gotchas
|
||||
- **`PreTriggerSeconds` behavior**: For `Recorder`/`HybridRecorder` modes, `PreTriggerSeconds` always returns `0`, ignoring the stored `_preTriggerSeconds` value. This may cause confusion if persisted/serialized values are expected to be preserved.
|
||||
- **`Suffix` normalization**: Non-empty suffixes are auto-prefixed with `_` (e.g., `"foo"` → `"_foo"`). Empty/whitespace suffixes remain unchanged.
|
||||
- **`GetSensorFromSettings` fallback**: If `lookup` is provided but lacks `serial`, it falls back to `SensorsCollection.SensorsList.GetSensorBySerialNumber(serial)`. This dual-source lookup may mask missing data in `lookup`.
|
||||
- **`GetSensorSettings` omits default values**: Settings with default/zero values (e.g., `DelayMS=0`) are excluded from the serialized string. This may cause deserialization to use defaults instead of explicit values if the caller expects all settings to be present.
|
||||
- **`SysBuiltObject` return value**: Returns `false` if the stored procedure returns no rows, but does not distinguish between "not found" and "error occurred" (error handling logs are suppressed).
|
||||
- **`DeleteAll` error handling**: Output parameters (`@ErrorSeverity`, `@ErrorState`, `@ErrorMessage`) are captured but not logged or propagated (commented-out logging suggests intentional suppression).
|
||||
- **`TestTemplateLite` is incomplete**: The class is explicitly labeled a "lightweight" version and omits many fields of a full `TestTemplate`. Its `IsComplete` flag may not reflect full validation state.
|
||||
- **`RegionOfInterest` clamping is cascading**: Setting `PreTrigger` may trigger `Start` updates (via `Start = PreTrigger`), and setting `Start` may trigger `End` updates (via `End = Start + 0.01`). This can cause unexpected side effects in UI bindings.
|
||||
- **No documentation for `TestTemplate`**: `TemporaryTemplate` is typed as `TestTemplate`, but this class is not defined in the provided sources. Its structure and relationship to `TestTemplateLite` are unclear.
|
||||
Reference in New Issue
Block a user