Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/Sensors/SensorSettingsModule.md
2026-04-17 14:55:32 -04:00

7.3 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ISensorSettingsView.cs
Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ISensorSettingsViewModel.cs
Common/DTS.Common/Interface/Sensors/SensorSettingsModule/ICalibrationPolicy.cs
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; 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.