init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/App/WaitCursor.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/App/App.cs
|
||||
generated_at: "2026-04-17T16:44:58.377701+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fa7ba64696e65370"
|
||||
---
|
||||
|
||||
# Documentation: DatabaseImport Application Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides UI state management utilities for a WPF-based database import application. It consists of two components: `WaitCursor`, a disposable utility class for temporarily displaying a wait cursor with automatic restoration, and `App`, the main application class that manages application-wide busy states, provides lazy-initialized access to an `ISO13499FileDb` instance, and handles thread-safe UI manipulation through dispatcher-aware methods.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `WaitCursor` Class
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public WaitCursor()` | Saves the current `Mouse.OverrideCursor` value to `_previousCursor`, then sets `Mouse.OverrideCursor` to `Cursors.Wait`. |
|
||||
| `Dispose` | `public void Dispose()` | Restores the cursor by setting `Mouse.OverrideCursor` back to the saved `_previousCursor` value. |
|
||||
|
||||
### `App` Class (partial)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `IsoDb` | `public ISO13499FileDb IsoDb { get;
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Constants.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Enums.cs
|
||||
generated_at: "2026-04-17T16:28:42.803827+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9657b5b95f022b50"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
### Purpose
|
||||
This module provides core constant and enumeration definitions for the DatabaseImport subsystem. It defines sentinel values for non-ISO test object handling, recording mode configurations, sensor compatibility levels, and an extensive taxonomy of test template tags used throughout the test configuration and execution pipeline.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`Constants` (static class)**
|
||||
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE = "x_NonISOTestObjectType_x"` — Sentinel string value identifying non-ISO test object channel types.
|
||||
- `public const string NON_ISO_TESTOBJECT_NAME = "x_NonISOTestObjectName_x"` — Sentinel string value identifying non-ISO test object names.
|
||||
|
||||
**`RecordingModes` (enum)**
|
||||
- `CircularBuffer` — Recording mode using circular buffer, description "RecordingModes_CircularBuffer".
|
||||
- `Recorder` — Standard recorder mode, description "RecordingModes_Recorder".
|
||||
- `HybridRecorder` — Hybrid recorder mode, description "RecordingModes_HybridRecorder".
|
||||
- Decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` for description-based conversion.
|
||||
|
||||
**`IsoChannelSensorCompatibilityLevels` (enum)**
|
||||
- `DontWarn` — No warning for compatibility issues.
|
||||
- `Warn` — Warn on compatibility issues.
|
||||
- `DontAllow` — Block on compatibility issues.
|
||||
|
||||
**`TestTemplateTags` (enum)**
|
||||
- Extensive enumeration with 100+ values including: `UploadData`, `UploadExportsOnly`, `UploadFolder`, `CommonLine`, `AllCustomers`, `AllTestEngineers`, `AllLabs`, `Test`, `AllowMissingSensors`, `AllowSensorIdToBlankChannel`, `AutomaticProgression`, `AutomaticProgressionDelayMS`, `InvertTriggerCompletion`, `TriggerCheckStep`, `PostTestDiagnostics`, `TriggerCheckRealtime`, `InvertStartRecordCompletion`, `ViewDiagnostics`, `VerifyChannels`, `AutoVerifyProgress`, `AutoVerifyDelaySeconds`, `TestGraphs`, `GraphCount`, `Name`, `TestId`, `SetupFile`, `Description`, `AvailableTestObjects`, `SamplesPerSecond`, `SampleRateText`, `PreTriggerSeconds`, `PostTriggerSeconds`, `RecordingMode`, `RecordingModeText`, `StrictDiagnostics`, `TestObjects`, `AllTestObjects`, `SysBuiltTestObjects`, `RequireUserConfirmationOnErrors`, `DoROIDownload`, `ROIButtonVisibility`, `ViewROIDownload`, `ViewROIDownloadButtonVisibility`, `DownloadAll`, `DownloadAllButtonVisibility`, `ViewRealtime`, `ViewRealtimeButtonVisibility`, `RegionsOfInterest`, `ROIStart`, `ROIEnd`, `ViewDownloadAll`, `ViewDownloadAllButtonVisibility`, `ViewExport`, `ViewExportButtonVisibility`, `ExportFormats`, `DownloadFolder`, `ExportFolder`, `SameAsDownloadFolder`, `TestTime`, `LabDetails`, `CustomerDetails`, `TestEngineerDetails`, `DefaultNumberRealtimeGraphs`, `GraphDetailsVisibility`, `CurrentGraph`, `UseCustomerDetails`, `UseTestEngineerDetails`, `TurnOffExcitation`, `UseLabratoryDetails`, `TestDirectory`, `OriginalTestDirectory`, `LocalOnly`, `LastModified`, `LastMmodifiedBy`, `ExpressTestSetup`, `EW`, `ExcitationWarmupTimeMS`, `ArmCheckListStep`, `CheckListBatteryVoltageCheck`, `CheckListInputVoltageCheck`, `CheckListSquibResistanceCheck`, `CheckListSensorIDCheck`, `CheckListTriggerStartCheck`, `CheckListMustPass`, `WarnOnFailedBattery`, `HardwareOverrides`, `DoAutoArm`, `SysBuiltTestObjectTypes`, `AddedGroupRemoved`, `CheckoutMode`, `QuitTestWithoutWarning`, `SuppressMissingSensorsWarning`, `ISFFile`, `TestObjectsAndAddedGroups`, `NotAllChannelsRealTime`, `NotAllChannelsViewer`, `GroupsStepValid`.
|
||||
|
||||
**`StrictLevel` (enum)**
|
||||
- `Strict` — Strict validation mode.
|
||||
- `UpdateTable` — Update table mode.
|
||||
|
||||
### Invariants
|
||||
- The sentinel constants `NON_ISO_TESTOBJECT_CHANNEL_TYPE` and `NON_ISO_TESTOBJECT_NAME` use distinctive `x_..._x` delimiters to avoid collision with legitimate values.
|
||||
- `RecordingModes` values are paired with description strings via `[Description]` attributes; the `EnumDescriptionTypeConverter` must be available at runtime for proper conversion.
|
||||
- `TestTemplateTags` enum values map to configuration keys/tags; the enum serves as a type-safe accessor for template properties.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System`, `System.ComponentModel` (for `TypeConverter` and `DescriptionAttribute`).
|
||||
- **Depended on by**: Unclear from source alone; likely consumed by test configuration, validation, and database import logic throughout the DatabaseImporter module.
|
||||
|
||||
### Gotchas
|
||||
- The `TestTemplateTags` enum contains a typo: `UseLabratoryDetails` (should be "Laboratory"). This typo may be persisted in configuration files or databases.
|
||||
- The `LastMmodifiedBy` tag has a typo (double 'm'). This may affect configuration key lookups.
|
||||
- The sentinel values in `Constants` use `x_` prefix and `_x` suffix pattern; code matching these values must use exact string comparison.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
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-17T15:53:46.839159+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ab5877b874f4b126"
|
||||
---
|
||||
|
||||
# Documentation: DatabaseImport Hardware Classes
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures for representing Data Acquisition System (DAS) hardware configuration within the DatabaseImport subsystem. It models the hierarchical relationship between DAS hardware units, their individual channels, and associated settings. These classes serve as in-memory representations of hardware state, supporting serialization to database tables (e.g., `tblTestSetupDASSettings`) and facilitating hardware comparison, caching, and lookup operations during database import processes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### DASSettings
|
||||
|
||||
A POCO class for storing DAS-specific test configuration settings.
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `DASSerialNumber` | `string` | Serial number identifier for the DAS unit |
|
||||
| `SampleRate` | `double` | Sampling rate configuration |
|
||||
| `ExcitationWarmupTimeMS` | `int` | Excitation warmup time in milliseconds |
|
||||
| `HardwareAAF` | `double` | Hardware Anti-Aliasing Filter setting |
|
||||
| `PreTriggerSeconds` | `double` | Pre-trigger duration in seconds |
|
||||
| `PostTriggerSeconds` | `double` | Post-trigger duration in seconds |
|
||||
| `StatusLineCheck` | `bool` | Whether status line checking is enabled |
|
||||
| `BatteryCheck` | `bool` | Whether battery checking is enabled |
|
||||
| `InputVoltageMin` | `double` | Minimum input voltage threshold |
|
||||
| `InputVoltageMax` | `double` | Maximum input voltage threshold |
|
||||
| `BatteryVoltageMin` | `double` | Minimum battery voltage threshold |
|
||||
| `BatteryVoltageMax` | `double` | Maximum battery voltage threshold |
|
||||
|
||||
---
|
||||
|
||||
### HardwareChannel
|
||||
|
||||
Represents a single channel on a DAS hardware unit. Implements `IComparable<HardwareChannel>` and `IHardwareChannel`.
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public HardwareChannel(HardwareChannel copy) // Copy constructor
|
||||
public HardwareChannel(ISO.HardwareChannel channel, DASHardware hardware)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Access |
|
||||
|----------|------|--------|
|
||||
| `Hardware` | `DASHardware` | Read-only |
|
||||
| `ChannelNumber` | `int` | Read-only (default: 0) |
|
||||
| `Sensor` | `SensorData` | Read/write (nullable) |
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public ISO.HardwareChannel GetISOChannel() // Returns the underlying ISO channel
|
||||
public string GetId() // Returns composite ID: "{hardwareId}x{channelNumber+1}"
|
||||
public int CompareTo(HardwareChannel right) // Compares by DASDisplayOrder, then ChannelIdx
|
||||
public bool IsSupportedBridgeType(Test.Module.Channel.Sensor.BridgeType bridgeType)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### DASHardwareList
|
||||
|
||||
Singleton class providing hardware lookup and caching functionality.
|
||||
|
||||
**Static Methods:**
|
||||
```csharp
|
||||
public static DASHardwareList GetList() // Returns singleton instance
|
||||
```
|
||||
|
||||
**Instance Methods:**
|
||||
```csharp
|
||||
public void ReloadAll() // Currently a no-op (implementation commented out)
|
||||
public DASHardware GetHardware(string id, bool bUseCache = true)
|
||||
public DASHardware GetHardware(string id,
|
||||
@@ -0,0 +1,180 @@
|
||||
---
|
||||
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-17T15:55:45.702453+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7030e77345a741e1"
|
||||
---
|
||||
|
||||
# Documentation: RegionsAndZones Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data structures and visual components for defining geographical regions within zones for test object templates in a database import system. It enables users to draw, configure, and persist rectangular regions on zone images, associating each region with ISO-standardized metadata (directions, filter classes, locations, positions) and filtering channels based on those properties. The module bridges the gap between visual region selection (via WPF adorners) and the underlying ISO database representation.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Zone Class (`Zone.cs`)
|
||||
|
||||
**Constructors:**
|
||||
- `Zone(Zone copy, TestObjectTemplate template)` — Copy constructor that clones regions from an existing Zone and initializes from `ISODllZone` properties.
|
||||
- `Zone(TemplateZone z, TestObjectTemplate template)` — Primary constructor that initializes a Zone from a `TemplateZone`, loads the associated picture from disk, and creates `Region` instances from `TemplateRegion` children.
|
||||
|
||||
**Properties:**
|
||||
- `string Name { get; set; }` — Zone name, sourced from `ISODllZone.ZoneName`.
|
||||
- `string Description { get; set; }` — Zone description.
|
||||
- `string Image { get; set; }` — Image filename (not full path).
|
||||
- `TemplateZone ISODllZone { get; }` — Read-only reference to the underlying ISO template zone.
|
||||
- `string[] AllPictures { get; }` — Returns sorted list of all available picture filenames from the `ZonePictures` directory. Thread-safe via locking.
|
||||
- `int PictureIndex { get; set; }` — Index into `AllPictures`; setting this loads the corresponding image into `PictureSource`. Setting to a negative value clears `PictureSource`.
|
||||
- `System.Windows.Media.ImageSource PictureSource { get; set; }` — The loaded bitmap image for display.
|
||||
- `Region[] Regions { get; set; }` — Array of regions belonging to this zone.
|
||||
|
||||
**Methods:**
|
||||
- `void PopulateFilenamesIfNeeded()` — Thread-safe lazy initialization of the picture file list.
|
||||
- `string GetPictureName()` — Returns the filename of the currently selected picture, or empty string if `PictureIndex < 0`.
|
||||
|
||||
**Nested Types:**
|
||||
- `FileInfoComparer : IComparer<System.IO.FileInfo>` — Ordinal comparison of file paths for sorting.
|
||||
|
||||
---
|
||||
|
||||
### RegionAdorner Class (`RegionAdorner.cs`)
|
||||
|
||||
Inherits from `Adorner`, implements `INotifyPropertyChanged`.
|
||||
|
||||
**Constructors:**
|
||||
- `RegionAdorner(UIElement adornedElement, TestObjectTemplate template, Contexts context)` — Creates an adorner bound to the specified element, initializes a new `Region`, and attaches mouse event handlers.
|
||||
|
||||
**Properties:**
|
||||
- `Region MyRegion { get; set; }` — The region data model associated with this adorner.
|
||||
- `Rect SelectRect { get; set; }` — The selection rectangle in adorned element coordinates. Setting this updates `MyRegion.RegionUpperLeft` and `MyRegion.RegionBottomRight` via coordinate transformation.
|
||||
- `bool IsNew { get; set; }` — Indicates whether this is a new region being drawn. Toggles visibility of add/delete controls on `MyRegion`.
|
||||
- `Point AnchorPoint { get; set; }` — Starting point for drawing operations.
|
||||
- `Contexts Context { get; set; }` — Editing context (EditTestObject or EditTestObjectTemplate).
|
||||
|
||||
**Events:**
|
||||
- `event RegionSelectedHandler OnRegionSelected` — Raised on left mouse button down.
|
||||
- `event EndSelectionHandler OnEndSelection` — Raised when mouse capture is released.
|
||||
|
||||
**Methods:**
|
||||
- `Point GetUpperLeft()` — Transforms `SelectRect.TopLeft` from measured coordinates to actual image coordinates.
|
||||
- `Point GetLowerRight()` — Transforms `SelectRect.BottomRight` from measured coordinates to actual image coordinates.
|
||||
- `void DrawSelection(object sender, MouseEventArgs e, UIElement adornedElement)` — Updates `SelectRect` based on mouse drag from `AnchorPoint`.
|
||||
- `void MoveSelection(object sender, MouseEventArgs e, UIElement adornedElement)` — Moves an existing `SelectRect` by mouse delta.
|
||||
- `void EndSelection(object sender, MouseButtonEventArgs e)` — Releases mouse capture and raises `OnEndSelection`.
|
||||
|
||||
**Nested Types:**
|
||||
- `enum Contexts { EditTestObject, EditTestObjectTemplate }` — Editing mode enumeration.
|
||||
|
||||
---
|
||||
|
||||
### Region Class (`Region.cs`)
|
||||
|
||||
**Constructors:**
|
||||
- `Region(RegionAdorner adorner, TestObjectTemplate template)` — Creates a new region with default name/description, bound to an adorner.
|
||||
- `Region(TestObjectTemplate template, TemplateRegion r)` — Reconstructs a region from a persisted `TemplateRegion`, loading all ISO metadata references.
|
||||
|
||||
**Properties (Identity):**
|
||||
- `string RegionName { get; set; }`
|
||||
- `string RegionDescription { get; set; }`
|
||||
- `TestObjectTemplate Template { get; set; }`
|
||||
|
||||
**Properties (Coordinates):**
|
||||
- `Point RegionUpperLeft { get; set; }`
|
||||
- `Point RegionBottomRight { get; set; }`
|
||||
|
||||
**Properties (ISO Metadata):**
|
||||
- `MMEDirections RegionDirection { get; set; }`
|
||||
- `MMEFilterClasses RegionFilterClass { get; set; }`
|
||||
- `MMEFineLocations1 RegionFineLocation1 { get; set; }`
|
||||
- `MMEFineLocations2 RegionFineLocation2 { get; set; }`
|
||||
- `MMEFineLocations3 RegionFineLocation3 { get; set; }`
|
||||
- `MMETransducerMainLocation RegionMainLocation { get; set; }`
|
||||
- `MMEPhysicalDimensions RegionPhysicalDimension { get; set; }`
|
||||
- `MMEPositions RegionPosition { get; set; }`
|
||||
- `MMETestObjects RegionTestObject { get; set; }`
|
||||
- `string ISOCode { get; set; }` — Computed ISO code string (16 characters).
|
||||
|
||||
**Properties (Available Options):**
|
||||
Each ISO metadata type has corresponding `All*` and `All*Strings` properties for UI binding:
|
||||
- `MMEDirections[] AllDirections`, `string[] AllDirectionsStrings`
|
||||
- `MMEFilterClasses[] AllFilterClasses`, `string[] AllFilterClassStrings`
|
||||
- `MMEFineLocations1[] AllFineLocations1`, `string[] AllFineLocations1Strings`
|
||||
- `MMEFineLocations2[] AllFineLocations2`, `string[] AllFineLocations2Strings`
|
||||
- `MMEFineLocations3[] AllFineLocations3`, `string[] AllFineLocations3Strings`
|
||||
- `MMETransducerMainLocation[] AllMainLocations`, `string[] AllMainLocationsStrings`
|
||||
- `MMEPhysicalDimensions[] AllPhysicalDimensions`, `string[] AllPhysicalDimensionStrings`
|
||||
- `MMEPositions[] AllPositions`, `string[] AllPositionStrings`
|
||||
|
||||
**Properties (Channels):**
|
||||
- `TestObjectTemplateChannel[] RegionChannels { get; set; }` — Filtered channel list based on region ISO settings.
|
||||
- `TemplateChannelUI[] RegionUIChannels { get; set; }` — Corresponding UI channel wrappers.
|
||||
|
||||
**Properties (UI State):**
|
||||
- `Visibility RegionAddVisibility { get; set; }` — Defaults to `Visible`.
|
||||
- `Visibility RegionDeleteVisibility { get; set; }` — Defaults to `Hidden`.
|
||||
|
||||
**Methods:**
|
||||
- `TemplateRegion ToISORegion(TestObjectTemplate template, Zone zone, int number)` — Serializes this region to a `TemplateRegion` for persistence.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Picture Index Validity**: `PictureIndex` is always in the range `[-1, AllPictures.Length - 1]`. A value of `-1` indicates no picture is selected and `PictureSource` is `null`.
|
||||
|
||||
2. **Thread Safety on Picture Loading**: All access to `_fileNames` in `Zone` is protected by `lock(MyLock)`. The static lock object ensures consistency across all `Zone` instances.
|
||||
|
||||
3. **Region-Adorner Binding**: When a `Region` is created via `Region(RegionAdorner, TestObjectTemplate)`, the `_adorner` field is set and used for `InvalidateVisual()` calls. When created via `Region(TestObjectTemplate, TemplateRegion)`, `_adorner` remains `null`.
|
||||
|
||||
4. **ISO Code Format**: `ISOCode` is always a 16-character string constructed via `ISO.IsoCode.GetString()` with fallback values ("?", "??", "????") for null properties.
|
||||
|
||||
5. **Coordinate Transformation**: `RegionAdorner.GetUpperLeft()` and `GetLowerRight()` return `(0,0)` if the adorned element is not an `Image` or has no `Source`.
|
||||
|
||||
6. **Channel Filtering Consistency**: `FilterRegionChannels()` removes channels that do not match the current ISO metadata selections. Channels are filtered in reverse order to safely remove while iterating.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- **WPF Assemblies**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Documents`, `System.Windows.Input`, `System.Windows.Media`, `System.Windows.Shapes`
|
||||
- **System I/O**: `System.IO.File`, `System.IO.Directory`, `System.IO.FileInfo`, `System.IO.Path`
|
||||
- **External Types** (defined elsewhere in the codebase):
|
||||
- `TestObjectTemplate` — Template container for test objects
|
||||
- `TestObjectTemplateChannel` — Channel definition within templates
|
||||
- `TemplateChannelUI` — UI wrapper for channels
|
||||
- `TemplateZone` — ISO DLL zone representation
|
||||
- `TemplateRegion` — Persisted region data
|
||||
- `MMEDirections`, `MMEFilterClasses`, `MMEFineLocations1/2/3`, `MMETransducerMainLocation`, `MMEPhysicalDimensions`, `MMEPositions`, `MMETestObjects` — ISO metadata types
|
||||
- `ISO.IsoCode` — ISO code string builder
|
||||
- `App` (Application subclass) — Provides `IsoDb` property for database lookups
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone; likely consumed by UI components for zone/region editing workflows.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Hardcoded Picture Directory**: The `ZonePictures` directory path is constructed using `AppDomain.CurrentDomain.BaseDirectory`. This assumes the directory exists and is writable. No error handling for missing directory in `PopulateFilenames()`.
|
||||
|
||||
2. **BitmapImage Initialization in Constructor**: The `Zone(TemplateZone, TestObjectTemplate)` constructor wraps `BitmapImage` initialization in a try/catch that silently sets `PictureIndex = -1` on failure. The image load failure is not logged or surfaced.
|
||||
|
||||
3. **Commented-Out BasePropertyChanged Inheritance**: All three classes have commented-out `: BasePropertyChanged` inheritance, suggesting a refactoring or migration away from a common base class. This may indicate incomplete property change notification.
|
||||
|
||||
4. **Commented-Out Event Subscription**: In `Region.Template` setter and constructor, the `Template_PropertyChanged` subscription is commented out, but the handler method `Template_PropertyChanged` remains. This is dead code.
|
||||
|
||||
5. **Inconsistent Null Handling in Coordinate Transformation**: `GetUpperLeft()` returns `SelectRect.TopLeft` if the adorned element is not an `Image`, but `GetLowerRight()` returns `new Point(0, 0)` in the same scenario. This asymmetry could cause unexpected behavior.
|
||||
|
||||
6. **Application.Current Cast Without Null Check**: `Region.DetermineAvailableISOSettings()` uses `(Application.Current as App).IsoDb` without null checking. Will throw if called from a non-WPF context or before application initialization.
|
||||
|
||||
7. **Magic Strings for ISO Defaults**: Default/fallback values ("?", "??", "????") are hardcoded in multiple places (`SetISOCode`, `DetermineAvailableISOSettings`, `FilterRegionChannels`). These should be constants.
|
||||
|
||||
8. **Index Tracking Without Validation**: Properties like `RegionDirection` set `_directionIndex` based on list lookup, but if the value is not found in the list, the index behavior is undefined (would be `-1` from `IndexOf`).
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/ZeroMethod.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/InitialOffset.cs
|
||||
generated_at: "2026-04-17T16:12:18.709203+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cb2911eb84adcb4a"
|
||||
---
|
||||
|
||||
# Sensors
|
||||
|
||||
### Purpose
|
||||
This module contains data structures representing sensor calibration and configuration parameters, specifically `ZeroMethod` and `InitialOffset`. It handles the parsing, storage, and change notification for sensor zeroing methods and initial engineering unit offsets.
|
||||
|
||||
### Public Interface
|
||||
* **`ZeroMethod`**: A class implementing `INotifyPropertyChanged` to represent a sensor zeroing configuration.
|
||||
* `ZeroMethod(ZeroMethodType zm, double start, double end)`: Constructor initializing method type and range.
|
||||
* `ZeroMethod(string zm)`: Constructor that parses a comma-separated string to initialize the object.
|
||||
* `ZeroMethod(ZeroMethod copy)`: Deep copy constructor.
|
||||
* `event PropertyChangedEventHandler PropertyChanged`: Event raised when a property value changes.
|
||||
* `ZeroMethodType Method { get; set; }`: The type of zeroing method.
|
||||
* `double Start { get; set; }`: The start value for the zeroing range.
|
||||
* `double End { get; set; }`: The end value for the zeroing range.
|
||||
* **`InitialOffset`**: A class representing an initial offset in Engineering Units (EU), supporting different calculation forms.
|
||||
* `InitialOffset()`: Default constructor (sets `Form` to `None`).
|
||||
* `InitialOffset(double d)`: Constructor for legacy format (sets `Form` to `EU`).
|
||||
* `InitialOffset(InitialOffset copy)`: Deep copy constructor.
|
||||
* `void FromDbSerializeString(string input)`: Deserializes the object from a string format used for database storage.
|
||||
* `enum Forms`: Defines the offset format (`None = 0`, `EU = 1`, `EUAtMV = 2`).
|
||||
* `Forms Form { get; set; }`: The format of the current instance.
|
||||
* `double EU { get; set; }`: The Engineering Unit value.
|
||||
* `double MV { get; set; }`: The millivolt (mV) value (used only when `Form` is `EUAtMV`).
|
||||
|
||||
### Invariants
|
||||
* **`ZeroMethod`**: When parsing via the string constructor, the invariant culture is used. If fewer than 3 tokens are present, the method returns without setting properties.
|
||||
* **`InitialOffset`**: When `Form` is `EUAtMV`, the `EU` property represents the value observed at `MV`, not the final offset (calculation required elsewhere).
|
||||
* **`InitialOffset`**: The `FromDbSerializeString` method expects exactly 3 tokens separated by the invariant culture list separator for valid forms; otherwise, it throws `InvalidDataException` or `FormatException`.
|
||||
|
||||
### Dependencies
|
||||
* **Depends on**:
|
||||
* `System`
|
||||
* `System.ComponentModel` (for `INotifyPropertyChanged`)
|
||||
* `System.Globalization` (for `CultureInfo.InvariantCulture`)
|
||||
* `System.IO` (for `InvalidDataException`)
|
||||
* **Dependents**: Unknown (consumers not present in provided source).
|
||||
|
||||
### Gotchas
|
||||
* **Silent Failure in `ZeroMethod`**: The `Initialize` method in `ZeroMethod` silently returns (doing nothing) if the input string has fewer than 3 tokens, potentially leaving the object in an uninitialized/default state without throwing an exception.
|
||||
* **Parsing Culture**: Both classes rely heavily on `CultureInfo.InvariantCulture
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
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-17T16:44:34.283612+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2e1e8d7dd687d918"
|
||||
---
|
||||
|
||||
# Documentation: TestMetaData Classes
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides wrapper classes for test metadata entities (Laboratory, Customer, and Test Engineer details) within the `DatabaseImport` namespace. These classes serve as proxies to underlying `ISO` namespace types, exposing a simplified `Name` property interface. The module facilitates CRUD-like operations on test metadata, including singleton-based caching for test engineer records with thread-safe population and deletion capabilities.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `LabratoryDetails`
|
||||
A wrapper class for `ISO.LabratoryDetails`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Name` | `string` (get/set) | Gets or sets the laboratory name by delegating to the underlying `ISO.LabratoryDetails.Name`. |
|
||||
|
||||
**Note:** The class contains a `readonly` field `_lab` of type `ISO.LabratoryDetails`, but no constructor is visible in the source. Initialization behavior is unclear.
|
||||
|
||||
---
|
||||
|
||||
### `LabratoryDetailsList`
|
||||
A static utility class for laboratory collection operations.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `DeleteAll` | `static void DeleteAll()` | Deletes all laboratory details by calling `ISO.LabratoryDetails.DeleteLabratoryDetails()`. |
|
||||
|
||||
---
|
||||
|
||||
### `CustomerDetails`
|
||||
A wrapper class for `ISO.CustomerDetails`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Name` | `string` (get/set) | Gets or sets the customer name by delegating to the underlying `ISO.CustomerDetails.Name`. |
|
||||
|
||||
**Note:** The class contains a `readonly` field `_customerDetails` of type `ISO.CustomerDetails`, but no constructor is visible in the source. Initialization behavior is unclear.
|
||||
|
||||
---
|
||||
|
||||
### `CustomerDetailsList`
|
||||
A static utility class for customer collection operations.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `DeleteAll` | `static void DeleteAll()` | Deletes all customer details by calling `ISO.CustomerDetails.DeleteCustomerDetails()`. |
|
||||
|
||||
---
|
||||
|
||||
### `TestEngineerDetails`
|
||||
A wrapper class for `ISO.TestEngineerDetails`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
@@ -0,0 +1,361 @@
|
||||
---
|
||||
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-17T15:53:12.658358+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3da6de582f653aae"
|
||||
---
|
||||
|
||||
# TestObject Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the domain model for test objects (physical test groups) and their templates within the DatabaseImport subsystem. It manages the lifecycle, persistence, and configuration of test objects through an ISO 13499-compliant database layer. The module bridges between UI representations (`TemplateChannelUI`), business logic (`TestObject`, `TestTestObject`), template definitions (`TestObjectTemplate`), and the underlying ISO database storage, while supporting both ISO-standard and non-ISO test object configurations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TemplateChannelUI
|
||||
**File:** `TemplateChannelUI.cs`
|
||||
|
||||
A GUI wrapper for template channels.
|
||||
|
||||
```csharp
|
||||
public TemplateChannelUI(TestObjectTemplateChannel channel)
|
||||
```
|
||||
Constructs a wrapper containing the provided `TestObjectTemplateChannel`. The internal `_channel` field is private with no public accessor exposed in the source.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectTemplateCollection
|
||||
**File:** `TestObjectTemplateCollection.cs`
|
||||
|
||||
A singleton collection managing test object templates.
|
||||
|
||||
```csharp
|
||||
public static TestObjectTemplateCollection TemplateCollection { get; }
|
||||
```
|
||||
Lazy-initialized singleton accessor. Not thread-safe (no lock on initialization).
|
||||
|
||||
```csharp
|
||||
public void ReloadAll(bool loadSubComponents)
|
||||
```
|
||||
Currently empty implementation (logic commented out).
|
||||
|
||||
```csharp
|
||||
public TestObjectTemplate GetTemplate(string templateId)
|
||||
```
|
||||
Retrieves a template by ID from the ISO database. Returns `null` if not found.
|
||||
|
||||
```csharp
|
||||
public TestObjectTemplate SysBuiltTestObjectTemplate { get; }
|
||||
```
|
||||
Returns the system-built test object template (may be `null` as `_sysBuiltTestObjectTemplate` is never assigned in visible code).
|
||||
|
||||
```csharp
|
||||
public static void DeleteAll()
|
||||
```
|
||||
Static method that deletes all templates via `DeleteAllTemplates()` and reinitializes the singleton instance.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectList
|
||||
**File:** `TestObjectList.cs`
|
||||
|
||||
A thread-safe singleton list managing test objects.
|
||||
|
||||
```csharp
|
||||
public static TestObjectList TestObjectsList { get; }
|
||||
```
|
||||
Thread-safe singleton accessor using `lock(MyLock)`.
|
||||
|
||||
```csharp
|
||||
public static TestObjectList AddedGroupsList { get; }
|
||||
```
|
||||
Separate thread-safe singleton for "added groups" (system-built test objects).
|
||||
|
||||
```csharp
|
||||
public void ReloadAll(bool bLoadSubComponents)
|
||||
```
|
||||
Empty implementation.
|
||||
|
||||
```csharp
|
||||
public TestObject GetTestObject(string serialNumber, bool bSysBuilt)
|
||||
```
|
||||
Retrieves a test object from the ISO database by serial number. Returns `null` if not found.
|
||||
|
||||
```csharp
|
||||
public TestObject GetTestObject(string serialNumber)
|
||||
```
|
||||
Attempts retrieval with `bSysBuilt=false` first, then `bSysBuilt=true` if the first attempt returns `null`.
|
||||
|
||||
```csharp
|
||||
public TestObject GetAddedGroup(string serialNumber)
|
||||
```
|
||||
Equivalent to `GetTestObject(serialNumber, true)`.
|
||||
|
||||
```csharp
|
||||
public void DeleteAll()
|
||||
```
|
||||
Deletes all test objects via `ISO.TestObject.DeleteAllTestObjects()`. Exceptions are silently caught.
|
||||
|
||||
---
|
||||
|
||||
### TestTestObject
|
||||
**File:** `TestTestObject.cs`
|
||||
|
||||
A test-specific test object with additional configuration, inheriting from `TestObject`.
|
||||
|
||||
```csharp
|
||||
public TestTestObject(TestObject obj)
|
||||
public TestTestObject(TestTestObject to)
|
||||
```
|
||||
Constructors that delegate to base `TestObject` constructor and copy metadata via `MetaCommonConstructor()`.
|
||||
|
||||
```csharp
|
||||
public MMEPositions Position { get; set; }
|
||||
```
|
||||
Gets/sets the group position. Setting propagates position to all required sensors with non-empty serial numbers in the test object. Special handling for `UserSetKey` ("@") toggles UI visibility.
|
||||
|
||||
```csharp
|
||||
public const string ChannelDefaultsKey = "#";
|
||||
public const string UserSetKey = "@";
|
||||
```
|
||||
Constants for position key values.
|
||||
|
||||
```csharp
|
||||
public Visibility GroupPositionComboBoxVisible { get; set; }
|
||||
public Visibility GroupPositionButtonVisible { get; set; }
|
||||
```
|
||||
UI visibility properties that collapse to `Visibility.Collapsed` when `SerializedSettings.ISOSupportLevel == ISOSupportLevels.NO_ISO`.
|
||||
|
||||
```csharp
|
||||
public MMETestObjects TestObject { get; set; }
|
||||
```
|
||||
Gets/sets the test object reference. Setting propagates `Test_Object` value to all required sensors.
|
||||
|
||||
```csharp
|
||||
public int ChannelTypesIndex { get; set; }
|
||||
```
|
||||
Index for channel types selection.
|
||||
|
||||
```csharp
|
||||
public void SetTestObject(string s)
|
||||
public void SetPosition(string s)
|
||||
```
|
||||
Direct setters that update backing fields and raise `OnPropertyChanged`.
|
||||
|
||||
```csharp
|
||||
public MMEPositions[] AvailablePositions { get; }
|
||||
public MMEPositions[] AvailableGroupPositions { get; }
|
||||
```
|
||||
Returns available positions from the database. `AvailableGroupPositions` prepends `_channelDefaultsGUID`.
|
||||
|
||||
```csharp
|
||||
public int ExcitationWarmupTimeMS { get; set; }
|
||||
public double TargetSampleRate { get; set; }
|
||||
public double PreTriggerSeconds { get; set; }
|
||||
public double PostTriggerSeconds { get; set; }
|
||||
```
|
||||
Test-specific timing configuration properties.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectTemplate
|
||||
**File:** `TestObjectTemplate.cs`
|
||||
|
||||
Defines a template for creating test objects.
|
||||
|
||||
```csharp
|
||||
public enum Tags { ChannelCountText, PossibleChannelCountText, TemplateName, ... }
|
||||
```
|
||||
Enum for property change notification identifiers.
|
||||
|
||||
```csharp
|
||||
public TestObjectTemplate()
|
||||
public TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)
|
||||
public TestObjectTemplate(ISO.TestObjectTemplate template, ref ISO13499FileDb db)
|
||||
```
|
||||
Constructors: default, copy, and ISO-based initialization.
|
||||
|
||||
```csharp
|
||||
public string LastModifiedBy { get; set; } = "N/A";
|
||||
public DateTime LastModified { get; set; } = SqlDateTime.MinValue;
|
||||
```
|
||||
Audit metadata.
|
||||
|
||||
```csharp
|
||||
public int CurrentZoneIndex { get; set; }
|
||||
public Zone CurrentZone { get; set; }
|
||||
```
|
||||
Zone selection state.
|
||||
|
||||
```csharp
|
||||
public List<TestObjectTemplateChannel> RequiredChannels { get; set; }
|
||||
public TestObjectTemplateChannel[] TemplateAllChannels { get; set; }
|
||||
public TemplateChannelUI[] TemplateAllUIChannels { get; set; }
|
||||
public Zone[] TemplateZones { get; set; }
|
||||
```
|
||||
Channel and zone collections.
|
||||
|
||||
```csharp
|
||||
public MMETestObjects TestObject { get; set; }
|
||||
public string TestObjectType { get; set; }
|
||||
public string[] AvailableTestObjectTypes { get; set; }
|
||||
public int TestObjectTypeIndex { get; set; }
|
||||
```
|
||||
Test object type configuration.
|
||||
|
||||
```csharp
|
||||
public static MMETestObjects GetNonISOTestObject()
|
||||
```
|
||||
Creates or retrieves a non-ISO test object, generating a unique single-character code (A-Z, then 0-9). Throws `NotSupportedException` if all codes are exhausted.
|
||||
|
||||
```csharp
|
||||
public ISO.TestObjectTemplate ToISOTestObjectTemplate()
|
||||
```
|
||||
Converts this template to an ISO-compatible `ISO.TestObjectTemplate`.
|
||||
|
||||
---
|
||||
|
||||
### TestObject
|
||||
**File:** `TestObject.cs`
|
||||
|
||||
Core class representing a physical test object/group.
|
||||
|
||||
```csharp
|
||||
public enum Tags { SerialNumber, SerialNumberConverted, TestObjectType, ... }
|
||||
```
|
||||
Enum for property change notification identifiers.
|
||||
|
||||
```csharp
|
||||
public TestObject()
|
||||
public TestObject(TestObject copy)
|
||||
public TestObject(ISO.TestObject to, bool sysBuilt)
|
||||
```
|
||||
Constructors: default, copy, and ISO-based.
|
||||
|
||||
```csharp
|
||||
public void RefreshHardware()
|
||||
```
|
||||
Refreshes hardware collection from ISO test object.
|
||||
|
||||
```csharp
|
||||
public SerializedSettings.ISOSupportLevels GetObjectISOLevel()
|
||||
```
|
||||
Returns `NO_ISO` if template type contains `NON_ISO_TESTOBJECT_CHANNEL_TYPE` or `NONISOCHANNELTYPE`; otherwise `ISO_ONLY`.
|
||||
|
||||
```csharp
|
||||
public SensorData GetSensor(string channelId, string serialNumber, string alternateChannelId = null)
|
||||
```
|
||||
Retrieves sensor data with ISO settings applied. Falls back to `alternateChannelId` if primary lookup yields no settings. Applies filter class, position, polarity, range, timing, and mode settings from ISO sensor settings.
|
||||
|
||||
```csharp
|
||||
public void SetSensor(string channelName, SensorData sensor)
|
||||
```
|
||||
Persists sensor settings to the ISO test object for all `ISO.TestObject.SensorSettings` enum values.
|
||||
|
||||
```csharp
|
||||
public string SerialNumber { get; set; }
|
||||
public string SerialNumberConverted { get; set; }
|
||||
public string SerialNumberOrOriginalSerialNumber { get; }
|
||||
public string DisplaySerialNumber { get; set; }
|
||||
```
|
||||
Serial number properties with embedded/original handling.
|
||||
|
||||
```csharp
|
||||
public string TestSetupName { get; set; }
|
||||
public string TestObjectType { get; set; }
|
||||
public string ParentObject { get; set; }
|
||||
public bool SysBuilt { get; set; }
|
||||
```
|
||||
Core metadata properties.
|
||||
|
||||
```csharp
|
||||
public DASHardware[] Hardware { get; }
|
||||
public bool ContainsHardware(DASHardware h)
|
||||
public void SetHardwareFromISO()
|
||||
public void SetHardware(DASHardware[] hardware)
|
||||
public void AddHardware(DASHardware hardware)
|
||||
```
|
||||
Hardware management. `AddHardware` handles dummy hardware by appending `(01)`, `(02)`, etc. suffixes to avoid collisions.
|
||||
|
||||
```csharp
|
||||
public ISO.TestObject GetISOTestObject()
|
||||
```
|
||||
Returns the underlying ISO test object.
|
||||
|
||||
```csharp
|
||||
public TestObjectTemplate Template { get; set; }
|
||||
public void SetTemplateDontResetISOObject(TestObjectTemplate value)
|
||||
```
|
||||
Template management. `SetTemplateDontResetISOObject` avoids full ISO template reset.
|
||||
|
||||
```csharp
|
||||
public string[] ZoneNames { get; set; }
|
||||
public string TemplateType { get; }
|
||||
```
|
||||
Zone and template type accessors.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Singleton Initialization**: `TestObjectTemplateCollection.TemplateCollection` and `TestObjectList.TestObjectsList` are lazily initialized and, once created, return the same instance until explicitly reset (via `DeleteAll()` for templates).
|
||||
|
||||
2. **Thread Safety**: `TestObjectList` singleton access uses `lock(MyLock)`; `TestObjectTemplateCollection` does not.
|
||||
|
||||
3. **Hardware Uniqueness**: Within a `TestObject`, hardware is stored in a `Dictionary<string, DASHardware>` keyed by `SerialNumber`. `AddHardware` will not add duplicate serial numbers.
|
||||
|
||||
4. **Dummy Hardware Naming**: When adding dummy hardware with a conflicting serial number, the system appends `(NN)` suffixes starting at `(01)`.
|
||||
|
||||
5. **ISO Object Synchronization**: Setting `TestObject.SerialNumber`, `TestObject.ParentObject`, or `TestObject.Template` updates the underlying `_isoTestObject` accordingly.
|
||||
|
||||
6. **Position Propagation**: In `TestTestObject`, setting `Position` or `TestObject` propagates the value to all required sensors with non-empty serial numbers.
|
||||
|
||||
7. **Filter Class Fallback**: In `GetSensor()`, if `FilterClassIso` is `"?"`, it defaults to `"P"` (Prefiltered/Unfiltered).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- **System namespaces**: `System`, `System.Collections.Generic`, `System.Linq`, `System.Globalization`, `System.Data.SqlTypes`, `System.Windows`
|
||||
- **ISO Database Layer**: `ISO.TestObject`, `ISO.TestObjectTemplate`, `ISO13499FileDb`, `ISO.TestObject.SensorSettings`, `ISO.TestObject.SensorSetting`, `TemplateZone`
|
||||
- **Application Layer**: `App` (accessed via `Application.Current as App`), `App.IsoDb`
|
||||
- **Domain Types**: `MMEPositions`, `MMETestObjects`, `MMEPossibleChannels`, `Zone`, `DASHardware`, `DASHardwareList`, `SensorData`, `SensorsCollection`, `FilterClass`, `DigitalOutputModes`, `SquibFireMode`, `DigitalInputModes`
|
||||
- **Configuration**: `SerializedSettings.ISOSupportLevels`
|
||||
- **Constants**: `Constants.NON_ISO_TESTOBJECT_NAME`, `Constants.NON_ISO_TESTOBJECT_CHANNEL_TYPE`
|
||||
- **Base Classes**: `DbTimeStampBase` (inherited by `TestObject`)
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone; however, the public singletons (`TestObjectTemplateCollection.TemplateCollection`, `TestObjectList.TestObjectsList`) suggest external consumers access templates and test objects through these entry points.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Commented-Out Code**: `TestObjectTemplateCollection.ReloadAll()` and `TestObjectList.ReloadAll()` have empty implementations with commented-out logic. Calling these methods does nothing.
|
||||
|
||||
2. **Non-Thread-Safe Singleton**: `TestObjectTemplateCollection.TemplateCollection` uses `volatile` but no `lock`, unlike `TestObjectList` which is properly thread-safe.
|
||||
|
||||
3. **SysBuiltTestObjectTemplate Always Null**: The `_sysBuiltTestObjectTemplate` field is declared but never assigned in the visible source, so `SysBuiltTestObjectTemplate` will always return `null`.
|
||||
|
||||
4. **Silent Exception Swallowing**: `DeleteAll()` methods in both `TestObjectTemplateCollection` and `TestObjectList` catch and silently ignore all exceptions.
|
||||
|
||||
5. **GetNonISOTestObject Code Exhaustion**: If all single-character codes (A-Z, 0-9) are exhausted, `GetNonISOTestObject()` throws `NotSupportedException` with message `"TestObjectTemplate_CouldNotCreateNONISOTESTOBJECT"`.
|
||||
|
||||
6. **DisplaySerialNumber Side Effect**: Setting `DisplaySerialNumber` assumes the object is an "Added Group" and modifies `SerialNumber`, `SerialNumberConverted`, `OriginalSerialNumber`, and `OriginalTemplateName` in a specific pattern.
|
||||
|
||||
7. **Channel ID vs Channel Name**: `GetSensor()` accepts both `channelId` and `alternateChannelId` because, per the source comment (fogbugz 11910), channel name and channel ID were alternately used for sensor lookups.
|
||||
|
||||
8. **ISO Support Level Affects UI Visibility**: `TestTestObject.GroupPositionComboBoxVisible` and `GroupPositionButtonVisible` return `Visibility.Collapsed` when `ISOSupportLevel == NO_ISO`, regardless of their backing field values.
|
||||
|
||||
9. **Hardware Dictionary Keyed by SerialNumber**: `TestObject._hardware` is keyed by serial number, not hardware ID. Two hardware items with different IDs but the same serial number cannot coexist in the same test object.
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
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-17T15:52:00.688061+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "580aa33f674a5152"
|
||||
---
|
||||
|
||||
# Documentation: DatabaseImport.TestTemplate Namespace
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides classes and interfaces for managing test templates, hardware configuration, and sensor settings within the DatabaseImport system. It handles the definition of test setups (via `TestTemplateLite`), regions of interest for data analysis, hardware inclusion rules for test configurations, and cached hardware lookups. The module serves as a bridge between database-stored test configurations and runtime test execution, supporting both lightweight test setup representations and full template management through a singleton list pattern.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ICachedContainer (Interface)
|
||||
**Namespace:** `DatabaseImport`
|
||||
|
||||
```csharp
|
||||
DASHardware GetCachedHardware(string serialNumber);
|
||||
IISOHardware[] GetAllCachedHardware();
|
||||
```
|
||||
- **GetCachedHardware**: Retrieves a single `DASHardware` instance by serial number from cache.
|
||||
- **GetAllCachedHardware**: Returns an array of all cached `IISOHardware` instances.
|
||||
|
||||
---
|
||||
|
||||
### HardwareInclusionInstruction (Class)
|
||||
**Namespace:** `DatabaseImport`
|
||||
|
||||
```csharp
|
||||
public HardwareInclusionInstruction(string hardwareId, Actions action)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `string HardwareId { get; }` - Identifier for the hardware item.
|
||||
- `Actions Action { get; }` - The inclusion action to perform.
|
||||
|
||||
**Nested Enum:**
|
||||
- `Actions.Remove` - Exclude hardware that would otherwise be included by group membership.
|
||||
- `Actions.Add` - Include hardware that would not otherwise be included by group membership.
|
||||
|
||||
---
|
||||
|
||||
### TestTemplateLite (Class)
|
||||
**Namespace:** `DatabaseImport`
|
||||
**Implements:** `ITestSetup`
|
||||
|
||||
**Properties:**
|
||||
- `string Name { get; set; }` - Test setup name.
|
||||
- `string Description { get; set; }` - Default: empty string.
|
||||
- `RecordingModes RecordingMode { get; set; }` - Recording mode selection.
|
||||
- `double PreTriggerSeconds { get; set; }` - Returns `0D` when `RecordingMode` is `Recorder` or `HybridRecorder`; otherwise returns the private `_preTriggerSeconds` value.
|
||||
- `string ErrorMessage { get; set; }` - Error message string.
|
||||
- `string CompletionErrorMessage { get; }` - Read-only; returns `ErrorMessage` truncated to 250 characters if longer.
|
||||
- `double PostTriggerSeconds { get; set; }` - Post-trigger duration.
|
||||
- `DateTime LastModified { get; set; }` - Modification timestamp.
|
||||
- `string LastModifiedBy { get; set; }` - User who last modified the setup.
|
||||
- `bool IsComplete { get; set; }` - Completion status flag.
|
||||
|
||||
---
|
||||
|
||||
### RegionOfInterest (Class)
|
||||
**Namespace:** `DatabaseImport`
|
||||
**Implements:** `INotifyPropertyChanged`
|
||||
**Attribute:** `[Serializable]`
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public RegionOfInterest()
|
||||
public RegionOfInterest(bool isDefault = false)
|
||||
public RegionOfInterest(string suffix = "", bool isDefault = false, double start = -1D, double end = 1D)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `string Suffix { get; set; }` - Auto-prefixed with `"_"` if not already present; empty/whitespace-only values are handled specially.
|
||||
- `double Start { get; set; }` - Region start time; constrained to be less than `End` and greater than or equal to `PreTrigger`.
|
||||
- `double End { get; set; }` - Region end time; constrained to be greater than `Start` and less than or equal to `PostTrigger`.
|
||||
- `double PreTrigger { get; set; }` - Pre-trigger boundary; setting this updates `Start` if `Start < PreTrigger`.
|
||||
- `double PostTrigger { get; set; }` - Post-trigger boundary; setting this updates `End` if `End > PostTrigger`.
|
||||
- `bool IsEnabled { get; set; }` - Default: `true`.
|
||||
- `bool IsDefault { get; private set; }` - Set via constructor only.
|
||||
|
||||
**Event:**
|
||||
- `event PropertyChangedEventHandler PropertyChanged` - Raised on property changes.
|
||||
|
||||
---
|
||||
|
||||
### TestTemplateList (Class)
|
||||
**Namespace:** `DatabaseImport`
|
||||
|
||||
**Singleton Access:**
|
||||
```csharp
|
||||
public static TestTemplateList TestTemplatesList { get; }
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `TestTemplate TemporaryTemplate { get; set; }` - Holds a template in memory without committing to database.
|
||||
|
||||
**Static Methods:**
|
||||
```csharp
|
||||
public static SensorData GetSensorFromSettings(string settings, string serial)
|
||||
public static SensorData GetSensorFromSettings(string settings, string serial, Dictionary<string, SensorData> lookup)
|
||||
public static string GetSensorSettings(SensorData sd)
|
||||
public static bool SysBuiltObject(string serialNumber)
|
||||
public static void ConvertToDictionary(DataTable dt, ref Dictionary<string, List<Dictionary<string, object>>> lookup, string key)
|
||||
```
|
||||
|
||||
**Instance Methods:**
|
||||
```csharp
|
||||
public void Reload()
|
||||
public void DeleteAll
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Controls/SensorsAndModels/ImportSensorsImportControl.cs
|
||||
generated_at: "2026-04-17T15:59:41.103394+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a1d05ecf81eb6d1b"
|
||||
---
|
||||
|
||||
# Documentation: ImportSensorsImportControl.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides database cleanup functionality for the DatabaseImporter system, specifically for clearing application data tables during TDM export operations. It serves as a WPF UserControl that orchestrates the deletion of test templates, test objects, sensors, sensor models, calibrations, customer details, and various database entities. The module supports two modes: a basic clear operation and an extended database import mode that also removes users, tags, UI items, locked items, and historical database versions.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `public static void ClearAllTables(bool clearForDbImport)`
|
||||
|
||||
Clears all major application data tables. When `clearForDbImport` is `true`, performs additional cleanup including DAS tables, locked items, users, tags, UI items, and old database versions. When `false`, only clears the core application collections.
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void ClearAllTables(bool clearForDbImport)
|
||||
```
|
||||
|
||||
### `public static List<string[]> GetAllUsers()`
|
||||
|
||||
Retrieves all users from the database using the `sp_UserGet` stored procedure. Returns a list of string arrays, each containing user fields: ID, UserName, DisplayName, Password, Role, LastModified, LastModifiedBy, and LocalOnly.
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Controls/TestSetups/ImportTestSetup.cs
|
||||
generated_at: "2026-04-17T16:00:10.803585+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fc36fa53e2d8d797"
|
||||
---
|
||||
|
||||
# Documentation: ImportTestSetup.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`ImportTestSetup` is a WPF `UserControl` that handles importing test setup configuration data from XML into a SQL Server database. It serves as the import orchestrator for the DatabaseImport module, parsing XML elements and routing them to appropriate stored procedures. The module maintains static collections of imported entities (sensors, calibrations, customers, labs, test setups, etc.) and supports versioned import logic to handle different file format versions.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Public Static Methods
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ProcessRootNode` | `void ProcessRootNode(string name, string outerXML, DbImporter.SetStatusDelegate SetStatus)` | Routes XML root elements to appropriate import handlers based on element name. Dispatches to `ImportElement` with corresponding stored procedure names. |
|
||||
|
||||
### Public Static Collections (Read-only Fields)
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `Directions` | `List<MMEDirections>` | Custom ISO direction fields |
|
||||
| `FilterClasses` | `List<MMEFilterClasses>` | Custom filter class fields |
|
||||
| `FineLoc1s` | `List<MMEFineLocations1>` | Fine location 1 fields |
|
||||
| `FineLoc2s` | `List<MMEFineLocations2>` | Fine location 2 fields |
|
||||
| `FineLoc3s` | `List<MMEFineLocations3>` | Fine location 3 fields |
|
||||
| `MainLocs` | `List<MMETransducerMainLocation>` | Transducer main location fields |
|
||||
| `TestObjects` | `List<MMETestObjects>` | Test object fields |
|
||||
| `PhysicalDimensions` | `List<MMEPhysicalDimensions>` | Physical dimension fields |
|
||||
| `Positions` | `List<MMEPositions>` | Position fields |
|
||||
| `Calibrations` | `List<SensorCalibration>` | Sensor calibration histories |
|
||||
| `CustomerDetails` | `List<ISO.CustomerDetails>` | Customer detail records |
|
||||
| `LabDetails` | `List<ISO.LabratoryDetails>` | Laboratory detail records |
|
||||
| `Sensors` | `List<SensorData>` | Sensor data records |
|
||||
| `_testSetups` | `List<TestTemplate>` | Test setup templates (public despite underscore prefix) |
|
||||
|
||||
### Public Enum
|
||||
|
||||
```csharp
|
||||
public enum PossibleStatus
|
||||
{
|
||||
Waiting,
|
||||
Working,
|
||||
Done,
|
||||
Failed
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Version Constant**: `CurrentVersion` is always `2.0D`.
|
||||
- **Command Timeout**: All stored procedure executions use a 60-second command timeout.
|
||||
- **XML Wrapping**: All XML passed to stored procedures is wrapped with outer element tags: `"<" + outerElementName + ">" + outerXML + "</" + outerElementName + ">"`.
|
||||
- **Collection State**: All static collections must be
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Converters/EnumDescriptionTypeConverter.cs
|
||||
generated_at: "2026-04-17T16:29:45.029341+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b3c152d40e6fbba4"
|
||||
---
|
||||
|
||||
# Converters
|
||||
|
||||
### Purpose
|
||||
This module provides WPF data binding converters for the DatabaseImporter subsystem. The `EnumDescriptionTypeConverter` class enables display of enum description attributes instead of raw enum values in UI bindings, improving user-facing representation of enumerated types.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`EnumDescriptionTypeConverter`** (inherits from `EnumConverter`)
|
||||
- `public EnumDescriptionTypeConverter(Type type)` — Constructor that accepts the enum `Type` to be converted and passes it to the base `EnumConverter` constructor.
|
||||
|
||||
### Invariants
|
||||
- The converter must be instantiated with a valid enum `Type`; behavior is undefined for non-enum types (delegated to base `EnumConverter` behavior).
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System`, `System.ComponentModel` (specifically `EnumConverter`).
|
||||
- **Depended by**: Unclear from source alone; likely used in WPF XAML bindings within the DatabaseImporter module.
|
||||
|
||||
### Gotchas
|
||||
- The class contains no overridden conversion methods (e.g., `ConvertTo`, `ConvertFrom`). The actual description-display logic referenced in the documentation comment is not present in this source file. It is unclear whether this is incomplete, relies on base class behavior, or the implementation exists elsewhere.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.SensorUnits.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.Bridge.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/DigitalInputScaleMultiplier.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/LinearizationFormula.cs
|
||||
generated_at: "2026-04-17T15:53:56.452748+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d057a2503f607f02"
|
||||
---
|
||||
|
||||
# Documentation: DatabaseImport DAS Concepts
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines sensor-related data structures and parsing logic for a Data Acquisition System (DAS) database import facility. It provides enumeration types for sensor sensitivity units and bridge configurations, a class for transforming digital input values to arbitrary scales, and a comprehensive linearization formula system supporting multiple calibration formats (IRTracc variants and polynomial). These components are part of a larger `Test` class hierarchy representing channel and sensor configuration concepts.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Test.Module.Channel.Sensor.SensUnits` (enum)
|
||||
|
||||
**Location:** `Test.Module.Channel.Sensor.SensorUnits.cs`
|
||||
|
||||
Enumeration of sensitivity unit types for sensors.
|
||||
|
||||
| Member | Value | Description Attribute |
|
||||
|--------|-------|----------------------|
|
||||
| `NONE` | 0 | "NONE" - For polynomial sensors |
|
||||
| `mV` | 1 | "mV" - Millivolts at capacity EU |
|
||||
| `mVperV` | 2 | "mV/V" - Excitation proportional at capacity EU |
|
||||
| `mVperVperEU` | 3 | "mV/V/EU" - Excitation proportional per EU |
|
||||
| `mVperEU` | 4 | "mV/EU" - Millivolts per engineering unit |
|
||||
|
||||
---
|
||||
|
||||
### `Test.Module.Channel.Sensor.BridgeType` (enum)
|
||||
|
||||
**Location:** `Test.Module.Channel.Sensor.Bridge.cs`
|
||||
|
||||
Enumeration of bridge/sensor configuration types. Values are bit flags.
|
||||
|
||||
| Member | Value | Description Attribute |
|
||||
|--------|-------|----------------------|
|
||||
| `IEPE` | 1 (1 << 0) | "IEPE" |
|
||||
| `QuarterBridge` | 2 (1 << 1) | "Quarter" |
|
||||
| `HalfBridge` | 4 (1 << 2) | "Bridge-Half" |
|
||||
| `FullBridge` | 8 (1 << 3) | "Bridge-Full" |
|
||||
| `DigitalInput` | 16 (1 << 4) | "DigitalInput" |
|
||||
| `SQUIB` | 32 (1 << 5) | "SQUIB" |
|
||||
| `TOMDigital` | 64 (1 << 6) | "TOMDigital" |
|
||||
| `HalfBridge_SigPlus` | 128 (1 << 7) | "Bridge-Half SigPlus" |
|
||||
|
||||
---
|
||||
|
||||
### `DigitalInputScaleMultiplier` (class)
|
||||
|
||||
**Location:** `DigitalInputScaleMultiplier.cs`
|
||||
|
||||
Transforms digital input data by mapping binary 0/1 values to arbitrary low/high display values.
|
||||
|
||||
**Nested Enum:**
|
||||
```csharp
|
||||
public enum Forms { ArbitraryLowAndHigh }
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `Forms Form { get; set; }` — Default: `Forms.ArbitraryLowAndHigh`
|
||||
- `double DefaultValue { get; set; }` — Value to display for digital 0 (OFF)
|
||||
- `double ActiveValue { get; set; }` — Value to display for digital 1 (ON), default: `1.0`
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public DigitalInputScaleMultiplier() // Sets DefaultValue to 0.0
|
||||
public DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy) // Copy constructor
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public void FromDbSerializeString(string s)
|
||||
```
|
||||
Deserializes from a string format. Silently returns on null input. Throws `NotSupportedException` for invalid formats.
|
||||
|
||||
---
|
||||
|
||||
### `LinearizationFormula` (class)
|
||||
|
||||
**Location:** `LinearizationFormula.cs`
|
||||
|
||||
Holds linearization parameters for sensor calibration, supporting multiple formula styles.
|
||||
|
||||
**Properties:**
|
||||
- `NonLinearStyles NonLinearStyle { get; set; }` — Default: `NonLinearStyles.IRTraccDiagnosticsZero`
|
||||
- `double PolynomialSensitivity { get; set; }` — Default: `1.0`
|
||||
- `double LinearizationExponent { get; set; }` — Default: `1.0`
|
||||
- `double MMPerV { get; set; }` — Millimeters per volt (see Gotchas)
|
||||
- `double MVAt0MM { get; set; }` — Millivol
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalInputs.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalOutputs.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/SupportedExportFormatBitFlags.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Squibs.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/ExcitationVoltageOptions.cs
|
||||
generated_at: "2026-04-17T16:44:17.508414+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e72bc78b9ae7a008"
|
||||
---
|
||||
|
||||
# DatabaseImport Enums Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines a set of enumeration types used within the `DatabaseImport` namespace to configure hardware channel modes, export formats, and measurement parameters. These enums serve as configuration options for data acquisition hardware—specifically digital I/O channels, squib firing mechanisms, excitation voltage settings, and supported export file formats. The enums are designed primarily as bit flags to allow combination of multiple modes, and several employ `DescriptionAttribute` and custom attributes for UI display purposes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DigitalInputModes`
|
||||
**Signature:** `public enum DigitalInputModes`
|
||||
|
||||
Defines input modes for digital data channels. Values are bit-shifted to enable bitwise combination.
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `TLH` | `1 << 1` (2) | Transition low to high |
|
||||
| `THL` | `1 << 2` (4) | Transition high to low |
|
||||
| `CCNO` | `1 << 3` (8) | Contact closure normally open |
|
||||
| `CCNC` | `1 << 4` (16) | Contact closure normally closed |
|
||||
|
||||
Decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` and `[DescriptionAttribute]` on each member.
|
||||
|
||||
---
|
||||
|
||||
### `DigitalOutputModes`
|
||||
**Signature:** `public enum DigitalOutputModes`
|
||||
|
||||
Defines output modes for digital channels. Values are bit-shifted to enable bitwise combination.
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `NONE` | `0` | Digital channel's mode not set |
|
||||
| `FVLH` | `1 << 0` (1) | Five volt, low-to-high transition |
|
||||
| `FVHL` | `1 << 1` (2) | Five volt, high-to-low transition |
|
||||
| `CCNO` | `1 << 2` (4) | Contact closure normally open |
|
||||
| `CCNC` | `1 <<
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Hardware/HardwareTypes.cs
|
||||
generated_at: "2026-04-17T16:14:41.840190+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c3e7211775a00a58"
|
||||
---
|
||||
|
||||
# Hardware
|
||||
|
||||
### Purpose
|
||||
This module defines the `HardwareTypes` enumeration within the `DatabaseImport` namespace. It provides a comprehensive catalog of hardware device identifiers used throughout the system, covering SLICE device variants (Base, Bridge, IEPE, NANO, Micro, etc.), TDAS equipment, G5 components, Ribeye devices, and various modules (TOM, SIM, DIM). This enum serves as the canonical hardware type reference for database import operations and hardware identification across the system.
|
||||
|
||||
### Public Interface
|
||||
- **`HardwareTypes`** (enum) - A public enumeration with 34 named hardware type constants:
|
||||
- `SLICE_Base = 0`, `SLICE_Bridge = 1`, `SLICE_Distributor = 2`
|
||||
- `TDAS_Pro_Rack = 3`
|
||||
- `SLICE2_IEPE_Hi = 4`, `SLICE2_IEPE_Lo = 5`, `SLICE2_Bridge_Hi = 6`, `SLICE2_Bridge_Lo = 7`, `SLICE2_Base = 8`
|
||||
- `TOM = 9`, `SIM = 10`, `DIM = 11`
|
||||
- `G5VDS = 12`
|
||||
- `Ribeye = 13`, `RibeyeLED = 14`
|
||||
- `SLICE_IEPE = 15`
|
||||
- `SLICE1_5_Nano_Base = 16`, `SLICE_Micro_Base = 17`, `SLICE_NANO_Base = 18`
|
||||
- `SLICE2_SIM = 19`, `SLICE2_DIM = 20`, `SLICE2_TOM = 21`
|
||||
- `G5INDUMMY = 23` (note: value 22 is skipped/commented out as `G5IPORT`)
|
||||
- `SLICE_EthernetController = 24`
|
||||
- `SLICE1_5_Micro_Base = 25`
|
||||
- `SLICE_LabEthernet = 26`
|
||||
- `SLICE2_SLS = 27`, `SLICE1_G5Stack = 28`, `SLICE2_SLT = 29`, `SLICE2_SLD = 30`
|
||||
- `TDAS_LabRack = 31`
|
||||
- `SLICE6_Base = 32`, `SLICE6DB = 33`
|
||||
|
||||
### Invariants
|
||||
- Enum values are explicitly assigned and
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/SensorStatus.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/LinearizationFormula.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/ZeroMethodType.cs
|
||||
generated_at: "2026-04-17T16:44:42.091498+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "dd75266de8fb5275"
|
||||
---
|
||||
|
||||
# Documentation: Sensor Enums (DatabaseImport)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines three enumeration types used within the `DatabaseImport` namespace to represent sensor-related states and configuration options. `SensorStatus` tracks the operational lifecycle state of a sensor. `NonLinearStyles` specifies available linearization formulas for processing non-linear sensor data, with several options specific to IRTracc devices. `ZeroMethodType` defines methods for calculating electrical zero values during sensor data import, with explicit values maintained for legacy compatibility with older data formats (e.g., GM ISF imports).
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `SensorStatus` (enum)
|
||||
Represents the operational status of a sensor in the system.
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `Available` | Sensor is available for use |
|
||||
| `InUse` | Sensor is currently in use |
|
||||
| `OutForService` | Sensor is out for service |
|
||||
| `OutForCalibration` | Sensor is out for calibration |
|
||||
| `Retired` | Sensor has been retired |
|
||||
|
||||
---
|
||||
|
||||
### `NonLinearStyles` (enum)
|
||||
Defines linearization formula types for non-linear sensor data processing.
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `IRTraccManual` | IRTracc manual linearization |
|
||||
| `IRTraccDiagnosticsZero` | IRTracc diagnostics zero method |
|
||||
| `IRTraccZeroMMmV` | IRTracc zero MM/mV method |
|
||||
| `IRTraccAverageOverTime` | IRTracc average over time method |
|
||||
| `Polynomial` | Polynomial-based linearization |
|
||||
| `IRTraccCalFactor` | IRTracc calibration factor method |
|
||||
|
||||
---
|
||||
|
||||
### `ZeroMethodType` (enum)
|
||||
Defines methods for calculating electrical zero values. Members have explicit integer values assigned for legacy compatibility.
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `AverageOverTime` | 0 | Calculate electrical zero using an average over time |
|
||||
| `UsePreEventDiagnosticsZero` | 1 | Calculate zero using time in pre-event diagnostics |
|
||||
| `None` | 2 | Calculate zero using an injected value (absolute zero) |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`ZeroMethodType` explicit values must not change**: The source explicitly states that "Lots of legacy compatibility (e.g. importing GM ISF) depends on the order/value of this enum." The integer values 0, 1, and 2 are contractually bound for backward compatibility.
|
||||
- **Enum member order for `ZeroMethodType` is significant**: Reordering members would break legacy data import functionality.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**Dependencies of this module:**
|
||||
- None visible from source. These enums are self-contained with no external imports.
|
||||
|
||||
**Dependents (inferred):**
|
||||
- Other components within the `DatabaseImport` namespace that handle sensor data import, particularly those processing IRTracc sensor data or GM ISF legacy formats.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1
|
||||
414
docs/ai/DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO.md
Normal file
414
docs/ai/DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO.md
Normal file
@@ -0,0 +1,414 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateZone.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CalculatedValueClass.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LevelTriggerChannel.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectChannel.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateRegion.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/IsoCode.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestEngineerDetails.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestSetting.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/HardwareChannel.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectMetaData.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CustomerDetails.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LabratoryDetails.cs
|
||||
generated_at: "2026-04-17T15:45:33.440998+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b4d75a90ad9bddba"
|
||||
---
|
||||
|
||||
# DatabaseImport.ISO Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data entity classes for the DatabaseImport system, representing domain objects used in crash test data management according to ISO standards. It handles template definitions (zones, regions), channel configurations (test object channels, hardware channels, calculated values, level triggers), metadata management (test objects, test setups, engineer/lab/customer details), and ISO code generation for channel identification. These entities serve as DTOs (Data Transfer Objects) that map directly to database rows and support serialization for persistence and interchange.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TemplateZone
|
||||
```csharp
|
||||
public class TemplateZone
|
||||
```
|
||||
Represents a zone within a test template containing regions.
|
||||
|
||||
**Constructors:**
|
||||
- `TemplateZone(string template, string name, string picture, string description)` — Initializes with explicit values.
|
||||
- `TemplateZone(DataRow dr)` — Initializes from a database row; automatically loads `TemplateRegions` via `TemplateRegion.GetAllRegions()`.
|
||||
|
||||
**Properties:**
|
||||
- `string TemplateName { get; }` — Read-only template identifier.
|
||||
- `string ZoneName { get; }` — Zone name; defaults to `"Default zone"` if DBNull.
|
||||
- `string Picture { get; set; }` — Picture path/identifier.
|
||||
- `string Description { get; }` — Zone description; defaults to empty string if DBNull.
|
||||
- `TemplateRegion[] TemplateRegions { get; set; }` — Array of regions; setter clears and repopulates internal list.
|
||||
|
||||
---
|
||||
|
||||
### TemplateRegion
|
||||
```csharp
|
||||
public class TemplateRegion
|
||||
```
|
||||
Represents a region within a template zone with location and positioning data.
|
||||
|
||||
**Constructors:**
|
||||
- `TemplateRegion(string templateName, string zoneName, bool bLocalOnly)` — Initializes with template/zone names and local-only flag.
|
||||
- `TemplateRegion(DataRow dr)` — Initializes from a database row.
|
||||
|
||||
**Properties:**
|
||||
- `string TemplateName { get; }`, `string TemplateZone { get; }` — Parent identifiers.
|
||||
- `int RegionNumber { get; set; }`, `string RegionName { get; set; }`, `string RegionDescription { get; set; }` — Region identification.
|
||||
- `string TestObject { get; set; }`, `string Position { get; set; }` — Association data.
|
||||
- `string MainLocation { get; set; }`, `string FineLocation1/2/3 { get; set; }` — Location hierarchy.
|
||||
- `string PhysicalDimension { get; set; }`, `string Direction { get; set; }`, `string FilterClass { get; set; }` — Physical properties.
|
||||
- `bool LocalOnly { get; }` — Whether region is local-only.
|
||||
- `System.Drawing.Point UpperLeft { get; set; }`, `LowerRight { get; set; }` — Bounding coordinates.
|
||||
|
||||
**Static Methods:**
|
||||
- `internal static TemplateRegion[] GetAllRegions(string templateName, string zoneName)` — Retrieves all regions from database via stored procedure `sp_TemplateRegionsGet`.
|
||||
|
||||
---
|
||||
|
||||
### CalculatedValueClass
|
||||
```csharp
|
||||
public class CalculatedValueClass
|
||||
```
|
||||
Represents a calculated/derived channel (sums, averages, IRTRACC calculations).
|
||||
|
||||
**Constructor:**
|
||||
- `CalculatedValueClass(DataRow dr)` — Initializes from database row using `DbOperations.CalculatedChannels.Fields` enum.
|
||||
|
||||
**Properties:**
|
||||
- `int Id { get; set; }` — Defaults to `-1`.
|
||||
- `Operations Operation { get; set; }` — Calculation type; defaults to `Operations.SUM`.
|
||||
- `string CalculatedValueCode { get; set; }` — Defaults to `"???????????????X"`.
|
||||
- `string[] InputChannelIds { get; set; }` — Input channel identifiers.
|
||||
- `byte[] InputChannelIdsBlob { get; set; }` — UTF-8 encoded, list-separator-delimited blob of channel IDs.
|
||||
- `string CFCForInputChannels { get; set; }`, `string ChannelFilterClassForOutput { get; set; }` — Filter classes.
|
||||
- `string TestSetupName { get; set; }`, `string Name { get; set; }` — Identification.
|
||||
|
||||
**Nested Enum:**
|
||||
- `Operations` — `SUM = 1`, `AVERAGE = 2`, `IRTRACC3D = 3`, `IRTRACC3D_ABDOMEN = 4`, `IRTRACC3D_LOWERTHORAX = 5`.
|
||||
|
||||
---
|
||||
|
||||
### LevelTriggerChannel
|
||||
```csharp
|
||||
public class LevelTriggerChannel
|
||||
```
|
||||
Stores level trigger threshold configuration for a channel.
|
||||
|
||||
**Constructors:**
|
||||
- `LevelTriggerChannel(LevelTriggerChannel copy)` — Copy constructor.
|
||||
- `LevelTriggerChannel(DataRow dr)` — Initializes from database row using `DbOperations.LevelTriggers.Fields`.
|
||||
|
||||
**Properties:**
|
||||
- `string TestSetupName`, `string GroupSerialNumber`, `string TestObjectChannelId`, `string HardwareChannelId`, `string SensorSerialNumber` — Association identifiers.
|
||||
- `bool GreaterThanEnabled { get; set; }` — Defaults to `true`.
|
||||
- `double GreaterThanThresholdEU`, `double LessThanThresholdEU` — Threshold values in Engineering Units.
|
||||
- `bool LessThanEnabled`, `bool TriggerBetweenBounds`, `bool TriggerOutsideBounds` — Trigger mode flags.
|
||||
- `double InsideUpperLevelEU`, `double InsideLowerLevelEU`, `double OutsideUpperLevelEU`, `double OutsideLowerLevelEU` — Boundary values.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectChannel
|
||||
```csharp
|
||||
public class TestObjectChannel : TestObjectTemplateChannel, IComparable<TestObjectChannel>
|
||||
```
|
||||
Represents a channel on a test object with metadata and hardware association.
|
||||
|
||||
**Constructor:**
|
||||
- `TestObjectChannel(TestObjectTemplateChannel copy, ISO.TestObject testObject, ISO.TestObjectTemplate template)`
|
||||
|
||||
**Properties:**
|
||||
- `bool Disabled { get; set; }` — Whether channel is excluded from data collection.
|
||||
- `int ChannelIdx { get; set; }` — Defaults to `CHANNEL_IDX_UNKNOWN` (-1).
|
||||
- `string SensorSerialNumber` — Via property bag; sensor association.
|
||||
- `string HardwareId` — Via property bag; parses and normalizes format.
|
||||
- `SquibChannelTypes SquibChannelType { get; set; }` — Squib channel classification.
|
||||
- `ISO.TestObject TestObject { get; }` — Parent test object.
|
||||
|
||||
**Methods:**
|
||||
- `int CompareTo(TestObjectChannel right)` — Compares by DisplayOrder, then Name, then TestObject serial number.
|
||||
- `string GetGraphId()` — Returns ID with current suffix for squib current channels.
|
||||
- `string GetId()` — Returns composite ID: `{SerialNumber}_{MMEChannelType}_{ChannelId}`.
|
||||
- `string GetIdWithSpecificChannelId(long id)` — Returns ID with specified channel ID.
|
||||
|
||||
**Nested Enum:**
|
||||
- `SquibChannelTypes` — `None`, `Voltage`, `Current`.
|
||||
|
||||
**Constants:**
|
||||
- `const int CHANNEL_IDX_UNKNOWN = -1`
|
||||
|
||||
---
|
||||
|
||||
### IsoCode
|
||||
```csharp
|
||||
public class IsoCode
|
||||
```
|
||||
Represents a 16-character ISO channel code with positional fields.
|
||||
|
||||
**Constructor:**
|
||||
- `IsoCode(string isoCode)` — Pads/truncates to 16 characters; pads with `'?'` if short.
|
||||
|
||||
**Properties:**
|
||||
- `string StringRepresentation { get; set; }` — Full 16-character code.
|
||||
|
||||
**Static Methods:**
|
||||
- `static string GetString(MMEPossibleChannels channel, bool careAboutTestTimeFields)` — Generates ISO code from channel; masks test object and filter class with `'?'` if `careAboutTestTimeFields` is false.
|
||||
- `static string GetString(string testObject, string position, string main, string floc1, string floc2, string floc3, string physdim, string dir, string fc)` — Concatenates parameters into code string.
|
||||
|
||||
---
|
||||
|
||||
### TestEngineerDetails
|
||||
```csharp
|
||||
public class TestEngineerDetails
|
||||
```
|
||||
Stores test engineer contact information.
|
||||
|
||||
**Constructors:**
|
||||
- `TestEngineerDetails()`
|
||||
- `TestEngineerDetails(DataRow dr)`
|
||||
- `TestEngineerDetails(TestEngineerDetails copy)`
|
||||
- `TestEngineerDetails(ITestEngineerDetailsDbRecord testEngineerDetailsDbRecord)`
|
||||
|
||||
**Properties:**
|
||||
- `string TestEngineerName`, `TestEngineerPhone`, `TestEngineerFax`, `TestEngineerEmail` — Default to `"NOVALUE"`.
|
||||
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version` — Record metadata.
|
||||
|
||||
**Static Methods:**
|
||||
- `static void DeleteAllTestEngineerDetails()` — Deletes all records via `DTS.Common.Storage.DbOperations.TestEngineerDetailsDelete()`.
|
||||
- `static TestEngineerDetails[] GetAllTestEngineerDetails()` — Retrieves all records.
|
||||
|
||||
---
|
||||
|
||||
### CustomerDetails
|
||||
```csharp
|
||||
public class CustomerDetails
|
||||
```
|
||||
Stores customer information for tests.
|
||||
|
||||
**Constructors:**
|
||||
- `CustomerDetails()`, `CustomerDetails(DataRow dr)`, `CustomerDetails(CustomerDetails copy)`
|
||||
|
||||
**Properties:**
|
||||
- `string CustomerName`, `string CustomerTestRefNumber` — Default to `string.Empty`.
|
||||
- `string ProjectRefNumber`, `string CustomerOrderNumber`, `string CustomerCostUnit` — Default to `"NOVALUE"`.
|
||||
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version`.
|
||||
|
||||
**Static Methods:**
|
||||
- `static CustomerDetails ReadXML(XmlElement root)` — Deserializes from XML.
|
||||
- `static void DeleteCustomerDetails(string name = null)` — Deletes records via `DTS.Common.Storage.DbOperations.CustomerDetailsDelete()`.
|
||||
|
||||
**Instance Methods:**
|
||||
- `void WriteXML(ref XmlWriter writer)` — Serializes to XML.
|
||||
|
||||
---
|
||||
|
||||
### LabratoryDetails
|
||||
```csharp
|
||||
public class LabratoryDetails
|
||||
```
|
||||
Stores laboratory contact information. Note: class name contains typo ("Labratory" vs "Laboratory").
|
||||
|
||||
**Constructors:**
|
||||
- `LabratoryDetails()`, `LabratoryDetails(DataRow dr)`
|
||||
|
||||
**Properties:**
|
||||
- `string LabratoryName`, `string LabratoryContactName`, `string LabratoryTestRefNumber`, `string LabratoryProjectRefNumber` — Default to `string.Empty`.
|
||||
- `string LabratoryContactPhone`, `string LabratoryContactFax`, `string LabratoryContactEmail` — Default to `"NOVALUE"`.
|
||||
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version`.
|
||||
|
||||
**Static Methods:**
|
||||
- `static LabratoryDetails ReadXML(XmlElement root)` — Deserializes from XML.
|
||||
- `static void DeleteLabratoryDetails()` — Deletes records via `DTS.Common.Storage.DbOperations.LabratoryDetailsDelete()`.
|
||||
|
||||
---
|
||||
|
||||
### TestSetting
|
||||
```csharp
|
||||
public class TestSetting
|
||||
```
|
||||
Represents a single test setting with ID, value, and default.
|
||||
|
||||
**Constructors:**
|
||||
- `TestSetting(string id, string value, string defaultValue)`
|
||||
- `TestSetting(TestSetting copy)`, `TestSetting(TestSetting copy, string value)`
|
||||
|
||||
**Properties:**
|
||||
- `string Id { get; }`, `string Value { get; set; }`, `string DefaultValue { get; }` — All read-only except Value.
|
||||
|
||||
**Methods:**
|
||||
- `string ToSerializeString()` — Returns `{Id}={Value}` with separator escaping.
|
||||
|
||||
**Static Methods:**
|
||||
- `static bool TryParse(string s, out TestSetting ts)` — Parses serialized format.
|
||||
|
||||
---
|
||||
|
||||
### TestSettingDictionary
|
||||
```csharp
|
||||
public class TestSettingDictionary
|
||||
```
|
||||
Dictionary container for test settings with serialization support.
|
||||
|
||||
**Constructor:**
|
||||
- `TestSettingDictionary()`, `TestSettingDictionary(TestSettingDictionary copy)`
|
||||
|
||||
**Methods:**
|
||||
- `string GetValue(string id, string defaultValue)` — Returns value or default if not found.
|
||||
- `void SetValue(TestSetting setting, string value)` — Updates value, creates new TestSetting.
|
||||
- `void SetValue(TestSetting setting)` — Initializes setting in dictionary.
|
||||
- `void SetValue(string id, string value)` — Sets or creates setting.
|
||||
- `void UnLoad()` — Clears dictionary.
|
||||
- `string ToSerializeString()` — Serializes all settings.
|
||||
- `void LoadSettings(string s)` — Deserializes settings string.
|
||||
|
||||
---
|
||||
|
||||
### HardwareChannel
|
||||
```csharp
|
||||
public class HardwareChannel : INotifyPropertyChanged
|
||||
```
|
||||
Represents a hardware channel on a Data Acquisition System.
|
||||
|
||||
**Constructors:**
|
||||
- `HardwareChannel(HardwareChannel copy, Hardware h)`
|
||||
- `HardwareChannel(IDataRecord reader, Hardware hardware)`
|
||||
|
||||
**Properties (all notify property changed):**
|
||||
- `Hardware ParentDAS` — Parent hardware reference.
|
||||
- `int ChannelIdx`, `int DASDisplayOrder`, `int ModuleArrayIndex` — Indexing.
|
||||
- `string ModuleSerialNumber` — Module identifier.
|
||||
- `int SupportedBridges` — Defaults to `12`.
|
||||
- `int SupportedSquibFireModes`, `int SupportedExcitations`, `int SupportedDigitalInputModes`, `int SupportedDigitalOutputModes` — All default to `16`.
|
||||
- `bool LocalOnly`.
|
||||
|
||||
**Static Methods:**
|
||||
- `static int PhysicalCompare(HardwareChannel left, HardwareChannel right)` — Compares by ChannelIdx.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectMetaData
|
||||
```csharp
|
||||
public class TestObjectMetaData
|
||||
```
|
||||
Metadata container for test objects.
|
||||
|
||||
**Constructor:**
|
||||
- `TestObjectMetaData(char testobject)` — Initializes all fields with defaults.
|
||||
|
||||
**Properties:**
|
||||
- `static double Version { get; set; }` — Defaults to `1.06`.
|
||||
- `char TestObject { get; }` — Test object character code.
|
||||
- Methods: `void SetProperty(MetaData meta)`.
|
||||
|
||||
**Nested Enums:**
|
||||
- `CommentFields` — `Comment1`, `Comment2`, `Comment3`.
|
||||
- `Fields` — `NameOfTestObject`, `VelocityOfTestObject`, `MassOfTestObject`, etc.
|
||||
- `OptionFields` — `Offset`, `BarrierWidth`, `BarrierHeight`, etc.
|
||||
|
||||
---
|
||||
|
||||
### MetaData
|
||||
```csharp
|
||||
public class MetaData
|
||||
```
|
||||
Single metadata entry.
|
||||
|
||||
**Constructor:**
|
||||
- `MetaData(string name, bool optional, string value, double version)`, `MetaData(MetaData copy)`
|
||||
|
||||
**Properties:**
|
||||
- `string Name { get; }`, `bool IsOptional { get; }`, `double Version { get; }`, `string Value { get; set; }`.
|
||||
|
||||
---
|
||||
|
||||
### TestSetupMetaData
|
||||
```csharp
|
||||
public class TestSetupMetaData
|
||||
```
|
||||
Metadata container for test setups.
|
||||
|
||||
**Constructor:**
|
||||
- `TestSetupMetaData(bool requireXCrashCompatibilityForISOExports)` — Initializes fields; uses empty string for certain fields if XCrash compatibility required.
|
||||
|
||||
**Properties:**
|
||||
- `double Version` — Defaults to `1.06`.
|
||||
|
||||
**Methods:**
|
||||
- `void SetProperty(MetaData meta, bool requireXCrashCompatibilityForISOExports)` — Sets property with XCrash compatibility handling.
|
||||
|
||||
**Nested Enum:**
|
||||
- `Fields` — `LabName`, `LaboratoryContactName`, `TestEngineerName`, `Title`, `MediumNoNumberOfMedia`, etc.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **IsoCode Length**: `IsoCode.StringRepresentation` is always exactly 16 characters. Shorter strings are padded with `'?'`; longer strings are truncated.
|
||||
|
||||
2. **TemplateZone Read-Only Properties**: `TemplateName` and `Description` are read-only after construction. `ZoneName` is read-only with a default of `""` but set during construction.
|
||||
|
||||
3. **TemplateRegions Array Semantics**: The `TemplateRegions` setter on `TemplateZone` clears the internal list before adding new values; it does not append.
|
||||
|
||||
4. **InputChannelIdsBlob Encoding**: Always UTF-8 encoded, using `CultureInfo.InvariantCulture.TextInfo.ListSeparator` as delimiter.
|
||||
|
||||
5. **TestObjectChannel ChannelIdx**: Defaults to `CHANNEL_IDX_UNKNOWN` (-1) when not assigned.
|
||||
|
||||
6. **HardwareId Parsing**: If `HardwareId` is set with a 3-part underscore-delimited format, it is normalized by removing the third token's prefix up to `'x'`.
|
||||
|
||||
7. **"NOVALUE" Sentinel**: `TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`, `TestObjectMetaData`, and `TestSetupMetaData` use `"NOVALUE"` as a sentinel value for unset string fields. Empty string inputs are ignored (do not overwrite "NOVALUE").
|
||||
|
||||
8. **CalculatedValueClass Id**: Defaults to `-1` indicating unassigned.
|
||||
|
||||
9. **LevelTriggerChannel GreaterThanEnabled**: Defaults to `true`; `LessThanEnabled` defaults to `false`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (from imports):
|
||||
- `System` — Core framework.
|
||||
- `System.Collections.Generic` — Generic collections.
|
||||
- `System.Data` / `System.Data.SqlClient` — ADO.NET data access.
|
||||
- `System.Drawing` — Point structure for coordinates.
|
||||
- `System.Text` — StringBuilder, Encoding.
|
||||
- `System.Xml` — XML read/write.
|
||||
- `System.Globalization` — Culture-invariant parsing.
|
||||
- `System.ComponentModel` — INotifyPropertyChanged.
|
||||
- `DTS.Common.Interface.TestMetaData` — `ITestEngineerDetailsDbRecord` interface.
|
||||
- `DTS.Common.Storage.DbOperations` — Database operations for details records.
|
||||
- `DTS.Common.Constants` — `CURRENT_SUFFIX` constant.
|
||||
|
||||
### Internal Dependencies (inferred):
|
||||
- `DbOperations` — Static class providing database access, stored procedure names via `DbOperationsEnum`, and field name enums (`CalculatedChannels.Fields`, `LevelTriggers.Fields`, `DAS.DASChannelFields`).
|
||||
- `DbOperations.Connection` — Database connection with `QueryDataSet` method.
|
||||
- `TestObjectTemplateChannel` — Base class for `TestObjectChannel`.
|
||||
- `ISO.TestObject` — Referenced by `TestObjectChannel`.
|
||||
- `ISO.TestObjectTemplate` — Referenced by `TestObjectChannel`.
|
||||
- `MMEPossibleChannels` — Channel definition class used by `IsoCode`.
|
||||
- `Hardware` — Hardware/DAS class referenced by `HardwareChannel`.
|
||||
|
||||
### Consumers:
|
||||
Unknown from source alone — these appear to be data entities consumed by higher-level import/export logic.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Swallowed Exceptions**: `LevelTriggerChannel(DataRow)` catches and silently ignores all exceptions. `TemplateRegion.GetAllRegions()` catches and ignores exceptions at multiple levels. This can result in partial or missing data without any indication of failure.
|
||||
|
||||
2. **Commented-Out Logging**: Multiple files contain commented-out `APILogger.Log()` calls (e.g., `LevelTriggerChannel`, `TemplateRegion`, `TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`). This suggests logging was removed or disabled, making debugging difficult.
|
||||
|
||||
3. **Typo in Class Name**: `LabratoryDetails` is misspelled (should be "Laboratory"). This typo propagates to property names (`LabratoryName`, `LabratoryContactName`, etc.) and database column names.
|
||||
|
||||
4. **Future Breaking Change**: `CalculatedValueClass` documentation states it "will probably become an abstract base class in the future." Direct instantiation may break in later versions.
|
||||
|
||||
5. **IsoCode Padding Character**: When padding short ISO codes, the class uses `'?'` not `'0'`. This differs from the default initialization which uses `'0'`.
|
||||
|
||||
6. **HardwareChannel Default Values**: `SupportedBridges` defaults to `12` while all other "Supported*" properties default to `16`. Reason unclear from source.
|
||||
|
||||
7. **TestSettingDictionary Separator Inconsistency
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/DataRecorders/IHardwareChannel.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/DataRecorders/IDASHardware.cs
|
||||
generated_at: "2026-04-17T16:12:18.707405+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "13ed9f0f902f8811"
|
||||
---
|
||||
|
||||
# DataRecorders
|
||||
|
||||
### Purpose
|
||||
This module defines marker interfaces for hardware components within the `DatabaseImport` subsystem. It appears to establish a contract for hardware abstraction, specifically for "TTS import" functionality, though the interfaces currently lack members.
|
||||
|
||||
### Public Interface
|
||||
* **`IHardwareChannel`**: An empty public interface. It imposes no methods or properties on implementers.
|
||||
* **`IDASHardware`**: An empty public interface. According to the XML documentation, it "represents hardware in TTS import".
|
||||
|
||||
### Invariants
|
||||
* None identified from source alone (interfaces are empty).
|
||||
|
||||
### Dependencies
|
||||
* **Depends on**: None (only uses the `DatabaseImport` namespace).
|
||||
* **Dependents**: Unknown (consumers not present in provided source).
|
||||
|
||||
### Gotchas
|
||||
* Both `IHardwareChannel` and `IDASHardware` are currently empty interfaces. They may serve as marker interfaces for type checking, or they may be unfinished stubs requiring implementation in the future.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Hardware/IISOHardware.cs
|
||||
generated_at: "2026-04-17T16:46:21.406876+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "772b87749e7fb24d"
|
||||
---
|
||||
|
||||
# Documentation: IISOHardware.cs
|
||||
|
||||
## 1. Purpose
|
||||
This file defines the `IISOHardware` interface within the `DatabaseImport` namespace. Based on the source code provided, the interface is currently empty. It appears to serve as a structural placeholder or a marker interface for hardware-related abstractions within the Database Import module, though it does not currently enforce any specific contract or behavior.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes a single public interface:
|
||||
|
||||
* **`interface IISOHardware`**
|
||||
* **Signature:** `public interface IISOHardware`
|
||||
* **Behavior:** Defines no members, methods, properties, or events. It represents an empty contract.
|
||||
|
||||
## 3. Invariants
|
||||
No invariants can be determined from the source code alone. As the interface has no members, it enforces no state constraints or validation rules.
|
||||
|
||||
## 4. Dependencies
|
||||
* **This module depends on:** None. The file contains no `using` directives and relies only on standard system namespaces implicitly.
|
||||
* **What depends on this:** Unknown from source alone. Consumers of this interface are not present in the provided file.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Empty Interface:** The `IISOHardware` interface is explicitly empty. It is unclear if this is an intentional design choice (e.g., a marker interface used for type checking) or if the implementation is incomplete. Developers should not assume any members exist on this interface without checking the codebase for extension interfaces or implementation details.
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ISensorData.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ISensorCalibration.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ICalibrationRecords.cs
|
||||
generated_at: "2026-04-17T16:44:29.472956+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f364623d1f54a6c3"
|
||||
---
|
||||
|
||||
# Documentation: Sensor Interfaces (DatabaseImport)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines three marker interfaces—`ISensorData`, `ISensorCalibration`, and `ICalibrationRecords`—within the `DatabaseImport` namespace. These interfaces appear to establish type contracts for sensor-related data structures used in database import operations. Based on their naming and location within the `Interface/Sensors` directory, they likely serve as abstraction points for polymorphic handling of sensor data, calibration information, and calibration record collections within the database import subsystem. **However, the interfaces contain no members, so their specific behavioral contracts cannot be determined from source alone.**
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ISensorData`
|
||||
- **Namespace:** `DatabaseImport`
|
||||
- **Signature:** `public interface ISensorData`
|
||||
- **Members:** None (empty interface)
|
||||
- **Behavior:** Undefined from source. Appears to be a marker interface for sensor data types.
|
||||
|
||||
### `ISensorCalibration`
|
||||
- **Namespace:** `DatabaseImport`
|
||||
- **Signature:** `public interface ISensorCalibration`
|
||||
- **Members:** None (empty interface)
|
||||
- **Behavior:** Undefined from source. Appears to be a marker interface for sensor calibration types.
|
||||
|
||||
### `ICalibrationRecords`
|
||||
- **Namespace:** `DatabaseImport`
|
||||
- **Signature:** `public interface ICalibrationRecords`
|
||||
- **Members:** None (empty interface)
|
||||
- **Behavior:** Undefined from source. Appears to be a marker interface for calibration record collections.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
**None can be determined from source alone.** All three interfaces are empty marker interfaces with no properties, methods, events, or constraints defined. Any invariants would be established by implementing classes or by consumer code, but these are not visible in the provided source files.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies of this module:
|
||||
- **None visible.** The source files contain no `using` directives and reference no external types. They depend only on the .NET type system for interface declaration.
|
||||
|
||||
### What depends on this module:
|
||||
- **Cannot be determined from source alone.** No consumers, implementers, or related types are shown in the provided files. The directory structure (`DatabaseImport/Interface/Sensors/`) suggests these are foundational abstractions expected to be implemented by concrete sensor data classes, but no implementations are provided.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **All interfaces are empty marker interfaces.** This is unusual for a production codebase. Possible explanations include:
|
||||
- They are intended purely for type identification/categorization.
|
||||
- The implementation is incomplete or in progress.
|
||||
- Members were removed during refactoring but the interfaces were retained for backward compatibility.
|
||||
- Behavior is defined elsewhere (e.g., via extension methods, external contracts, or convention).
|
||||
|
||||
2. **No documentation or XML comments.** The interfaces lack any inline documentation explaining their purpose or intended usage patterns.
|
||||
|
||||
3. **Relationship between interfaces is unclear.** The source provides no indication whether `ISensorCalibration` and `ICalibrationRecords` are related, or how `ISensorData` relates to the calibration interfaces.
|
||||
|
||||
4. **Namespace naming inconsistency.** The directory path contains `DatabaseImporter` while the namespace is `DatabaseImport` (no "er" suffix). This may be intentional or a historical naming inconsistency.
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/TestSetups/TestSetupsList/ITestSetup.cs
|
||||
generated_at: "2026-04-17T16:14:41.837991+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "993b64490752370f"
|
||||
---
|
||||
|
||||
# TestSetupsList
|
||||
|
||||
### Purpose
|
||||
This module defines the `ITestSetup` interface within the `DatabaseImport` namespace. It appears to be a placeholder or marker interface for test setup entities, intended to be implemented by concrete test setup classes used during database import operations. The interface is currently empty, suggesting it may serve as a contract extension point or type marker for dependency injection and polymorphic handling of test setup objects.
|
||||
|
||||
### Public Interface
|
||||
- **`ITestSetup`** (interface) - An empty public interface in the `DatabaseImport` namespace. No members are defined. Intended usage patterns are not clear from source alone.
|
||||
|
||||
### Invariants
|
||||
- None identifiable from the empty interface definition.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: None (standalone interface definition).
|
||||
- **Depended on by**: Unknown from source alone; likely consumed by other DatabaseImport components handling test setup data.
|
||||
|
||||
### Gotchas
|
||||
- The interface is completely empty with no members, which may indicate it is under development, deprecated, or serves purely as a marker/type discriminator. The intended contract is unclear from source alone.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/AssemblyInfo.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/Settings.Designer.cs
|
||||
generated_at: "2026-04-17T16:28:42.805400+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "798fca9d3593b72e"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module provides assembly-level metadata and application/user settings configuration for the DatabaseImport assembly. It defines persistent configuration values including download paths, auto-arm permissions, calibration warning periods, database type selection, and ISO export compatibility requirements.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`Settings` (sealed partial class, internal)**
|
||||
- `public static Settings Default { get; }` — Singleton instance accessor returning synchronized settings.
|
||||
- `public string DownloadFolder { get; }` — Application-scoped setting, default value `"..\\Data"`.
|
||||
- `public bool AllowAutoArm { get; }` — Application-scoped setting, default value `false`.
|
||||
- `public int CalWarningPeriodDays { get; set; }` — User-scoped setting, default value `7`.
|
||||
- `public int DBType { get; }` — Application-scoped setting, default value `1`.
|
||||
- `public bool RequireXCrashCompatibilityForISOExports { get; }` — Application-scoped setting, default value `true`.
|
||||
|
||||
### Invariants
|
||||
- `Settings` inherits from `System.Configuration.ApplicationSettingsBase` and uses thread synchronization via `Synchronized()`.
|
||||
- Application-scoped settings (`DownloadFolder`, `AllowAutoArm`, `DBType`, `RequireXCrashCompatibilityForISOExports`) are read-only at runtime.
|
||||
- User-scoped settings (`CalWarningPeriodDays`) can be modified and persisted.
|
||||
- The class is auto-generated by `SettingsSingleFileGenerator`; manual changes will be overwritten.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Runtime.CompilerServices`, `System.CodeDom.Compiler`.
|
||||
- **Depended on by**: Unclear from source alone; likely consumed throughout the DatabaseImport assembly for configuration access.
|
||||
|
||||
### Gotchas
|
||||
- `DownloadFolder` uses a relative path `"..\\Data"`; the actual location depends on the working directory at runtime.
|
||||
- `DBType` is an integer (default `1`); the mapping of integer values to database types is not defined in this source.
|
||||
- The `CalWarningPeriodDays` is user-scoped, meaning it can vary per user profile; other settings are application-wide.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,269 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorRange.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorDB.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/DigitalInputSetting.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/DigitalOutputSetting.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SquibSetting.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/FilterClass.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorCalibrationList.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/CalibrationRecords.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/IsoCode.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorsCollection.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorCalibration.cs
|
||||
generated_at: "2026-04-17T15:48:08.013914+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7a9bc918bd6b0831"
|
||||
---
|
||||
|
||||
# SensorDB Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data layer for sensor configuration and calibration management within the DataPRO database import system. It defines data structures for various sensor types (analog, digital input/output, squib), their calibration records, ISO codes for sensor identification, and filter class specifications. The module handles database serialization/deserialization, implements property change notification for UI binding, and manages cached collections of sensors and calibrations for efficient lookup operations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### SensorRange
|
||||
```csharp
|
||||
public class SensorRange : INotifyPropertyChanged
|
||||
```
|
||||
Stores triple-value sensor range thresholds.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SensorRange(string value)` | Constructor | Parses comma-separated string "low,medium,high". Throws `InvalidDataException` if not exactly 3 values. |
|
||||
| `SensorRange(double low, double medium, double high)` | Constructor | Initializes with explicit values. |
|
||||
| `Low` | `double { get; set; }` | Low threshold value. |
|
||||
| `Medium` | `double { get; set; }` | Medium threshold value. |
|
||||
| `High` | `double { get; set; }` | High threshold value. |
|
||||
|
||||
### LowHigh
|
||||
```csharp
|
||||
public class LowHigh : INotifyPropertyChanged
|
||||
```
|
||||
Stores low/high value pairs.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `LowHigh(double low, double high)` | Constructor | Initializes with explicit values. |
|
||||
| `LowHigh(string value)` | Constructor | Parses comma-separated string. Requires at least 2 values. Uses `InvariantCulture` for parsing. |
|
||||
| `Low` | `double { get; set; }` | Low value. |
|
||||
| `High` | `double { get; set; }` | High value. |
|
||||
|
||||
### Enums (SensorDB.cs)
|
||||
|
||||
| Enum | Values | Description |
|
||||
|------|--------|-------------|
|
||||
| `ShuntMode` | `None, Emulation, Internal, External` | Shunt calibration modes. |
|
||||
| `BridgeLeg` | `First, Second, Third, Fourth` | Bridge measurement leg selection. |
|
||||
| `CouplingModes` | `AC = 0, DC` | Signal coupling modes. |
|
||||
|
||||
### FilterClass
|
||||
```csharp
|
||||
public class FilterClass : INotifyPropertyChanged
|
||||
```
|
||||
Represents CFC (Channel Frequency Class) filter specifications per SAE J211.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `FilterClassType` | Nested enum | `None = 0, AdHoc = -1, CFC10 = 17, CFC60 = 100, CFC180 = 300, CFC600 = 1000, CFC1000 = 1650` |
|
||||
| `FilterClass(FilterClassType fc)` | Constructor | Creates from enum value. Throws `Exception` for unknown types. |
|
||||
| `FilterClass(string fclass)` | Constructor | Parses string by numeric value or name substring matching. |
|
||||
| `FClass` | `FilterClassType { get; set; }` | The filter class type. |
|
||||
| `Frequency` | `double { get; set; }` | Frequency in Hz. |
|
||||
| `ToString()` | `override string` | Returns formatted string like "100 (CFC60)" or integer for AdHoc. |
|
||||
|
||||
### IsoCode
|
||||
```csharp
|
||||
public class IsoCode
|
||||
```
|
||||
Represents a 16-character ISO sensor identification code.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `IsoCode(string isoCode)` | Constructor | Parses 16-char code. Pads with '?' if shorter, truncates if longer. Null becomes empty string. |
|
||||
| `TestObject` | `string { get; set; }` | Character at position 0. |
|
||||
| `Position` | `string { get; set; }` | Character at position 1. |
|
||||
| `MainLocation` | `string { get; set; }` | Characters at positions 2-5 (4 chars). |
|
||||
| `FineLocation1` | `string { get; set; }` | Characters at positions 6-7 (2 chars). |
|
||||
| `FineLocation2` | `string { get; set; }` | Characters at positions 8-9 (2 chars). |
|
||||
| `FineLocation3` | `string { get; set; }` | Characters at positions 10-11 (2 chars). |
|
||||
| `PhysicalDimension` | `string { get; set; }` | Characters at positions 12-13 (2 chars). |
|
||||
| `Direction` | `string { get; set; }` | Character at position 14. |
|
||||
| `FilterClass` | `string { get; set; }` | Character at position 15. |
|
||||
| `StringRepresentation` | `string { get; set; }` | Full 16-character string. |
|
||||
|
||||
### CalibrationRecord
|
||||
```csharp
|
||||
public class CalibrationRecord
|
||||
```
|
||||
Single calibration data point.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CalibrationRecord()` | Constructor | Creates with default `LinearizationFormula`. |
|
||||
| `CalibrationRecord(string s)` | Constructor | Parses from serialized string using `FromString()`. |
|
||||
| `CalibrationRecord(CalibrationRecord copy)` | Constructor | Deep copy constructor. |
|
||||
| `Sensitivity` | `double { get; set; }` | Sensitivity value. |
|
||||
| `ZeroPoint` | `double { get; set; }` | Calculated from `Poly.ZeroPositionIntercept / Poly.CalibrationFactor` when factor non-zero; otherwise stored value. |
|
||||
| `Poly` | `LinearizationFormula { get; set; }` | Linearization polynomial. |
|
||||
| `AtCapacity` | `bool { get; set; }` | Default `false`. |
|
||||
| `EngineeringUnits` | `string { get; set; }` | Default "g". |
|
||||
| `SensitivityUnits` | `Test.Module.Channel.Sensor.SensUnits { get; set; }` | Default `NONE`. |
|
||||
| `Excitation` | `ExcitationVoltageOptions.ExcitationVoltageOption { get; set; }` | Default `Volt5`. |
|
||||
| `CapacityOutputIsBasedOn` | `double { get; set; }` | Default 1.000. |
|
||||
| `FromString(string s)` | `void` | Deserializes from token-separated string. |
|
||||
|
||||
### CalibrationRecords
|
||||
```csharp
|
||||
public class CalibrationRecords : ICalibrationRecords
|
||||
```
|
||||
Collection of calibration records.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CalibrationRecords()` | Constructor | Creates with single default `CalibrationRecord`. |
|
||||
| `CalibrationRecords(CalibrationRecords copy)` | Constructor | Deep copy constructor. |
|
||||
| `CalibrationRecords(string records)` | Constructor | Deserializes using `FromSerializedString()`. |
|
||||
| `Records` | `CalibrationRecord[] { get; set; }` | Array of records. Default single empty record. |
|
||||
| `FromSerializedString(string s)` | `void` | Parses records separated by `"__x__"`. |
|
||||
|
||||
### SensorCalibration
|
||||
```csharp
|
||||
public class SensorCalibration : IComparable<SensorCalibration>, INotifyPropertyChanged, ISensorCalibration
|
||||
```
|
||||
Complete calibration data for a sensor.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SensorCalibration()` | Constructor | Default constructor. |
|
||||
| `SensorCalibration(string s)` | Constructor | Deserializes from string. |
|
||||
| `SensorCalibration(DataRow dr)` | Constructor | Populates from database row. |
|
||||
| `SensorCalibration(SensorCalibration sc)` | Constructor | Deep copy constructor. |
|
||||
| `NewDigitalSC()` | `static SensorCalibration` | Factory for digital sensor calibration. |
|
||||
| `GetLatestCalibrationBySerialNumberAndExcitation(SensorData, ExcitationVoltageOption)` | `static SensorCalibration` | Delegates to `SensorCalibrationList`. |
|
||||
| `CalVersion` | `long { get; set; }` | Default `long.MinValue`. |
|
||||
| `SerialNumber` | `string { get; set; }` | Sensor serial number. |
|
||||
| `CalibrationDate` | `DateTime { get; set; }` | Primary sort key. |
|
||||
| `ModifyDate` | `DateTime { get; set; }` | Secondary sort key. |
|
||||
| `Username` | `string { get; set; }` | User who created calibration. |
|
||||
| `Records` | `CalibrationRecords { get; set; }` | Calibration data points. |
|
||||
| `NonLinear` | `bool { get; set; }` | When set true, forces `Sensitivity=1`, `IsProportional=false`, `RemoveOffset=false`. |
|
||||
| `IsProportional` | `bool { get; set; }` | Returns `false` if `NonLinear` is true. Default `true`. |
|
||||
| `RemoveOffset` | `bool { get; set; }` | Returns `false` if `NonLinear` is true. Default `true`. |
|
||||
| `LocalOnly` | `bool { get; set; }` | Whether calibration is local-only. |
|
||||
| `ZeroMethod` | `ZeroMethod { get; set; }` | Lazy-initialized with default. Modified by `NonLinear` state. |
|
||||
| `InitialOffset` | `InitialOffset { get; set; }` | Initial offset configuration. |
|
||||
| `CertificationDocuments` | `string[] { get; set; }` | Associated certification docs. |
|
||||
| `CompareTo(SensorCalibration other)` | `int` | Compares by `CalibrationDate` (descending), then `ModifyDate` (descending), then `CalVersion`. |
|
||||
| `FromSerializedString(string s)` | `void` | Deserializes from field-separated string. |
|
||||
| `ReadXML(XmlElement root)` | `void` | Populates from XML element. |
|
||||
|
||||
### SensorCalibrationList
|
||||
```csharp
|
||||
public class SensorCalibrationList
|
||||
```
|
||||
Manages cached calibration lookups.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Reload()` | `static void` | Resets singleton instance under lock. |
|
||||
| `GetLatestCalibrationBySerialNumberAndExcitation(SensorData, ExcitationVoltageOption)` | `static SensorCalibration` | Returns latest matching calibration. Returns `NewDigitalSC()` for digital/squib types. Checks cached list first, then database. |
|
||||
| `DeleteAll()` | `static void` | Deletes all calibrations via stored procedure `sp_SensorCalibrationsDelete`. Clears internal cache. |
|
||||
|
||||
### SensorsCollection
|
||||
```csharp
|
||||
public class SensorsCollection : INotifyPropertyChanged
|
||||
```
|
||||
Singleton collection for sensor lookup.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SensorsList` | `static SensorsCollection { get; }` | Singleton accessor (lazy-initialized under lock). |
|
||||
| `HookedUp` | `bool { get; set; }` | Controls whether `PropertyChanged` events are raised. Default `true`. |
|
||||
| `Reload()` | `void` | **Empty implementation.** |
|
||||
| `DeleteAll()` | `void` | Deletes all sensors via `sp_SensorDeleteAll`, then calls `SensorCalibrationList.DeleteAll()`. |
|
||||
| `GetSensorBySerialNumber(string, bool, bool)` | `SensorData` | Searches cache then database across analog, digital input, squib, and digital output tables. Returns `null` if not found (unless test-specific digital out SN). |
|
||||
|
||||
### DigitalInputSetting
|
||||
```csharp
|
||||
public class DigitalInputSetting : SensorData
|
||||
```
|
||||
Configuration for digital input channels.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `DigitalInputSetting(IDataRecord reader)` | Constructor | Populates from database record. Catches and silently ignores exceptions. |
|
||||
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = DigitalInput`, `Capacity = 1`, `DisplayUnit = "V"`, `BridgeResistance = NaN`, etc. |
|
||||
|
||||
### DigitalOutputSetting
|
||||
```csharp
|
||||
public class DigitalOutputSetting : SensorData
|
||||
```
|
||||
Configuration for digital output channels.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `DigitalOutputSetting()` | Constructor | Calls `SetDefaults()`. |
|
||||
| `DigitalOutputSetting(IDataRecord reader)` | Constructor | Populates from database record, then calls `SetDefaults()`. Silently catches exceptions. |
|
||||
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = TOMDigital`, `Capacity = 1`, `DisplayUnit = "V"`, etc. |
|
||||
| `ChannelDescription` | `string { get; set; }` | Alias for `SerialNumber`. Raises `PropertyChanged` on set. |
|
||||
|
||||
### SquibSetting
|
||||
```csharp
|
||||
public class SquibSetting : SensorData
|
||||
```
|
||||
Configuration for squib (explosive initiator) channels.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SquibSetting(IDataRecord reader)` | Constructor | Populates from database record. Silently catches exceptions. |
|
||||
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = SQUIB`, `Capacity = 5`, `DisplayUnit = "V"`, etc. |
|
||||
| `SquibDescription` | `string { get; set; }` | Alias for `SerialNumber`. |
|
||||
| `ArticleId` | `string { get; set; }` | Alias for `Id`. |
|
||||
| `BypassCurrentFilter` | `bool { get; set; }` | Uses `SetProperty` for notification. |
|
||||
| `BypassVoltageFilter` | `bool { get; set; }` | Uses `SetProperty` for notification. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **SensorRange parsing**: Input string must contain exactly 3 comma-separated values; otherwise `InvalidDataException` is thrown.
|
||||
|
||||
2. **LowHigh parsing**: Input string must contain at least 2 comma-separated values; otherwise `InvalidDataException` is thrown.
|
||||
|
||||
3. **IsoCode length**: Always exactly 16 characters. Shorter inputs are right-padded with '?'; longer inputs are truncated to 16.
|
||||
|
||||
4. **FilterClass frequency mapping**: `FilterClassType` enum values double as their frequency in Hz (e.g., `CFC60 = 100` means 100 Hz).
|
||||
|
||||
5. **CalibrationRecord.ZeroPoint**: When `Poly.CalibrationFactor != 0`, the getter returns a calculated value (`Poly.ZeroPositionIntercept / Poly.CalibrationFactor`) rather than the stored `_zeroPoint`.
|
||||
|
||||
6. **NonLinear calibration state**: Setting `SensorCalibration.NonLinear = true` forcibly sets `Records[0].Sensitivity = 1`, `IsProportional = false`, and `RemoveOffset = false`.
|
||||
|
||||
7. **SensorCalibration ordering**: `CompareTo` sorts descending by `CalibrationDate`, then `ModifyDate`, then `CalVersion`.
|
||||
|
||||
8. **Digital sensor calibration**: `GetLatestCalibrationBySerialNumberAndExcitation` returns `NewDigitalSC()` for any sensor where `IsDigitalInput()`, `IsSquib()`, or `IsDigitalOutput()` returns true.
|
||||
|
||||
9. **SensorsCollection.HookedUp**: When `false`, `OnPropertyChanged` is a no-op; no events are raised.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System.Data` / `System.Data.SqlClient` - Database operations via `IDataRecord`, `DataRow`, `SqlCommand`
|
||||
- `System.ComponentModel` - `INotifyPropertyChanged` interface
|
||||
- `System.Globalization` - `CultureInfo.InvariantCulture` for parsing
|
||||
- `System.Xml` - XML parsing in `SensorCalibration.ReadXML`
|
||||
|
||||
### External types referenced (not defined in source):
|
||||
- `SensorData` - Base class for sensor settings
|
||||
- `DbOperations` - Database field name constants and `GetSQLCommand()` factory
|
||||
- `DbOperationsEnum.StoredProcedure` - Stored procedure name enum
|
||||
- `ExcitationVoltageOptions.ExcitationVoltageOption` - Excitation voltage enum
|
||||
- `Test.Module.Channel.Sensor.BridgeType` - Bridge type enum (`DigitalInput`, `TOMDigital`, `SQUIB`)
|
||||
- `Test
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/GlobalSetting.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/SettingsDB.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/Setting.cs
|
||||
generated_at: "2026-04-17T15:54:56.419164+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "13a82f958bbaccd7"
|
||||
---
|
||||
|
||||
# Documentation: SettingsDB Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a thread-safe, database-backed key-value store for application settings. It implements a singleton pattern (`SettingsDB`) that manages in-memory cached `Setting` objects, with concrete implementations like `GlobalSetting` for system-wide configuration. The module abstracts database operations for persisting and retrieving settings via SQL stored procedures, supporting both string and boolean values with automatic default value initialization.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `SettingsDB` (Concrete Class)
|
||||
|
||||
A singleton class that serves as the primary entry point for managing global settings.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetGlobalValue` | `public static string GetGlobalValue(string id, string defaultValue)` | Retrieves a global setting by ID. Creates a new `GlobalSetting` with the provided default value if the ID doesn't exist in the cache. Returns the cached `PropertyValue`. |
|
||||
| `GetGlobalValueBool` | `public static bool GetGlobalValueBool(string id, bool defaultValue)` | Retrieves a global setting as a boolean. Parses the stored string value; returns `defaultValue` if parsing fails. |
|
||||
| `SetGlobalValue` | `public static void SetGlobalValue(string id, string value)` | Stores a global property in the database. Creates a new `GlobalSetting` if the ID doesn't exist; otherwise updates the existing value via `SetValue()`. |
|
||||
| `SetGlobalValueBoolean` | `public static void SetGlobalValueBoolean(string id, bool value)` | Stores a boolean global property. Converts the bool to string using `InvariantCulture` before persisting. |
|
||||
|
||||
### `Setting` (Abstract Base Class)
|
||||
|
||||
Base class for all setting types, handling database persistence.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `PropertyId` | `public string PropertyId => _propertyId` | Read-only string identifier for the property. |
|
||||
| `PropertyValue` | `public string PropertyValue => _propertyValue` | Read-only string value of the property. |
|
||||
| `UserId` | `public string UserId
|
||||
@@ -0,0 +1,168 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/IDbTimeStampAware.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/DbOperationsEnum.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/DbOperations.cs
|
||||
generated_at: "2026-04-17T15:55:34.382481+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2b4b04a70e36d4d6"
|
||||
---
|
||||
|
||||
# DatabaseImport Storage Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data access layer for the DatabaseImport system, managing database connections, schema definitions, and timestamp-based synchronization between in-memory objects and the database. It defines the structure of database entities through strongly-typed field enumerations, centralizes stored procedure references, and implements a timestamp comparison mechanism to detect when local data is out of sync with the database. The module supports both centralized SQL Server deployments and local SQL LocalDB instances.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### IDbTimeStampAware (Interface)
|
||||
**Signature:** `public interface IDbTimeStampAware`
|
||||
|
||||
Defines the contract for objects that track synchronization state with the database.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetTimeStampMemory` | `long GetTimeStampMemory()` | Returns the current in-memory timestamp value. |
|
||||
| `SetTimeStampMemory` | `void SetTimeStampMemory(long value)` | Sets the in-memory timestamp to the specified value. |
|
||||
| `GetTimeStampDb` | `long GetTimeStampDb()` | Retrieves the current timestamp from the database. |
|
||||
| `IsOutOfDate` | `bool IsOutOfDate()` | Returns `true` if the in-memory data differs from the database. |
|
||||
|
||||
### DbTimeStampBase (Abstract Class)
|
||||
**Signature:** `public abstract class DbTimeStampBase : IDbTimeStampAware, INotifyPropertyChanged`
|
||||
|
||||
Base class providing `INotifyPropertyChanged` implementation and timestamp tracking functionality.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `PropertyChanged` | `event PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. |
|
||||
| `SetProperty<T>` | `protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)` | Helper method for property setters; returns `true` if value changed. |
|
||||
| `OnPropertyChanged` | `protected void OnPropertyChanged(string propertyName = null)` | Raises the `PropertyChanged` event. |
|
||||
| `GetTimeStampMemory` | `public long GetTimeStampMemory()` | Returns the protected `DbTimeStamp` field. |
|
||||
| `SetTimeStampMemory` | `public void SetTimeStampMemory(long value)` | Assigns `value` to `DbTimeStamp`. |
|
||||
| `SetTimeStampMemory` | `public void SetTimeStampMemory(DataRow row)` | Sets `DbTimeStamp` to `0`. |
|
||||
| `SetTimeStampMemory` | `public void SetTimeStampMemory(IDataReader reader)` | Sets `DbTimeStamp` to `0`. |
|
||||
| `GetTimeStampDb` | `public long GetTimeStampDb(Dictionary<string, long> lookup)` | Returns `0`. |
|
||||
| `GetTimeStampDb` | `public long GetTimeStampDb()` | Returns `0`. |
|
||||
| `IsOutOfDate` | `public bool IsOutOfDate()` | Compares memory and DB timestamps; returns `false` if DB timestamp is `0`, syncs memory to DB if memory is `0` but DB is not. |
|
||||
|
||||
### DbOperationsEnum (Class)
|
||||
**Signature:** `public class DbOperationsEnum`
|
||||
|
||||
Container class for database-related enumerations.
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `StoredProcedure` (enum) | Contains 120+ stored procedure names including `sp_UserDelete`, `sp_UserGet`, `sp_DBImportUsers`, `sp_SensorModelsGet`, `sp_TestSetupsGet`, etc. |
|
||||
|
||||
### DbOperations (Class)
|
||||
**Signature:** `public class DbOperations`
|
||||
|
||||
Primary database operations class containing schema definitions and connection management.
|
||||
|
||||
#### Constants
|
||||
| Constant | Value | Description |
|
||||
|----------|-------|-------------|
|
||||
| `CURRENT_DB_VERSION` | `61` | Current database schema version for this codebase. |
|
||||
|
||||
#### Static Fields
|
||||
| Field | Default | Description |
|
||||
|-------|---------|-------------|
|
||||
| `_usingCentralizedDB` | `true` | `true` = remote centralized server; `false` = local SqlLocalDB. |
|
||||
| `_usingMSSQL` | `true` | Indicates MSSQL usage. |
|
||||
| `_usingNTLMAuthentication` | `false` | Whether to use Windows Authentication. |
|
||||
| `_previousDir` | `string.Empty` | Previous directory path. |
|
||||
| `cmd` | `SqlCommand` | Static SQL command instance. |
|
||||
|
||||
#### Static Properties
|
||||
| Property | Description |
|
||||
|----------|-------------|
|
||||
| `Connection` | Singleton accessor returning the `DbOperations` instance. |
|
||||
|
||||
#### Instance Properties
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Server` | `string` | Database server address. |
|
||||
| `Username` | `string` | SQL authentication username. |
|
||||
| `Password` | `string` | SQL authentication password. |
|
||||
| `DBName` | `string` | Database name. |
|
||||
|
||||
#### Static Methods
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetSQLCommand` | `public static SqlCommand GetSQLCommand()` | Returns `_cmd`, initializing connection if needed. |
|
||||
| `GetSQLCommand` | `public static SqlCommand GetSQLCommand(bool newCommand)` | Returns existing or new `SqlCommand` with open connection. |
|
||||
| `IsServerConnected` | `public static bool IsServerConnected()` | Tests connection to local database; returns `true` if successful. |
|
||||
|
||||
#### Instance Methods
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetLocalConnectionString` | `public string GetLocalConnectionString()` | Builds connection string based on authentication mode. |
|
||||
| `QueryDataSet` | `public DataSet QueryDataSet(SqlCommand icmd)` | Executes query and returns populated `DataSet`. |
|
||||
|
||||
#### Nested Schema Classes
|
||||
All nested classes are `abstract` and contain field enumerations with optional `DbTypeAttr` attributes:
|
||||
|
||||
| Class | Key Members |
|
||||
|-------|-------------|
|
||||
| `Tags` | `TagFields` enum |
|
||||
| `DbVersions` | `DbVersionFields` enum |
|
||||
| `Settings` | `UserFields` enum |
|
||||
| `Users` | `UserFields`, `UIItemFields` enums |
|
||||
| `SensorDB` | `SensorDataFields`, `SensorModelFields`, `SensorCalibrationFields` enums |
|
||||
| `CalculatedChannels` | `Table` constant, `Fields` enum with `DbTypeAttr` |
|
||||
| `LevelTriggers` | `Fields` enum with `DbTypeAttr` |
|
||||
| `TestSetups` | `HardwareFields`, `ChannelSettingFields`, `Fields`, `TestSetupObjectFields`, `TestObjectMetaDataFields`, `GraphFields` enums |
|
||||
| `TestObjectChannelSettings` | `Fields` enum |
|
||||
| `DigitalOutputSettings` | `Fields` enum |
|
||||
| `Squib` | `Fields` enum |
|
||||
| `MMETables` | `MMEDirectionsFields`, `MMEFilterClassesFields`, `MMEFineLocations1Fields`, `MMEFineLocations2Fields`, `MMEFineLocations3Fields`, `MMEPhysicalDimensionFields`, `MMEPositionsFields`, `MMETestObjectsFields`, `MMEMainLocationsFields` enums |
|
||||
| `DAS` | `Fields`, `DASChannelFields` enums |
|
||||
| `DigitalInputSettings` | `Fields` enum |
|
||||
|
||||
#### DbTypeAttr (Attribute Class)
|
||||
**Signature:** `public class DbTypeAttr : Attribute`
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `DbType` | SQL type string (e.g., `"INTEGER PRIMARY KEY NOT NULL"`, `"NVARCHAR(255)"`). |
|
||||
| `GetDbType(object o)` | Static method to retrieve `DbType` value from enum member via reflection. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Singleton Pattern**: `DbOperations.Connection` always returns the same instance; access is thread-safe via `dbLock`.
|
||||
|
||||
2. **Connection State**: `GetSQLCommand()` ensures the returned `SqlCommand` has an open connection; it calls `Parameters.Clear()` before returning.
|
||||
|
||||
3. **Timestamp Comparison Logic**: `IsOutOfDate()` returns `false` when `db == 0` (no record exists), preventing false "out of date" flags for new records.
|
||||
|
||||
4. **Auto-Sync Behavior**: When `mem == 0 && db != 0`, `IsOutOfDate()` silently syncs memory to DB value before comparison.
|
||||
|
||||
5. **Database Version**: The codebase expects database schema version `61` (`CURRENT_DB_VERSION`).
|
||||
|
||||
6. **Field Enum Indexing**: `SensorDataFields.SerialNumber` is explicitly set to value `1`, not the default `0`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `System.Collections.Generic` (for `Dictionary<string, long>`)
|
||||
- `System.ComponentModel` (for `INotifyPropertyChanged`, `PropertyChangedEventHandler`)
|
||||
- `System.Data` (for `DataSet`, `DataRow`, `IDataReader`, `ConnectionState`)
|
||||
- `System.Data.SqlClient` (for `SqlConnection`, `SqlCommand`, `SqlDataAdapter`, `SqlException`)
|
||||
|
||||
### External Dependencies Referenced (but not defined in source):
|
||||
- `APILogger` - Referenced in commented code for exception logging.
|
||||
- `Connection.GetLocalConnectionString()` - Called in `IsServerConnected()` (appears to be a static method on `DbOperations.Connection`).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Non-functional Timestamp Methods**: `SetTimeStampMemory(DataRow)`, `SetTimeStampMemory(IDataReader)`, `
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/User.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/ITagAware.cs
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/Tags.cs
|
||||
generated_at: "2026-04-17T16:44:26.882862+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a4f52a52acc619da"
|
||||
---
|
||||
|
||||
# Documentation: DatabaseImport.Users Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the domain model for User entities within the DatabaseImport system, with support for tag associations. It enables serialization of tag IDs to binary blobs for database storage, and defines the structure for tag entities that can be persisted and cloned. The module is designed to facilitate importing user data with associated metadata (tags) from external sources.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `User` Class
|
||||
**Namespace:** `DatabaseImport`
|
||||
**Inheritance:** `TagAwareBase`
|
||||
|
||||
A minimal entity class representing a single user. Inherits all behavior from `TagAwareBase`, including tag management and timestamp functionality.
|
||||
|
||||
```csharp
|
||||
public class User : TagAwareBase
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `ITagAware` Interface
|
||||
**Namespace:** `DatabaseImport`
|
||||
|
||||
A marker interface for classes that support tag awareness. Currently defines no members.
|
||||
|
||||
```csharp
|
||||
public interface ITagAware
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `TagAwareBase` Class (Abstract)
|
||||
**Namespace:** `DatabaseImport`
|
||||
**Inheritance:** `DbTimeStampBase`
|
||||
|
||||
Base class providing tag storage and binary serialization capabilities.
|
||||
|
||||
#### Properties
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `byte[] TagsBlobBytes { get; set; }` | Gets or sets tag IDs as a binary blob. Getter converts `TagIDs` to a byte array; setter parses bytes back to `TagIDs`. |
|
||||
| `int[] TagIDs { get; set; }` | Gets or sets the array of tag IDs. Never null; defaults to empty array. |
|
||||
|
||||
---
|
||||
|
||||
### `Tags` Class
|
||||
**Namespace:** `DatabaseImport`
|
||||
|
||||
Container class for tag-related types.
|
||||
|
||||
---
|
||||
|
||||
### `Tags.Tag` Class (Nested)
|
||||
**Namespace:** `DatabaseImport`
|
||||
**Implements:** `ICloneable`
|
||||
|
||||
Represents a single tag entity with ID, text, and obsolescence state.
|
||||
|
||||
#### Properties
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `int ID { get; set; }` | The unique identifier for the tag. |
|
||||
| `string Text { get; set; }` | The display text of the tag. |
|
||||
| `bool IsObsolete { get; set; }` | Indicates whether the tag is obsolete. |
|
||||
|
||||
#### Constructors
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `Tag(Tag copy)` | Copy constructor. Creates a new instance with values copied from `copy`. |
|
||||
| `Tag(IDataRecord reader)` | Constructs a tag from a database record, reading fields via `DbOperations.Tags.TagFields`
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Utilities/DiskUtility.cs
|
||||
generated_at: "2026-04-17T16:29:45.030001+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0f336a841c73386c"
|
||||
---
|
||||
|
||||
# Utilities
|
||||
|
||||
### Purpose
|
||||
This module provides disk and file system utility functions for the DatabaseImporter subsystem. It centralizes validation logic for file and path naming to ensure compatibility with operating system constraints.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DiskUtility`**
|
||||
- `public static bool ValidateFileAndPathNameChars(string nameToValidate)` — Validates that the input string contains no illegal characters for file or path names. Returns `true` if valid, `false` otherwise. Checks against `Path.GetInvalidFileNameChars()`, `Path.GetInvalidPathChars()`, and additionally rejects strings containing periods (`.`) or strings that are empty/whitespace-only after trimming.
|
||||
|
||||
### Invariants
|
||||
- Input string must not be
|
||||
Reference in New Issue
Block a user