init
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/TestSetups/Imports/TTS/LevelTrigger/ILevelTriggerView.cs
|
||||
- Common/DTS.Common/Interface/TestSetups/Imports/TTS/LevelTrigger/ILevelTriggerViewModel.cs
|
||||
- Common/DTS.Common/Interface/TestSetups/Imports/TTS/LevelTrigger/ILevelTrigger.cs
|
||||
generated_at: "2026-04-16T03:12:36.684994+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "514ecd9d78491b12"
|
||||
---
|
||||
|
||||
# LevelTrigger
|
||||
|
||||
## Documentation: Level Trigger Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module defines the core interfaces for the *Level Trigger* functionality within the TTS (presumably *Test Trigger System*) import subsystem. It establishes the contract for modeling a level-triggering mechanism—likely used to initiate or control test sequences based on signal thresholds—by decoupling data (via `ILevelTrigger`), view-model (via `ILevelTriggerViewModel`), and view (via `ILevelTriggerView`) concerns. The module serves as a foundational abstraction for UI and logic layers to interact with level-trigger configurations, including channel assignment, threshold values (in % and engineering units), and metadata like hardware serial numbers and channel counts.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ILevelTriggerView`
|
||||
- **Definition**: `public interface ILevelTriggerView : IBaseView { }`
|
||||
- **Behavior**: A marker interface extending `IBaseView`, representing the view layer for the level trigger UI component. No additional members are defined—its purpose is structural separation within the MVVM pattern.
|
||||
|
||||
#### `ILevelTriggerViewModel`
|
||||
- **Definition**: `public interface ILevelTriggerViewModel : IBaseViewModel`
|
||||
- `ILevelTriggerView View { get; set; }`
|
||||
- **Behavior**: Extends `IBaseViewModel` and binds to an `ILevelTriggerView` instance. The `View` property enables two-way binding or manual assignment between the view and view-model layers.
|
||||
|
||||
#### `ILevelTrigger`
|
||||
- **Definition**: `public interface ILevelTrigger`
|
||||
- **Properties**:
|
||||
- `string Code { get; }` — Identifier for the level trigger configuration.
|
||||
- `string JCode { get; }` — Secondary identifier (possibly job- or project-specific).
|
||||
- `double ValuePercent { get; set; }` — Trigger threshold as a percentage (e.g., 0–100).
|
||||
- `double ValueEU { get; set; }` — Trigger threshold in engineering units (e.g., volts, PSI).
|
||||
- `string EULabel { get; }` — Human-readable label for the engineering unit (e.g., `"V"`, `"psi"`).
|
||||
- `string HWSerialNumber { get; }` — Serial number of the associated hardware device.
|
||||
- `int ChannelNumber { get; }` — Number of channels supported or currently in use.
|
||||
- `ITTSChannelRecord Channel { get; set; }` — The *currently assigned* channel for triggering.
|
||||
- `ITTSSetup TestSetup { get; }` — Reference to the parent test setup containing this trigger.
|
||||
- `ITTSChannelRecord[] AvailableChannels { get; }` — List of channels eligible for assignment.
|
||||
- `bool IsActive { get; }` — Indicates whether the level trigger is currently active/enabled.
|
||||
- `bool IsModified { get; set; }` — Flag indicating whether the configuration has unsaved changes.
|
||||
- **Methods**:
|
||||
- `void Refresh()` — Updates the `AvailableChannels` collection and potentially reassigns `Channel` (e.g., if current channel becomes unavailable).
|
||||
- `void Add(ITTSChannelRecord channel)` — Adds a channel to the `AvailableChannels` list.
|
||||
- `void Remove(ITTSChannelRecord channel)` — Removes a channel from `AvailableChannels`; if `Channel == channel`, it is unassigned.
|
||||
- `byte[] GetBytes()` — Returns a deterministic byte sequence for hashing (e.g., for change detection or serialization).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `Channel` must be `null` or an element of `AvailableChannels`.
|
||||
- `ChannelNumber` reflects the count of channels in `AvailableChannels` (though not explicitly enforced—implementation-dependent).
|
||||
- `ValuePercent` and `ValueEU` represent the *same* threshold in different units; consistency between them is expected but not enforced by the interface.
|
||||
- `IsActive` and `IsModified` are independent flags; `IsModified` does not imply `IsActive`, and vice versa.
|
||||
- `Refresh()` must ensure `AvailableChannels` is up-to-date and `Channel` remains valid (or becomes `null` if no valid channel remains).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### *This module depends on*:
|
||||
- `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`)
|
||||
- `DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile` (for `ITTSChannelRecord`, `ITTSSetup`)
|
||||
|
||||
#### *This module is depended on by*:
|
||||
- UI layers (via `ILevelTriggerView` and `ILevelTriggerViewModel`)
|
||||
- Logic layers managing test setup configurations (via `ILevelTrigger`)
|
||||
- Serialization/hashing utilities (via `GetBytes()`)
|
||||
|
||||
*Note*: Concrete implementations of `ITTSChannelRecord` and `ITTSSetup` are defined in the referenced namespace (`DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile`), but their details are not included here.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Ambiguity in `ChannelNumber`**: The interface does not clarify whether `ChannelNumber` represents the *total capacity* of the hardware or the *current count* of `AvailableChannels`.
|
||||
- **No validation on `ValuePercent`/`ValueEU`**: The interface allows arbitrary `double` values; implementations must enforce ranges (e.g., 0–100 for `%`).
|
||||
- **`Refresh()` semantics**: The summary states it "updates available channels and Channel", but does not specify whether `Channel` is reset to `null` if no valid channel remains, or if it attempts to preserve the current assignment.
|
||||
- **`IsModified` lifecycle**: The interface exposes `IsModified` as a settable property, but does not define when it should be set (e.g., by user input, programmatic changes, or explicit save events).
|
||||
- **No thread-safety guarantees**: All members are non-atomic; concurrent access to `Channel`, `AvailableChannels`, or `IsModified` may require external synchronization.
|
||||
- **None identified from source alone** for `ILevelTriggerView` and `ILevelTriggerViewModel` beyond structural MVVM assumptions.
|
||||
Reference in New Issue
Block a user