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,127 @@
---
source_files:
- Common/DTS.Common/Interface/Sensors/AnalogDiagnostics/IDiagnosticRun.cs
- Common/DTS.Common/Interface/Sensors/AnalogDiagnostics/IDiagnosticEntry.cs
generated_at: "2026-04-16T03:05:03.996620+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "21f713440e29c323"
---
# AnalogDiagnostics
## Documentation: Analog Diagnostics Data Models
---
### 1. Purpose
This module defines core data contract interfaces (`IDiagnosticRun` and `IDiagnosticEntry`) used to represent structured diagnostic test results for analog sensors in the DTS (Data Acquisition and Test System) platform. It serves as a standardized abstraction layer for persisting, querying, and exchanging diagnostic metadata—including run context (e.g., user, test name, pre/post-test flag) and per-sensor metrics (e.g., excitation, offset, noise, shunt)—alongside associated calibration and hardware identification. These interfaces decouple domain logic from storage or transport mechanisms, enabling consistent handling of diagnostic data across acquisition, reporting, and analysis components.
---
### 2. Public Interface
#### `IDiagnosticRun`
Represents a single diagnostic test run session.
- **`long? Id { get; set; }`**
Optional unique identifier for the diagnostic run.
- **`string DataPROUser { get; set; }`**
User identifier (e.g., login name) who initiated or performed the diagnostic run.
- **`int? TestId { get; set; }`**
Optional numeric identifier for the test configuration used in this run.
- **`string TestName { get; set; }`**
Human-readable name of the test configuration (e.g., `"Full Calibration"`).
- **`bool PreTest { get; set; }`**
Indicates whether this run occurred *before* (`true`) or *after* (`false`) a primary calibration or procedure.
#### `IDiagnosticEntry`
Represents a single sensors diagnostic measurement within a diagnostic run.
- **`long? Id { get; set; }`**
Optional unique identifier for this entry.
- **`long DiagnosticRunId { get; set; }`**
Required foreign key linking this entry to its parent `IDiagnosticRun`.
- **`double? Excitation { get; set; }`**
Measured excitation voltage (in volts) applied to the sensor.
- **`DiagnosticStatus ExcitationStatus { get; set; }`**
Pass/fail/untested status of the excitation measurement.
- **`double? Offset { get; set; }`**
Measured zero-point offset (in volts or counts, depending on sensor type).
- **`DiagnosticStatus OffsetStatus { get; set; }`**
Pass/fail/untested status of the offset measurement.
- **`double? ActualRange { get; set; }`**
Measured full-scale range (e.g., span in volts or counts).
- **`DiagnosticStatus ActualRangeStatus { get; set; }`**
Pass/fail/untested status of the range measurement.
- **`double? Noise { get; set; }`**
Measured noise level (e.g., RMS noise in microvolts).
- **`DiagnosticStatus NoiseStatus { get; set; }`**
Pass/fail/untested status of the noise measurement.
- **`double? Shunt { get; set; }`**
Measured shunt calibration response (e.g., in microvolts per ohm).
- **`DiagnosticStatus ShuntStatus { get; set; }`**
Pass/fail/untested status of the shunt measurement.
- **`int? SensorId { get; set; }`**
Optional internal numeric ID of the sensor.
- **`string SensorSerialNumber { get; set; }`**
Serial number of the sensor (e.g., `"SN123456"`).
- **`int? DASId { get; set; }`**
Optional internal ID of the Data Acquisition System (DAS) used.
- **`string DASSerialNumber { get; set; }`**
Serial number of the DAS.
- **`int DASChannelIdx { get; set; }`**
Required zero-based channel index on the DAS where the sensor was connected.
- **`string UserCode { get; set; }`**
User-defined identifier for the sensor (e.g., `"SENSOR_A"`).
- **`string UserChannelName { get; set; }`**
User-assigned name for the channel (e.g., `"Load Cell 1"`).
- **`string IsoCode { get; set; }`**
Isolated system code (e.g., subsystem or test fixture identifier).
- **`string IsoChannelName { get; set; }`**
Name of the channel within the isolated system.
- **`double ScaleFactor { get; set; }`**
Required scaling factor applied to raw sensor readings (e.g., to convert to engineering units).
- **`int CalibrationRecordId { get; set; }`**
Required ID referencing the calibration record used for this entry.
- **`string CalibrationRecordXML { get; set; }`**
Required XML string containing full calibration parameters (e.g., coefficients, limits).
- **`DateTime Timestamp { get; set; }`**
Required timestamp of when the diagnostic measurement was recorded.
#### `DiagnosticStatus`
Enumerated status values for diagnostic metrics.
- **`Untested = 0`**
Measurement not performed (e.g., skipped or not applicable).
- **`Passed = 1`**
Measurement within acceptable limits.
- **`Failed = 2`**
Measurement outside acceptable limits.
---
### 3. Invariants
- **`DiagnosticRunId`** in `IDiagnosticEntry` is non-nullable (`long`) and must reference a valid `IDiagnosticRun.Id` (though enforcement is not specified in the interface).
- **`DASChannelIdx`** in `IDiagnosticEntry` is non-nullable (`int`) and expected to be ≥ 0.
- **`ScaleFactor`**, **`CalibrationRecordId`**, **`CalibrationRecordXML`**, and **`Timestamp`** in `IDiagnosticEntry` are non-nullable and must be provided.
- **`DiagnosticStatus`** values are mutually exclusive per metric: only one of `Untested`, `Passed`, or `Failed` may apply per diagnostic parameter.
- **`PreTest`** in `IDiagnosticRun` is a boolean flag with no default; implementations must explicitly set `true` or `false`.
---
### 4. Dependencies
- **Dependencies *of* this module**:
- `System` (used for `DateTime` in `IDiagnosticEntry`).
- **Dependencies *on* this module**:
- Any component handling diagnostic data persistence (e.g., database mappers, API controllers) or analysis (e.g., reporting tools) will depend on these interfaces.
- Likely consumed by concrete implementations in data access layers (e.g., Entity Framework entities) or serialization layers (e.g., JSON/XML converters).
- *Not* referenced in the provided source, but inferred from naming conventions: `DTS.Common.Interface.Sensors` namespace suggests integration with broader sensor management modules.
---
### 5. Gotchas
- **`Id` properties are nullable (`long?`)** in both interfaces. This implies entries may be transient (unsaved) or use optimistic concurrency patterns, but consumers must handle `null` cases to avoid runtime errors.
- **`CalibrationRecordXML` is a raw XML string**, not parsed or validated by the interface. Consumers must ensure XML integrity and schema compliance.
- **`DASChannelIdx` is zero-based**, consistent with typical array indexing, but may conflict with hardware documentation using 1-based channel numbering.
- **No validation rules are enforced by the interface itself** (e.g., range checks on `Excitation`, `Offset`, or `Noise`). Validation must be implemented externally.
- **`IsoCode` and `IsoChannelName`** appear to represent logical grouping (e.g., test fixture), but their semantics are not documented—consumers should verify usage context.
- **No versioning or evolution strategy is defined** for `CalibrationRecordXML`; changes to calibration schema may break deserialization.
- **None identified from source alone.**

