12 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T16:01:30.188313+00:00 | zai-org/GLM-5-FP8 | 1 | 516e7030d5d58a0c |
HardwareListViewModel Documentation
1. Purpose
HardwareListViewModel is the ViewModel for the Hardware List module in a WPF/Prism-based application. It manages the display, filtering, sorting, and manipulation of hardware devices (DAS units, SLICE modules, racks, etc.) within the system. The class handles hardware configuration including sample rates, anti-aliasing filter rates, clock synchronization, PTP domain IDs, calibration tracking, and SLICE6-to-SLICE6DB associations. It serves as the intermediary between hardware data models and the UI views, exposing bindable properties and commands for hardware management operations.
2. Public Interface
Constructor
public HardwareListViewModel(IHardwareListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
Initializes the ViewModel with its associated view, Prism region manager, event aggregator for pub/sub messaging, and Unity DI container. Sets up event subscriptions for RaiseNotification and BusyIndicatorChangeNotification events.
Properties
| Property | Type | Description |
|---|---|---|
View |
IHardwareListView |
The associated view, with DataContext set to this ViewModel |
OverdueView |
IHardwareListOverdueView |
View for overdue hardware display |
SelectView |
IHardwareListSelectView |
View for hardware selection |
ReplaceView |
IHardwareListReplaceView |
View for hardware replacement |
SLICE6TreeView |
ISLICE6TreeView |
Tree view for SLICE6/Slice 6 Air hardware hierarchy |
NotificationRequest |
InteractionRequest<Notification> |
Interaction request for showing notifications |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Interaction request for confirmations |
StreamingDSPProfile |
IStreamingFilterProfile |
Profile for DSP streaming filter calculations |
Hardware |
IHardware[] |
Array of hardware items for display |
OverdueHardware |
IHardware[] |
Array of hardware with overdue calibration |
SelectedHardwareItems |
ObservableCollection<IHardware> |
Currently selected hardware items |
ShowCompact |
bool |
Whether to show compact view (hides rack modules) |
IsBusy |
bool |
Busy indicator state for UI |
IsEdit |
bool |
Edit mode flag |
ListViewId |
string |
Returns "HardwareListView" |
Calibration Period Properties
public int TDASCalPeriod { get; set; }
public int G5CalPeriod { get; set; }
public int SLICE1CalPeriod { get; set; }
public int SLICE1_5CalPeriod { get; set; }
public int SLICE2_CalPeriod { get; set; }
public int SLICE6_CalPeriod { get; set; }
public int POWERPRO_CalPeriod { get; set; }
public int SLICE6Air_CalPeriod { get; set; }
public int SLICE6AirBridge_CalPeriod { get; set; }
public int SLICE6DB_CalPeriod { get; set; }
public int TSRAir_CalPeriod { get; set; }
public int SLICETC_CalPeriod { get; set; }
public int SLICE_PRO_CAN_FD_CalPeriod { get; set; }
Key Methods
Hardware Loading and Management
public void GetHardware(bool bIncludeModules, bool bIncludeOverdue, bool bIncludeBridges, int? testId, int? groupId)
Loads all DAS hardware from the system, applies filtering based on parameters, aggregates child module properties to parent devices, and populates Hardware and OverdueHardware arrays.
public void LoadTreeView(string serialNumber)
Loads SLICE6 tree nodes for a given serial number, populating SLICE6TreeNodes and AvailableSLICE6.
public void Unset()
Clears all hardware arrays, filters, cached data, and publishes ListViewStatusEvent with Unloaded status.
Sample Rate Methods
public void GetAvailableSampleRates(int[] availableSampleRates)
public void SetTestSampleRates(Dictionary<string, double> testSampleRates)
public void UpdateTestSampleRate(string childSerialNumber, double testSampleRate)
Manage sample rate configuration for hardware. SetTestSampleRates automatically selects the next highest available rate if a requested rate is unavailable (except for TSRAIR hardware).
Anti-Aliasing Filter Methods
public void SetTestAAFRates(Dictionary<string, float> testAAFRates)
public void UpdateTestAAFilterRate(string childSerialNumber, float testAAFilterRate)
public internal float GetAAFForHardware(IISOHardware h, int sampleRate)
Configure anti-aliasing filter rates. GetAAFForHardware routes to different AAF calculations based on DASTypeEnum (TDAS vs SLICE types).
public Func<SerializableAAF.DAS_TYPE, int, float> GetAAFForHardwareFunc { get; set; }
Injectable function for AAF calculation, allowing external implementation.
Clock and PTP Methods
public void SetTestClockProfiles(DTS.Common.ClockSyncProfile masterProfile, DTS.Common.ClockSyncProfile slaveProfile)
public void SetTestClockMasters(Dictionary<string, bool> testClockMasters)
public void UpdateTestClockMaster(string childSerialNumber, bool testClockMaster)
public void SetTestPTPDomainIDs(Dictionary<string, byte> testPTPDomainIDs)
public void UpdateTestPTPDomainID(string childSerialNumber, byte ptpDomainId)
Event Publishing Methods
public void FireAAFilterRate(IHardware hardware, string testAAFilterRate)
public void FireSampleRate(IHardware hardware, string testSampleRate)
public void FireClockMaster(IHardware hardware, bool isClockMaster)
public void FireIncluded(IHardware hardware)
public void FirePTPDomainID(IHardware hardware, byte ptpDomainID)
Publish corresponding Prism events via IEventAggregator.
Filtering and Sorting
public void Filter(string term)
public void Filter(object tag, string term)
public void Sort(object o, bool bColumnClick)
public void SortOverdue(object o, bool bColumnClick)
public void ClearAllFilters()
Hardware Replacement
public void InitializeReplace(ITestSetup testSetup, IsoViewMode viewMode)
public void Replace()
InitializeReplace prepares the replacement workflow by loading channel assignments. Replace executes the replacement and publishes HardwareReplaceEvent.
SLICE6 Association Methods
public void SaveSLICE6Associations(string serialNumber)
public void Associate(ISLICE6TreeNode node)
public void Associate(IHardware node)
public void UnAssociate(ISLICE6TreeNode node)
Manage SLICE6-to-SLICE6DB associations. Changes are in-memory until SaveSLICE6Associations is called.
Selection
public IHardware[] GetSelectedItems()
public void SetIncluded(string[] serialNumbers, bool included)
public void SetIncluded(int[] ids)
Nested Enum
public enum Fields
{
SerialNumber, HardwareType, IPAddress, ChannelCount, Firmware,
MaxSampleRate, TestSampleRate, CalDate, CalDueDate,
IsClockMaster, FirstUseDate, PTPDomainID
}
Used for field-specific filtering.
Event
public event PropertyChangedEventHandler PropertyChanged
public void OnPropertyChanged(string propertyName)
Standard INotifyPropertyChanged implementation.
3. Invariants
-
Selection Synchronization:
SelectedHardwareItemscollection changes triggerFireSelectionChanged(), which publishesHardwareListHardwareSelectedEventwith serial numbers, unlessSelectedItemsStatus.GetUpdating()returns true. -
Parent-Child Hardware Aggregation: In
GetHardware(), child module properties (channel counts, calibration dates, max sample rates) are aggregated to parent DAS devices. ParentMaxSampleRatetakes the minimum of children; parentCalDate/CalDueDatetakes the earliest date. -
Duplicate Prevention:
GetHardware()uses aHashSet<string>(processed) to prevent double-counting hardware by serial number during aggregation. -
Mixed Rate Detection: When a child's sample rate differs from siblings with the same
ParentDAS, the parent'sMixedRatesproperty is set totrue. -
Overdue Hardware Separation: Hardware with
CalDueDate <= DateTime.Todayis always added toOverdueHardwarearray regardless of other filters. -
Sort State Consistency:
_sortFieldand_sortAscendingtrack current sort state; clicking the same column toggles direction.
4. Dependencies
Imports (This Module Depends On)
DTS.Common.Classes.Hardware- Hardware data classesDTS.Common.Enums.Hardware- Hardware type enumerationsDTS.Common.Events/DTS.Common.Events.Hardware.HardwareList- Event definitionsDTS.Common.Interface.DASFactory.Diagnostics.HardwareList- Diagnostic interfacesDTS.Common.Interface.DASFactory.Diagnostics- DAS factory interfacesDTS.Common.Interface.TestSetups.TestSetupsList- Test setup interfacesDTS.Common.Enums/DTS.Common.Enums.DASFactory- EnumerationsDTS.Common.Utilities.Logging-APILoggerfor loggingDTS.Common.Classes.DSP- DSP-related classesDTS.Common.Interactivity-InteractionRequest,Notification,ConfirmationDTS.Common.ISO.Hardware- ISO hardware interfaces (referenced viaIISOHardware)HardareList.Model- Note: namespace appears to have a typo (missing 'w')Unity- IoC containerPrism.Regions/Prism.Events- Prism framework
Published Events (Consumed By Others)
HardwareListEditHardwareEventHardwareListHardwareTestAAFilterRateEventHardwareListHardwareTestSampleRateEventHardwareListHardwareTestClockMasterEventHardwareListHardwareIncludedEventHardwareListHardwareSelectedEventHardwareListHardwareTestPTPDomainIDEventHardwareReplaceEventHardwareListShowCompactEventListViewStatusEventPageErrorEvent
Subscribed Events
RaiseNotificationBusyIndicatorChangeNotification
5. Gotchas
-
Incomplete
SetCacheImplementation: The methodSetCache(IISOHardware[] hardware)only clears_cachedHardwarebut never populates it with the passed parameter. This appears to be incomplete functionality. -
Namespace Typo: The namespace
HardareList.Modelis imported (missing 'w' in "Hardware"), suggesting a historical naming inconsistency. -
IsDirtyNever Set: TheIsDirtyproperty is declared with a private setter but is never assignedtrueanywhere in the class. Its purpose is unclear from the source. -
Empty Lifecycle Methods:
Initialize(),Initialize(object),Initialize(object, object),InitializeAsync(),InitializeAsync(object),Activated(),Cleanup(), andCleanupAsync()all have empty orTask.CompletedTaskimplementations, suggesting either interface compliance or placeholder code. -
ReSharper Suppressions: The file includes
// ReSharper disabledirectives forCheckNamespace,MemberCanBePrivate.Global, andInconsistentNaming, indicating intentional deviations from standard conventions. -
TSRAIR Special Handling:
GetAvailableSampleRates()applies different valid sample rates (DFConstantsAndEnums.TSRAIR_ValidSampleRates) for TSRAIR hardware, andSetTestSampleRates()skips the "next highest rate" fallback for TSRAIR. -
AAF Rate Fallback Behavior: In
SetTestAAFRates(), if a serial number is missing from the dictionary, the code logs a warning, calculates a default AAF rate, and shows a user notification—but only on the first occurrence (shownflag). -
Module Visibility Logic: In
Filter(string term), whenShowCompactis true, modules with a non-emptyParentDASare excluded from the main list but still added toOverdueHardwareif calibration is overdue.