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,117 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Sensors/SensorSettingsModule/ISensorSettingsView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorSettingsModule/ICalibrationPolicy.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorSettingsModule/ISensorSettingsViewModel.cs
generated_at: "2026-04-16T02:30:05.623483+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1a993886a7ce02c0"
---
# SensorSettingsModule
## Documentation: Sensor Settings Module Interfaces
---
### 1. **Purpose**
This module defines the core interfaces for managing sensor-related configuration settings in the DTS system. It provides a structured abstraction for UI (view), state management (view model), and calibration policy enforcement, enabling consistent handling of sensor defaults (e.g., squib, digital I/O, IEPE, analog), calibration behavior, and persistence. Its role is to decouple presentation logic from data storage while enforcing validation and configuration integrity across the sensor subsystem.
---
### 2. **Public Interface**
#### `ISensorSettingsView`
- **Inherits**: `IBaseView`
- **Description**: A marker interface representing the view layer for the sensor settings UI. No additional members beyond base view contract.
#### `ICalibrationPolicy`
- **Description**: Defines the contract for managing sensor calibration policy settings.
- **Properties**:
- `SensorConstants.SensorCalPolicy SelectedCalPolicy { get; set; }`
Gets or sets the currently selected calibration policy.
- `SensorConstants.SensorCalPolicy[] AvailableSensorCalPolicies { get; }`
Gets an array of all supported calibration policies.
- `int WarningPeriod { get; set; }`
Gets or sets the number of days before a calibration is due when a warning should be issued.
- `bool UseSensorFirstUseDate { get; set; }`
Gets or sets whether the calibration interval should be calculated from the sensors *first use date* (`true`) or *last calibration date* (`false`).
- **Methods**:
- `void ReadXML(System.Xml.XmlElement root)`
Loads calibration policy settings from the provided XML element.
- `void WriteXML(ref System.Xml.XmlWriter writer)`
Serializes calibration policy settings to XML using the provided writer.
#### `ISensorSettingsViewModel`
- **Inherits**: `IBaseViewModel`
- **Description**: Manages the state and logic for sensor settings UI, including defaults for multiple sensor types and calibration policy.
- **Properties**:
- `string User { get; set; }`
User identifier used when persisting/retrieving settings from the database.
- `int UserID { get; set; }`
Numeric user ID used when persisting/retrieving settings from the database.
- `ISensorSettingsView View { get; set; }`
Reference to the associated view instance.
- `ISquibSettingDefaults SquibSettings { get; set; }`
Default settings for squib (explosive device) configurations.
- `IDigitalOutDefaults DigitalOutSettings { get; set; }`
Default settings for digital output channels.
- `IDigitalInputDefaults DigitalInputDefaults { get; set; }`
Default settings for digital input channels.
- `IIEPESensorDefaults IEPESensorDefaults { get; set; }`
Default settings for IEPE (Integrated Electronics Piezo-Electric) sensors.
- `ICalibrationPolicy SensorCalibrationDefaults { get; set; }`
Calibration policy defaults and behavior.
- `IAnalogDefaults AnalogDefaults { get; set; }`
Default settings for analog channels (FB13120 reference).
- **Methods**:
- `void RestoreOriginalSettings()`
Resets all settings to their original (factory or initial) values.
- `void Unset()`
Uninitializes the display and frees associated resources.
- `void OnSetActive()`
Initializes or activates the display (e.g., when the settings page becomes active).
- `bool ValidateAndSave()`
Validates current settings; returns `true` and saves if valid, returns `false` and does *not* save if invalid.
---
### 3. **Invariants**
- `ISensorSettingsViewModel` must maintain a non-null `View` reference when `OnSetActive()` or `ValidateAndSave()` are called (implied by `View` being settable and used in UI lifecycle).
- `ICalibrationPolicy.SelectedCalPolicy` must be one of the values in `AvailableSensorCalPolicies` at all times (enforced by setter semantics).
- `ICalibrationPolicy.WarningPeriod` must be ≥ 0 (implied by "period in days before calibration is due to warn").
- `ICalibrationPolicy.UseSensorFirstUseDate` determines the reference point for calibration interval calculation; its value must be consistent with the selected policys semantics.
- `ISensorSettingsViewModel.ValidateAndSave()` must *not* persist settings if validation fails.
- `ISensorSettingsViewModel.User` and `ISensorSettingsViewModel.UserID` must be set before calling persistence-related methods (e.g., `ValidateAndSave`, `ReadXML`, `WriteXML`), as they are explicitly documented as being used for DB persistence.
---
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`)
- `DTS.Common.Enums.Sensors` (for `SensorConstants.SensorCalPolicy`)
- `System.Xml` (for `XmlElement`, `XmlWriter` in `ICalibrationPolicy`)
- Other interfaces in this module (`ISquibSettingDefaults`, `IDigitalOutDefaults`, etc.) — *not defined in this file set*, but referenced.
- **Depended on by**:
- UI components implementing `ISensorSettingsView`.
- View model implementations (e.g., concrete classes implementing `ISensorSettingsViewModel`).
- Persistence layers (via `ReadXML`/`WriteXML` in `ICalibrationPolicy`).
- Other modules that configure or consume sensor defaults (e.g., sensor initialization, test sequencing).
---
### 5. **Gotchas**
- **Ambiguous persistence scope**: While `User`/`UserID` are documented as used for DB persistence, the `ISensorSettingsViewModel` interface itself does *not* expose explicit save/load methods — persistence is implied to occur via `ValidateAndSave()` and XML methods in `ICalibrationPolicy`. The exact mechanism (e.g., when defaults are loaded) is not specified here.
- **Missing XML context**: `ICalibrationPolicy.ReadXML`/`WriteXML` lack details on expected XML structure or namespace. Implementation details are hidden.
- **`UseSensorFirstUseDate` semantics**: The behavior of "first use date" vs. "last calibration date" is not defined — e.g., what happens if a sensor has never been used? No fallback policy is specified.
- **No error handling in XML methods**: `ReadXML`/`WriteXML` do not declare exceptions or error states — callers must infer failure modes (e.g., malformed XML).
- **`ValidateAndSave()` behavior**: The method name suggests validation *and* saving, but the documentation only clarifies behavior on success/failure — it does not specify *what* validation rules apply or *where* defaults are persisted (DB vs. config file).
- **No thread-safety guarantees**: None of the interfaces indicate thread-safety; concurrent access may require external synchronization.
> *None of the above are explicitly stated in the source; inferred from naming, documentation, and typical usage patterns.*

View File

@@ -0,0 +1,125 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsListOverdueView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorTemplatesExportView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsTemplatesImportView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorTemplatesViewModel.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsListView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsListEditGroupView.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IDragAndDropItem.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISquib.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsListEditGroupViewModel.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IStreamInputSetting.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/ISensorsListViewModel.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IUartIOSetting.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IDigitalInputSetting.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IDigitalOutputSetting.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IStreamOutputSetting.cs
- Common/DTS.CommonCore/Interface/Sensors/SensorsList/IAnalogSensor.cs
generated_at: "2026-04-16T02:30:32.654902+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "843b21a9981849bf"
---
# Sensors List Module Documentation
## 1. Purpose
This module defines the core interfaces for the *Sensors List* UI layer, which provides a standardized way to display, filter, sort, and manage various types of sensor and sensor-like settings (analog sensors, squibs, digital inputs/outputs, UART I/O, stream inputs/outputs) in the DTS system. It serves as the contract between the UI (views) and the presentation logic (view models), enabling consistent interaction patterns across different sensor list contexts such as main sensor lists, edit group configuration, overdue sensors, and template import/export operations. The interfaces abstract implementation details of data sources and UI rendering while enforcing shared behavior for filtering, sorting, inclusion state, and drag-and-drop payloads.
## 2. Public Interface
### Interfaces (View Models)
- **`ISensorsListViewModel`**
Primary view model for the main sensor list view. Manages collections of `IAnalogSensor`, `ISquib`, `IDigitalInputSetting`, `IDigitalOutputSetting`, `IUartIOSetting`, and `IStreamOutputSetting`. Supports filtering, sorting (including overdue-specific sorting), inclusion toggling, and drag-and-drop of included items. Provides methods to retrieve sensors with calibration warning periods and to set cached sensor/calibration data.
- `void GetSensors(int sensorCalWarningPeriodDays, bool included)`
- `void GetSensors(int sensorCalWarningPeriodDays, int[] sensorsAllowed, IReadOnlyDictionary<int, ISensorData> sensors)`
- `IDragAndDropItem[] GetIncludedSensors()`
- `void UseIncludedColumn(bool bUsesIncludedColumn)`
- `void SetIncludedAll(bool bIncluded)`
- `bool ShowOnlyTDCSensors { set; }`
- `bool ShowOnlySlicewareSensors { set; }`
- **`ISensorsListEditGroupViewModel`**
View model for the *Edit Group* configuration context. Extends `IFilterableListView` and manages heterogeneous sensor collections (analog, squib, digital, UART, stream). Supports tab-specific filtering, assignment/online status toggling, and setting active tab.
- `ISensorsListEditGroupView View { get; set; }`
- `IAnalogSensor[] AnalogSensors { get; set; }`, `ISquib[] Squibs { get; set; }`, etc.
- `void GetSensors(int sensorCalWarningPeriodDays, bool included)`
- `void FilterSquib(object columnTag, string searchTerm)`, `FilterDigitalIn(...)`, `FilterDigitalOut(...)`, `FilterUartIO(...)`, `FilterStreamOut(...)`, `FilterStreamIn(...)`
- `void SetShowAssigned(bool showAssigned, bool showUnassigned, IReadOnlyDictionary<string, bool> assignedSensors)`
- `void SetAssignedSensors(IReadOnlyDictionary<string, bool> serialNumbers)`
- `bool IsSensorOnline(string serialNumber)`
- `void SetActiveTab(PossibleFilters filter)`
- **`ISensorTemplatesViewModel`**
Marker interface for template-related view models (no additional members beyond `IBaseViewModel`).
### Interfaces (Views)
- **`ISensorsListView`**
View for the main sensor list. Handles column configuration based on calibration behavior and inclusion column visibility.
- `void HandleColumns(CalibrationBehaviors calibrationBehavior)`
- `void SetIncludedVisible(bool bUsesIncludeColumn)`
- **`ISensorsListEditGroupView`**
View for the *Edit Group* configuration. Handles column configuration before display.
- `void HandleColumns()` *(Note: Comment references "13065 Sensor 'First Use' Date")*
- **`ISensorsListOverdueView`**, **`ISensorTemplatesExportView`**, **`ISensorsTemplatesImportView`**
Marker interfaces extending `IBaseView`. No additional methods; likely used for view registration or routing.
### Interfaces (Sensor/Setting Models)
All sensor and setting interfaces share common properties and behaviors:
- **`ISquib`**, **`IDigitalInputSetting`**, **`IDigitalOutputSetting`**, **`IUartIOSetting`**, **`IStreamInputSetting`**, **`IStreamOutputSetting`**, **`IAnalogSensor`**
Common properties:
- `int DatabaseId`, `bool Included`, `string SerialNumber`, `string Description`
- `string LastModifiedBy` / `ModifiedBy`, `DateTime LastModified`
- `bool Assigned`, `bool Online`, `bool Broken`, `bool DoNotUse`
- `string ISOCode`, `string ISOChannelName`, `string UserCode`, `string UserChannelName`
- `bool Filter(string term)`
Specific properties (selected examples):
- `ISquib`: `double ResistanceLow`, `double ResistanceHigh`, `string SQMode`, `double SQDelay`, `SquibFireMode Mode`
- `IDigitalInputSetting`: `string DIMode`, `string EID`, `string ActiveValue`, `string DefaultValue`, `DigitalInputModes Mode`
- `IDigitalOutputSetting`: `double DODelay`, `double DODuration`, `bool LimitDuration`, `Enums.DigitalOutputModes DOMode`
- `IUartIOSetting`: `uint BaudRate`, `uint DataBits`, `StopBits StopBits`, `Parity Parity`, `Handshake FlowControl` *(always `NONE`)*, `UartDataFormat DataFormat`
- `IStreamOutputSetting`: `UDPStreamProfile UDPProfile`, `string UDPAddress`, `ushort UDPTimeChannelId`, `bool IsCH10`, `bool IsTMNS`, `bool IsIENA`, `bool IsUART`, `uint TMNS_SubFrameId`, `ushort IENA_Key`, etc.
- `IAnalogSensor`: `SensorConstants.BridgeType Bridge`, `bool IEPE`, `double Capacity`, `string Sensitivity`, `DateTime CalDate`, `DateTime CalDueDate`, `Enums.Sensors.FilterClassType CFC`, `DateTime? FirstUseDate`, `int? LatestCalibrationId`, `bool UsingLatestCalibration`
### Interfaces (Drag-and-Drop)
- **`IDragAndDropItem`**
Standard payload for drag-and-drop operations originating from sensor lists.
- `string SerialNumber { get; set; }`
- `int DatabaseId { get; set; }` *(valid only if >0)*
- `string ISOCode { get; }`, `string ISOChannelName { get; }`
- `string UserCode { get; }`, `string UserChannelName { get; }`
## 3. Invariants
- **`DatabaseId`**: Must be `> 0` for valid database entries; `0` or negative values indicate unsaved or transient items.
- **`Included`**: Controls UI visibility via checkbox; affects inclusion in `GetIncludedSensors()` and drag-and-drop payloads.
- **`Broken` / `DoNotUse`**: When `true`, the item must *not* appear in selectable lists for *Edit Test Setup* or *Edit Group* contexts (explicitly stated in `ISquib`, `IStreamInputSetting`, `IDigitalInputSetting`, `IDigitalOutputSetting`).
- **`Assigned` / `Online`**: Boolean flags indicating channel association and runtime connectivity status, respectively. Used for filtering and status display.
- **Filtering**: All sensor interfaces implement `bool Filter(string term)` to support client-side search.
- **ISO/User Channel Names**: For `IAnalogSensor`, these represent *default* values when assigning to a new blank channel.
- **`FirstUseDate` / `LatestCalibrationId` / `UsingLatestCalibration`**: Only meaningful when `UsingLatestCalibration` is `true`; otherwise, calibration data may be stale.
## 4. Dependencies
- **Base Interfaces**: All interfaces extend `IBaseView` (for views) or `IBaseViewModel` (for view models).
- **Enums**:
- `DTS.Common.Enums.Sensors` (e.g., `CalibrationBehaviors`, `PossibleFilters`, `DigitalInputModes`, `DigitalOutputModes`)
- `DTS.Common.Enums` (e.g., `SquibFireMode`, `UartDataFormat`, `Parity`, `StopBits`, `Handshake`)
- **Pagination**: `IFilterableListView` (from `DTS.Common.Interface.Pagination`) is implemented by view models to support filtering/sorting.
- **Collections**: Uses `IReadOnlyDictionary<string, bool>`, `IDictionary<string, bool>`, `IReadOnlyDictionary<int, ISensorData>`, `ISensorData[]`, `ISensorCalibration[]`.
- **System**: `System`, `System.Collections.Generic`, `System.IO.Ports` (for `IUartIOSetting`).
- **Inferred Consumers**:
- View models depend on concrete implementations of `ISensorData`, `ISensorCalibration`, and `IFilterClass`.
- Views likely depend on view models for data binding.
- Drag-and-drop handlers consume `IDragAndDropItem`.
## 5. Gotchas
- **`FlowControl` in `IUartIOSetting`**: Explicitly documented as *always `NONE`* (FB 30486); do not attempt to set it.
- **`Online` for digital outputs**: Comment notes *"there's no real way of finding digital output online"* — this flag may be unreliable or unused.
- **`ISOCode`/`UserChannelName` for digital outputs/outputs**: Comments note these are present for consistency but *"not really needed"* since outputs arent in collected data.
- **`FirstUseDate`**: Nullable `DateTime?`; null indicates unset. Only valid when `UsingLatestCalibration` is `true`.
- **Template Views**: `ISensorsTemplatesImportView`/`ISensorTemplatesExportView`/`ISensorTemplatesViewModel` are empty markers — their behavior is inferred from naming but not defined in the source.
- **Overdue View**: `ISensorsListOverdueView` is a marker interface; no overdue-specific logic is defined here (likely handled in `ISensorsListViewModel.SortOverdue(...)`).
- **No Implementation Details**: Source files contain *only* interface definitions — no implementation, behavior, or data flow details are visible.

View File

@@ -0,0 +1,86 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Sensors/SoftwareFilters/ISoftwareFiltersView.cs
- Common/DTS.CommonCore/Interface/Sensors/SoftwareFilters/ISoftwareFiltersViewModel.cs
generated_at: "2026-04-16T02:30:19.442870+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c132999d4e5c3d51"
---
# SoftwareFilters
## Documentation: Software Filters Module (View & ViewModel Interfaces)
---
### 1. Purpose
This module defines the contract interfaces for managing software-based sensor filters within the DTS system. Specifically, it establishes the separation between view-layer representation (`ISoftwareFiltersView`) and the associated view-model logic (`ISoftwareFiltersViewModel`), enabling data binding and UI interaction for filter configuration. The `IFilterClass` interface standardizes metadata and behavior for filter classification types (e.g., low-pass, high-pass), supporting UI display and sorting via `FilterName`, `FClass`, `Frequency`, and a numeric representation. This module serves as the foundational abstraction for filter management UI components, likely consumed by a configuration or diagnostics interface.
---
### 2. Public Interface
#### `ISoftwareFiltersView`
- **Inherits**: `IBaseView`
- **Purpose**: Marker interface for the view layer of the software filters UI. No additional members defined—intended for dependency injection or view-model binding.
#### `IFilterClass`
- **Inherits**: `IComparable`
- **Attributes**: `[TypeConverter(typeof(ExpandableObjectConverter))]`
- **Properties**:
- `string FilterName { get; }` — Read-only display name of the filter class.
- `FilterClassType FClass { get; set; }` — Enumerated type representing the filter class (e.g., `LowPass`, `HighPass`).
- `double Frequency { get; set; }` — Center or cutoff frequency in Hz.
- **Methods**:
- `int GetFilterClassNumericValue()` — Returns a numeric code corresponding to the `FClass` value (e.g., for serialization or legacy compatibility).
#### `ISoftwareFiltersViewModel`
- **Inherits**: `IBaseViewModel`, `IFilterableListView`
- **Properties**:
- `ISoftwareFiltersView View { get; set; }` — Reference to the associated view instance (likely for view-model-to-view communication).
- `ObservableCollection<ISoftwareFilter> SoftwareFilters { get; set; }` — Collection of active software filters.
- `string CurrentUser { get; set; }` — Username of the currently logged-in user (likely for audit/logging).
- **Methods**:
- `void Sort(object sortBy, bool bColumnClick)` — Sorts the `SoftwareFilters` collection based on `sortBy` (e.g., column header) and user interaction (`bColumnClick`).
- `void Unset()` — Resets or clears the view model state (e.g., disposes resources, clears selections).
- `void Filter(string currentFilter)` — Applies a text-based filter to the `SoftwareFilters` collection (e.g., search term).
- `ISoftwareFilter[] GetSoftwareFilters()` — Returns a snapshot of the current `SoftwareFilters` collection as an array.
- `void PopulateView()` — Loads or refreshes the views data (e.g., populates `SoftwareFilters` from a data source).
- `bool ValidateAndSave()` — Validates filter configurations and persists changes; returns `true` on success.
---
### 3. Invariants
- `ISoftwareFiltersView` must be implemented by a concrete view class (e.g., WPF `UserControl`), but its interface itself is empty—no behavioral invariants beyond being an `IBaseView`.
- `IFilterClass` instances must maintain consistency between `FClass` (enum) and the value returned by `GetFilterClassNumericValue()` (e.g., `FClass.LowPass``1`).
- `Frequency` must be non-negative (`≥ 0.0`) for valid filter configurations (implied by physical constraints of sensor filters, though not explicitly enforced in the interface).
- `SoftwareFilters` collection must be thread-safe *for read-only access* during UI operations (e.g., sorting/filtering), though write operations (e.g., `PopulateView`) may require synchronization.
- `ValidateAndSave()` must return `false` if any filter in `SoftwareFilters` fails validation (e.g., invalid `Frequency`, missing `FilterName`).
---
### 4. Dependencies
#### This module depends on:
- `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`, `IFilterableListView`).
- `DTS.Common.Enums.Sensors` (for `FilterClassType` enum).
- `System` (for `IComparable`, `ObservableCollection<T>`, `TypeConverter`).
#### This module is depended upon by:
- UI components implementing `ISoftwareFiltersView` (e.g., XAML views).
- View-model implementations (e.g., concrete classes implementing `ISoftwareFiltersViewModel`).
- Data layers or services that populate `SoftwareFilters` (e.g., via `PopulateView()`).
- Serialization or persistence modules that consume `IFilterClass` (e.g., to convert `GetFilterClassNumericValue()` to protocol buffers/JSON).
---
### 5. Gotchas
- **`IFilterClass` is an interface, not a class**: Implementers must manually synchronize `FClass` and `GetFilterClassNumericValue()`—no default implementation is provided.
- **`Sort` signature is non-generic**: The `sortBy` parameter is `object`, implying runtime type checking (e.g., `sortBy as string`) is required—error-prone without clear contract on expected values.
- **`Unset()` behavior is undefined**: The interface does not specify whether `Unset()` clears `SoftwareFilters`, disposes resources, or nullifies `View`. Implementation-specific.
- **`ValidateAndSave()` lacks error details**: Returns only `bool`, so callers cannot determine *why* validation failed (e.g., missing frequency vs. invalid enum).
- **`CurrentUser` is exposed but not validated**: No constraints ensure `CurrentUser` is non-null/non-empty before `ValidateAndSave()` is called.
- **No documentation for `IFilterableListView`**: Since `ISoftwareFiltersViewModel` inherits from it, its contract (e.g., `Filter` method signature) is assumed but not visible here.
*None identified beyond the above.*