Files
DP44/enriched-partialglm/Common/DTS.CommonCore/Interface/Hardware/AddEditHardware.md
2026-04-17 14:55:32 -04:00

8.9 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Interface/Hardware/AddEditHardware/IAddEditHardwareView.cs
Common/DTS.CommonCore/Interface/Hardware/AddEditHardware/IAddEditHardwareDASModule.cs
Common/DTS.CommonCore/Interface/Hardware/AddEditHardware/IAddEditHardwareViewModel.cs
Common/DTS.CommonCore/Interface/Hardware/AddEditHardware/IAddEditHardwareHardware.cs
2026-04-16T12:24:47.346735+00:00 zai-org/GLM-5-FP8 1 8c9d2e027679c71f

Documentation: DTS.Common.Interface.Hardware.AddEditHardware

1. Purpose

This module defines the contract layer for the Add/Edit Hardware feature within the DTS system. It provides four interfaces that establish the boundaries between the view layer (IAddEditHardwareView), presentation logic (IAddEditHardwareViewModel), hardware domain model (IAddEditHardwareHardware), and modular hardware components (IAddEditHardwareDASModule). These interfaces enable the creation, modification, validation, and persistence of Data Acquisition System (DAS) hardware configurations, including support for modular hardware components like SLICE bridges.


2. Public Interface

IAddEditHardwareView

Inherits from: IBaseView

Member Signature Description
Activated void Activated() Notifies the view that it has been activated and should handle any post-activation work.
ViewDbVersion int ViewDbVersion { get; set; } Gets or sets the database version associated with the view.

IAddEditHardwareDASModule

Inherits from: None

Member Signature Description
ModuleType HardwareTypes ModuleType { get; set; } Gets or sets the type of the DAS module.
SerialNumber string SerialNumber { get; set; } Gets or sets the serial number for the DAS module.
DASImage ImageSource DASImage { get; } Gets an image representing the DAS (read-only).
OwningHardware IAddEditHardwareHardware OwningHardware { get; set; } Gets or sets a reference to the parent hardware that owns this module.
SLICEBridgeType SLICEBridgeTypes SLICEBridgeType { get; set; } Gets or sets the SLICE bridge type for this module.
GetSerialNumberPrefix string GetSerialNumberPrefix() Returns the prefix for any modules of this ModuleType.

IAddEditHardwareHardware

Inherits from: None

Member Signature Description
HardwareType HardwareTypes HardwareType { get; set; } Gets or sets the DAS hardware type.
SerialNumber string SerialNumber { get; set; } Gets or sets the serial number for the DAS.
FirmwareVersion string FirmwareVersion { get; set; } Gets or sets the firmware version of the DAS.
IPAddress string IPAddress { get; set; } Gets or sets the IP address of the DAS (if supported).
SupportsIPAddress bool SupportsIPAddress { get; } Indicates whether the DAS supports an IP address (read-only).
SupportsRackSize bool SupportsRackSize { get; } Indicates whether the DAS supports rack sizes (read-only).
SupportsConfiguration bool SupportsConfiguration { get; } Indicates whether the DAS supports configuration (read-only).
SLICEConfiguration SLICEConfigurations SLICEConfiguration { get; set; } Gets or sets the SLICE configuration of the DAS.
RackSize RackSizes RackSize { get; set; } Gets or sets the size of the rack (if supported).
DASImage ImageSource DASImage { get; } Gets an image representing the DAS (read-only).
Modules ObservableCollection<IAddEditHardwareDASModule> Modules { get; set; } Gets or sets the collection of DAS modules attached to this hardware.
StandIn bool StandIn { get; set; } Indicates whether this is actual physical hardware or stand-in/placeholder hardware.
IsModule bool IsModule { get; set; } Indicates whether this hardware is a module.
IsAdd bool IsAdd { get; set; } Indicates whether this record already exists in the database (false) or is a new entry (true).
RemoveModule void RemoveModule(IAddEditHardwareDASModule module) Removes the specified module from the hardware.
AddModule void AddModule() Adds a new module to the hardware.
ToISOHardware IISOHardware ToISOHardware() Returns a new IISOHardware representation of the hardware.