View File

@@ -0,0 +1,114 @@
---
source_files:
- Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ISensorSettingsView.cs
- Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ISensorSettingsViewModel.cs
- Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ICalibrationPolicy.cs
generated_at: "2026-04-16T03:05:05.346141+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c6c47e92bf4e7ff2"
---
# SensorSettingsModule
### **Purpose**
This module defines the interface contracts for the sensor settings configuration UI layer in the DTS system, specifically for managing user-specific and system-wide defaults related to various sensor types (e.g., squib, digital I/O, IEPE, analog), calibration policies, and usage tracking. It serves as the abstraction layer between the UI (via `ISensorSettingsView`) and the underlying logic (via `ISensorSettingsViewModel`), enabling persistence, validation, and restoration of sensor configuration defaults stored in a database. The module does not implement business logic itself but standardizes the contract for components that do.
---
### **Public Interface**
#### **`ISensorSettingsView`**
- **Inherits**: `IBaseView`
- **Description**: A marker interface representing the view component in the MVVM pattern for sensor settings. No additional members beyond inheritance.
#### **`ISensorSettingsViewModel`**
- **Inherits**: `IBaseViewModel`
- **Properties**:
- `string User { get; set; }`
User identifier used when persisting or loading settings from the database.
- `int UserID { get; set; }`
Numeric user ID used when persisting or loading settings from the database.
- `ISensorSettingsView View { get; set; }`
Reference to the associated view instance.
- `ISquibSettingDefaults SquibSettings { get; set; }`
Holds default configuration values for squib sensors.
- `IDigitalOutDefaults DigitalOutSettings { get; set; }`
Holds default configuration values for digital outputs.
- `IDigitalInputDefaults DigitalInputDefaults { get; set; }`
Holds default configuration values for digital inputs.
- `IIEPESensorDefaults IEPESensorDefaults { get; set; }`
Holds default configuration values for IEPE sensors.
- `ICalibrationPolicy SensorCalibrationDefaults { get; set; }`
Holds default calibration policy settings.
- `IAnalogDefaults AnalogDefaults { get; set; }`
Holds default filter and analog configuration settings (commented as “Fb 13120 default filter class setting”).
- **Methods**:
- `void RestoreOriginalSettings()`
Resets all settings to their original (e.g., factory or initial) values.
- `void Unset()`
Uninitializes the display and frees allocated resources.
- `void OnSetActive()`
Initializes or activates the display (e.g., loads current settings into UI).
- `bool ValidateAndSave()`
Validates current settings; returns `true` and saves to DB if valid, otherwise returns `false` without saving.
#### **`ICalibrationPolicy`**
- **Properties**:
- `SensorConstants.SensorCalPolicy SelectedCalPolicy { get; set; }`
Currently selected calibration policy.
- `SensorConstants.SensorCalPolicy[] AvailableSensorCalPolicies { get; }`
Array of supported calibration policies.
- `int WarningPeriod { get; set; }`
Number of days before calibration due date to issue a warning.
- `bool UseSensorFirstUseDate { get; set; }`
If `true`, calibration interval starts from first use; otherwise, from last calibration.
- `bool DontAllowDataCollectionIfOverused { get; set; }`
If `true`, blocks data collection when sensor usage exceeds its maximum allowed uses.
- `int UsageRemainingForWarning { get; set; }`
Threshold of remaining uses below which a warning is displayed.
- `int DefaultMaxUsageAllowed { get; set; }`
Default maximum number of allowed uses per sensor.
- `bool SensorAssemblyEnabled { get; }`
Indicates whether the database supports sensor usage tracking (read-only).
- `bool AllowInspectBeforeUseEnabled { get; }`
Indicates whether the database supports inspect-before-use enforcement (read-only).
- `bool AllowInspectBeforeUse { get; set; }`
Enables/disables inspect-before-use enforcement (commented as “FB43142”).
- **Methods**:
- `void ReadXML(System.Xml.XmlElement root)`
Loads calibration policy settings from an XML element (commented as “FB15758 Import/Export settings”).
- `void WriteXML(ref System.Xml.XmlWriter writer)`
Exports calibration policy settings to XML.
---
### **Invariants**
- `User` and `UserID` must be set before calling `ValidateAndSave()` or `RestoreOriginalSettings()` if persistence is intended, as they are explicitly used for DB operations.
- `View` must be assigned before calling `OnSetActive()` or `Unset()` if the view is involved in initialization or cleanup.
- `ValidateAndSave()` must not persist changes if validation fails — i.e., the methods return value (`bool`) determines whether persistence occurs.
- `SensorAssemblyEnabled` and `AllowInspectBeforeUseEnabled` are read-only and reflect database capabilities — they must not be modified at runtime.
- `AvailableSensorCalPolicies` must be non-null and immutable (no runtime modification expected), as it is exposed only via a getter.
---
### **Dependencies**
- **Internal Dependencies**:
- `DTS.Common.Base`: Provides `IBaseView` and `IBaseViewModel`, indicating this module is part of a larger UI framework.
- `DTS.Common.Enums.Sensors`: Defines `SensorConstants.SensorCalPolicy`, used by `ICalibrationPolicy`.
- **Interface Dependencies** (not defined in provided files, but referenced):
- `ISquibSettingDefaults`, `IDigitalOutDefaults`, `IDigitalInputDefaults`, `IIEPESensorDefaults`, `ICalibrationPolicy`, `IAnalogDefaults` — these interfaces must be defined elsewhere and are assumed to be part of the same module or related sensor modules.
- **External Dependencies**:
- `System.Xml`: Used by `ICalibrationPolicy.ReadXML`/`WriteXML` for import/export functionality.
**Dependents**:
This module is consumed by UI components implementing `ISensorSettingsView` and business logic components implementing `ISensorSettingsViewModel`. Likely used by a settings dialog or configuration panel in the main application.
---
### **Gotchas**
- **Ambiguous “original values”**: `RestoreOriginalSettings()` does not specify whether “original” means factory defaults, last-saved defaults, or initial load values — behavior depends on implementation.
- **Read-only flags for DB capabilities**: `SensorAssemblyEnabled` and `AllowInspectBeforeUseEnabled` are read-only but may be misused if assumed to control behavior directly — they only indicate DB support, not enforcement status.
- **XML import/export is limited to `ICalibrationPolicy`**: Other settings interfaces (`ISquibSettingDefaults`, `IAnalogDefaults`, etc.) are not shown to support XML serialization — only `ICalibrationPolicy` has `ReadXML`/`WriteXML`.
- **No explicit error handling documented**: Methods like `ValidateAndSave()` and `ReadXML` do not specify exception behavior or error reporting mechanisms — callers must infer or rely on external logging.
- **Missing interface definitions**: Core settings interfaces (`ISquibSettingDefaults`, `IAnalogDefaults`, etc.) are referenced but not included in the source — their contracts (and thus full behavior) are unknown from this excerpt.

