--- source_files: - Common/DTS.Common/Interface/DTS.Viewer/TestModification/ITestModificationView.cs - Common/DTS.Common/Interface/DTS.Viewer/TestModification/ITestModificationViewModel.cs - Common/DTS.Common/Interface/DTS.Viewer/TestModification/ITestModificationModel.cs generated_at: "2026-04-16T03:07:00.161504+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "43122e167ffc47f8" --- # TestModification ### **Purpose** This module defines the core interfaces for the *Test Modification* feature within the DTS Viewer application, enabling users to inspect and modify channel-specific calibration and configuration parameters (e.g., description, Eu multiplier/offset, T0/T1/T2 line-fit settings, sensitivity, software filters, and data flags). It implements the MVVM pattern across three layers—`ITestModificationView` (UI), `ITestModificationViewModel` (presentation logic), and `ITestModificationModel` (data/access to calibration and channel state)—to support interactive editing of test channel metadata and calibration values, including integration with the sensor database for calibration updates. --- ### **Public Interface** #### **`ITestModificationView`** - **Inherits**: `IBaseView` - **Description**: A marker interface representing the view layer for the test modification UI. No additional members beyond base view contract. #### **`ITestModificationViewModel`** - **Inherits**: `IBaseViewModel` - **Properties**: - `ITestModificationView View { get; set; }` — Binds to the associated view instance. - `IBaseViewModel Parent { get; set; }` — Reference to the parent view model (e.g., main viewer or channel list). - `bool UseISOCodeFilterMapping { get; set; }` — Controls whether modifying a software filter should trigger automatic ISO code updates. - `bool UseZeroForUnfiltered { get; set; }` — Determines whether `0` (vs. `P`) is used as the ISO code value when the software filter is set to "unfiltered". - **Methods**: - `void PublishChanges()` — Commits pending modifications (likely to the model or underlying data layer). - `void UpdateDatabaseMethod()` — Updates the sensor calibration record in the database (see [case 43615](http://manuscript.dts.local/f/cases/43615/SW-Feature-Request-UART-Channel-Diagnostics-GPS-NMEA-1PPS)). #### **`ITestModificationModel`** - **Inherits**: `IBaseModel` - **Properties**: - `ITestModificationViewModel Parent { get; set; }` — Reference to the owning view model. - `ITestChannel SelectedChannel { get; set; }` — The channel currently being modified. - `string Description { get; set; }` — Channel description string; `IsModifiedDescription` tracks changes. - `double EuMultiplier { get; set; }` — Eu multiplier; `IsModifiedEuMultiplier` tracks changes. - `double EuOffset { get; set; }` — Eu offset; `IsModifiedEuOffset` tracks changes. - `double T0 { get; set; }` — T0 offset in ms; `IsModifiedT0` tracks changes. - `bool IsModifiedLineFit { get; set; }` — Whether T1/T2 line-fit parameters are modified. - `double T1 { get; set; }` — Line-fit start time (ms). - `double T2 { get; set; }` — Line-fit end time (ms). - `double Sensitivity { get; set; }` — Channel sensitivity; `IsModifiedSensitivity` tracks changes. - `IFilterClass SelectedFilter { get; set; }` — Software filter for the channel (per [FB 13120](https://github.com/...), uses `IFilterClass` instead of legacy `CFCFilter`). - `T0Mode T0Mode { get; set; }` — T0 adjustment mode (enum value; type defined elsewhere). - `DataFlag SelectedDataFlag { get; set; }` — Data flag setting; `IsModifiedDataFlag` tracks changes. - `ISensorDbRecord Sensor { get; set; }` — Sensor record in the database corresponding to the channel. - `ISensorCalDbRecord Cal { get; set; }` — Latest calibration record for the sensor. - `double CalSensitivity { get; set; }` — Sensitivity value from the calibration record. - `bool ShowSensorCal { get; }` — Whether sensor calibration UI should be visible. - `bool NonLinear { get; }` — Whether the calibration is non-linear. - `bool ProportionalToExcitation { get; }` — Whether the sensor output is proportional to excitation voltage. - **Computed Flags** (read-only): - `bool IsModified { get; }` — `true` if *any* field differs from its default/unmodified state. - `bool IsModifiedDescription { get; }` - `bool IsModifiedEuMultiplier { get; }` - `bool IsModifiedEuOffset { get; }` - `bool IsModifiedT0 { get; }` - `bool IsModifiedSensitivity { get; }` - `bool IsModifiedFilter { get; }` - `bool IsModifiedDataFlag { get; }` - **Methods**: - `bool ValidateT0()` — Returns `true` if `T0` is within the valid time range of the current dataset; `false` otherwise. --- ### **Invariants** - `SelectedChannel` must be non-null for all model properties to be meaningful; behavior is undefined if `SelectedChannel` is `null`. - `IsModified*` flags are derived from comparisons against default/unmodified values and must be consistent with the corresponding property values. - `ValidateT0()` must return `false` if `T0` falls outside the time span of the dataset associated with `SelectedChannel`. - `CalSensitivity`, `NonLinear`, `ProportionalToExcitation`, and `ShowSensorCal` are derived from the `Cal` and `Sensor` records and must reflect their current state. - `SelectedFilter` must be assignable to `IFilterClass` (no direct dependency on legacy `CFCFilter` per comment). - `UseISOCodeFilterMapping` and `UseZeroForUnfiltered` control ISO code behavior *only when* a software filter is modified; they do not affect other fields. --- ### **Dependencies** - **Internal Dependencies**: - `DTS.Common.Base` — Provides `IBaseView`, `IBaseViewModel`, `IBaseModel`. - `DTS.Common.Interface.Sensors` — Provides `ISensorDbRecord`, `ISensorCalDbRecord`. - `DTS.Common.Interface.Sensors.SoftwareFilters` — Provides `IFilterClass`. - `ITestChannel` — Referenced but not defined in these files; assumed to be defined elsewhere in `DTS.Common.Interface`. - `T0Mode` — Enum type referenced but not defined here. - `DataFlag` — Enum type referenced but not defined here. - **Depended Upon By**: - Concrete implementations of `ITestModificationView`, `ITestModificationViewModel`, and `ITestModificationModel` (e.g., WPF views, view models, and data models in the viewer module). - Likely consumed by higher-level modules managing test channel editing workflows (e.g., main viewer, channel list, or calibration manager). --- ### **Gotchas** - `IsModifiedLineFit` is the *only* `bool` property in `ITestModificationModel` with a public setter (`set`); all other `IsModified*` properties are read-only. This may indicate that line-fit modification state can be externally forced (e.g., reset), but usage is unclear without implementation context. - `UpdateDatabaseMethod()` lacks parameterization; it likely operates on the current `SelectedChannel`, `Sensor`, and `Cal` state. Side effects (e.g., DB write, validation) are not documented beyond the XML comment. - `UseZeroForUnfiltered` and `UseISOCodeFilterMapping` are *not* validated or enforced in the interface—behavior depends on implementation. - No explicit error handling or exception contracts are defined (e.g., for `PublishChanges()` or `UpdateDatabaseMethod()`). - `ValidateT0()`’s validity criteria ("within the dataset") are underspecified: dataset bounds are not defined in the interface. - None of the `IsModified*` flags are resettable via the interface—implementation may require external reset (e.g., after `PublishChanges()`). - None identified from source alone.