9.5 KiB
9.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||
|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:05:48.722310+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9dcf1285946405bb |
AddEditHardware
Documentation: AddEditHardware Module
1. Purpose
This module provides the core data and UI abstractions for the Add/Edit Hardware functionality within the DAS (Data Acquisition System) factory diagnostics workflow. It enables users to create or modify hardware configurations—including DAS units and their associated modules (e.g., SLICE bridges)—by encapsulating state, validation, and persistence logic. The module follows the MVVM pattern, with interfaces defining clear contracts between view, view model, hardware model, and DAS module representations. It integrates with the broader diagnostics and ISO hardware subsystems to support both physical and “stand-in” hardware entries.
2. Public Interface
IAddEditHardwareView
void Activated();
Notifies the view that it has been activated (e.g., brought to foreground or initialized), prompting it to perform post-activation work (e.g., UI refresh, focus management).int ViewDbVersion { get; set; }
Gets or sets the database version associated with the current view state—likely used for concurrency control or version-specific UI behavior.
IAddEditHardwareDASModule
HardwareTypes ModuleType { get; set; }
Gets or sets the type of the DAS module (e.g., SLICE6, SLICEPROSIM).string SerialNumber { get; set; }
Gets or sets the module’s serial number.ImageSource DASImage { get; }
Gets anImageSourcerepresenting the module visually (e.g., for UI rendering).IAddEditHardwareHardware OwningHardware { get; set; }
Gets or sets the parent hardware object to which this module belongs.SLICEBridgeTypes SLICEBridgeType { get; set; }
Gets or sets the SLICE bridge type (e.g., SLICE6, SLICEPROSIM), likely used for module-specific configuration.string GetSerialNumberPrefix();
Returns the expected prefix for serial numbers of modules of thisModuleType(e.g.,"S6-"for SLICE6 modules).
IAddEditHardwareViewModel
IAddEditHardwareView View { get; set; }
Gets or sets the associated view instance (MVVM binding).void Unset();
Cleans up references (e.g., to view, tree views) to prevent memory leaks or stale bindings.IAddEditHardwareHardware Hardware { get; set; }
Gets or sets the hardware object being edited.int? TestId { get; set; }
Gets or sets the optional test ID associated with this hardware entry.void SetHardware(IDASHardware hw, IISOHardware isoHW);
Initializes the view model with existing hardware (hw) and ISO representation (isoHW) for editing.bool NotificationsOn { get; set; }
Gets or sets whether property change notifications are enabled (e.g., disabled during bulk initialization).bool Validate(IISOHardware isoHW, ref List<string> errors, ref List<string> warnings, bool displayWindow, bool IsAdd);
Validates the current hardware state against business rules. Populateserrors/warningslists and optionally displays a dialog (displayWindow). Returnstrueif valid.void PublishPageError(bool displayWindow, List<string> errors, List<string> warnings);
Displays validation errors/warnings (e.g., via UI dialog or status bar) ifdisplayWindowistrue.void Save();
Commits changes to the underlying data store (e.g., database).IISOHardware GetISOHardware();
Returns the currentIISOHardwarerepresentation of the edited hardware.bool AllowStandin { get; set; }
Gets or sets whether “stand-in” (non-physical) hardware entries are permitted.void SetSLICE6TreeView(ISLICE6TreeView treeView, IHardwareListViewModel treeViewModel);
Injects the SLICE6 tree view and its view model for integration (e.g., module selection).ISLICE6TreeView SLICE6TreeView { get; }
Gets the currently assigned SLICE6 tree view instance.
IAddEditHardwareHardware
HardwareTypes HardwareType { get; set; }
Gets or sets the DAS hardware type (e.g., SLICE6, SLICEPROSIM).string SerialNumber { get; set; }
Gets or sets the DAS serial number.string FirmwareVersion { get; set; }
Gets or sets the DAS firmware version.string IPAddress { get; set; }
Gets or sets the DAS IP address (if supported).bool SupportsIPAddress { get; }
Gets whether the DAS type supports IP addressing.bool SupportsRackSize { get; }
Gets whether the DAS type supports rack size configuration.bool SupportsConfiguration { get; }
Gets whether the DAS type supports generic configuration.bool SupportsSLICEPROSIMConfiguration { get; }
Gets whether SLICEPROSIM-specific configuration is supported.bool SupportsSLICETCConfiguration { get; }
Gets whether SLICETC-specific configuration is supported.SLICEPROSIMConfigurations SLICEPROSIMConfiguration { get; set; }
Gets or sets the SLICEPROSIM configuration.SLICETCConfigurations SLICETCConfiguration { get; set; }
Gets or sets the SLICETC configuration.RackSizes RackSize { get; set; }
Gets or sets the rack size (if supported).ImageSource DASImage { get; }
Gets anImageSourcerepresenting the DAS unit visually.ObservableCollection<IAddEditHardwareDASModule> Modules { get; set; }
Gets or sets the collection of modules attached to this DAS.void RemoveModule(IAddEditHardwareDASModule module);
Removes a module from theModulescollection.void AddModule();
Adds a new module to theModulescollection (type inferred fromHardwareType).IISOHardware ToISOHardware();
Converts the current state to anIISOHardwareinstance for persistence or downstream use.bool StandIn { get; set; }
Gets or sets whether this is a stand-in (non-physical) hardware entry.bool IsModule { get; set; }
Gets or sets whether this instance represents a module (vs. a top-level DAS).bool IsAdd { get; set; }
Gets or sets whether this entry is new (true) or an update to an existing record (false).
3. Invariants
HardwareTypeandModuleTypemust be consistent withSLICEBridgeType(e.g., aSLICE6module must haveSLICEBridgeType == SLICE6).SerialNumbermust begin with the prefix returned byGetSerialNumberPrefix()for the module’sModuleType(enforced during validation, perValidate()).Modulescollection must not contain duplicate serial numbers (implied byValidate()andRemoveModule/AddModulesemantics).IsAddandIsModuleflags must be set correctly before callingSave()(e.g.,IsAdd = truefor new entries,IsModule = truefor child modules).StandInhardware entries must not require physical attributes like firmware version or IP address (handled viaSupports*properties and validation).ViewDbVersionmust match the database version at time of save (implied by naming and typical MVVM patterns for concurrency control).
4. Dependencies
- Depends on:
DTS.Common.Base(IBaseView,IBaseViewModel)DTS.Common.Enums.Hardware(HardwareTypes,RackSizes,SLICEPROSIMConfigurations,SLICETCConfigurations,SLICEBridgeTypes)DTS.Common.Interface.DASFactory.Diagnostics(IDASHardware,IISOHardware)DTS.Common.Interface.DASFactory.Diagnostics.HardwareList(IHardwareListViewModel,ISLICE6TreeView)System.Windows.Media(ImageSource)
- Depended on by:
- Likely concrete implementations of
IAddEditHardwareView,IAddEditHardwareViewModel, andIAddEditHardwareHardware(e.g., WPF views, view models, and domain models inDTS.Appor similar). - The broader diagnostics workflow (e.g.,
DASFactory.Diagnostics) consumesToISOHardware()andSave()outputs.
- Likely concrete implementations of
5. Gotchas
NotificationsOnis critical for avoiding spurious UI updates during initialization—failing to set it tofalseduringSetHardware()may cause validation errors or infinite loops.AddModule()does not take parameters—module type is inferred fromHardware.HardwareType, so callers must ensureHardwareTypeis set before callingAddModule().DASImageandModule.DASImageare read-only properties—images are likely computed/loaded internally (e.g., from resource paths) and cannot be directly assigned.IsModuleis distinct fromIsAdd:IsModule = trueindicates a child module, whileIsAddindicates whether the record is new. A module can be new (IsAdd = true) or updated (IsAdd = false).Validate()modifieserrors/warningsby reference—callers must initialize these lists before passing them.SLICE6TreeViewis optional—SetSLICE6TreeView()must be called explicitly for tree view integration; otherwise,SLICE6TreeViewremainsnull.- No explicit thread-safety guarantees—all interfaces assume single-threaded UI usage (standard for WPF MVVM).
None identified beyond the above.