Files
DP44/enriched-qwen3-coder-next/DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums.md

188 lines
9.5 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
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-16T04:30:02.337162+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "004a8160296448d2"
---
# Documentation: DatabaseImport Enumerations
## 1. Purpose
This module defines core enumerations used throughout the `DatabaseImport` subsystem to represent configuration states and capabilities related to digital I/O, squib (pyrotechnic initiator) measurement/fire modes, and data export formats. These enums provide strongly-typed, self-documenting representations of hardware and software configuration parameters, enabling consistent interpretation of digital channel behavior, squib operation, and export target formats across the codebase.
## 2. Public Interface
### `DigitalInputModes`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalInputs.cs`
*Attributes:* `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`
*Purpose:* Represents supported input modes for digital channels.
| 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 |
> **Note:** Values are powers of two, enabling bitwise combination.
---
### `DigitalOutputModes`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalOutputs.cs`
*Attributes:* `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`
*Purpose:* Represents supported output modes for digital channels.
| Member | Value | Description |
|--------|-------|-------------|
| `NONE` | `0` | Digital channel mode not set |
| `FVLH` | `1 << 0` (1) | 5V, low-to-high transition |
| `FVHL` | `1 << 1` (2) | 5V, high-to-low transition |
| `CCNO` | `1 << 2` (4) | Contact closure normally open |
| `CCNC` | `1 << 3` (8) | Contact closure normally closed |
> **Note:** Values are powers of two, enabling bitwise combination.
---
### `SupportedExportFormatBitFlags`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/SupportedExportFormatBitFlags.cs`
*Attributes:* `[Flags]`
*Purpose:* Represents supported export file formats as bit flags.
| Member | Value | Description |
|--------|-------|-------------|
| `none` | `0x0` | No format selected |
| `csvunfiltered` | `0x1` | Unfiltered CSV export |
| `diademadc` | `0x2` | DIAdem ADC format |
| `isounfiltered` | `0x4` | ISO unfiltered export |
| `somatunfiltered` | `0x8` | Somat unfiltered export |
| `tdmsadc` | `0x10` | TDMS ADC format |
| `toyotaunfiltered` | `0x20` | Toyota unfiltered export |
| `tsvunfiltered` | `0x40` | TSV unfiltered export |
| `csvfiltered` | `0x80` | Filtered CSV export |
| `isofiltered` | `0x200` | ISO filtered export |
| `somatfiltered` | `0x400` | Somat filtered export |
| `tdasadc` | `0x800` | TDAS ADC format |
| `toyotafiltered` | `0x1000` | Toyota filtered export |
| `tsvfiltered` | `0x2000` | TSV filtered export |
| `rdfadc` | `0x4000` | RDF ADC format |
| `ChryslerDDAS` | `0x8000` | Chrysler DDAS format |
| `HDFUnfiltered` | `0x10000` | HDF unfiltered export |
| `HDFFiltered` | `0x20000` | HDF filtered export |
| `HDFMV` | `0x40000` | HDF MV format |
| `HDFADC` | `0x80000` | HDF ADC format |
| `xlsxfiltered` | `0x100000` | Excel (XLSX) filtered export |
| `xlsxunfiltered` | `0x200000` | Excel (XLSX) unfiltered export |
> **Note:** One format (`diademfiltered = 0x100`) is commented out and currently unused.
---
### `SquibMeasurementType`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Squibs.cs`
*Attributes:* `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`
*Purpose:* Specifies what squib-related signals are recorded during measurement.
| Member | Value | Description |
|--------|-------|-------------|
| `NONE` | `0` | Measurement mode not set |
| `CURRENT` | `1 << 0` (1) | Squib current recorded |
| `INIT_SIGNAL` | `1 << 1` (2) | Squib initiation indicator recorded |
| `VOLTAGE` | `1 << 2` (4) | Squib voltage recorded |
> **Note:** Values are powers of two, enabling bitwise combination.
---
### `SquibFireMode`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Squibs.cs`
*Attributes:* `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`
*Purpose:* Specifies the discharge method used to fire the squib.
| Member | Value | Description |
|--------|-------|-------------|
| `NONE` | `1 << 0` (1) | Fire mode not set |
| `CAP` | `1 << 1` (2) | Capacitor discharge |
| `CONSTANT` | `1 << 2` (4) | Constant current discharge |
| `AC` | `1 << 3` (8) | AC discharge |
> **Note:** `NONE` is *not* zero-valued (value = 1), unlike typical patterns. This may be intentional to distinguish "unset" from "disabled".
---
### `ExcitationVoltageOptions`
*Defined in:* `DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/ExcitationVoltageOptions.cs`
*Purpose:* Defines available excitation voltage levels for sensors, with associated metadata.
#### Nested Type: `ExcitationVoltageOption`
*Attributes:* `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` (inferred from usage of `EnumDescriptionTypeConverter` elsewhere)
| Member | Value | Description | Voltage Magnitude |
|--------|-------|-------------|-------------------|
| `Undefined` | `1` | Undefined excitation voltage | `0.0` V |
| `Volt2` | `2` | 2.0 V | `2.0` V |
| `Volt2_5` | `4` | 2.5 V | `2.5` V |
| `Volt3` | `8` | 3.0 V | `3.0` V |
| `Volt5` | `16` | 5.0 V | `5.0` V |
| `Volt10` | `32` | 10.0 V | `10.0` V |
| `Volt1` | `64` | 1.0 V | `1.0` V |
#### Nested Type: `VoltageMagnitudeAttribute`
*Purpose:* Custom attribute to associate a numeric voltage magnitude with enum members.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Value` | `public double Value { get; }` | Returns the voltage magnitude (in volts) associated with the enum field. |
| `VoltageMagnitudeAttribute(double value)` | `public VoltageMagnitudeAttribute(double value)` | Constructor. Stores the voltage magnitude. |
> **Note:** `VoltageMagnitudeAttribute` is defined *inside* `ExcitationVoltageOptions` class.
---
## 3. Invariants
- **Bitwise Independence:** All enums except `SquibFireMode.NONE` and `ExcitationVoltageOption` use powers of two, enabling safe bitwise OR/AND operations for flag combinations.
- **`DigitalInputModes` vs `DigitalOutputModes`:** Both share `CCNO` and `CCNC` names but have different underlying values (e.g., `CCNO` = 8 in inputs, 4 in outputs). They are *not* interchangeable.
- **`SquibFireMode.NONE` ≠ 0:** Unlike `SquibMeasurementType.NONE`, `SquibFireMode.NONE` has value `1` (not `0`). This is likely intentional to distinguish "unset" from a valid fire mode.
- **`VoltageMagnitudeAttribute.Value` is non-null:** Every `ExcitationVoltageOption` field decorated with `[VoltageMagnitude(...)]` has a corresponding `double` value.
- **No overlapping values within an enum:** Each enum member has a unique underlying integer value (no duplicates within the same enum).
---
## 4. Dependencies
### This module depends on:
- `System.ComponentModel` (for `[Description]` and `TypeConverter` infrastructure)
- `System` (for `[Flags]`, `[AttributeUsage]`, `Attribute`, `double`)
### This module is depended upon by:
- Other modules in `DatabaseImport` (inferred from namespace usage)
- Likely used by:
- Configuration parsers (e.g., reading from database or XML)
- Export pipeline (to select output format via `SupportedExportFormatBitFlags`)
- Hardware abstraction layer (to configure digital channels via `DigitalInputModes`/`DigitalOutputModes`)
- Squib control logic (via `SquibMeasurementType`/`SquibFireMode`)
- Sensor configuration (via `ExcitationVoltageOptions`)
> **Note:** `EnumDescriptionTypeConverter` is referenced but not defined in the provided files. Its implementation must exist elsewhere in the codebase.
---
## 5. Gotchas
- **`SquibFireMode.NONE` is non-zero (`1`)**: This breaks the common convention where "none" or "unset" is `0`. Code checking for unset mode must compare explicitly to `SquibFireMode.NONE`, not `0`.
- **`DigitalInputModes` and `DigitalOutputModes` share names but not values**: `CCNO` and `CCNC` have different bit positions in each enum. Do not assume equivalence or reuse across input/output contexts.
- **`diademfiltered` is commented out**: The value `0x100` is reserved but unused. Do not assume it is supported or safe to use.
- **`ExcitationVoltageOption` values are powers of two, but not sequential**: Values are `1, 2, 4, 8, 16, 32, 64` — not contiguous. Avoid arithmetic assumptions (e.g., `Volt10` is not `Volt5 + 5`).
- **`VoltageMagnitudeAttribute` is nested**: Its fully qualified name is `ExcitationVoltageOptions.VoltageMagnitudeAttribute`. Reflection or attribute lookup must account for nesting.
- **No validation on enum combinations**: The enums support bitwise combination, but no runtime checks ensure logically invalid combinations (e.g., `TLH | THL` for a single digital input).
- **Missing `diademfiltered` may cause confusion**: If legacy code references `0x100`, it may be unclear whether it was intended for `diademfiltered` or another format.
None identified beyond those above.