Files
2026-04-17 14:55:32 -04:00

9.5 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/AbstractOLEDbWrapper.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TemplateZone.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TestObjectChannel.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/CalculatedValueClass.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/HardwareChannel.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TemplateRegion.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/LevelTriggerChannel.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/MMEFigures.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TestSetting.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TestEngineerDetails.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/TestObjectMetaData.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/IsoCode.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/ISO/CustomerDetails.cs
2026-04-17T15:45:10.285441+00:00 zai-org/GLM-5-FP8 1 82e99bbb3ec2255d

Documentation: DatabaseExport (Version 57 - ISO Module)

1. Purpose

This module provides a data access and entity modeling layer for a crash test data acquisition system, specifically handling "Version 57" database schemas. It contains classes responsible for mapping database rows (System.Data.DataRow) to C# objects representing test configurations, hardware channels, templates, and metadata. The module supports exporting and managing ISO-compliant data structures, including test objects, calculated channels, and trigger configurations.

2. Public Interface

AbstractOLEDbWrapper

Abstract class providing static helper methods for safe database value retrieval.

  • public static long GetLong(IDataReader reader, string field): Returns long.MinValue if the database field is DBNull, otherwise converts the value to Int64.
  • public static DateTime GetDate(IDataReader reader, string field): Returns DateTime.MinValue if the database field is DBNull, otherwise casts the value to DateTime.

TemplateZone

Represents a zone within a test template.

  • public TemplateZone(string template, string name, string picture, string description): Constructor initializing properties directly.
  • public TemplateZone(System.Data.DataRow dr): Constructor populating fields from a database row. Sets ZoneName to "Default zone" if null. Automatically loads TemplateRegions via TemplateRegion.GetAllRegions.
  • public TemplateRegion[] TemplateRegions { get; set; }: Array of regions belonging to this zone.

TemplateRegion

Represents a specific region within a TemplateZone, including coordinate data.

  • public TemplateRegion(DataRow dr): Constructor mapping database columns (e.g., UpperLeftX, RegionName) to properties.
  • internal static TemplateRegion[] GetAllRegions(string templateName, string zoneName): Queries the database (tblTemplateRegions) to retrieve all regions for a specific template and zone. Silently catches exceptions and returns an empty array on failure.

TestObjectChannel

Represents a specific data channel on a test object. Inherits from TestObjectTemplateChannel (not shown) and implements IComparable<TestObjectChannel>.

  • public enum SquibChannelTypes: Defines channel types (None, Voltage, Current).
  • public string GetGraphID(): Returns the channel ID, appending "_CU" if SquibChannelType is Current.
  • public string GetId(): Returns a formatted ID string (SerialNumber_MMEChannelType_Id).
  • public string GetID(): Functionally identical to GetId() but uses string.Format instead of interpolation.
  • public int CompareTo(TestObjectChannel right): Compares by DisplayOrder, then Name, then TestObject.SerialNumberOrOriginalSerialNumber.
  • public string HardwareId { set; }: Setter parses the input string expecting an underscore-delimited format (3 tokens) and reconstructs the value based on specific token logic involving ChannelSeparator.

CalculatedValueClass

Defines a calculated channel derived from other input channels.

  • public enum Operations: Defines calculation types (SUM, AVERAGE, IRTRACC3D, etc.).
  • public CalculatedValueClass(System.Data.DataRow dr): Constructor mapping database fields to properties using DbOperations.CalculatedChannels.Fields enum.
  • public byte[] InputChannelIdsBlob { get; set; }: Serializes/deserializes the InputChannelIds list to/from a UTF-8 encoded string separated by the system's list separator.

ISOHardwareChannel

Represents a physical hardware channel configuration.

  • public ISOHardwareChannel(DataRow dr, Hardware hardware): Constructor mapping DbOperations.DAS.DASChannelFields to properties. Throws NotSupportedException for unknown fields.
  • public static int PhysicalCompare(ISOHardwareChannel left, ISOHardwareChannel right): Compares two channels by ChannelIdx.

LevelTriggerChannel

