6.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:12:36.684994+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 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 : IBaseViewModelILevelTriggerView View { get; set; }
- Behavior: Extends
IBaseViewModeland binds to anILevelTriggerViewinstance. TheViewproperty 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 theAvailableChannelscollection and potentially reassignsChannel(e.g., if current channel becomes unavailable).void Add(ITTSChannelRecord channel)— Adds a channel to theAvailableChannelslist.void Remove(ITTSChannelRecord channel)— Removes a channel fromAvailableChannels; ifChannel == channel, it is unassigned.byte[] GetBytes()— Returns a deterministic byte sequence for hashing (e.g., for change detection or serialization).
- Properties:
3. Invariants
Channelmust benullor an element ofAvailableChannels.ChannelNumberreflects the count of channels inAvailableChannels(though not explicitly enforced—implementation-dependent).ValuePercentandValueEUrepresent the same threshold in different units; consistency between them is expected but not enforced by the interface.IsActiveandIsModifiedare independent flags;IsModifieddoes not implyIsActive, and vice versa.Refresh()must ensureAvailableChannelsis up-to-date andChannelremains valid (or becomesnullif no valid channel remains).
4. Dependencies
This module depends on:
DTS.Common.Base(forIBaseView,IBaseViewModel)DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile(forITTSChannelRecord,ITTSSetup)
This module is depended on by:
- UI layers (via
ILevelTriggerViewandILevelTriggerViewModel) - 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 whetherChannelNumberrepresents the total capacity of the hardware or the current count ofAvailableChannels. - No validation on
ValuePercent/ValueEU: The interface allows arbitrarydoublevalues; implementations must enforce ranges (e.g., 0–100 for%). Refresh()semantics: The summary states it "updates available channels and Channel", but does not specify whetherChannelis reset tonullif no valid channel remains, or if it attempts to preserve the current assignment.IsModifiedlifecycle: The interface exposesIsModifiedas 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, orIsModifiedmay require external synchronization. - None identified from source alone for
ILevelTriggerViewandILevelTriggerViewModelbeyond structural MVVM assumptions.