Files

177 lines
12 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Enums/Hardware/HardwareListTags.cs
- Common/DTS.Common/Enums/Hardware/SLICETCConfigurations.cs
- Common/DTS.Common/Enums/Hardware/SLICEConfigurations.cs
- Common/DTS.Common/Enums/Hardware/HardwareTypes.cs
generated_at: "2026-04-16T03:20:45.506468+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e0d93bab8eaafa95"
---
# Hardware Enums and Constants Documentation
## 1. Purpose
This module defines core enumerations and static utility methods for representing and reasoning about hardware devices in the DTS system. It establishes canonical types for hardware devices (`HardwareTypes`), their configurations (`SLICETCConfigurations`, `SLICEPROSIMConfigurations`), and metadata tags (`HardwareListTags`). The `HardwareConstants` class centralizes hardware-specific business logic—including recording mode support, streaming/clock sync profile validation, embedded sensor detection, and device-specific constants—enabling consistent behavior across the application layer. This module serves as a foundational abstraction layer between low-level hardware protocol details and higher-level UI and control logic.
## 2. Public Interface
### Enumerations
#### `HardwareListTags`
- **Purpose**: Defines metadata field names used to tag hardware inventory or display lists.
- **Values**:
- `Included`, `SerialNumber`, `HardwareType`, `ChannelCount`, `Firmware`, `MaxSampleRate`, `TestSampleRate`, `DSPStreamingFilter`, `CalDate`, `CalDueDate`, `IPAddress`, `FirstUseDate`
#### `SLICETCConfigurations`
- **Purpose**: Represents hardware configuration variants for SLICETC devices (e.g., channel count).
- **Values**:
- `TWENTYFOUR` → Description: `"SLICETC_CONFIGURATION_24"`
- `SIXTEEN` → Description: `"SLICETC_CONFIGURATION_16"`
- `EIGHT` → Description: `"SLICETC_CONFIGURATION_8"`
- **Note**: Uses `EnumDescriptionTypeConverter` for UI binding.
#### `SLICEPROSIMConfigurations`
- **Purpose**: Represents hardware configuration variants for SLICEPRO SIM devices.
- **Values**:
- `MEGA` → Description: `"SLICE_CONFIGURATION_MEGA"`
- `EIGHT_HUNDRED` → Description: `"SLICE_CONFIGURATION_800K"`
- `SEVEN_HUNDRED` → Description: `"SLICE_CONFIGURATION_700K"`
- `SIX_HUNDRED` → Description: `"SLICE_CONFIGURATION_600K"`
- **Note**: Uses `EnumDescriptionTypeConverter`.
#### `HardwareTypes`
- **Purpose**: Enumerates all supported hardware device types in the system.
- **Values**: Includes base models (e.g., `SLICE_Base`, `SLICE2_Base`), variants (e.g., `SLICE_IEPE`, `SLICE2_Bridge_Hi`), embedded modules (`EMB_*`), racks (`TDAS_Pro_Rack`, `TDAS_LabRack`), and newer platforms (`TSR_AIR`, `DKR`, `DIR`, `SLICE6_AIR_TC`, `SLICE_PRO_CAN_FD`).
- **Special Values**:
- `UNDEFINED = 38` → Description: `"HardwareType_EMPTY"`
- **Note**: Uses `EnumDescriptionTypeConverter`.
#### `SLICEBridgeTypes`
- **Purpose**: Defines channel types supported by SLICE bridge modules.
- **Values**:
- `Bridge`, `IEPE`, `ARS`, `ACC`, `RTC`, `UART`, `StreamOut`, `Thermocoupler`, `CAN`
- **Note**: Uses `EnumDescriptionTypeConverter`.
#### `RackSizes`
- **Purpose**: Represents rack form factor sizes.
- **Values**:
- `FOUR` → Description: `"RACK_SIZE_4M"`
- `EIGHT` → Description: `"RACK_SIZE_8M"`
- **Note**: Uses `EnumDescriptionTypeConverter`.
### Static Methods in `HardwareConstants`
#### `IsTSRAIRSerialNumber(string serialNumber)`
- **Signature**: `public static bool IsTSRAIRSerialNumber(string serialNumber)`
- **Behavior**: Returns `true` if `serialNumber` is non-null/empty and starts with `"TA"`.
#### `GetBrushForVoltageStatus(VoltageStatusColor status)`
- **Signature**: `public static SolidColorBrush GetBrushForVoltageStatus(DFConstantsAndEnums.VoltageStatusColor status)`
- **Behavior**: Maps voltage status color to a WPF `SolidColorBrush` from `BrushesAndColors`.
#### `SupportsTriggerInversion(HardwareTypes type, int protocolVersion)`
- **Signature**: `public static bool SupportsTriggerInversion(HardwareTypes type, int protocolVersion)`
- **Behavior**: Returns `true` for SLICE1, SLICE1.5, SLICE2 base/variant types (explicit list in source). Protocol version is unused in current implementation.
#### `SupportsStartInversion(HardwareTypes type, int protocolVersion)`
- **Signature**: `public static bool SupportsStartInversion(HardwareTypes type, int protocolVersion)`
- **Behavior**: Same as `SupportsTriggerInversion`, but also includes `SLICE6_AIR`.
#### `IsEthernetRecorder(HardwareTypes type)`
- **Signature**: `public static bool IsEthernetRecorder(HardwareTypes type)`
- **Behavior**: Returns `true` only for `HardwareTypes.S6A_EthernetRecorder`.
#### `HasEmbeddedSensors(HardwareTypes hardware)`
- **Signature**: `public static bool HasEmbeddedSensors(HardwareTypes hardware)`
- **Behavior**: Returns `true` for embedded sensor modules (`EMB_*`), `TSR_AIR`, `TSR_AIR_RevB`, `DKR`, `DIR`, `SLICE6_AIR_TC`.
#### `HasEmbeddedChannelType(HardwareTypes hardware, string channelType)`
- **Signature**: `public static bool HasEmbeddedChannelType(HardwareTypes hardware, string channelType)`
- **Behavior**: Returns `true`/`false` based on hardware type and `channelType` string (e.g., `"LOWG"`, `"HIGHG"`, `"MIC"`, etc.). Key rules:
- `TSR_AIR`/`TSR_AIR_RevB`: All embedded channel types supported.
- `DIR`: Supports `"HIGHG"`; others return `false`.
- `"MIC"`: Supported unless hardware is `DKR`.
- `"ARS"`: Always `false`.
- `"RTC..."`: Always `false`.
#### `IsRecordingModeSupported(...)`
- **Signature**: `public static bool IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
- **Behavior**: Delegates to per-hardware-type logic (e.g., `SLICE6AIR.IsRecordingModeSupported_S6AIR(...)`, `TSRAIR.IsRecordingModeSupported(...)`, `SLICE6AIRTC.IsRecordingModeSupported(...)`) or falls back to defaults:
- Non-TSRAIR devices: `CircularBuffer`, `Recorder`, and UART variants supported.
- `SLICE6DB*`, `SLICE6DB3`: `RAMActive` supported.
- `DIM`, `G5INDUMMY`, `G5VDS`, `Ribeye`, `SIM`, `TOM`, `TDAS_*`: Only `Recorder`, `CircularBuffer` supported (others return `false`).
- `SLICE_PRO_CAN_FD`: Only circular buffer modes supported.
#### `MaxSampleRateForRecordingMode(...)`
- **Signature**: `public static double MaxSampleRateForRecordingMode(IDASHardware h, RecordingModes mode, int protocolVersion = 1, uint baudRate = 0)`
- **Behavior**:
- For `SLICE6_AIR`: Delegates to `SLICE6AIR.MaxSampleRateHzForRecordingMode(...)`.
- For `S6A_EthernetRecorder`: Returns `SLICE6AIR.MaxSampleRateHz_OBRDDR`.
- Otherwise: Calls `h.GetMaxSampleRateDouble()`.
#### `IsStreamingProfileSupported(...)`
- **Signature**: `public static bool IsStreamingProfileSupported(UDPStreamProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
- **Behavior**: Delegates to per-hardware-type logic (`SLICE6`, `SLICE6AIR`, `SLICE6AIRBR`, `TSRAIR`, `SLICE6AIRTC`). All others return `false`.
#### `IsClockSyncProfileSupported(...)`
- **Signature**: `public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly, bool master)`
- **Behavior**: Delegates to per-hardware-type logic (`SLICE6`, `SLICE6AIR`, `SLICE6AIRTC`, `SLICE6AIRBR`, `SLICE6DB`, `TSRAIR`). All others return `false`. `TSRAIR` uses `master` parameter.
### Constants in `HardwareConstants`
| Constant | Value | Description |
|---------|-------|-------------|
| `TSRAIR_MAXSLICENABLE_VERSION` | `28` | Firmware version threshold for TSRAIR max-slice-enable feature |
| `TSRAIR_MAX_MODULES` | `6` | Max modules per TSRAIR (excludes SW-only UART/Streaming modules) |
| `TSR_AIR_PREPEND` | `"TA"` | Serial number prefix for TSRAIR devices |
| `INVALID_IDASCOMMUNICATION_RECORD_ID` | `-1` | Sentinel for invalid record IDs |
| `AllowSoftDisconnects` | `false` (default) | Global toggle for soft disconnects (must be set by app) |
| `DEFAULTMEMORYSIZE_PRO` | `16000000` | Default memory size for PRO-class devices |
| `DEFAULTMEMORYSIZE_DIM` | `2000000` | Default memory size for DIM |
| `DEFAULTMEMORYSIZE_TOM` | `2000000` | Default memory size for TOM |
## 3. Invariants
- **HardwareType Uniqueness**: Each `HardwareTypes` enum value has a unique underlying integer (060), with no duplicates.
- **TSRAIR Serial Number Format**: Valid TSRAIR serial numbers *must* start with `"TA"` (enforced by `IsTSRAIRSerialNumber`).
- **Embedded Sensor Consistency**: `HasEmbeddedSensors` and `HasEmbeddedChannelType` must be consistent: if `HasEmbeddedSensors(h)` is `true`, then `HasEmbeddedChannelType(h, "LOWG")` or similar must be `true` for at least one channel type.
- **Recording Mode Support**: `IsRecordingModeSupported` must return `true` for at least `Recorder` and `CircularBuffer` for all non-TSRAIR/non-DIM/TOM/G5/ribeye devices.
- **UART Recording Dependency**: `MaxSampleRateForRecordingMode` uses `baudRate` only for `SLICE6_AIR`; other devices ignore it.
- **Protocol Version Handling**: Protocol version is passed to many methods but not always used (e.g., `SupportsTriggerInversion`, `SupportsStartInversion` ignore it). Behavior may be incomplete.
## 4. Dependencies
### Internal Dependencies
- **`DTS.Common.Converters.EnumDescriptionTypeConverter`**: Used for UI binding of enum descriptions.
- **`DTS.Common.Constant.DASSpecific`**: Referenced for `DFConstantsAndEnums` (e.g., serial append constants like `"LOWG_SERIAL_APPEND"`).
- **`System.ComponentModel`**: Required for `[Description]` attributes.
- **`System.Windows.Media`**: Required for `SolidColorBrush` in `GetBrushForVoltageStatus`.
- **`DTS.Common.Interface.DataRecorders`**: Required for `IDASHardware` interface used in `MaxSampleRateForRecordingMode`.
- **`RecordingModes` and `RecordingModeExtensions`**: Used in `IsRecordingModeSupported`.
- **`UDPStreamProfile`, `ClockSyncProfile`**: Used in streaming/clock sync support checks.
### External Dependencies
- **WPF Framework**: For `SolidColorBrush` and `BrushesAndColors`.
- **`DFConstantsAndEnums`**: Defines channel type suffixes and `VoltageStatusColor`.
### Inferred Consumers
- UI layers (binding to `HardwareTypes`, `HardwareListTags`)
- Device discovery/validation logic (e.g., `IsTSRAIRSerialNumber`)
- Configuration UIs (e.g., `SLICETCConfigurations`, `SLICEPROSIMConfigurations`)
- Recording mode selection logic (via `IsRecordingModeSupported`)
- Streaming/clock sync configuration UIs
## 5. Gotchas
- **Protocol Version Ignored in Trigger/Start Inversion**: Methods `SupportsTriggerInversion` and `SupportsStartInversion` accept `protocolVersion` but do not use it. Support is based solely on hardware type, which may be outdated.
- **UART Streaming Excluded from Module Count**: `TSRAIR_MAX_MODULES = 6` explicitly excludes UART/Streaming modules (SW-only concepts), but this may be non-intuitive.
- **`S6A_EthernetRecorder` Reuses `SLICE6AIR` Logic**: The comment notes this is a workaround to avoid duplication, but may obscure differences in behavior.
- **`SLICE6_AIR_TC` Delegation Ambiguity**: `IsRecordingModeSupported` and `IsStreamingProfileSupported` delegate to `SLICE6AIRTC`, but no source for that class is provided—behavior is inferred.
- **Hardcoded Serial Number Prefix**: `TSR_AIR_PREPEND = "TA"` is hardcoded; no fallback or configuration.
- **`UNDEFINED` Value**: `UNDEFINED = 38` is marked with `"HardwareType_EMPTY"` description, but no usage context is provided.
- **`AllowSoftDisconnects` Global State**: A mutable static property—dangerous for multi-tenant or concurrent use unless externally synchronized.
- **Missing Hardware Types**: Commented-out values (`G5IPORT=22`, `SLICE6DB_AIR = 35`) suggest historical or future hardware not yet fully integrated.
- **`HasEmbeddedChannelType` Logic Complexity**: The method uses string-based channel types (e.g., `"LOWG_SERIAL_APPEND"`) instead of enums, increasing risk of typos and inconsistency.