init
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Hardware/AddEditHardware/IAddEditHardwareView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/AddEditHardware/IAddEditHardwareDASModule.cs
|
||||
- Common/DTS.Common/Interface/Hardware/AddEditHardware/IAddEditHardwareViewModel.cs
|
||||
- Common/DTS.Common/Interface/Hardware/AddEditHardware/IAddEditHardwareHardware.cs
|
||||
generated_at: "2026-04-16T03:05:48.722310+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "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 an `ImageSource` representing 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 this `ModuleType` (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. Populates `errors`/`warnings` lists and optionally displays a dialog (`displayWindow`). Returns `true` if valid.
|
||||
- **`void PublishPageError(bool displayWindow, List<string> errors, List<string> warnings);`**
|
||||
Displays validation errors/warnings (e.g., via UI dialog or status bar) if `displayWindow` is `true`.
|
||||
- **`void Save();`**
|
||||
Commits changes to the underlying data store (e.g., database).
|
||||
- **`IISOHardware GetISOHardware();`**
|
||||
Returns the current `IISOHardware` representation 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 an `ImageSource` representing 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 the `Modules` collection.
|
||||
- **`void AddModule();`**
|
||||
Adds a new module to the `Modules` collection (type inferred from `HardwareType`).
|
||||
- **`IISOHardware ToISOHardware();`**
|
||||
Converts the current state to an `IISOHardware` instance 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
|
||||
- **`HardwareType` and `ModuleType` must be consistent with `SLICEBridgeType`** (e.g., a `SLICE6` module must have `SLICEBridgeType == SLICE6`).
|
||||
- **`SerialNumber` must begin with the prefix returned by `GetSerialNumberPrefix()` for the module’s `ModuleType`** (enforced during validation, per `Validate()`).
|
||||
- **`Modules` collection must not contain duplicate serial numbers** (implied by `Validate()` and `RemoveModule`/`AddModule` semantics).
|
||||
- **`IsAdd` and `IsModule` flags must be set correctly before calling `Save()`** (e.g., `IsAdd = true` for new entries, `IsModule = true` for child modules).
|
||||
- **`StandIn` hardware entries must not require physical attributes like firmware version or IP address** (handled via `Supports*` properties and validation).
|
||||
- **`ViewDbVersion` must 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`, and `IAddEditHardwareHardware` (e.g., WPF views, view models, and domain models in `DTS.App` or similar).
|
||||
- The broader diagnostics workflow (e.g., `DASFactory.Diagnostics`) consumes `ToISOHardware()` and `Save()` outputs.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **`NotificationsOn` is critical for avoiding spurious UI updates during initialization**—failing to set it to `false` during `SetHardware()` may cause validation errors or infinite loops.
|
||||
- **`AddModule()` does not take parameters**—module type is inferred from `Hardware.HardwareType`, so callers must ensure `HardwareType` is set *before* calling `AddModule()`.
|
||||
- **`DASImage` and `Module.DASImage` are read-only properties**—images are likely computed/loaded internally (e.g., from resource paths) and cannot be directly assigned.
|
||||
- **`IsModule` is distinct from `IsAdd`**: `IsModule = true` indicates a child module, while `IsAdd` indicates whether the record is new. A module can be new (`IsAdd = true`) or updated (`IsAdd = false`).
|
||||
- **`Validate()` modifies `errors`/`warnings` by reference**—callers must initialize these lists before passing them.
|
||||
- **`SLICE6TreeView` is optional**—`SetSLICE6TreeView()` must be called explicitly for tree view integration; otherwise, `SLICE6TreeView` remains `null`.
|
||||
- **No explicit thread-safety guarantees**—all interfaces assume single-threaded UI usage (standard for WPF MVVM).
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/ISLICE6TreeView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardwareListView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardwareListOverdueView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardwareListReplaceView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardwareListSelectView.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/ISLICE6TreeNode.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardware.cs
|
||||
- Common/DTS.Common/Interface/Hardware/HardwareList/IHardwareListViewModel.cs
|
||||
generated_at: "2026-04-16T03:06:05.557409+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a6c557fc6025ec40"
|
||||
---
|
||||
|
||||
# HardwareList
|
||||
|
||||
## Documentation: Hardware List Module (DTS.Common.Interface.DASFactory.Diagnostics.HardwareList)
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module defines the interfaces for a hardware management and diagnostics view layer in the DASFactory system, specifically supporting the display, selection, association, and replacement of hardware units (e.g., DAS units, SLICE6 modules, bridges) within test setups. It provides a structured abstraction for UI components (views) and their corresponding state and logic (view model), enabling operations such as filtering, sorting, calibration tracking, sample rate configuration, clock synchronization (PTP), and hardware tree navigation (e.g., SLICE6 units associated with a SLICE6DB). Its role is to decouple UI rendering from business logic while supporting multiple specialized views (e.g., overdue, replace, select, tree) for different hardware management workflows.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### Interfaces (All in namespace `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`)
|
||||
|
||||
| Interface | Signature | Behavior |
|
||||
|-----------|-----------|----------|
|
||||
| **`ISLICE6TreeView`** | `interface ISLICE6TreeView : IBaseView` | Represents the view responsible for rendering the SLICE6 hardware tree. No additional behavior beyond `IBaseView`. |
|
||||
| **`IHardwareListView`** | `interface IHardwareListView : IBaseView` | General-purpose view for displaying the main hardware list. No additional behavior beyond `IBaseView`. |
|
||||
| **`IHardwareListOverdueView`** | `interface IHardwareListOverdueView : IBaseView` | View for displaying hardware with overdue calibration. No additional behavior beyond `IBaseView`. |
|
||||
| **`IHardwareListReplaceView`** | `interface IHardwareListReplaceView : IBaseView` | View for the hardware replacement workflow. No additional behavior beyond `IBaseView`. |
|
||||
| **`IHardwareListSelectView`** | `interface IHardwareListSelectView : IBaseView` | View for selecting hardware. Includes `InitializeColumns(bool bSteamingTest)` to configure column layout based on streaming test mode. |
|
||||
| **`ISLICE6TreeNode`** | `interface ISLICE6TreeNode` | Represents a SLICE6 unit node in a tree. Properties: `DASId`, `SerialNumber`, `Port`, `PortString` (read-only), `Number`, `PositionOnChain`, `PositionOnChainString` (read-only). |
|
||||
| **`IHardware`** | `interface IHardware` | Represents a hardware unit (e.g., DAS, SLICE6, bridge). Includes properties for identification (`DASId`, `SerialNumber`, `HardwareType`, `IPAddress`), configuration (`Disabled`, `Included`, `DSPStreamingFilter`, `TestSampleRate`, `PTPDomainID`), calibration (`CalDate`, `CalDueDate`, `FirstUseDate`, `IsFirstUseValid`), channel counts (`AnalogChannels`, `SquibChannels`, etc.), and methods: `SetIncluded`, `SetMixedRates`, `Filter`, `DetermineChannelCount`. |
|
||||
| **`IHardwareListViewModel`** | `interface IHardwareListViewModel : IBaseViewModel, IFilterableListView` | Core view model managing hardware state, associations, and view coordination. Key members: <br>• **Properties**: `SelectedSLICE6`, `AvailableSLICE6`, `SelectedSLICE6DB`, `AvailableSLICE6DB`, `Hardware`, `OverdueHardware`, `HardwareInTest`, `HardwareToReplace`, `AvailableHardware`, `ReplacementHardware`, `SLICE6TreeNodes`, `ShowCompact`, `TestAAFRateHzColumnWidth`, `TestSampleRateColumnWidth`, `TestClockMasterColumnWidth`, `PTPDomainColumnWidth`, `TDASCalPeriod`, `G5CalPeriod`, etc. <br>• **Methods**: `InitializeReplace`, `GetHardware`, `GetAvailableSampleRates`, `SetTestSampleRates`, `UpdateTestSampleRate`, `SetTestAAFRates`, `UpdateTestAAFilterRate`, `SetTestClockProfiles`, `SetTestClockMasters`, `UpdateTestClockMaster`, `SetTestPTPDomainIDs`, `UpdateTestPTPDomainID`, `CheckForMixedDAS`, `SetParentMixedRates`, `SetIncluded`, `Filter`, `Sort`, `SortOverdue`, `LoadTreeView`, `Associate`, `UnAssociate`, `SaveSLICE6Associations`, `Replace`, `SetCalPeriods`, `GetSelectedItems`, `SetCache`, `Unset`. |
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`IHardware.Included` and `IHardware.Disabled`**: These boolean flags are mutable via `SetIncluded(bool)` and direct property assignment. Their semantics are not explicitly defined in the source, but `SetIncluded` is provided as a dedicated method, suggesting it may trigger additional logic (e.g., cascading updates).
|
||||
- **`IHardware.DetermineChannelCount`**: The `ChannelCount` string is *not* auto-updated; it must be explicitly set via `DetermineChannelCount(bool showCompact, IHardware[] allHardware)`. The `showCompact` parameter controls whether SLICEPro units connected to ECMs are omitted.
|
||||
- **`IHardware.FirstUseDate` and `IsFirstUseValid`**: `FirstUseDate` is only meaningful when `IsFirstUseValid` is `true`. A `null` value for `FirstUseDate` indicates the hardware has not been used since calibration.
|
||||
- **`ISLICE6TreeNode` association**: `SLICE6TreeNodes` is populated by `LoadTreeView(string serialNumber)`. Associations (`Associate`, `UnAssociate`) are *not* committed until `SaveSLICE6Associations(string serialNumber)` is called.
|
||||
- **`IHardwareListViewModel` state**: The `IsEdit` flag is exposed but not defined in behavior; its usage is implied to control edit vs. read-only mode.
|
||||
- **`IBaseView` and `IBaseViewModel` inheritance**: All views and the view model derive from `DTS.Common.Base.IBaseView` and `IBaseViewModel` respectively, implying standard lifecycle/interaction patterns (e.g., initialization, binding) are expected but not detailed here.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **Core types**: `System`, `System.Collections.Generic`, `System.Collections.ObjectModel`
|
||||
- **Base layer**: `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`)
|
||||
- **DSP & hardware classes**: `DTS.Common.Classes.DSP` (`IStreamingFilterProfile`), `DTS.Common.Classes.Hardware` (`IISOHardware`)
|
||||
- **Enums**: `DTS.Common.Enums` (e.g., `IsoViewMode`)
|
||||
- **Pagination**: `DTS.Common.Interface.Pagination` (for `IFilterableListView`)
|
||||
- **Test setups**: `DTS.Common.Interface.TestSetups.TestSetupsList` (`ITestSetup`)
|
||||
- **Clock sync**: `DTS.Common.ClockSyncProfile` (used in `SetTestClockProfiles`)
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- **UI layer**: Concrete implementations of `IHardwareListView`, `IHardwareListOverdueView`, `IHardwareListReplaceView`, `IHardwareListSelectView`, `ISLICE6TreeView` (e.g., WPF/WinForms views).
|
||||
- **View model consumers**: Controllers or presenters that use `IHardwareListViewModel` to drive hardware management workflows.
|
||||
- **Hardware data sources**: Code that populates `IHardware[]` and `ISLICE6TreeNode[]` arrays (e.g., data access or service layers).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **`IHardwareListSelectView.InitializeColumns(bool bSteamingTest)`**: The parameter name `bSteamingTest` appears to be a typo for `bStreamingTest`. This could cause confusion during implementation or maintenance.
|
||||
- **`IHardware.DetermineChannelCount`**: The method *does not* automatically update `ChannelCount`; callers must ensure it is invoked after hardware changes to keep the display accurate.
|
||||
- **`SLICE6` association workflow**: `Associate`/`UnAssociate` operations are *not* committed to persistent storage until `SaveSLICE6Associations` is called. This two-step process (select → save) is critical to avoid data loss.
|
||||
- **`HardwareToReplace` vs. `ReplacementHardware`**: The `Replace()` method uses `HardwareToReplace` (the unit being replaced) and `ReplacementHardware` (the new unit). Confusing these could lead to incorrect replacements.
|
||||
- **`ShowCompact` flag**: Controls whether rack modules (e.g., SLICEPro units connected to ECMs) are shown in `ChannelCount` and possibly the UI. Its effect is limited to `DetermineChannelCount` per the XML comment.
|
||||
- **`GetHardware` parameters**: The `bIncludeModules`, `bIncludeOverdue`, `bIncludeBridges`, `testId`, and `groupId` parameters suggest flexible filtering, but their exact semantics (e.g., how `groupId` relates to test setups) are not documented in the interface.
|
||||
- **`SetTestSampleRates` vs. `UpdateTestSampleRate`**: `SetTestSampleRates` takes a `Dictionary<string, double>` (likely bulk initialization), while `UpdateTestSampleRate` updates a single unit. Mixing them carelessly could cause state inconsistencies.
|
||||
- **`CheckForMixedDAS` and `SetParentMixedRates`**: These methods suggest support for mixed sample rates within a DAS chain, but the logic for detecting/propagating mixed rates is not visible here. Callers must ensure correct ordering (e.g., `SetParentMixedRates` after `CheckForMixedDAS`).
|
||||
- **`PTPDomainID` type**: Defined as `byte`, but no range validation is visible in the interface. Implementers must ensure values are within valid PTP domain ranges (typically 0–127).
|
||||
|
||||
*None identified from source alone.*
|
||||
Reference in New Issue
Block a user