7.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:05:05.346141+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 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; returnstrueand saves to DB if valid, otherwise returnsfalsewithout 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; }
Iftrue, calibration interval starts from first use; otherwise, from last calibration.bool DontAllowDataCollectionIfOverused { get; set; }
Iftrue, 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
UserandUserIDmust be set before callingValidateAndSave()orRestoreOriginalSettings()if persistence is intended, as they are explicitly used for DB operations.Viewmust be assigned before callingOnSetActive()orUnset()if the view is involved in initialization or cleanup.ValidateAndSave()must not persist changes if validation fails — i.e., the method’s return value (bool) determines whether persistence occurs.SensorAssemblyEnabledandAllowInspectBeforeUseEnabledare read-only and reflect database capabilities — they must not be modified at runtime.AvailableSensorCalPoliciesmust be non-null and immutable (no runtime modification expected), as it is exposed only via a getter.
Dependencies
- Internal Dependencies:
DTS.Common.Base: ProvidesIBaseViewandIBaseViewModel, indicating this module is part of a larger UI framework.DTS.Common.Enums.Sensors: DefinesSensorConstants.SensorCalPolicy, used byICalibrationPolicy.
- 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 byICalibrationPolicy.ReadXML/WriteXMLfor 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:
SensorAssemblyEnabledandAllowInspectBeforeUseEnabledare 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 — onlyICalibrationPolicyhasReadXML/WriteXML. - No explicit error handling documented: Methods like
ValidateAndSave()andReadXMLdo 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.