init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListShowCompactEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListEditHardwareEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareSelectedEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareReplaceEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareSavedEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareIncludedEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareTestPTPDomainIDEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareTestSampleRateEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareTestClockMasterEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Hardware/HardwareList/HardwareListHardwareTestAAFilterRateEvent.cs
|
||||
generated_at: "2026-04-16T02:49:11.648039+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "eb1cd97d7f791c3c"
|
||||
---
|
||||
|
||||
# Hardware List Events Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of Prism-based events used to communicate changes in hardware state and configuration within the hardware list UI and related components. It serves as the central event contract for operations such as toggling compact/expanded view, selecting hardware items, editing hardware, replacing hardware, saving hardware, including/excluding hardware, and modifying hardware test parameters (e.g., sample rate, PTP domain ID, clock master status, anti-aliasing filter rate). These events enable loose coupling between UI components (e.g., list view, detail panel) and backend logic handling hardware management in the DAS (Data Acquisition System) diagnostics context.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
All events inherit from `CompositePresentationEvent<TPayload>` (Prism), meaning they support multiple subscribers and are published on the event aggregator.
|
||||
|
||||
| Event Type | Payload Type | Description |
|
||||
|------------|--------------|-------------|
|
||||
| `HardwareListShowCompactEvent` | `bool` | Indicates whether the hardware list view should be shown in compact (`true`) or expanded (`false`) mode. |
|
||||
| `HardwareListEditHardwareEvent` | `string` | Indicates a request to edit hardware; payload is the serial number of the hardware to edit. |
|
||||
| `HardwareListHardwareSelectedEvent` | `string[]` | Indicates hardware selection; payload is an array of serial numbers of selected hardware items. |
|
||||
| `HardwareReplaceEvent` | `Tuple<IHardware, IHardware>` | Indicates a hardware replacement request; payload is a tuple of *(old hardware, new hardware)*. |
|
||||
| `HardwareSavedEvent` | `Tuple<int, string>` | Indicates hardware was added or updated; payload is *(database ID, serial number)*. |
|
||||
| `HardwareListHardwareIncludedEvent` | `HardwareListHardwareIncludedEventArgs` | Indicates inclusion/exclusion status of a hardware item changed; payload contains `SerialNumber`, `DASId`, and `Included` (boolean). |
|
||||
| `HardwareListHardwareTestPTPDomainIDEvent` | `HardwareListHardwareTestPTPDomainIDEventArgs` | Indicates the PTP domain ID for a hardware item in the current test was changed; payload contains `SerialNumber`, `DASId`, and `PTPDomainId` (byte). |
|
||||
| `HardwareListHardwareTestSampleRateEvent` | `HardwareListHardwareTestSampleRateEventArgs` | Indicates the sample rate for a hardware item in the current test was changed; payload contains `SerialNumber`, `DASId`, and `TestSampleRate` (double). |
|
||||
| `HardwareListHardwareTestClockMasterEvent` | `HardwareListHardwareTestClockMasterEventArgs` | Indicates the clock master status for a hardware item in the current test was changed; payload contains `SerialNumber`, `DASId`, and `IsClockMaster` (bool). |
|
||||
| `HardwareListHardwareTestAAFilterRateEvent` | `HardwareListHardwareTestAAFilterRateEventArgs` | Indicates the anti-aliasing filter rate for a hardware item in the current test was changed; payload contains `SerialNumber`, `DASId`, and `TestAAFilterRate` (float). |
|
||||
|
||||
### Event Argument Types (non-event classes)
|
||||
|
||||
| Type | Fields | Description |
|
||||
|------|--------|-------------|
|
||||
| `HardwareListHardwareIncludedEventArgs` | `string SerialNumber`, `int DASId`, `bool Included` | Encapsulates state change for hardware inclusion/exclusion. |
|
||||
| `HardwareListHardwareTestPTPDomainIDEventArgs` | `string SerialNumber`, `int DASId`, `byte PTPDomainId` | Encapsulates PTP domain ID change for a hardware item in a test. |
|
||||
| `HardwareListHardwareTestSampleRateEventArgs` | `string SerialNumber`, `int DASId`, `double TestSampleRate` | Encapsulates sample rate change for a hardware item in a test. |
|
||||
| `HardwareListHardwareTestClockMasterEventArgs` | `string SerialNumber`, `int DASId`, `bool IsClockMaster` | Encapsulates clock master status change for a hardware item in a test. |
|
||||
| `HardwareListHardwareTestAAFilterRateEventArgs` | `string SerialNumber`, `int DASId`, `float TestAAFilterRate` | Encapsulates anti-aliasing filter rate change for a hardware item in a test. |
|
||||
|
||||
> **Note**: All event argument classes have *read-only* properties (set only via constructor). All constructors require arguments in the order shown in the field list.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- All events are published on the Prism event aggregator and follow Prism’s `CompositePresentationEvent` semantics (thread-safe, multi-subscriber, async-safe).
|
||||
- Payloads are *never null* unless explicitly allowed by the type (e.g., `string[]` may be empty array, but `string` payload in `HardwareListEditHardwareEvent` is expected to be non-null and non-empty).
|
||||
- For events carrying `DASId`, the value is expected to be a valid identifier for a DAS unit in the system.
|
||||
- For events carrying `SerialNumber`, the value is expected to uniquely identify a hardware unit.
|
||||
- For test parameter events (`PTPDomainID`, `SampleRate`, `ClockMaster`, `AAFilterRate`), the change reflects the *current test configuration*, not necessarily the hardware’s persistent configuration.
|
||||
- `HardwareSavedEvent` payload: `int` is the database ID (assumed ≥ 0), `string` is the serial number (assumed non-null, non-empty).
|
||||
- `HardwareReplaceEvent` payload: `Tuple<IHardware, IHardware>` — first item is the hardware being replaced, second is the replacement. Both items are expected to be non-null and implement `IHardware` (from `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`).
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- `Microsoft.Practices.Prism.Events` — for `CompositePresentationEvent<T>`.
|
||||
- `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` — referenced in `HardwareListEditHardwareEvent`, `HardwareListHardwareSelectedEvent`, `HardwareReplaceEvent` (via `IHardware` interface).
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- UI components (e.g., `HardwareListViewModel`, `HardwareListView`) likely subscribe to these events to update UI state.
|
||||
- Backend services handling hardware CRUD, replacement, and test configuration likely publish these events.
|
||||
- Other modules in the diagnostics or hardware management subsystems may subscribe to events like `HardwareSavedEvent`, `HardwareReplaceEvent`, or test parameter change events to synchronize state.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Naming inconsistency**: `HardwareListHardwareSelectedEvent` is documented as “hardware was selected”, but `HardwareListHardwareIncludedEvent` has a *different* purpose (inclusion/exclusion toggle). The class name `HardwareListHardwareIncludedEvent` is correct, but its XML comment incorrectly says “hardware was selected” — same as `HardwareListHardwareSelectedEvent`. This may cause confusion.
|
||||
- **Redundant naming**: `HardwareListHardwareSelectedEvent` and `HardwareListHardwareIncludedEvent` both have XML comments stating “hardware was selected”, despite having different payloads and semantics.
|
||||
- **Payload ambiguity**: `HardwareSavedEvent` is documented as “hardware was added or updated”, but the name suggests only addition. Developers may assume it’s *only* for additions.
|
||||
- **Event naming vs. purpose**: `HardwareListEditHardwareEvent` uses `string` payload (serial number), but its XML comment says “hardware was selected”, which conflicts with `HardwareListHardwareSelectedEvent`. This suggests possible copy-paste error in documentation.
|
||||
- **Missing null checks**: No validation is enforced at the event level — subscribers must handle null/empty serial numbers, invalid `DASId`, or out-of-range test parameters.
|
||||
- **`IHardware` interface**: Not defined in this module — defined in `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`. Its contract (properties/methods) is not visible here; assume it contains hardware metadata (e.g., serial, model, status).
|
||||
- **No ordering guarantees**: Events are published asynchronously (Prism default). Subscribers must not assume ordering between events (e.g., `HardwareSavedEvent` may arrive before or after `HardwareListHardwareIncludedEvent` for the same hardware).
|
||||
- **`bool` in `HardwareListShowCompactEvent`**: `true` = compact, `false` = expanded. This is counter-intuitive (many would expect `true` = expanded), so care must be taken in UI binding.
|
||||
|
||||
None identified beyond the above.
|
||||
Reference in New Issue
Block a user