This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
---
source_files:
- 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
generated_at: "2026-04-16T12:24:47.346735+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "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.

View File

@@ -0,0 +1,230 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/ISLICE6TreeView.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardwareListView.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardwareListSelectView.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardwareListOverdueView.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardwareListReplaceView.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/ISLICE6TreeNode.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardware.cs
- Common/DTS.CommonCore/Interface/Hardware/HardwareList/IHardwareListViewModel.cs
generated_at: "2026-04-16T12:25:52.763260+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0b794dc751ea2075"
---
# Hardware List Interfaces Documentation
## 1. Purpose
This module defines the contract layer for the Hardware List subsystem within the DTS (Data Acquisition System) diagnostics framework. It provides interfaces for managing hardware inventory, calibration tracking, and SLICE6/SLICE6DB device associations. The module follows the Model-View-ViewModel (MVVM) pattern, separating view concerns (`IHardwareListView`, `ISLICE6TreeView`, etc.) from business logic (`IHardwareListViewModel`) and domain entities (`IHardware`, `ISLICE6TreeNode`).
---
## 2. Public Interface
### View Interfaces (Markers)
All view interfaces extend `IBaseView` and serve as view contracts in the MVVM architecture:
| Interface | Namespace |
|-----------|-----------|
| `IHardwareListView` | `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` |
| `IHardwareListSelectView` | `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` |
| `IHardwareListOverdueView` | `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` |
| `IHardwareListReplaceView` | `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` |
| `ISLICE6TreeView` | `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` |
These interfaces define no additional members beyond inheriting `IBaseView`.
---
### `ISLICE6TreeNode`
Represents a node in the SLICE6 device tree hierarchy.
**Properties:**
| Name | Type | Access |
|------|------|--------|
| `DASId` | `int` | get/set |
| `SerialNumber` | `string` | get/set |
| `Port` | `int` | get/set |
| `PortString` | `string` | get only |
| `Number` | `int` | get/set |
| `PositionOnChain` | `int` | get/set |
| `PositionOnChainString` | `string` | get only |
---
### `IHardware`
Represents a hardware device in the inventory system.
**Properties:**
| Name | Type | Access |
|------|------|--------|
| `DASId` | `int` | get/set |
| `Disabled` | `bool` | get/set |
| `Included` | `bool` | get/set |
| `TestSampleRate` | `double` | get/set |
| `SerialNumber` | `string` | get/set |
| `HardwareType` | `string` | get/set |
| `ChannelCount` | `string` | get/set |
| `Firmware` | `string` | get/set |
| `MaxSampleRate` | `double?` | get/set |
| `CalDate` | `DateTime?` | get/set |
| `CalDueDate` | `DateTime?` | get/set |
| `Hardware` | `object` | get/set |
| `ParentDAS` | `string` | get/set |
| `PositionOnChain` | `int` | get/set |
| `PositionOnDistributor` | `int` | get/set |
| `Port` | `int` | get/set |
| `AnalogChannels` | `int` | get/set |
| `SquibChannels` | `int` | get/set |
| `DigitalInChannels` | `int` | get/set |
| `DigitalOutChannels` | `int` | get/set |
| `UartChannels` | `int` | get/set |
| `StreamOutChannels` | `int` | get/set |
| `StreamInChannels` | `int` | get/set |
| `IPAddress` | `string` | get/set |
| `FirstUseDate` | `DateTime?` | get/set |
| `IsFirstUseValid` | `bool` | get/set |
| `IsTSRAIR` | `bool` | get only |
| `PTPDomainID` | `byte` | get/set |
**Methods:**
| Signature | Description |
|-----------|-------------|
| `void SetIncluded(bool bIncluded)` | Sets the included state of the hardware |
| `void SetMixedRates(bool mixed)` | Sets mixed rate configuration |
| `bool Filter(string term)` | Filters hardware based on search term; returns match status |
| `void DetermineChannelCount(bool showCompact, IHardware[] allHardware)` | Determines channel count display text; `showCompact` controls whether SLICEPro units connected to ECMs are shown |
---
### `IHardwareListViewModel`
Main view model interface for hardware list management. Extends `IBaseViewModel` and `IFilterableListView`.
**Properties:**
| Name | Type | Access |
|------|------|--------|
| `SelectedSLICE6` | `ISLICE6TreeNode` | get/set |
| `AvailableSLICE6` | `ISLICE6TreeNode[]` | get/set |
| `SelectedSLICE6DB` | `IHardware` | get/set |
| `AvailableSLICE6DB` | `IHardware[]` | get/set |
| `IsEdit` | `bool` | get/set |
| `TDASCalPeriod` | `int` | get/set |
| `G5CalPeriod` | `int` | get/set |
| `SLICE1CalPeriod` | `int` | get/set |
| `SLICE1_5CalPeriod` | `int` | get/set |
| `SLICE2_CalPeriod` | `int` | get/set |
| `SLICE6_CalPeriod` | `int` | get/set |
| `POWERPRO_CalPeriod` | `int` | get/set |
| `SLICE6Air_CalPeriod` | `int` | get/set |
| `SLICE6DB_CalPeriod` | `int` | get/set |
| `TSRAir_CalPeriod` | `int` | get/set |
| `ReplaceView` | `IHardwareListReplaceView` | get/set |
| `View` | `IHardwareListView` | get/set |
| `OverdueView` | `IHardwareListOverdueView` | get/set |
| `SelectView` | `IHardwareListSelectView` | get/set |
| `SLICE6TreeView` | `ISLICE6TreeView` | get/set |
| `Hardware` | `IHardware[]` | get/set |
| `OverdueHardware` | `IHardware[]` | get/set |
| `HardwareInTest` | `IHardware[]` | get/set |
| `HardwareToReplace` | `IHardware` | get/set |
| `AvailableHardware` | `IHardware[]` | get/set |
| `ReplacementHardware` | `IHardware` | get/set |
| `TestAAFRateHzColumnWidth` | `int` | get/set |
| `TestSampleRateColumnWidth` | `int` | get/set |
| `TestClockMasterColumnWidth` | `int` | get/set |
| `PTPDomainColumnWidth` | `int` | get/set |
| `GetAAFForHardwareFunc` | `Func<SerializableAAF.DAS_TYPE, int, float>` | get/set |
| `ShowCompact` | `bool` | get/set |
| `SLICE6TreeNodes` | `ISLICE6TreeNode[]` | get/set |
**Methods:**
| Signature | Description |
|-----------|-------------|
| `void InitializeReplace(ITestSetup setup, IsoViewMode viewMode)` | Initializes replacement view for a given test setup |
| `void GetHardware(bool bIncludeModules, bool bIncludeOverdue, bool bIncludeBridges, int? testId, int? groupId)` | Retrieves hardware based on filter criteria |
| `void GetAvailableSampleRates(int[] availableSampleRates)` | Populates available sample rates |
| `void SetTestSampleRates(Dictionary<string, double> testSampleRates)` | Sets test sample rates by serial number |
| `void SetHasIncludedChildren()` | Updates included children state |
| `void UpdateTestSampleRate(string childSerialNumber, double testSampleRate)` | Updates sample rate for specific hardware |
| `void SetTestAAFRates(Dictionary<string, float> testAAFRates)` | Sets anti-alias filter rates |
| `void UpdateTestAAFilterRate(string childSerialNumber, float testAAFilterRate)` | Updates AAF rate for specific hardware |
| `void CheckForMixedDAS(string nonParentSerialNumber, double testSampleRate)` | Checks for mixed DAS configuration |
| `void SetParentMixedRates(string parentDAS, bool mixedRates)` | Sets mixed rate flag on parent DAS |
| `void SetTestClockProfiles(ClockSyncProfile masterProfile, ClockSyncProfile slaveProfile)` | Sets clock synchronization profiles |
| `void SetTestClockMasters(Dictionary<string, bool> testClockMasters)` | Sets clock master assignments |
| `void UpdateTestClockMaster(string childSerialNumber, bool testClockMaster)` | Updates clock master for specific hardware |
| `void SetTestPTPDomainIDs(Dictionary<string, byte> testPTPDomainIDs)` | Sets PTP domain IDs |
| `void UpdateTestPTPDomainID(string childSerialNumber, byte ptpDomainId)` | Updates PTP domain ID for specific hardware |
| `void Unset()` | Clears/resets view model state |
| `void Sort(object o, bool columnClick)` | Sorts hardware list |
| `void SortOverdue(object o, bool columnClick)` | Sorts overdue hardware list |
| `void SetIncluded(string[] serialNumbers, bool included)` | Sets included state for multiple hardware items |
| `void SetIncluded(int[] dasId)` | Sets included state by DAS ID array |
| `void Filter(string term)` | Filters the hardware list |
| `void MouseDoubleClick(int index)` | Handles double-click on hardware item |
| `void SetCache(IISOHardware[] hardware)` | Sets hardware cache |
| `void LoadTreeView(string serialNumber)` | Loads SLICE6 tree for given hardware serial number |
| `void Associate(ISLICE6TreeNode node)` | Associates SLICE6 with SLICE6DB (does not commit) |
| `void Associate(IHardware node)` | Associates units from one SLICE6DB with another (does not commit) |
| `void UnAssociate(ISLICE6TreeNode node)` | Removes SLICE6 association from SLICE6DB (does not commit) |
| `void SaveSLICE6Associations(string serialNumber)` | Commits SLICE6 association changes |
| `IHardware[] GetSelectedItems()` | Returns currently selected hardware items |
| `void Replace()` | Replaces `HardwareToReplace` with `ReplacementHardware` |
| `void SetCalPeriods(int g5CalPeriod, int slice1CalPeriod, int slice1_5CalPeriod, int slice2_CalPeriod, int slice6_CalPeriod, int tdasCalPeriod, int powerpro_CalPeriod, int slice6Air_CalPeriod, int slice6DB_CalPeriod, int tsrAir_CalPeriod, int slice6AirBridge_CalPeriod)` | Sets calibration periods for all hardware types |
---
## 3. Invariants
1. **FirstUseDate Validity**: `IHardware.FirstUseDate` is only meaningful when `IHardware.IsFirstUseValid` is `true`. A `null` `FirstUseDate` when `IsFirstUseValid` is `true` indicates the hardware has not been used since calibration.
2. **Association Operations**: The methods `Associate(ISLICE6TreeNode)`, `Associate(IHardware)`, and `UnAssociate(ISLICE6TreeNode)` perform in-memory modifications only. Changes must be persisted via `SaveSLICE6Associations(string serialNumber)`.
3. **Hardware Replacement**: The `Replace()` method requires both `HardwareToReplace` and `ReplacementHardware` to be set prior to invocation.
4. **View Mode Requirement**: `InitializeReplace` requires both a valid `ITestSetup` and `IsoViewMode` parameter.
---
## 4. Dependencies
### This module depends on:
- `DTS.Common.Base` - Provides `IBaseView`, `IBaseViewModel`
- `DTS.Common.Classes.Hardware` - Referenced in imports (specific types not visible in these files)
- `DTS.Common.Enums` - Provides `IsoViewMode` enum
- `DTS.Common.Interface.Pagination` - Provides `IFilterableListView`
- `DTS.Common.Interface.TestSetups.TestSetupsList` - Provides `ITestSetup`
- `System` - Core .NET types (`DateTime`, `Func`, `byte`)
- `System.Collections.Generic` - `Dictionary<>`
- `System.Collections.ObjectModel` - `ObservableCollection<>` (imported but not directly used in visible interfaces)
### Consumers of this module:
Cannot be determined from source alone. These are interface definitions; concrete implementations and consumers exist elsewhere in the codebase.
---
## 5. Gotchas
1. **Association Methods Don't Commit**: The `Associate` and `UnAssociate` methods explicitly state in their XML documentation that they "[do not commit]" changes. Developers must call `SaveSLICE6Associations` to persist changes.
2. **FirstUseDate Conditional Validity**: The `FirstUseDate` property has complex validity semantics tied to `IsFirstUseValid`. Code referencing 15524 DAS "First Use Date" feature should check `IsFirstUseValid` before relying on `FirstUseDate` values.
3. **SerializableAAF.DAS_TYPE Reference**: The `GetAAFForHardwareFunc` property references `SerializableAAF.DAS_TYPE`, which is not defined in these files. The location of this type is unclear from source alone.
4. **ClockSyncProfile Type Location**: The `SetTestClockProfiles` method uses `DTS.Common.ClockSyncProfile`, but the full namespace resolution and type definition are not visible in these files.
5. **IISOHardware vs IHardware**: The `SetCache` method accepts `IISOHardware[]`, which appears to be a different interface than `IHardware`. The relationship between these types is not defined in the provided source.