Stores trigger configuration based on signal levels.

  • public LevelTriggerChannel(System.Data.DataRow dr): Constructor mapping DbOperations.LevelTriggers.Fields to properties.
  • Properties include thresholds: GreaterThanThresholdEU, LessThanThresholdEU, InsideUpperLevelEU, etc.

MMEFigures

Represents figure metadata, inheriting from AbstractOLEDbWrapper.

  • public static MMEFigures[] GetFigures(): Static factory method querying the MMEFIGURES table via DbOperations.GetISOCommand(). Returns an array of populated MMEFigures objects.

TestSetting & TestSettingDictionary

Classes for managing key-value test settings with serialization support.

  • public string TestSetting.ToSerializeString(): Serializes the setting to "Key=Value" format, escaping internal equals signs with "_x_".
  • public static bool TestSetting.TryParse(string s, out TestSetting ts): Parses a serialized string back into a TestSetting object.
  • public void TestSettingDictionary.LoadSettings(string s): Parses a serialized string (separated by system list separator) and populates the dictionary.
  • public string TestSettingDictionary.ToSerializeString(): Serializes all settings in the dictionary.

TestEngineerDetails & CustomerDetails

Serializable classes holding contact details.

  • public Dictionary<string, string> GetValues(): Returns a dictionary of all fields and their values (used for serialization/database storage).
  • public static TestEngineerDetails[] GetAllTestEngineerDetails(): Fetches all records from tblTestEngineerDetails.
  • public static CustomerDetails[] GetAllCustomerDetails(): Fetches all records from tblCustomerDetails.

TestObjectMetaData & TestSetupMetaData

Manage metadata properties using a dictionary backing field.

  • public void SetProperty(MetaData meta): Adds or updates a metadata property.
  • public MetaData[] Properties { get; }: Returns all metadata properties as an array.

IsoCode

Handles the construction and parsing of a 16-character ISO code string.

  • public IsoCode(string isoCode): Constructor. Pads or truncates input to exactly 16 characters.
  • public string StringRepresentation { get; set; }: Gets or sets the 16-char code.
  • public static string GetString(...): Overloaded static methods to construct an ISO code from various components (MMEPossibleChannels, MMETestObjects, etc.).

3. Invariants

  1. IsoCode Length: An IsoCode string representation is always exactly 16 characters. Inputs are padded with '?' or truncated to enforce this.
  2. ChannelIDX Default: The default value for TestObjectChannel._channelIDX is CHANNEL_IDX_UNKNOWN (-1).
  3. DBNull Handling: Database readers/constructors in this module consistently convert DBNull.Value to specific default values (e.g., long.MinValue, DateTime.MinValue, "NOVALUE", or "Default zone") rather than throwing exceptions or leaving values null.
  4. Comparison Logic: TestObjectChannel.CompareTo guarantees a stable sort order based on DisplayOrder -> Name -> SerialNumber.
  5. HardwareId Parsing: The TestObjectChannel.HardwareId setter expects an underscore-delimited string with exactly 3 tokens to perform its parsing logic; otherwise, it passes the value through (or null) to SetProperty.

4. Dependencies

Internal Dependencies (Inferred from source):

  • DbOperations: Used extensively for database connections, commands, and parameter creation (GetCommand, GetISOCommand, CreateParam, Connection.QueryDataSet).
  • DatabaseExport.ISO.TestObject: Referenced in TestObjectChannel.
  • DatabaseExport.ISO.TestObjectTemplateChannel: Base class for TestObjectChannel.
  • DatabaseExport.Hardware: Referenced in ISOHardwareChannel.
  • MMEPossibleChannels, MMETestObjects, MMEPositions, MMEFilterClasses: Referenced in IsoCode.GetString static methods.

External Dependencies:

  • System.Data / System.Data.OleDb: Used for database interaction.
  • System.Drawing: Used in TemplateRegion for Point objects.
  • System.Globalization: Used for culture-invariant string parsing/serialization.

5. Gotchas

  1. Bug in MMEFigures.GetFigures: In the GetFigures() method, when reading the LAST_CHANGE column, the code incorrectly assigns the value to the datRevision variable instead of lastChange. This means Last_Change in the resulting object will likely be DateTime.MinValue, and DatRevision may contain the