View File

@@ -0,0 +1,187 @@
---
source_files:
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsListOverdueView.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorTemplatesExportView.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsTemplatesImportView.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorTemplatesViewModel.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsListView.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsListEditGroupView.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IDragAndDropItem.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISquib.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsListEditGroupViewModel.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IStreamInputSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ICanIOSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IUartIOSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IDigitalInputSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IDigitalOutputSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/ISensorsListViewModel.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IStreamOutputSetting.cs
- Common/DTS.Common/Interface/Sensors/SensorsList/IAnalogSensor.cs
generated_at: "2026-04-16T03:05:40.295550+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b898717ea86f9f52"
---
# SensorsList Module Documentation
## 1. Purpose
This module defines the core interfaces for the *Sensors List* UI layer in the DTS system, providing a standardized contract between views and view models for managing and displaying various types of sensor and I/O configuration data. It supports multiple sensor categories—including analog sensors, squibs, digital inputs/outputs, UART/CAN I/O, and stream I/O—alongside shared behaviors like filtering, sorting, drag-and-drop, visibility toggling for assembly/inspection columns, and status tracking (e.g., calibration overdue, usage count, online status). The module enables consistent UI presentation and interaction across different contexts such as main sensor lists, edit group setups, and template import/export workflows.
## 2. Public Interface
### Interfaces (Views)
- **`ISensorsListView`**
- `void HandleColumns(CalibrationBehaviors calibrationBehavior)`
Configures column visibility/behavior based on calibration policy (e.g., overdue warnings).
- `void SetIncludedVisible(bool bUsesIncludeColumn)`
Controls visibility of the "Included" checkbox column.
- `void HandleAssemblyVisibilityColumns(bool bDontAllowDataCollectionIfOverused)`
Shows/hides assembly-related columns (e.g., Assembly Name, Usage Count) based on usage policy.
- `void HandleInspectBeforeUseVisibilityColumn(bool show)`
Toggles visibility of the "Inspect Before Use" column.
- **`ISensorsListEditGroupView`**
- `void HandleColumns()`
Prepares column layout before display (handles "First Use" date column per issue 13065).
- `void HandleAssemblyVisibilityColumns(bool bDontAllowDataCollectionIfOverused)`
Same behavior as `ISensorsListView.HandleAssemblyVisibilityColumns`.
- `void HandleInspectBeforeUseVisibilityColumn(bool show)`
Same behavior as `ISensorsListView.HandleInspectBeforeUseVisibilityColumn`.
- **`ISensorsListOverdueView`**, **`ISensorTemplatesExportView`**, **`ISensorsTemplatesImportView`**
Marker interfaces inheriting `IBaseView`; no additional methods defined. Likely used for view registration or routing in DI/container.
### Interfaces (View Models)
- **`ISensorsListViewModel`**
- `ISensorsListView View { get; set; }`
- Properties: `AnalogSensors`, `Squibs`, `DigitalInputSettings`, `DigitalOutputSettings`, `UartIOSettings`, `StreamOutputSettings`
- `CalibrationBehavior CalibrationBehavior { get; set; }`
- `void GetSensors(...)` (2 overloads): Loads sensor data with calibration/usage context.
- `void SetSelectedSerial(string serialNumber)`
- `void Sort(object sortBy, bool bColumnClick)`, `void SortOverdue(object sortBy, bool bColumnClick)`
- `void Filter(...)`, `void FilterSquib(...)`, `FilterDigitalIn/Out/UartIO/StreamIn/Out(...)`
- `void SetCachedSensors(...)`, `SetCachedCalibrations(...)`
- `void UseIncludedColumn(bool bUsesIncludedColumn)`
- `void SetIncludedAll(bool bIncluded)`, `IDragAndDropItem[] GetIncludedSensors()`
- `bool ShowOnlyTDCSensors`, `bool ShowOnlySlicewareSensors { set; }`
- **`ISensorsListEditGroupViewModel`**
- `ISensorsListEditGroupView View { get; set; }`
- Properties: `AnalogSensors`, `Squibs`, `DigitalInputSettings`, `DigitalOutputSettings`, `UartSettings`, `StreamOutputSettings`
- `void GetSensors(...)`
- `void SetCapacityFormat(string format)`
- `void Sort(...)`, `void Filter(...)`, `Filter*` methods for each sensor type
- `void SetShowAssigned(bool showAssigned, bool showUnassigned, IReadOnlyDictionary<string, bool> assignedSensors)`
- `void SetShowOnline(bool showOnline)`, `SetAssignedSensors(...)`, `SetOnline(...)`, `IsSensorOnline(string serialNumber)`
- `void SetCachedSensors(...)`, `SetCachedCalibrations(...)`
- `void SetActiveTab(PossibleFilters filter)`
- `void HandleAssemblyVisibilityColumns(...)`, `HandleInspectBeforeUseVisibilityColumn(...)`
- **`ISensorTemplatesViewModel`**
Marker interface inheriting `IBaseViewModel`; no additional methods.
### Interfaces (Sensor/I/O Models)
All sensor/I/O interfaces share common properties for UI binding and status tracking. Key shared members:
- `int DatabaseId { get; set; }`
- `bool Included { get; set; }`
- `string SerialNumber { get; set; }`
- `string Description { get; set; }`
- `string LastModifiedBy`, `DateTime LastModified`
- `bool Filter(string term)`
- `bool Assigned { get; set; }`, `bool Online { get; set; }`
- `string ISOCode`, `ISOChannelName`, `UserCode`, `UserChannelName`
- `bool Broken { get; set; }`, `bool DoNotUse { get; set; }`
Specific interfaces:
- **`IAnalogSensor`**
- `SensorConstants.BridgeType Bridge { get; set; }`, `bool IEPE { get; }`
- `double Capacity`, `RangeHigh/Medium/Low`, `Sensitivity`, `AddedSensitivity`
- `double Resistance`, `Excitation`, `Units`, `EID`
- `DateTime CalDate`, `CalDueDate`, `FirstUseDate?`, `LatestCalibrationId?`, `UsingLatestCalibration`
- `int SensorUsageCount`, `MaximumUsage`, `AssemblyName`
- `CFC`, `Polarity`, `NonLinearCalculationType/Enum`, `ZeroMethod`, `ZeroMethodStart/End`
- `UIItemStatus SensorCalibrationOrUsageStatus { get; }`, `InitialOffset[]`, `IFilterClass FilterClass`
- **`ISquib`**
- `double ResistanceLow/High`, `string ID`, `string SQMode`
- `double SQDelay`, `SQCurrent`, `SQDuration`, `LimitDuration`
- `SquibFireMode Mode { get; set; }`
- **`IDigitalInputSetting`**
- `string DIMode`, `string EID`
- `string ActiveValue`, `DefaultValue`, `DigitalInputModes Mode`
- **`IDigitalOutputSetting`**
- `double DODelay`, `DODuration`, `LimitDuration`
- `Enums.DigitalOutputModes DOMode`
- **`IUartIOSetting`**
- `uint BaudRate`, `uint DataBits`, `StopBits StopBits`, `Parity Parity`
- `Handshake FlowControl { get; }` *(always NONE per comment)*
- `UartDataFormat DataFormat { get; set; }`
- **`ICanIOSetting`**
- `bool CanIsFD`, `int CanArbBaseBitrate/SJW`, `int CanDataBitrate/SJW`
- `string CanFileType`
- **`IStreamInputSetting`**
- `string UDPAddress`
- **`IStreamOutputSetting`**
- `UDPStreamProfile UDPProfile`, `string UDPAddress`
- `ushort UDPTimeChannelId`, `UDPDataChannelId`, `UDPTmNSConfig`
- `ushort IRIGTimeDataPacketIntervalMs`, `ushort TMATSIntervalMs`
- `bool IsCH10`, `IsTMNS`, `IsIENA`, `IsUART { get; }`
- `uint TMNS_SubFrameId`, `TMNS_MsgId`, `TMNS_MinorPerMajor`, `TMNS_TMATSPort`
- `ushort IENA_Key`, `IENA_SourcePort`
### Interfaces (Drag & Drop)
- **`IDragAndDropItem`**
- `string SerialNumber { get; set; }`
- `int DatabaseId { get; set; }` *(valid only if >0)*
- `string ISOCode { get; }`, `ISOChannelName { get; }`
- `string UserCode { get; }`, `UserChannelName { get; }`
## 3. Invariants
- **Database IDs**: All `DatabaseId` properties must be `> 0` to be considered valid (explicitly documented in `ISquib`, `IAnalogSensor`, `IUartIOSetting`, etc.).
- **Sensor Status Flags**:
- `Broken`/`DoNotUse` sensors are *excluded* from selection lists in "edit test setup" and "edit group" contexts (per comments in `ISquib`, `IAnalogSensor`, `IDigitalInputSetting`, etc.).
- **Assignment/Online Status**:
- `Assigned` indicates channel association (UI state).
- `Online` indicates runtime connectivity (where applicable; e.g., `IDigitalOutputSetting.Online` has no real implementation due to lack of EID).
- **Filtering**: All sensor/I/O interfaces implement `bool Filter(string term)` for UI-driven text filtering.
- **Drag-and-Drop Payload**: `IDragAndDropItem` provides a common contract for serializable sensor data across types.
- **Column Visibility**:
- `HandleAssemblyVisibilityColumns` and `HandleInspectBeforeUseVisibilityColumn` control display of usage/inspection-related columns.
- `SetIncludedVisible` toggles the "Included" checkbox column.
- **Calibration Context**:
- `IAnalogSensor` tracks `CalDate`, `CalDueDate`, `FirstUseDate?`, `UsingLatestCalibration`, and `LatestCalibrationId?` per issue 13065.
- `ISensorsListViewModel.GetSensors(...)` accepts `sensorCalWarningPeriodDays` for overdue colorization.
## 4. Dependencies
- **Base Layer**: All interfaces inherit from `DTS.Common.Base.IBaseView` or `IBaseViewModel`.
- **Enums**:
- `DTS.Common.Enums.Sensors` (e.g., `CalibrationBehaviors`, `PossibleFilters`, `DigitalInputModes`, `DigitalOutputModes`)
- `DTS.Common.Enums` (e.g., `SquibFireMode`, `UartDataFormat`)
- **Pagination**: `IFilterableListView` (from `DTS.Common.Interface.Pagination`) is implemented by view models.
- **Sensor-Specific Interfaces**:
- `IAnalogSensor` depends on `DTS.Common.Classes.Sensors`, `DTS.Common.Interface.Sensors.SoftwareFilters.IFilterClass`.
- **System Libraries**: `System`, `System.IO.Ports` (for `StopBits`, `Parity`, `Handshake`).
**Inferred Consumers**:
- View implementations (e.g., WPF/WinForms views) for `ISensorsListView`, `ISensorsListEditGroupView`, etc.
- View model implementations for `ISensorsListViewModel`, `ISensorsListEditGroupViewModel`.
- Drag-and-drop handlers using `IDragAndDropItem`.
## 5. Gotchas
- **`FlowControl` in `IUartIOSetting`**: Always returns `Handshake.None`; the setter is omitted (FB 30486).
- **`IDigitalOutputSetting.Online`**: No reliable way to determine online status (no EID); comment notes this is a known limitation.
- **`IDigitalInputSetting.DIMode` vs `Mode`**: `DIMode` is a string representation for UI display; `Mode` is the strongly-typed enum.
- **`IStreamOutputSetting.IsCH10/IsTMNS/IsIENA/IsUART`**: Read-only properties indicating streaming protocol type.
- **`IAnalogSensor.Sensitivity`/`AddedSensitivity`**: User-friendly display strings (not raw values).
- **`ISquib.SQMode`**: String-based mode field (not enum); likely maps to `SquibFireMode Mode`.
- **Column Handling**: `ISensorsListEditGroupView.HandleColumns()` is called *before* view display (per comment), while `ISensorsListView.HandleColumns()` takes `CalibrationBehaviors` as input.
- **No Usage Count Columns**: The commented-out `UseUsageCountColumns` in `ISensorsListViewModel` suggests historical or deferred functionality.
- **Template Views**: `ISensorsListOverdueView`, `ISensorTemplatesExportView`, `ISensorsTemplatesImportView` are empty interfaces—likely used for view discovery or routing only.
- **None identified from source alone.**

