This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,226 @@
---
source_files:
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/IServicePublic.cs
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/SerializedSettings.cs
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/CustomChannel.cs
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/TestGraph.cs
generated_at: "2026-04-17T15:53:29.795646+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "75360f877b7fe798"
---
# Documentation: DatabaseExport Module (Version 57)
## 1. Purpose
This module provides data structures and utilities for managing database export operations within the DataPRO system, specifically for Version 57 database schema compatibility. It defines channel type hierarchies for Data Acquisition System (DAS) hardware, provides a settings abstraction layer over a global settings database, enables user-defined custom channels that extend beyond the ISO13499 standard, and manages test graph configurations including channel selection and threshold definitions. The module serves as a bridge between the domain model and database persistence layer.
---
## 2. Public Interface
### IServicePublic.cs
#### `DASChannel`
```csharp
[Serializable]
public class DASChannel
```
Base class for all DAS channels. Marked as `Serializable`. Contains no members in this version (commented-out `IXmlSerializable` implementation suggests future extensibility).
#### `OutputTOMDigitalChannel`
```csharp
[Serializable]
public class OutputTOMDigitalChannel : DigitalOutputDASChannel
```
Inherits from `DigitalOutputDASChannel`. Defines digital output modes via nested enum:
- `DigitalOutputMode.NONE = 0` — Mode not set
- `DigitalOutputMode.FVLH = 1 << 0` — 5 volt, low-to-high transition
- `DigitalOutputMode.FVHL = 1 << 1` — 5 volt, high-to-low transition
- `DigitalOutputMode.CCNO = 1 << 2` — Contact closure normally open
- `DigitalOutputMode.CCNC = 1 << 3` — Contact closure normally closed
#### `OutputSquibChannel`
```csharp
[Serializable]
public class OutputSquibChannel
```
Defines squib (explosive initiator) channel configuration via two nested enums:
**`SquibFireMode`:**
- `NONE = 1 << 0`, `CAP = 1 << 1`, `CONSTANT = 1 << 2`, `AC = 1 << 3`
**`SquibMeasurementType`:**
- `NONE = 0`, `CURRENT = 1 << 0`, `INIT_SIGNAL = 1 << 1`, `VOLTAGE = 1 << 2`
#### `OutputDASChannel`
```csharp
[Serializable]
public class OutputDASChannel : DASChannel
```
Base class for output channels, inherits from `DASChannel`.
#### `DigitalOutputDASChannel`
```csharp
[Serializable]
public class DigitalOutputDASChannel : OutputDASChannel
```
Digital output channel, inherits from `OutputDASChannel`.
---
### SerializedSettings.cs
#### `SerializedSettings`
```csharp
public sealed class SerializedSettings
```
Static facade for application settings stored via `SettingsDB`. All properties are static.
**Key Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `ExportINIFile` | `string` | `""` | Location of export INI file |
| `IsoChannelSensorCompatibilityLevel` | `IsoChannelSensorCompatibilityLevels` | `Warn` | ISO channel/sensor compatibility level |
| `TestSetupAutomaticMode` | `bool` | `false` | Test setup automatic mode flag |
| `TestSetupDefaultCommonStatusLine` | `bool` | `true` | Common status line default |
| `TestSetupAutomaticProgressDelayMS` | `int` | `0` | Automatic mode delay in milliseconds |
| `ISOSupportLevel` | `ISOSupportLevels` | `ISO_ONLY` | ISO support level |
| `TestSetupDefaultWarnOnBatteryFail` | `bool` | `false` | Warn on battery failure |
| `TestSetupDefaultDontAllowOutOfCalSensors` | `bool` | `false` | Disallow out-of-calibration sensors |
**Nested Types:**
- `Keys` — Enum with ~100+ setting key names (e.g., `IgnorePowerMode`, `UseUserCodes`, `TDASCalPeriod`, etc.)
- `ISOSupportLevels` — Enum: `ISO_ONLY`, `TRANSITORY`, `NO_ISO`
---
### CustomChannel.cs
#### `CustomChannel`
```csharp
public class CustomChannel : IComparable<CustomChannel>
```
Wrapper for `MMEPossibleChannels` enabling user-defined channels outside ISO13499.
**Constructor:**
```csharp
public CustomChannel(MMEPossibleChannels channel, bool newChannel = true)
```
**Properties:**
- `Channel` (`MMEPossibleChannels`) — The wrapped channel
- `TestObject`, `Position`, `MainLocation`, `FinLoc1`, `FinLoc2`, `FinLoc3`, `PhysicalDimension`, `Direction`, `FilterClass` — ISO reference fields that sync to underlying channel
- `Text1`, `Remarks` — Text fields
**Methods:**
```csharp
public int CompareTo(CustomChannel other) // Compares by Text1
public Dictionary<string, string> GetValues() // Returns all field values as string dictionary
```
#### `CustomChannelList`
```csharp
public class CustomChannelList
```
Thread-safe singleton managing all custom channels.
**Static Property:**
```csharp
public static CustomChannelList List { get; } // Singleton accessor with lazy initialization
```
**Instance Property:**
```csharp
public CustomChannel[] AllChannels { get; } // Returns all channels, populates on first access
```
---
### TestGraph.cs
#### `TestGraph`
```csharp
public class TestGraph
```
Manages test graph configuration including channel selection and thresholds.
**Constructor:**
```csharp
public TestGraph(TestTemplate template)
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `GraphName` | `string` | `""` | Graph name |
| `GraphDescription` | `string` | `""` | Description |
| `UseDomainMin/Max` | `bool` | `false` | Domain axis constraints |
| `DomainMin` | `double` | `double.MinValue` | Minimum domain value |
| `DomainMax` | `double` | `double.MaxValue` | Maximum domain value |
| `UseRangeMin/Max` | `bool` | `false` | Range axis constraints |
| `RangeMin/RangeMax` | `double` | `double.MinValue`/`double.MaxValue` | Range constraints |
| `Thresholds` | `double[]` | empty | Threshold values |
| `Channels` | `TestObjectChannel[]` | — | Channels in graph (auto-removes orphaned) |
| `AvailableChannels` | `TestObjectChannel[]` | — | Channels available to add |
**Methods:**
```csharp
public string GetThresholdsSQL() // Serialize thresholds to SQL format
public void SetThresholdsFromSQL(string) // Deserialize thresholds
public string GetChannelsForSQL() // Serialize channels to SQL format
public void SetChannelsFromSQL(string) // Deserialize channels
```
---
## 3. Invariants
1. **Channel Hierarchy**: `DASChannel``OutputDASChannel``DigitalOutputDASChannel``OutputTOMDigitalChannel` forms a strict inheritance chain.
2. **Bit Flag Enums**: `DigitalOutputMode`, `SquibFireMode`, and `SquibMeasurementType` use bit-shifted values (`1 << n`) intended for bitwise combination.
3. **Singleton Pattern**: `CustomChannelList.List` uses double-checked locking with a private `object MyLock` to ensure thread-safe singleton initialization.
4. **Channel Synchronization**: In `CustomChannel`, setting any location/direction property (e.g., `Position`, `MainLocation`) automatically updates the underlying `MMEPossibleChannels` object via `Channel.Set_*` methods.
5. **Graph Channel Consistency**: `TestGraph.Channels` getter automatically removes channels whose parent `TestTestObject` is no longer in `_groups` or `_addedGroups`.
6. **Squib Channel Handling**: Squib channels generate two available channels (Current and Voltage) with distinct graph IDs; Current channels are suffixed with `_CU`.
---
## 4. Dependencies
### This module depends on:
- `System`, `System.Collections.Generic`, `System.Globalization`, `System.Linq`, `System.Text` (standard .NET)
- `SettingsDB` (inferred from `SettingsDB.GetGlobalValue*` calls)
- `ISO13499FileDb.IsoDb` (ISO database operations)
- `MMEPossibleChannels`, `MMETestObjects`, `MMEPositions`, `MMETransducerMainLocation`, `MMEFineLocations1/2/3`, `MMEPhysicalDimensions`, `MMEDirections`, `MMEFilterClasses` (domain entities)
- `DbOperations.MMETables.MMEPossibleChannelsFields` (field enumeration)
- `SensorsCollection.SensorsList` (sensor lookup)
- `Test.Module.Channel.Sensor.BridgeType` (sensor bridge types)
- `TestObjectChannel`, `TestTestObject`, `TestTemplate`, `TestObjectTemplate` (test domain objects)
- `IsoChannelSensorCompatibilityLevels` (enum, source not provided)
### What depends on this module:
- Cannot be determined from source alone; these are entity/utility classes likely consumed by higher-level test management and export modules.
---
## 5. Gotchas
1. **Misleading XML Comments**: `OutputTOMDigitalChannel` has XML comment "Base class for SQUIB channels" which appears incorrect—it inherits from `DigitalOutputDASChannel` and defines digital output modes, not squib functionality. The same comment is correctly applied to `OutputSquibChannel`.
2. **Inconsistent Enum Base Values**:
- `SquibFireMode.NONE = 1 << 0` (value 1)
- `SquibMeasurementType.NONE = 0` (value 0)
- `DigitalOutputMode.NONE = 0` (value 0)
This inconsistency could cause issues when checking for "not set" states.
3. **Commented-Out Interfaces**: `DASChannel` and `Output