IAddEditHardwareViewModel

Inherits from: IBaseViewModel

Member Signature Description
View IAddEditHardwareView View { get; set; } Gets or sets the associated view instance.
Hardware IAddEditHardwareHardware Hardware { get; set; } Gets or sets the hardware being operated on in the viewmodel.
TestId int? TestId { get; set; } Gets or sets an optional test identifier.
NotificationsOn bool NotificationsOn { get; set; } Controls whether change notifications are sent. Can be disabled during initialization to avoid spurious notifications.
AllowStandin bool AllowStandin { get; set; } Indicates whether stand-in hardware is supported by the current model.
SLICE6TreeView ISLICE6TreeView SLICE6TreeView { get; } Provides access to the current SLICE6 tree view (read-only).
Unset void Unset() Clears or resets the viewmodel state.
SetHardware void SetHardware(IDASHardware hw, IISOHardware isoHW) Initializes the viewmodel with the given hardware.
Validate bool Validate(IISOHardware isoHW, ref List<string> errors, ref List<string> warnings, bool displayWindow, bool IsAdd) Validates the hardware. Returns true if the hardware can be committed. Populates errors and warnings lists.
Save void Save() Commits any changes present.
GetISOHardware IISOHardware GetISOHardware() Returns the IISOHardware representation.
SetSLICE6TreeView void SetSLICE6TreeView(ISLICE6TreeView treeView, IHardwareListViewModel treeViewModel) Allows access to the SLICE6 treeview module.

3. Invariants

  1. Module Ownership: An IAddEditHardwareDASModule must have a valid OwningHardware reference to function properly within the module hierarchy.

  2. Support Capability Flags: The boolean support properties (SupportsIPAddress, SupportsRackSize, SupportsConfiguration) on IAddEditHardwareHardware are read-only and their values are determined by the HardwareType. Consumers should check these before attempting to set related properties.

  3. Validation Before Save: The Validate method on IAddEditHardwareViewModel should be called and return true before calling Save() to ensure data integrity.

  4. Notifications Control: NotificationsOn should be set to false during programmatic initialization to prevent unwanted change notification events, then set back to true for normal operation.

  5. IsAdd State: The IsAdd property on IAddEditHardwareHardware must accurately reflect whether the hardware record is new (true) or existing (false) to ensure correct database operations.


4. Dependencies

This module depends on:

  • DTS.Common.Base — Provides IBaseView and IBaseViewModel base interfaces
  • DTS.Common.Enums.Hardware — Provides HardwareTypes, SLICEBridgeTypes, SLICEConfigurations, RackSizes enums
  • DTS.Common.Interface.DASFactory.Diagnostics — Provides IDASHardware
  • DTS.Common.Interface.DASFactory.Diagnostics.HardwareList — Provides IHardwareListViewModel, ISLICE6TreeView
  • DTS.Common.Interface.DataRecorders — Provides IISOHardware
  • System.Collections.Generic — For List<T>
  • System.Collections.ObjectModel — For ObservableCollection<T>
  • System.Windows.Media — For ImageSource

What depends on this module:

  • Not determinable from the provided source files alone. Implementations of these interfaces would exist elsewhere in the codebase.

5. Gotchas

  1. XML Documentation Issue: In IAddEditHardwareViewModel, the NotificationsOn property has a malformed XML comment — the closing tag is <summary> instead of </summary>. This may cause documentation generation warnings or incorrect IntelliSense output.

  2. ref Parameters in Validate: The Validate method uses ref parameters for errors and warnings lists rather than out. Callers must initialize these lists before calling the method, or the behavior is undefined.

  3. AddModule Parameterless: The AddModule() method on IAddEditHardwareHardware takes no parameters, suggesting the implementation is responsible for constructing and configuring the new module internally. The exact mechanism for how the new module is initialized is unclear from the interface alone.

  4. ViewDbVersion Purpose: The purpose and usage of ViewDbVersion on IAddEditHardwareView is not documented in the source; its relationship to database versioning or migration is unclear.