View File

@@ -0,0 +1,70 @@
---
source_files:
- Common/DTS.Common/Interface/Sensors/SoftwareFilters/ISoftwareFiltersView.cs
- Common/DTS.Common/Interface/Sensors/SoftwareFilters/ISoftwareFiltersViewModel.cs
generated_at: "2026-04-16T03:05:19.731762+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "400399ad7d8f290b"
---
# SoftwareFilters
## 1. Purpose
This module defines the interface contracts for the software filters feature within the sensor subsystem. It establishes the contract for the view (`ISoftwareFiltersView`), the view model (`ISoftwareFiltersViewModel`), and the filter class abstraction (`IFilterClass`). Its role is to provide a standardized, data-bound UI layer for managing configurable software filters (e.g., low-pass, high-pass) applied to sensor data, supporting filtering, sorting, validation, and persistence operations.
## 2. Public Interface
### `ISoftwareFiltersView`
- **Inherits**: `IBaseView`
- **Description**: Marker interface for the view layer (e.g., UI page/user control) responsible for rendering the software filters list. No additional members beyond base view contract.
### `IFilterClass`
- **Inherits**: `IComparable`
- **Attributes**: `[TypeConverter(typeof(ExpandableObjectConverter))]`
- **Properties**:
- `string FilterName { get; }` Read-only name of the filter class (e.g., `"LowPass"`, `"HighPass"`).
- `FilterClassType FClass { get; set; }` Gets or sets the enumerated type representing the filter class (from `DTS.Common.Enums.Sensors.FilterClassType`).
- `double Frequency { get; set; }` Gets or sets the cutoff frequency (in Hz) for the filter.
- **Methods**:
- `int GetFilterClassNumericValue()` Returns a numeric representation of the filter class (e.g., for serialization or comparison).
### `ISoftwareFiltersViewModel`
- **Inherits**: `IBaseViewModel`, `IFilterableListView`
- **Properties**:
- `ISoftwareFiltersView View { get; set; }` Reference to the associated view instance (for view-model-to-view binding).
- `ObservableCollection<ISoftwareFilter> SoftwareFilters { get; set; }` Collection of software filter items currently loaded.
- `string CurrentUser { get; set; }` Username of the currently logged-in user (likely used for audit or permissions).
- **Methods**:
- `void Sort(object sortBy, bool bColumnClick)` Sorts the `SoftwareFilters` collection based on the provided sort key (`sortBy`) and user interaction context (`bColumnClick`).
- `void Unset()` Releases resources or clears state (e.g., unbinds view, clears collections).
- `void Filter(string currentFilter)` Applies a text filter (`currentFilter`) to the `SoftwareFilters` collection (e.g., to show only matching filter names).
- `ISoftwareFilter[] GetSoftwareFilters()` Returns a snapshot of the current `SoftwareFilters` collection as an array.
- `void PopulateView()` Loads or refreshes data in the view (e.g., binds `SoftwareFilters` to the UI).
- `bool ValidateAndSave()` Validates the current state of filters (e.g., frequency ranges, required fields) and persists changes; returns `true` on success, `false` otherwise.
## 3. Invariants
- `ISoftwareFiltersView` must be implemented by a concrete view class that supports data binding to `ISoftwareFiltersViewModel`.
- `IFilterClass` instances must maintain consistency between `FClass`, `FilterName`, and the numeric value returned by `GetFilterClassNumericValue()` (e.g., `FilterClassType.LowPass``"LowPass"``1`).
- `ISoftwareFiltersViewModel.SoftwareFilters` must be an `ObservableCollection<ISoftwareFilter>`; modifications (add/remove) must raise collection change notifications.
- `ValidateAndSave()` must return `false` if any filter in `SoftwareFilters` fails validation (e.g., negative frequency, missing name), and no changes should be persisted in that case.
- `Sort()` and `Filter()` operations must not mutate the underlying data source beyond the views current representation (i.e., sorting/filtering is applied to the in-memory collection, not the persistent store).
## 4. Dependencies
- **Depends on**:
- `DTS.Common.Base.IBaseView`, `DTS.Common.Base.IBaseViewModel`
- `DTS.Common.Interface.Pagination.IFilterableListView` (for `Filter()` and `Sort()` contract)
- `DTS.Common.Enums.Sensors.FilterClassType` (used in `IFilterClass.FClass`)
- `System.Collections.ObjectModel.ObservableCollection<T>`
- `System.ComponentModel.TypeConverter`
- **Depended on by**:
- UI layer components (e.g., WPF/XAML views implementing `ISoftwareFiltersView`)
- View model implementations (e.g., concrete `SoftwareFiltersViewModel`)
- Sensor data processing pipelines (via `ISoftwareFilter` instances, though not shown here, implied by `SoftwareFilters` property).
## 5. Gotchas
- `IFilterClass` implements `IComparable` but no comparison logic is defined in the interface—implementations must define `CompareTo()` behavior (e.g., by `Frequency`, `FClass`, or `FilterName`).
- `GetSoftwareFilters()` returns a snapshot array; subsequent modifications to `SoftwareFilters` collection will not be reflected in the returned array.
- `CurrentUser` is exposed but its usage (e.g., for authorization in `ValidateAndSave()`) is not specified in this interface—implementation details may vary.
- `bColumnClick` parameter in `Sort()` suggests UI-driven sorting (e.g., header click), but the interface does not define how this affects sort direction (ascending/descending)—this behavior is implementation-specific.
- No documentation is provided for `ISoftwareFilter` (used in `SoftwareFilters`), so its contract (properties/methods) is unknown from this source.