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,36 @@
---
source_files:
- Common/DTS.CommonCore/Attributes/VersionAttribute.cs
generated_at: "2026-04-16T02:14:13.867408+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "97df6c62ae44caee"
---
# Attributes
### 1. **Purpose**
This module defines a custom .NET attribute, `VersionAttribute`, used to annotate types (e.g., classes, interfaces, structs) with an explicit version number. Its role is to enable runtime version metadata inspection—typically for serialization compatibility checks, schema evolution, or API versioning—by attaching a compile-time or design-time version identifier to types in the `DTS.CommonCore` library.
### 2. **Public Interface**
- **`class VersionAttribute : Attribute`**
A custom attribute class for associating an integer version with a type.
- **Constructor**: `VersionAttribute(int version)`
Initializes the attribute with the specified `version`.
- **Property**: `int Version { get; }`
Gets the version number supplied during construction. Read-only after initialization.
### 3. **Invariants**
- `Version` is immutable after construction: the setter is `private`, so it can only be assigned in the constructor.
- The `version` parameter passed to the constructor must be a valid `int`; no validation is performed (e.g., no enforcement of non-negativity or upper bound).
- The attribute is intended for use on *types* (as per .NET `AttributeUsage` defaults), though no explicit `AttributeUsage` declaration is present—this means it applies to all program elements by default (including assemblies, modules, parameters, etc.), per .NET conventions.
### 4. **Dependencies**
- **Dependencies**: Only depends on `System` (specifically `System.Attribute`). No external or project-specific dependencies.
- **Depended on by**: Inferred from the namespace (`DTS.Common.Attributes`) and naming—likely consumed by reflection-based tooling (e.g., serializers, migration frameworks, or API gateways) within the broader `DTS.CommonCore` codebase, though no direct consumers are visible in this file.
### 5. **Gotchas**
- **Missing `AttributeUsage`**: The attribute lacks an explicit `[AttributeUsage(...)]` declaration. By default, it can be applied to *any* program element (not just types), which may be unintended. If intended only for types, this is a potential source of misuse.
- **No version semantics defined**: The attribute stores an `int` but does not enforce or document what the version represents (e.g., major.minor, schema revision, or internal counter). Consumers must infer semantics externally.
- **No version comparison helpers**: The attribute provides no methods (e.g., `CompareTo`, `IsCompatibleWith`)—consumers must implement their own version logic.
- **None identified from source alone.**

View File

@@ -0,0 +1,175 @@
---
source_files:
- Common/DTS.CommonCore/Base/Classes/BasePropertyChanged.cs
- Common/DTS.CommonCore/Base/Classes/DisplayResourceAttribute.cs
- Common/DTS.CommonCore/Base/Classes/DescriptionResourceAttribute.cs
- Common/DTS.CommonCore/Base/Classes/DynamicTypeDescriptor.cs
generated_at: "2026-04-16T02:51:28.846308+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e84e534d3f8838df"
---
# Classes
## Documentation: `DTS.Common.Base` Module Property Change Notification & Dynamic Type Descriptor Infrastructure
---
### 1. **Purpose**
This module provides foundational infrastructure for property change notification and dynamic runtime customization of object metadata—primarily to support UI frameworks like `PropertyGrid` where static attributes (e.g., `DisplayName`, `Description`) must be overridden or extended at runtime. It includes a base class (`BasePropertyChanged`) for implementing `INotifyPropertyChanged`, and two custom attribute classes (`DisplayResourceAttribute`, `DescriptionResourceAttribute`) that delegate display strings to localized resources via `Strings.Strings.ResourceManager`. Additionally, `DynamicTypeDescriptor` enables dynamic modification of property metadata (e.g., browsability, display name, category) for objects, especially useful for types like Entity Framework proxies where attributes cannot be applied directly.
---
### 2. **Public Interface**
#### `BasePropertyChanged`
- **`event PropertyChangedEventHandler PropertyChanged`**
Virtual event for property change notifications. Subclasses may override to customize notification behavior.
- **`bool SetProperty<T>(ref T storage, T value, string propertyName = null)`**
Compares `storage` and `value` for equality; if different, updates `storage`, invokes `OnPropertyChanged`, and returns `true`. Returns `false` if values are equal. Used to implement `INotifyPropertyChanged` concisely.
- **`virtual void OnPropertyChanged(string propertyName = null)`**
Raises the `PropertyChanged` event with the given property name. If `propertyName` is `null`, raises `PropertyChangedEventArgs.Empty`.
#### `DisplayResourceAttribute`
- **`DisplayResourceAttribute(string resourceId)`**
Constructor. Stores `resourceId` for later lookup in `Strings.Strings.ResourceManager`.
- **`override string DisplayName`**
Returns the localized string from `Strings.Strings.ResourceManager.GetString(resourceId)`, or `"##ResourceNotFound##" + resourceId` if not found.
#### `DescriptionResourceAttribute`
- **`DescriptionResourceAttribute(string resourceId)`**
Constructor. Stores `resourceId` for later lookup in `Strings.Strings.ResourceManager`.
- **`override string Description`**
Returns the localized string from `Strings.Strings.ResourceManager.GetString(resourceId)`, or `"##DescriptionNotFound##" + resourceId` if not found.
#### `DynamicTypeDescriptor`
- **`DynamicTypeDescriptor(Type type)`**
Constructor. Initializes internal state by querying `TypeDescriptor` for the given `type`. Filters out non-browsable properties. Stores original properties, type converter, default event/property, and editors.
- **`T GetPropertyValue<T>(string name, T defaultValue)`**
Retrieves the value of the property named `name` from the current `Component`, casting to `T`. Returns `defaultValue` on failure or if property not found.
- **`void SetPropertyValue(string name, object value)`**
Sets the value of the property named `name` on the current `Component`. No-op if property not found.
- **`DynamicProperty AddProperty(Type type, string name, object value, string displayName, string description, string category, bool hasDefaultValue, object defaultValue, bool readOnly, Type uiTypeEditor)`**
Creates and adds a new `DynamicProperty` with specified metadata. Overload omits `uiTypeEditor` (defaults to `null`).
- **`void AddProperty(PropertyDescriptor property)`**
Adds a pre-constructed `PropertyDescriptor` (e.g., `DynamicProperty`) to the `Properties` collection.
- **`void RemoveProperty(string name)`**
Removes the property named `name` from the `Properties` collection.
- **`DynamicTypeDescriptor FromComponent(object component)`**
Creates a new `DynamicTypeDescriptor` instance bound to `component`, copying original metadata and creating `DynamicProperty` wrappers for each property. Requires `component` to be assignable to the original `_type`.
- **`event PropertyChangedEventHandler PropertyChanged`**
Implements `INotifyPropertyChanged`. Raised internally via `OnValueChanged(PropertyDescriptor)` when a property value changes.
- **`PropertyDescriptorCollection Properties { get; }`**
Mutable collection of *browsable* properties (original + dynamically added/modified). Non-browsable properties are excluded during construction.
- **`PropertyDescriptorCollection OriginalProperties { get; }`**
Immutable snapshot of the original properties (including non-browsable ones) as returned by `TypeDescriptor.GetProperties(type)`.
- **`object Component { get; }`**
The object instance whose properties are being described. Set only during `FromComponent`.
- **`string ClassName { get; set; }` / `string ComponentName { get; set; }`**
Overridable display names for the type and component, respectively, used in `ICustomTypeDescriptor.GetClassName()`/`GetComponentName()`.
#### `DynamicTypeDescriptor.DynamicProperty`
- **`DynamicProperty(DynamicTypeDescriptor descriptor, Type type, object value, string name, Attribute[] attrs)`**
Internal constructor for a new dynamic property (not tied to an existing property descriptor).
- **`DynamicProperty(DynamicTypeDescriptor descriptor, PropertyDescriptor existing, object component)`**
Internal constructor wrapping an *existing* property descriptor, capturing its value and attributes.
- **`void SetDisplayName(string displayName)` / `void SetDescription(string description)` / `void SetCategory(string category)`**
Overrides the corresponding property metadata (e.g., `DisplayName`, `Description`, `Category`) for this dynamic property.
- **`void SetBrowsable(bool browsable)` / `void SetIsReadOnly(bool readOnly)`**
Overrides `IsBrowsable` and `IsReadOnly` behavior.
- **`void RemoveAttributesOfType<T>()`**
Removes all attributes of type `T` (or derived) from the internal `_attributes` list.
- **`IList<Attribute> AttributesList { get; }`**
Exposes the internal list of attributes for inspection/modification.
- **`override object GetValue(object component)` / `override void SetValue(object component, object value)`**
Gets/sets the property value. If wrapping an `_existing` property, delegates to it; otherwise uses the internal `Value` field.
- **`override void ResetValue(object component)`**
Resets value to default (if `_existing` exists, delegates; otherwise uses `_defaultValue` or `Value`).
- **`override bool IsBrowsable` / `override bool IsReadOnly` / `override string DisplayName` / `override string Description` / `override string Category`**
Returns overridden values if set; otherwise falls back to base implementation or wrapped `_existing` property.
---
### 3. **Invariants**
- **`BasePropertyChanged.SetProperty`**
- Only raises `PropertyChanged` if `storage` and `value` are *not* equal (via `Equals`).
- `storage` is updated *before* `OnPropertyChanged` is called.
- **`DynamicTypeDescriptor`**
- `Properties` collection excludes non-browsable properties *at construction time* (via `if (!property.IsBrowsable) continue;`).
- `FromComponent` performs a *shallow copy* of internal state (e.g., `_editors`, `_typeConverter`), but creates *new* `DynamicProperty` instances per property.
- `DynamicProperty` overrides metadata *only if explicitly set* via `Set*` methods; otherwise falls back to original or base behavior.
- `DynamicTypeDescriptor` implements `ICustomTypeDescriptor` and `INotifyPropertyChanged`—consumers may rely on both interfaces.
- **`DisplayResourceAttribute` / `DescriptionResourceAttribute`**
- `DisplayName`/`Description` always returns a non-null string: either the localized value or a fallback marker (`##ResourceNotFound##`/`##DescriptionNotFound##`) concatenated with the `resourceId`.
- Resource lookup uses `Strings.Strings.ResourceManager.GetString(resourceId)`—*no* automatic suffixing (e.g., `"PropertyName_Description"` must be the exact `resourceId` passed to the constructor).
---
### 4. **Dependencies**
- **Internal Dependencies**
- `System.ComponentModel` (`INotifyPropertyChanged`, `PropertyChangedEventHandler`, `Attribute`, `PropertyDescriptor`, etc.).
- `Strings.Strings.ResourceManager` (from `DTS.Common` resources) for `DisplayResourceAttribute` and `DescriptionResourceAttribute`.
- `System.Drawing.Design` (`UITypeEditor`, `EditorAttribute`) for editor support in `DynamicTypeDescriptor`.
- **External Dependencies**
- `DynamicTypeDescriptor` is used by UI components (e.g., `PropertyGrid`) that rely on `ICustomTypeDescriptor`.
- `BasePropertyChanged` is intended for use by view models or entities requiring `INotifyPropertyChanged`.
- `DisplayResourceAttribute`/`DescriptionResourceAttribute` are used as attributes on properties to enable localization.
- **Inferred Usage**
- Likely consumed by UI layers (e.g., WinForms `PropertyGrid`, WPF data binding) where dynamic metadata or localization is needed.
---
### 5. **Gotchas**
- **`DynamicTypeDescriptor` does *not* automatically propagate changes to the underlying `Component`** when using `DynamicProperty` with no `_existing` property. `SetValue`/`ResetValue` only update the internal `Value` field of the `DynamicProperty`. To bind to real properties, use `FromComponent` to wrap an existing property descriptor.
- **`DynamicProperty.Attributes` is a *snapshot* of `_attributes` at construction time** unless modified via `RemoveAttributesOfType<T>` or `Set*` methods. Direct mutation of `_attributes` is not exposed.
- **`DisplayResourceAttribute` and `DescriptionResourceAttribute` do *not* support fallback to property name**—if the resource ID is missing, the marker string (`##ResourceNotFound##`/`##DescriptionNotFound##`) is returned *as-is*, including the ID. This may cause UI clutter if not handled.
- **`BasePropertyChanged.SetProperty` uses `Equals` for comparison**, which may be unsafe for mutable reference types (e.g., collections). Consider using `EqualityComparer<T>.Default` or custom comparison if needed.
- **`DynamicTypeDescriptor` filters properties by `IsBrowsable` at construction time**, so non-browsable properties (e.g., `DesignerSerializationVisibility.Hidden`) are permanently excluded from `Properties`. Use `OriginalProperties` to inspect all properties.
- **`DynamicTypeDescriptor.FromComponent` requires `component.GetType()` to be assignable to `_type`**. Passing a derived type may throw `ArgumentException`.
- **`DynamicProperty`s `ShouldSerializeValue` always returns `false` unless wrapping an `_existing` property**—this may interfere with serialization logic expecting `ShouldSerialize*` semantics.
- **No thread-safety guarantees** are documented or implied for `DynamicTypeDescriptor` or `BasePropertyChanged`. Concurrent access to `Properties` or `PropertyChanged` events may require external synchronization.
- **`Strings.Strings.ResourceManager` must be initialized before `DisplayResourceAttribute`/`DescriptionResourceAttribute` are instantiated**, or `GetString` will return `null`. This is a runtime dependency on the applications localization setup.
---
*Documentation generated from source files only. No external behavior or assumptions beyond the provided code.*

View File

@@ -0,0 +1,108 @@
---
source_files:
- Common/DTS.CommonCore/Base/Interface/IBaseClass.cs
- Common/DTS.CommonCore/Base/Interface/IViewModel.cs
- Common/DTS.CommonCore/Base/Interface/IBaseView.cs
- Common/DTS.CommonCore/Base/Interface/IBaseWindow.cs
- Common/DTS.CommonCore/Base/Interface/IBaseModel.cs
- Common/DTS.CommonCore/Base/Interface/IBasePropertyChanged.cs
- Common/DTS.CommonCore/Base/Interface/IHeaderInfoProvider.cs
- Common/DTS.CommonCore/Base/Interface/IBaseWindowModel.cs
- Common/DTS.CommonCore/Base/Interface/IBaseViewModel.cs
generated_at: "2026-04-16T02:50:59.182890+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cd583516ecde421b"
---
# Interface
## Documentation: DTS.Common.Base Interface Layer
---
### 1. Purpose
This module defines a foundational set of interfaces for implementing the Model-View-ViewModel (MVVM) pattern within the DTS codebase. It establishes contract-based abstractions for core UI and data entities—`IBaseModel`, `IBaseViewModel`, `IBaseWindowModel`, `IBaseView`, `IBaseWindow`, and supporting interfaces like `IBasePropertyChanged` and `IHeaderInfoProvider<T>`—to enforce consistency, lifecycle management, and property change notification across the application. These interfaces decouple UI components (Views/Windows) from their backing logic (ViewModels/Models), enabling testability, reuse, and standardized behavior for state tracking (`IsDirty`, `IsBusy`, `IsSaved`), initialization, and cleanup.
---
### 2. Public Interface
#### Interfaces (all in `DTS.Common.Base` namespace)
| Interface | Signature | Description |
|-----------|-----------|-------------|
| `IBaseClass` | `public interface IBaseClass : IBasePropertyChanged { }` | Marker interface extending `IBasePropertyChanged`. Used as a base contract for classes requiring property change notification. |
| `IBasePropertyChanged` | `public interface IBasePropertyChanged : INotifyPropertyChanged { void OnPropertyChanged(string propertyName); }` | Extends `INotifyPropertyChanged` with a required `OnPropertyChanged(string)` method. *Note: No default implementation is provided.* |
| `IBaseModel` | `public interface IBaseModel : IBasePropertyChanged { bool IsSaved { get; } }` | Base interface for domain models. Guarantees `IsSaved` read-only state (e.g., whether the model has unsaved changes). |
| `IBaseViewModel` | `public interface IBaseViewModel : IBasePropertyChanged { ... }` | Base interface for ViewModels. Includes lifecycle methods (`Initialize`, `Activated`, `Cleanup`, `CleanupAsync`, `InitializeAsync`) and state properties (`IsMenuIncluded`, `IsNavigationIncluded`, `IsBusy`, `IsDirty`). Supports multiple `Initialize` overloads (with/without `parameter`, and with `parameter` + `model`). |
| `IBaseWindowModel` | `public interface IBaseWindowModel : INotifyPropertyChanged { ... }` | Base interface for Window-level ViewModels. Mirrors `IBaseViewModel` but **does not inherit `IBasePropertyChanged`** (directly implements `INotifyPropertyChanged`). Includes identical lifecycle/state members. |
| `IViewModel` | `public interface IViewModel { object Model { get; set; } }` | Minimal interface for ViewModels to expose their backing `Model`. Does not enforce lifecycle or state properties. |
| `IBaseView` | `public interface IBaseView { object DataContext { get; set; } }` | Base interface for Views (e.g., UserControls). Declares `DataContext` for binding to a ViewModel. |
| `IBaseWindow` | `public interface IBaseWindow { object DataContext { get; set; } }` | Base interface for Window classes. Declares `DataContext` for binding to a Window-level ViewModel. |
| `IHeaderInfoProvider<T>` | `public interface IHeaderInfoProvider<T> { T HeaderInfo { get; } }` | Generic interface for objects that expose a `HeaderInfo` (e.g., for XAML binding to UI headers). Type parameter `T` specifies the `HeaderInfo` type. |
**Lifecycle Method Overloads Summary**
All `Initialize`/`Cleanup` methods are defined in both `IBaseViewModel` and `IBaseWindowModel`:
- `void Initialize();`
- `void Initialize(object parameter);`
- `void Initialize(object parameter, object model);` *(only in `IBaseViewModel`)*
- `Task InitializeAsync();`
- `Task InitializeAsync(object parameter);`
- `void Activated();`
- `void Cleanup();`
- `Task CleanupAsync();`
**State Properties**
Shared across `IBaseViewModel` and `IBaseWindowModel`:
- `bool IsMenuIncluded { get; set; }`
- `bool IsNavigationIncluded { get; set; }`
- `bool IsBusy { get; set; }`
- `bool IsDirty { get; }` *(read-only)*
- `bool IsSaved { get; }` *(only in `IBaseModel`)*
---
### 3. Invariants
- **Property Change Notification**: Any class implementing `IBasePropertyChanged` (including `IBaseClass`, `IBaseModel`, `IBaseViewModel`) **must** raise `PropertyChanged` via `OnPropertyChanged(string propertyName)`. The interface does *not* enforce thread-safety or throttling—consumers must handle this.
- **`IsDirty` vs `IsSaved`**:
- `IsDirty` (in `IBaseViewModel`/`IBaseWindowModel`) indicates whether the ViewModel has unsaved changes *relative to its initialization state*.
- `IsSaved` (in `IBaseModel`) indicates whether the underlying Model has been persisted.
These are orthogonal: a model can be `IsSaved=true` but `IsDirty=true` if the ViewModel has made new changes since the last save.
- **Lifecycle Order**:
`Initialize`/`InitializeAsync``Activated` → (user interaction) → `Cleanup`/`CleanupAsync`.
`InitializeAsync` and `CleanupAsync` are asynchronous; callers must await them to ensure completion before proceeding.
- **`IHeaderInfoProvider<T>`**: The `HeaderInfo` property is read-only (`get` only). Implementations must ensure `HeaderInfo` is non-null (or handle null gracefully) for XAML binding.
---
### 4. Dependencies
#### Dependencies *of this module*:
- **`System.ComponentModel`**: Required for `INotifyPropertyChanged` (used in `IBasePropertyChanged`, `IBaseWindowModel`, `IBaseViewModel`).
- **`System.Threading.Tasks`**: Required for `Task` return types in `IBaseViewModel` and `IBaseWindowModel`.
#### Dependencies *on this module* (inferred from naming conventions and usage patterns):
- **UI Layer**: Views (e.g., WPF `Window`, `UserControl`) likely implement `IBaseView`/`IBaseWindow` and bind `DataContext` to ViewModels implementing `IBaseViewModel`/`IBaseWindowModel`.
- **ViewModel Layer**: Concrete ViewModels inherit from base classes implementing `IBaseViewModel` or `IBaseWindowModel`.
- **Model Layer**: Domain models likely implement `IBaseModel`.
- **Header Binding**: UI components (e.g., headers, toolbars) consume types implementing `IHeaderInfoProvider<T>`.
#### No internal dependencies *within* this module (interfaces are self-contained).
---
### 5. Gotchas
- **`IBaseWindowModel` does *not* inherit `IBasePropertyChanged`**: It directly implements `INotifyPropertyChanged`. This is inconsistent with `IBaseViewModel` (which inherits `IBasePropertyChanged`). Developers may mistakenly assume both share the same base contract.
- **`OnPropertyChanged` signature lacks default parameter**: The interface defines `void OnPropertyChanged(string propertyName);` without a default value (commented-out alternatives exist in source but are not part of the contract). Implementers *must* pass a non-null property name (or risk silent failures).
- **`IsDirty` is read-only**: Its value must be computed internally (e.g., via `SetProperty` logic or manual tracking). No setter is exposed, so external state changes (e.g., after save) require updating via internal logic.
- **`Initialize(object parameter, object model)` is `IBaseViewModel`-only**: `IBaseWindowModel` lacks this overload. Using it in a Window-level ViewModel may cause ambiguity or require custom implementation.
- **No default implementations**: These are *interfaces only*. Concrete behavior (e.g., `SetProperty`, `IsDirty` tracking) must be provided by base classes or implementations (not documented here).
- **Namespace quirk**: All interfaces use `DTS.Common.Base` despite being in `DTS.CommonCore` paths. This may cause confusion if namespace resolution is expected to match folder structure.
*None identified from source alone.*

View File

@@ -0,0 +1,57 @@
---
source_files:
- Common/DTS.CommonCore/Base/Model/BaseModel.cs
generated_at: "2026-04-16T02:51:14.177689+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ed3fc24e01d7b3b1"
---
# Model
### 1. **Purpose**
`BaseModel<TModel>` is an abstract base class intended to provide foundational functionality for model objects within the `DTS.Common.Base` namespace. It encapsulates common state—specifically, a `Model` property of generic type `TModel` and an `IsSaved` flag indicating persistence status—and inherits from `BasePropertyChanged`, presumably to support property change notifications (e.g., for UI binding). Its role is to standardize model representation and lifecycle tracking across derived model types in the codebase.
---
### 2. **Public Interface**
- **`public TModel Model { get; set; }`**
Gets or sets the underlying model object. The type `TModel` is constrained to be a reference type (`class`). This property holds the actual data payload for the model instance.
- **`public bool IsSaved { get; private set; }`**
Gets a read-only flag indicating whether the model has been persisted (e.g., saved to a database or backend). The setter is `private`, meaning only code within `BaseModel<TModel>` (e.g., derived classes or internal logic) can update this state.
- **`public BaseModel()`**
Public parameterless constructor for the abstract base class. Allows instantiation of concrete derived types. (Note: The class is `abstract`, so direct instantiation is not possible—this constructor is only invoked via derived classes.)
---
### 3. **Invariants**
- `TModel` must be a reference type (enforced by `where TModel : class`).
- `IsSaved` is initialized to `false` by default (C# default for `bool`) and can only be modified internally (via `private set`). External code can read but not directly set this flag.
- The class inherits from `BasePropertyChanged`, implying that property change notifications (e.g., `INotifyPropertyChanged`) are expected to be supported, though the specific implementation details are not visible in this file.
---
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Base.BasePropertyChanged` (base class; assumed to implement `INotifyPropertyChanged` or similar).
- `DTS.Common.Base.IBaseModel` (interface implemented explicitly via `IBaseModel`).
- The `TModel` type parameter is constrained to `class`, but no other constraints are specified.
- **Depended on by**:
- Concrete model classes in the codebase that derive from `BaseModel<TModel>` (e.g., `public class CustomerModel : BaseModel<Customer>`).
- Likely used by UI layers or services that interact with model instances via `IBaseModel` (e.g., for polymorphic handling of model state).
---
### 5. **Gotchas**
- **`IsSaved` is not automatically managed**: The flag is exposed but has no built-in logic to update it (e.g., on save operations). Consumers must manually set `IsSaved = true` (e.g., in derived classes or service layers), which could lead to inconsistencies if overlooked.
- **No validation or cloning support**: The class provides no hooks for validation, deep copying, or immutability—these must be implemented in derived classes if needed.
- **`Model` property is nullable**: Since `TModel` is unconstrained beyond `class`, `Model` may be `null`. Consumers must handle null cases explicitly.
- **No documentation for `IBaseModel` interface**: Its contract (e.g., members like `IsSaved`) is not visible here, so behavior relies on external definitions.
- **`BasePropertyChanged` is not defined here**: Its behavior (e.g., how property change notifications are raised) is unknown from this file alone.
*None identified from source alone.*

View File

@@ -0,0 +1,79 @@
---
source_files:
- Common/DTS.CommonCore/Base/View/BaseWindow.cs
- Common/DTS.CommonCore/Base/View/BaseView.cs
generated_at: "2026-04-16T02:51:29.370197+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e8beceb1bd7a7dfb"
---
# View
## Documentation: `DTS.Common.Base` View Base Classes
---
### 1. Purpose
This module provides foundational WPF view base classes (`BaseWindow` and `BaseView`) that standardize behavior for UI components in the application. These classes abstract common concerns—specifically, determining whether the underlying data model has unsaved changes (`IsDirty`) and retrieving a display-friendly header string (`HeaderInfo`) for tabbed interfaces—by delegating to interfaces implemented by the `DataContext`. They serve as reusable base classes to enforce consistency across views and reduce boilerplate in derived window and user control implementations.
---
### 2. Public Interface
#### `BaseWindow`
- **Namespace**: `DTS.Common.Base`
- **Inherits**: `System.Windows.Window`, implements `IBaseWindow` (interface not shown in source; assumed to declare `IsDirty` and `HeaderInfo` members).
- **`public bool IsDirty { get; }`**
Returns `true` if the `DataContext` implements `IBaseWindowModel` *and* its `IsDirty` property is `true`; otherwise `false`. Returns `false` if `DataContext` is `null` or does not implement `IBaseWindowModel`.
- **`public string HeaderInfo { get; }`**
Returns the `HeaderInfo` string from the `DataContext` *if* it implements `IHeaderInfoProvider<string>`; otherwise returns `string.Empty`.
#### `BaseView`
- **Namespace**: `DTS.Common.Base`
- **Inherits**: `System.Windows.Controls.UserControl`, implements `IBaseView` (interface not shown in source; assumed to declare `IsDirty` and `HeaderInfo` members).
- **`public bool IsDirty { get; }`**
Returns `true` if the `DataContext` implements `IBaseViewModel` *and* its `IsDirty` property is `true`; otherwise `false`. Returns `false` if `DataContext` is `null` or does not implement `IBaseViewModel`.
- **`public string HeaderInfo { get; }`**
Returns the `HeaderInfo` string from the `DataContext` *if* it implements `IHeaderInfoProvider<string>`; otherwise returns `string.Empty`.
> **Note**: Both classes use identical logic for `HeaderInfo`, but differ in the interface they check for `IsDirty`: `IBaseWindowModel` (for `BaseWindow`) vs. `IBaseViewModel` (for `BaseView`). The interfaces `IBaseWindowModel` and `IBaseViewModel` are not defined in the provided source.
---
### 3. Invariants
- `IsDirty` **always** returns `false` if `DataContext` is `null`.
- `IsDirty` **only** reads from the `DataContext`; it does not modify state.
- `HeaderInfo` **always** returns a non-null string (`string.Empty` if no provider is available).
- Both classes assume `DataContext` is set *before* `IsDirty` or `HeaderInfo` is accessed (though no explicit ordering requirement is enforced).
- The `IsDirty` logic is **passive**: it reflects the state of the `DataContext` but does not trigger updates or subscriptions.
---
### 4. Dependencies
#### External Dependencies (from source):
- `System.Windows` (WPF framework) — required for `Window` and `UserControl` base types.
- Interfaces `IBaseWindowModel`, `IBaseViewModel`, and `IHeaderInfoProvider<string>` — referenced but not defined in the provided source. Their definitions must exist elsewhere in the codebase (likely in `DTS.Common.Base` or a related namespace).
#### Internal Dependencies:
- **Consumers**: Any WPF window or user control inheriting from `BaseWindow` or `BaseView` (e.g., custom `MainWindow : BaseWindow`).
- **Required by `DataContext`**:
- For `BaseWindow`: `DataContext` must implement `IBaseWindowModel` to participate in `IsDirty` reporting.
- For `BaseView`: `DataContext` must implement `IBaseViewModel` to participate in `IsDirty` reporting.
- For *both*: `DataContext` must implement `IHeaderInfoProvider<string>` to provide a non-empty `HeaderInfo`.
---
### 5. Gotchas
- **Interface mismatch risk**: `BaseWindow` checks for `IBaseWindowModel`, while `BaseView` checks for `IBaseViewModel`. If a shared model implements both (or neither), behavior may be inconsistent or misleading.
- **No fallback or logging**: If `DataContext` is misconfigured (e.g., implements `IHeaderInfoProvider<string>` but returns `null`), `HeaderInfo` will still return `string.Empty`—no warning or exception occurs.
- **No change notification**: `IsDirty` is a synchronous read-only property. It does not raise `INotifyPropertyChanged` events, so UI bindings to `IsDirty` (e.g., for tab indicators) may not update automatically when the underlying model changes. Consumers must ensure `DataContext` raises `PropertyChanged` for `IsDirty` *and* re-evaluates the property (e.g., via `OnPropertyChanged(nameof(IsDirty))` in the view model).
- **Ambiguous naming**: The XML comments refer to “IBaseWindowModel” and “IBaseViewModel” but do not clarify their relationship or whether they overlap. Without seeing their definitions, it is unclear if a single `DataContext` could implement both.
- **No null-safety for `HeaderInfo`**: If `IHeaderInfoProvider<string>.HeaderInfo` returns `null`, the property will return `null` (not `string.Empty`). The code only guards against missing interface implementation, not interface contract violations.
> **None identified from source alone** for additional issues beyond those inferred from the logic and naming patterns.

View File

@@ -0,0 +1,182 @@
---
source_files:
- Common/DTS.CommonCore/Base/ViewModel/ViewModelBase.cs
- Common/DTS.CommonCore/Base/ViewModel/BaseViewModel.cs
generated_at: "2026-04-16T02:51:04.199849+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e292dc2f8a859c0e"
---
# ViewModel
## Documentation: ViewModel Base Classes (`DTS.Common.Base`)
---
### 1. Purpose
This module provides two foundational abstract base classes for implementing ViewModels in the Prism-based WPF UI layer: `ViewModelBase<T>` (a minimal, model-centric base) and `BaseViewModel<TModel>` (a richer, infrastructure-aware base integrating Prism, Unity DI, and region management). `ViewModelBase<T>` serves as a low-level abstraction for custom ViewModel implementations requiring explicit control over model lifecycle, async initialization, and property change notifications. `BaseViewModel<TModel>` extends this with Prism-specific services (event aggregator, region manager, container), built-in command infrastructure (`CloseCommand`, `ConfirmationRequest`), and standardized initialization/cleanup hooks—aiming to reduce boilerplate in typical ViewModels while enforcing consistent lifecycle management and status reporting.
---
### 2. Public Interface
#### `ViewModelBase<T>` (in `ViewModelBase.cs`)
- **`public object Model { get; set; }`**
Holds the underlying model object. Stored as `object`; cast to `T` internally.
- **`public bool IsBusy { get; protected set; }`**
Read-only public property indicating whether an asynchronous operation is in progress. Protected setter allows derived classes to update it.
- **`public virtual bool IsDirty { get; protected set; }`**
Read-only public property indicating whether the `Model` has unsaved changes. Virtual to allow overriding.
- **`public virtual event EventHandler<ErrorEventArgs> ErrorOccurred;`**
Event raised when an error occurs during processing.
- **`public virtual event PropertyChangedEventHandler PropertyChanged;`**
Standard `INotifyPropertyChanged` event for property change notifications.
- **`protected abstract Task<T> InitializeAsync();`**
Override to implement async model initialization. The returned `Task<T>` result is used to populate the `Model` property.
- **`protected abstract void DoRefresh(Func<T> factoryMethod);`**
Override to implement model refresh logic using a static factory method.
- **`protected abstract void OnError(Exception error);`**
Override to raise the `ErrorOccurred` event.
- **`protected abstract void OnModelChanged(T oldValue, T newValue);`**
Override to handle model replacement (e.g., unhooking/hooking event handlers on the old/new model).
- **`protected abstract void OnPropertyChanged(string propertyName);`**
Override to raise the `PropertyChanged` event.
> **Note**: `ViewModelBase<T>` implements `INotifyPropertyChanged` and `IViewModel` (interface not shown), and inherits from `DependencyObject`.
---
#### `BaseViewModel<TModel>` (in `BaseViewModel.cs`)
- **`protected IEventAggregator Aggregator { get; }`**
Prism event aggregator for pub/sub messaging.
- **`protected IUnityContainer Container { get; }`**
Unity DI container for service resolution.
- **`protected IRegionManager _regionManager { get; }`**
Prism region manager for view navigation/region population.
- **`public TModel Model { get; set; }`**
Strongly-typed model object (contrasted with `ViewModelBase<T>.Model` which is `object`).
- **`public InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism `InteractionRequest` for displaying confirmation dialogs.
- **`public DelegateCommand<object> CloseCommand { get; }`**
Command to close the view/viewmodel; executes `CloseMethod`, which in turn calls `CleanupAtClose()``Cleanup()`.
- **`protected virtual void CloseMethod(object parameter)`**
Default implementation invokes `CleanupAtClose()`.
- **`public virtual void Activated()`**
Hook called after viewmodel activation (e.g., by Prism region navigation). Default is no-op.
- **`public virtual void Initialize()`**
Publishes a `ShowStatus` event with `StatusState.Busy` and `"Loading"` message via `Aggregator`.
- **`public virtual void Initialize(object parameter)`**
Same as above; accepts initialization parameter (unused in current implementation).
- **`public virtual void Initialize(object parameter, object model)`**
Placeholder with no implementation.
- **`public virtual async Task InitializeAsync()`**
Async version of `Initialize()`, marshals `ShowStatus` publish to UI thread via `Dispatcher.CurrentDispatcher.InvokeAsync`.
- **`public virtual async Task InitializeAsync(object parameter)`**
Async version of `Initialize(object)`.
- **`public new event PropertyChangedEventHandler PropertyChanged;`**
Shadows base `PropertyChanged` event (likely from `BasePropertyChanged`, not shown).
- **`public bool IsMenuIncluded { get; set; }`**
Flag indicating whether the view includes a menu.
- **`public bool IsNavigationIncluded { get; set; }`**
Flag indicating whether the view includes navigation controls.
- **`public int Percentage { get; set; }`**
Status progress percentage (e.g., for loading bars).
- **`public string IsBusyMessage { get; set; }`**
Custom busy message to display.
- **`public bool IsBusy { get; set; }`**
Busy state flag (redundant with `ViewModelBase<T>.IsBusy`; no synchronization between the two).
- **`public bool IsDirty { get; set; }`**
Dirty state flag (redundant with `ViewModelBase<T>.IsDirty`; no synchronization).
- **`public virtual void Cleanup()`**
Sets `Model` to `default(TModel)`.
- **`public Task CleanupAsync()`**
**Throws `NotImplementedException`** — not implemented.
> **Note**: `BaseViewModel<TModel>` inherits from `BasePropertyChanged` (not shown), implements `IBaseViewModel` (not shown), and requires `TModel : class`.
---
### 3. Invariants
- **`ViewModelBase<T>`**:
- `InitializeAsync()` must return a `Task<T>` whose result is assigned to `Model`.
- `OnModelChanged` must be called whenever `Model` changes (implementation responsibility of derived class).
- `OnPropertyChanged` must be called for all property changes requiring UI updates.
- `OnError` must be called to raise `ErrorOccurred`.
- **`BaseViewModel<TModel>`**:
- `Initialize()`/`InitializeAsync()` *must* publish a `ShowStatus` event with `StatusInfo.StatusState.Busy` and `"Loading"` message during initialization.
- `CloseCommand` always triggers `Cleanup()` (via `CleanupAtClose()`).
- `Cleanup()` sets `Model = default(TModel)`.
- `IsBusy`, `IsDirty`, `Percentage`, `IsBusyMessage`, `IsMenuIncluded`, and `IsNavigationIncluded` are *not* synchronized with any internal state machine — their values are purely application-defined.
---
### 4. Dependencies
#### `ViewModelBase<T>`
- **System namespaces**: `System`, `System.ComponentModel`, `System.Diagnostics`, `System.IO`, `System.Threading.Tasks`, `System.Windows`.
- **Implements**: `INotifyPropertyChanged`, `IViewModel` (external interface).
- **Inherits**: `DependencyObject`.
- **Used by**: Any ViewModel requiring low-level control over model lifecycle and notifications.
#### `BaseViewModel<TModel>`
- **Prism namespaces**: `Microsoft.Practices.Prism.Events`, `Microsoft.Practices.Prism.Commands`, `Microsoft.Practices.Prism.Regions`, `Microsoft.Practices.Prism.Interactivity.InteractionRequest`.
- **Unity DI**: `Microsoft.Practices.Unity`.
- **Internal namespaces**: `DTS.Common.Events` (for `ShowStatus`, `StatusInfo`, `Strings`).
- **Inherits**: `BasePropertyChanged` (unseen, assumed to provide `INotifyPropertyChanged`).
- **Implements**: `IBaseViewModel` (external interface).
- **Depends on**:
- `IRegionManager`, `IEventAggregator`, `IUnityContainer` (injected via constructor).
- `Strings.Strings.Loading` (string resource).
- `Dispatcher.CurrentDispatcher` (for async marshaling).
- **Used by**: Most ViewModels in the application requiring Prism integration.
---
### 5. Gotchas
- **`BaseViewModel<TModel>.CleanupAsync()` is unimplemented** — throws `NotImplementedException`. Do not call this method.
- **Redundant state flags**: Both `ViewModelBase<T>` and `BaseViewModel<TModel>` define `IsBusy` and `IsDirty`. There is *no synchronization* between them. If a class inherits from both (or uses both), these flags may diverge.
- **`Model` type mismatch**: `ViewModelBase<T>.Model` is `object`, while `BaseViewModel<TModel>.Model` is strongly-typed `TModel`. Mixing these bases may lead to casting issues.
- **`Initialize(object parameter, object model)` is a no-op** — despite accepting parameters, it does nothing. Initialization logic must be implemented in other overloads.
- **`BaseViewModel` uses `new event PropertyChangedEventHandler`** — this shadows any base `PropertyChanged` (e.g., from `BasePropertyChanged`), which may cause confusion if event handlers are attached to the wrong reference.
- **No automatic `IsBusy`/`IsDirty` management**: Derived classes must manually update `IsBusy`/`IsDirty` (in `ViewModelBase<T>`) or rely on application logic (in `BaseViewModel<TModel>`).
- **`DoRefresh`s contract is underspecified**: The source does not clarify how/when `DoRefresh` should be called or how it interacts with `InitializeAsync`.
- **`Strings.Strings.Loading` is referenced but not defined here** — assumes a `Strings` resource class exists in `DTS.Common` with a `Loading` property.
> **None identified from source alone** for `ViewModelBase<T>` beyond its minimal design. For `BaseViewModel<TModel>`, the above are the primary concerns.

View File

@@ -0,0 +1,180 @@
---
source_files:
- Common/DTS.CommonCore/Behaviors/StringMetaDataAttr.cs
- Common/DTS.CommonCore/Behaviors/TrimTextBoxBehavior.cs
- Common/DTS.CommonCore/Behaviors/InteractivityTemplate.cs
- Common/DTS.CommonCore/Behaviors/TextBoxPasteBehavior.cs
- Common/DTS.CommonCore/Behaviors/MultiSelectionBehavior.cs
generated_at: "2026-04-16T02:15:57.710410+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c2b7aea8fc779731"
---
# Behaviors
## Documentation: `DTS.Common.Behaviors` Module
---
### 1. Purpose
This module provides a set of WPF-specific behaviors and utility attributes to extend UI control functionality and support metadata annotations on types. It enables declarative attachment of cross-cutting concerns—such as text trimming on `TextBox` loss of focus, paste interception with custom command execution, multi-selection synchronization between a `ListBox` and an external `IList`, and dynamic injection of interactivity elements via templates—without modifying control logic directly. The module also includes a generic attribute (`StringMetaDataAttr`) for associating arbitrary string metadata with types or enum values, primarily for documentation or UI labeling purposes.
---
### 2. Public Interface
#### `StringMetaDataAttr`
- **`public string MetaData { get; }`**
Read-only property storing the metadata string provided at construction.
- **`internal StringMetaDataAttr(string attr)`**
Internal constructor; sets `MetaData` to `attr`.
- **`public static string GetStringMetaData(object o)`**
Retrieves the `MetaData` string from a `StringMetaDataAttr` applied to the *enum value* or *type* represented by `o`.
- Uses reflection on `o.GetType().GetMember(o.ToString())` to find the member.
- Returns `null` if no attribute is found or if `o` is `null`/member not found.
#### `TrimTextBoxBehavior`
- **`public class TrimTextBoxBehavior : Behavior<TextBox>`**
Attaches to a `TextBox` and trims its `Text` property on `LostFocus`.
- On attachment: subscribes to `LostFocus`.
- On `LostFocus`: trims `Text`, updates binding source if changed.
- On detachment: unsubscribes from `LostFocus`.
#### `InteractivityItems`
- **`public class InteractivityItems : FrameworkElement`**
Holds collections of behaviors and triggers for dynamic injection.
- **`public List<TriggerBase> Triggers { get; }`**
Lazy-initialized list of triggers.
- **`public List<Behavior> Behaviors { get; }`**
Lazy-initialized list of behaviors.
- **Attached Property: `Template` (`InteractivityTemplate`)**
When set on a `DependencyObject`, loads content from the `InteractivityTemplate`, extracts its behaviors/triggers, and adds them to the target objects `Interaction.GetBehaviors()` and `Interaction.GetTriggers()` collections.
#### `TextBoxPasteBehavior`
- **`public static readonly DependencyProperty PasteCommandProperty`**
Attached dependency property for `PasteCommand`.
- **`public static ICommand GetPasteCommand(DependencyObject target)`**
Gets the `PasteCommand` value.
- **`public static void SetPasteCommand(DependencyObject target, ICommand value)`**
Sets the `PasteCommand` value.
- **`private static void PasteCommandChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)`**
Attaches/detaches handler for `CommandManager.ExecutedEvent` on the target `TextBox` (or its `MainEditBox` if `ChannelCodeBuilder`/`ChannelNameBuilder`).
- **`private static void CommandExecuted(object sender, RoutedEventArgs e)`**
Handles `ApplicationCommands.Paste` (or custom `RoutedUICommand` named `"Paste"`).
- Retrieves text from `Clipboard`.
- Calls `command.Execute(textBox)` if `command.CanExecute(null)` is true.
- Sets `e.Handled = true` to suppress default paste.
- On exception, publishes `PageErrorEvent` via `IEventAggregator`.
#### `MultiSelectionBehavior`
- **`public class MultiSelectionBehavior : Behavior<ListBox>`**
Synchronizes `SelectedItems` of a `ListBox` with an external `IList`.
- **`public IList SelectedItems { get; set; }`**
Dependency property backing the external list to sync with.
- **`public static readonly DependencyProperty SelectedItemsProperty`**
Registered dependency property.
- **`private static void SelectedItemsChanged(...)`**
Handles changes to `SelectedItems`:
- Clears `ListBox.SelectedItems` and repopulates from new value.
- Subscribes/unsubscribes to `CollectionChanged` on the new/old value and `SelectionChanged` on `AssociatedObject`.
- **`private void SourceCollectionChanged(...)`**
Updates `AssociatedObject.SelectedItems` when the external `IList` changes (e.g., via `INotifyCollectionChanged`).
- **`private void ListBoxSelectionChanged(...)`**
Updates the external `SelectedItems` list when `ListBox` selection changes.
- Uses `SelectedItemsStatus.SetUpdating(...)` to suppress notifications during bulk updates.
- Skips adding items if already present.
- Logs exceptions via `APILogger.Log(ex)`.
---
### 3. Invariants
- **`StringMetaDataAttr.GetStringMetaData(object o)`**
- Only inspects the *member name* derived from `o.ToString()`. For enums, this is the enum *name* (e.g., `"Red"`), not the value.
- Returns `null` if `o` is `null`, or if `o.GetType().GetMember(...)` yields no results.
- Does *not* search base types or interfaces—only the exact member named by `o.ToString()`.
- **`TrimTextBoxBehavior`**
- Only trims on `LostFocus`; no trimming occurs during typing or on `TextChanged`.
- Binding update is triggered via `UpdateSource()` only if trimming actually changed the text.
- **`InteractivityItems.Template`**
- The `InteractivityTemplate.LoadContent()` must return a `FrameworkElement` containing `InteractivityItems` (or compatible structure); otherwise, behavior injection may fail silently.
- `OnTemplateChanged` is invoked *after* the property is set; no guarantee about timing relative to visual tree load.
- **`TextBoxPasteBehavior`**
- Only intercepts `Paste` if `PasteCommand` is set *before* paste occurs (via `PasteCommandChanged` subscription logic).
- Assumes `sender` is either a `TextBox`, `ChannelCodeBuilder`, or `ChannelNameBuilder`; otherwise, `textBox` may be `null` (though `PasteCommandChanged` and `CommandExecuted` both attempt fallbacks).
- `Clipboard.GetText()` may throw; exceptions are caught and published as `PageErrorEvent`.
- **`MultiSelectionBehavior`**
- `SelectedItems` must be an `IList` (not `IEnumerable`) to support `Add`/`Remove`.
- Type compatibility is checked via `type.IsAssignableFrom(item.GetType())`; items failing this are silently skipped (exception logged).
- `_isUpdatingSource` and `_isUpdatingTarget` flags prevent infinite loops during bidirectional sync.
- `SelectedItemsStatus.SetUpdating(...)` is used but *not defined in this module*—implies dependency on `DTS.Common.Utilities` (see *Dependencies*).
---
### 4. Dependencies
#### Internal Dependencies (from imports)
- **WPF Framework**:
- `System.Windows`, `System.Windows.Controls`, `System.Windows.Interactivity` (for `Behavior<T>`, `Interaction`, `TriggerBase`).
- `System.Windows.Input` (for `ICommand`, `RoutedEventHandler`, `ExecutedRoutedEventArgs`, `ApplicationCommands`).
- **Prism Library**:
- `Microsoft.Practices.Prism.Events` (`IEventAggregator`, `EventAggregator`).
- `Microsoft.Practices.ServiceLocation` (`ServiceLocator`).
- **Custom Types**:
- `DTS.Common.Controls.ChannelCodeBuilder`, `DTS.Common.Controls.ChannelNameBuilder` (access `MainEditBox`).
- `DTS.Common.Utilities.Logging.APILogger` (used in `MultiSelectionBehavior`).
- `DTS.Common.Events.PageErrorEvent`, `PageErrorArg` (used in `TextBoxPasteBehavior`).
- `DTS.Common.Utilities.SelectedItemsStatus` (used in `MultiSelectionBehavior` for `SetUpdating`).
#### External Dependencies
- **Behavioral**:
- `TrimTextBoxBehavior`, `MultiSelectionBehavior`, `InteractivityItems` require `System.Windows.Interactivity` (Blend SDK).
- `TextBoxPasteBehavior` requires `System.Windows.Interactivity` indirectly via `Interaction` usage (though not directly instantiated here).
#### Consumers (inferred)
- Likely used in XAML via `Interaction.Behaviors`, `InteractivityItems.Template`, or attached properties (`TextBoxPasteBehavior.PasteCommand`).
- `StringMetaDataAttr` is likely applied to enums or classes in other modules (e.g., `enum Status { [StringMetaData("Active")] Active }`).
---
### 5. Gotchas
- **`StringMetaDataAttr.GetStringMetaData(object o)`**:
- **Fails for enum *values* with `Flags` attribute** if `o.ToString()` returns a combined string (e.g., `"Red | Blue"`), as `GetMember("Red | Blue")` will not match any member.
- **Does not handle nested types**—only top-level members named by `o.ToString()`.
- **`TrimTextBoxBehavior`**:
- Trimming may cause caret position loss or unexpected selection changes (not mitigated).
- `UpdateSource()` may trigger validation errors or other side effects in the binding pipeline.
- **`InteractivityItems.Template`**:
- `OnTemplateChanged` assumes `interactivityTemplate.LoadContent()` returns an `InteractivityItems` instance. If not, casting to `(InteractivityItems)` will throw.
- No deduplication: adding the same behavior/trigger multiple times via `Template` is possible.
- **`TextBoxPasteBehavior`**:
- **Critical bug in `CommandExecuted`**:
```csharp
TextBox textBox = sender as TextBox;
if (null == sender && sender is ChannelCodeBuilder ccb) // ← Always false: sender cannot be null *and* be a ChannelCodeBuilder
```
Should be `if (null == textBox && sender is ChannelCodeBuilder ccb)`. Same for `ChannelNameBuilder`. This will cause `textBox` to remain `null`, leading to `NullReferenceException` when accessing `textBox.RemoveHandler(...)` or `textBox.AddHandler(...)`.
- `Clipboard.GetText()` may throw `ExternalException` (e.g., clipboard in use); caught but logged generically.
- **`MultiSelectionBehavior`**:
- `SelectedItemsStatus.SetUpdating(...)` is used but *not defined in this module*—if `SelectedItemsStatus` is missing or misconfigured, notification suppression may fail, causing performance issues or infinite loops.
- `itemsToAdd.Last()` check is inefficient for large lists (O(n) per item).
- `selectedItems.Contains(item)` is O(n) per item; for large lists, this may be a performance bottleneck.
- No handling of `NotifyCollectionChangedAction.Replace`—only `Add`, `Remove`, and `Reset`.
- **General**:
- All behaviors assume WPF UI thread context (no dispatcher marshaling).
- No null-safety for `AssociatedObject` in `OnDetaching`/`OnAttached` (relies on `Behavior<T>` base class to guard).
- `StringMetaDataAttr` is `internal`—cannot be instantiated outside this module, limiting extensibility.
None identified beyond the above.

View File

@@ -0,0 +1,99 @@
---
source_files:
- Common/DTS.CommonCore/BusyIndicatorManager/xBusyIndicator.xaml.cs
- Common/DTS.CommonCore/BusyIndicatorManager/BusyIndicatorManager.cs
generated_at: "2026-04-16T02:11:43.845066+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "85046dce961f12c2"
---
# BusyIndicatorManager
## Documentation: BusyIndicatorManager Module
---
### 1. Purpose
This module provides a centralized, singleton-based busy indicator management system for WPF applications, enabling multiple components or operations to request and release busy state independently while ensuring the UI reflects a consistent busy status. It decouples the *initiation* of busy operations (via unique IDs) from the *actual display* of the busy indicator, which is expected to be bound to the `IsBusy` and `Message` properties of the `BusyIndicatorManager` instance. The `xBusyIndicator` class serves as the XAML-backed UI control that presumably consumes this manager (though its current implementation is minimal).
---
### 2. Public Interface
#### `BusyIndicatorManager` (Singleton)
- **`public static BusyIndicatorManager Instance { get; }`**
Thread-safe singleton accessor. Returns the single shared instance of `BusyIndicatorManager`. Uses double-checked locking via `SyncRoot`.
- **`public bool IsBusy { get; }`**
Read-only property indicating whether *any* busy request is currently active. Raises `PropertyChanged` on change (via `NotificationObject` base).
- **`public string Message { get; }`**
Read-only property containing the *current* busy message. Reflects the message of the *last added or active* busy request (see `ShowBusy`/`CloseBusy` behavior). Raises `PropertyChanged` on change.
- **`public void ShowBusy(int id, string busyMessage)`**
Registers a new busy request with the given `id`. If `id` is new, it adds the `busyMessage` to the internal dictionary and sets `IsBusy = true` and `Message = busyMessage`. If `id` already exists, it updates the stored message for that `id`, and ensures `IsBusy = true` and `Message = busyMessage` (i.e., overwrites current message regardless of prior state).
*Note:* Does *not* deduplicate or prevent multiple `ShowBusy` calls with the same `id`—only updates the message.
- **`public void CloseBusy(int id)`**
Removes the busy request identified by `id`. If no requests remain (`busyParameters.Count == 0`), sets `IsBusy = false` and `Message = ""`. Otherwise, sets `IsBusy = true` and `Message = busyParameters.Last().Value` (i.e., the message of the *last-enumerated* remaining request).
*Note:* Enumeration order of `Dictionary<int, string>` is insertion order in .NET, but relying on `Last()` for priority is fragile and not guaranteed to be intuitive.
#### `xBusyIndicator` (UI Control)
- **`public xBusyIndicator()`**
Constructor. Calls `InitializeComponent()` to load the XAML-defined UI.
- **`public void Connect(int connectionId, object target)`**
Currently **empty implementation**. Presumably intended to associate a UI element (`target`) with a logical connection ID (`connectionId`), but no behavior is defined in the source.
---
### 3. Invariants
- **Singleton uniqueness**: Exactly one instance of `BusyIndicatorManager` exists per AppDomain (enforced via `lock` and null-check).
- **`IsBusy` truthfulness**:
- `IsBusy == true` **iff** `busyParameters.Count > 0`.
- `IsBusy == false` **iff** `busyParameters.Count == 0`.
- **`Message` consistency**:
- When `IsBusy == true`, `Message` equals the `busyMessage` string associated with the *last-enumerated* entry in `busyParameters`.
- When `IsBusy == false`, `Message == string.Empty`.
- **ID uniqueness per request**: Each `id` in `ShowBusy(id, ...)` maps to one message in `busyParameters`. Reusing an `id` updates the message but does *not* create a new entry.
---
### 4. Dependencies
#### Dependencies *of* this module:
- **`Microsoft.Practices.Prism.ViewModel.NotificationObject`**: Base class for `BusyIndicatorManager`, enabling property change notifications (`RaisePropertyChanged`).
- **`System.Collections.Generic`**: Used for `Dictionary<int, string>`.
- **`System.Linq`**: Used for `busyParameters.Last()` in `CloseBusy`.
- **WPF UI framework**: `xBusyIndicator` inherits from `System.Windows.Controls.UserControl` (implied by `InitializeComponent()` and XAML usage).
#### Dependencies *on* this module:
- **UI components** (not visible in source): Presumably XAML views bind to `BusyIndicatorManager.Instance.IsBusy` and `.Message` to drive a `BusyIndicator` control (e.g., from `Xceed.Wpf.Toolkit`).
- **`xBusyIndicator.xaml`**: The XAML file for `xBusyIndicator` (not provided), which likely consumes `BusyIndicatorManager` to display the busy state.
---
### 5. Gotchas
- **`CloseBusy` message selection is arbitrary**: `busyParameters.Last()` uses dictionary enumeration order, which is insertion order in .NET, but this is not documented as a contract. If multiple requests are active, the displayed message may change unexpectedly when an unrelated request is closed.
*Example:* Requests added in order `id=1`, `id=2`, `id=3` → closing `id=2` changes message to that of `id=3`, even if `id=1` was the "primary" request.
- **No validation on `id`**: `ShowBusy` and `CloseBusy` accept any `int`. Duplicates are allowed (with update semantics), but no error is thrown for invalid IDs.
- **`Connect` method is a stub**: `xBusyIndicator.Connect` has no implementation. Its purpose is unclear—without knowing the intended use of `connectionId` and `target`, this API is non-functional.
- **No thread-safety for `busyParameters`**: While singleton instantiation is thread-safe, all operations on `busyParameters` (e.g., `ContainsKey`, `Add`, `Remove`, `Last`) are *not* synchronized. Concurrent calls to `ShowBusy`/`CloseBusy` from multiple threads may cause race conditions (e.g., `KeyNotFoundException`, corrupted dictionary state).
*Note:* The singleton uses a lock for initialization only.
- **Message overwriting on `id` reuse**: Calling `ShowBusy(42, "A")` then `ShowBusy(42, "B")` updates the message but does *not* reset `IsBusy` if it was already `true`. This may be intentional, but could mask bugs if callers assume each `ShowBusy` is independent.
- **Hardcoded property names**: `RaisePropertyChanged("IsBusy")` uses string literals. No compile-time safety—renaming properties would break binding silently.
- **No timeout or cancellation support**: Busy state persists indefinitely until `CloseBusy(id)` is called. No mechanism to auto-release or cancel long-running requests.
- **`Xceed.Wpf.Toolkit` imported but unused**: The namespace is imported in `xBusyIndicator.xaml.cs`, but no `Xceed.Wpf.Toolkit` types are referenced in the provided code. May indicate future use or leftover artifact.

View File

@@ -0,0 +1,250 @@
---
source_files:
- Common/DTS.CommonCore/Classes/StatusAndProgressBarEventArgs.cs
- Common/DTS.CommonCore/Classes/Singleton.cs
- Common/DTS.CommonCore/Classes/ImportData.cs
- Common/DTS.CommonCore/Classes/RegionNames.cs
- Common/DTS.CommonCore/Classes/ServiceCall.cs
- Common/DTS.CommonCore/Classes/TagAwareBase.cs
- Common/DTS.CommonCore/Classes/Utility.cs
- Common/DTS.CommonCore/Classes/Tags.cs
generated_at: "2026-04-16T02:12:54.891278+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ab2980ca84007830"
---
# DTS.CommonCore Classes Documentation
## 1. Purpose
This module provides foundational infrastructure and data structures for the DTS (Data Transfer System) application. It establishes core patterns—including singleton management, service call queuing, tag-aware object modeling, and utility data access helpers—while defining shared data models for import operations, UI region naming, and status/progress reporting. The module serves as a shared dependency layer, enabling consistent behavior across UI, service, and data access components by encapsulating cross-cutting concerns like thread-safe resource management, database tag handling, and robust data parsing.
## 2. Public Interface
### `StatusAndProgressBarEventArgs`
- **`Color StatusColor { get; set; }`**: Color used to indicate status (e.g., success, error, warning).
- **`string StatusText { get; set; }`**: Human-readable status message.
- **`double ProgressValue { get; set; }`**: Numeric progress value (typically 0.0100.0).
- **`Visibility ProgressBarVisibility { get; set; }`**: Controls whether the progress bar is visible (`Visible`, `Hidden`, or `Collapsed`).
- **`IBaseViewModel Requester { get; set; }`**: Reference to the originating view model requesting the status update.
- **`string ErrorText { get; set; }`**: Optional error message associated with the status.
### `Singleton<T>`
- **`protected Singleton()`**: Constructor prevents direct instantiation; throws `InvalidOperationException` if called when `Instance` already exists.
- **`public static T Instance { get; }`**: Returns the singleton instance of `T`. Initialization occurs lazily in a static constructor. If instantiation fails, subsequent access throws the captured exception.
### `ImportData`
#### `ImportPageType`
- **`enum ImportPageType`**: Defines import source types: `ImportSensor`, `ImportTestSetup`.
#### `SensorImportData`
- **`Dictionary<string, List<string>> GroupNameSensorListLookup { get; set; }`**: Maps group names to lists of sensor names.
- **`Dictionary<string, string> SensorGroupNameLookup { get; set; }`**: Maps sensor names to group names.
- **`Dictionary<string, string> SensorGroupTypeLookup { get; set; }`**: Maps group names to group types.
- **`Dictionary<string, string> GroupNameTestObjectLookup { get; set; }`**: Maps group names to test object names.
- **`List<string> Errors { get; set; }`**: Accumulated error messages during import.
- **`Dictionary<string, string> SensorISOCode { get; set; }`**: Maps sensor names to ISO codes.
- **`Dictionary<string, string> SensorISOChannelName { get; set; }`**: Maps sensor names to ISO channel names.
- **`Dictionary<string, string> SensorUserCode { get; set; }`**: Maps sensor names to user-defined codes.
- **`Dictionary<string, string> SensorUserChannelName { get; set; }`**: Maps sensor names to user-defined channel names.
- **`Dictionary<string, string> SensorDASSerialNumber { get; set; }`**: Maps sensor names to DAS serial numbers.
- **`Dictionary<string, int> SensorChannelIndex { get; set; }`**: Maps sensor names to channel indices.
#### `TestSetupImportData`
- **`string Name { get; set; }`**: Test setup name.
- **`string Description { get; set; }`**: Test setup description.
- **`double SamplesPerSecond { get; set; }`**: Sampling rate.
- **`double PosttriggerSeconds { get; set; }`**: Post-trigger duration.
- **`double PretriggerSeconds { get; set; }`**: Pre-trigger duration.
- **`RecordingModes RecordingMode { get; set; }`**: Recording mode (enum defined elsewhere).
- **`CalibrationBehaviors CalibrationBehavior { get; set; }`**: Calibration behavior (enum defined elsewhere).
- **`int Version { get; set; }`**: Test setup version.
- **`List<string> TestChannelOrders { get; set; }`**: Ordered list of test channel names.
- **`List<string> Tags { get; set; }`**: List of tag strings.
- **`InputClockSource ClockMasterInput { get; set; }`**: Input clock source for master (default: `None`).
- **`OutputClockSource ClockMasterOutput { get; set; }`**: Output clock source for master (default: `None`).
- **`bool ManageClocksOutsideOfDataPROMaster { get; set; }`**: Flag for external clock management on master (default: `false`).
- **`bool ManageClocksOutsideOfDataPROSlave { get; set; }`**: Flag for external clock management on slave (default: `false`).
- **`OutputClockSource ClockSlaveInput { get; set; }`**: Input clock source for slave (default: `None`).
- **`OutputClockSource ClockSlaveOutput { get; set; }`**: Output clock source for slave (default: `None`).
- **`Dictionary<string, int> SampleRateForDAS { get; }`**: Maps DAS device names to sample rates.
- **`Dictionary<string, uint> DomainIdForDAS { get; }`**: Maps DAS device names to domain IDs.
- **`Dictionary<string, bool> IsClockMaster { get; }`**: Maps DAS device names to clock master flag.
### `RegionNames`
- **`public const string FrontRegion = "FrontRegion"`**
- **`public const string MainRegion = "MainRegion"`**
- **`public const string ViewerEuRegion = "ViewerEuRegion"`**
- **`public const string ViewerMvRegion = "ViewerMvRegion"`**
- **`public const string ViewerEdcRegion = "ViewerEdcRegion"`**
- **`public const string ViewerTestsRegion = "ViewerTestsRegion"`**
- **`public const string ViewerGraphRegion = "ViewerGraphRegion"`**
- **`public const string ViewerGraphsRegion = "ViewerGraphsRegion"`**
- **`public const string ViewerGraphMainRegion = "ViewerGraphMainRegion"`**
- **`public const string ViewerGraphListRegion = "ViewerGraphListRegion"`**
- **`public const string ViewerGraphChannelRegion = "ViewerGraphChannelRegion"`**
- **`public const string ViewerTestModificationRegion = "ViewerTestModificationRegion"`**
- **`public const string ViewerLegendRegion = "ViewerLegendRegion"`**
- **`public const string ViewerSearchRegion = "ViewerSearchRegion"`**
- **`public const string ViewerSettingsRegion = "ViewerSettingsRegion"`**
- **`public const string ViewerDiagRegion = "ViewerDiagRegion"`**
- **`public const string ViewerDisplayRegion = "ViewerDisplayRegion"`**
- **`public const string ViewerChartOptionsRegion = "ViewerChartOptionsRegion"`**
- **`public const string ViewerStatsRegion = "ViewerStatsRegion"`**
- **`public const string ViewerCursorRegion = "ViewerCursorRegion"`**
- **`public const string ViewerFiterRegion = "ViewerFiterRegion"`** *(Note: Typo in source—likely intended "Filter")*
- **`public const string MenuRegion = "MenuRegion"`**
- **`public const string NavigationRegion = "NavigationRegion"`**
- **`public const string BottomRegion = "BottomRegion"`**
- **`public const string RightRegion = "RightRegion"`**
- **`public const string TopRegion = "TopRegion"`**
- **`public const string VerticalTabRegion = "VerticalTabRegion"`**
- **`public const string HorizontalTabRegion = "HorizontalTabRegion"`**
- **`public const string RibbonRegion = "RibbonRegion"`**
- **`public const string PropertyDisplayRegion = "PropertyDisplayRegion"`**
- **`public const string PropertyModifyRegion = "PropertyModifyRegion"`**
- **`public const string PropertyAddRegion = "PropertyAddRegion"`**
- **`public const string PSDDataSelectRegion = "PSDDataSelectRegion"`**
- **`public const string PSDGraphRegion = "PSDGraphRegion"`**
- **`public const string ReportChartOptionsRegion = "ReportChartOptionsRegion"`**
- **`public const string ReportResultsRegion = "ReportResultsRegion"`**
### `ServiceCall`
- **`bool Started { get; set; }`**: Indicates whether the work has started.
- **`Action WorkAction { get; set; }`**: The delegate representing the work to execute.
- **`void MarkDone()`**: Notifies the `ServiceQueue` that this call has completed.
- **`string Name { get; set; }`**: Human-readable name for debugging/tracing.
- **`ServiceCall(string name)`**: Constructor setting the `Name`.
### `ServiceQueue`
- **`public static void Enqueue(ServiceCall call)`**: Adds a `ServiceCall` to the queue. Starts execution if queue was empty.
- **`public static void MarkFinished(ServiceCall call)`**: Marks a `ServiceCall` as finished. If it was the current item, the next item in the queue is started.
### `TagAwareBase`
- **`enum TagTypes`**: Defines tag categories: `User`, `Group`, `Template`, `TestSetup`, `Sensors`, `SensorModels`.
- **`public abstract TagTypes TagType { get; }`**: Must be implemented by derived classes to specify its tag type.
- **`public byte[] TagsBlobBytes { get; set; }`**: Gets/sets `TagIDs` as a byte array (used for DB storage).
- **`public int[] TagIDs { get; set; }`**: Array of tag IDs associated with this object.
- **`void SetTagsFromCommaSeparatedString(string tagText, Tags.GetSqlCommandDelegate getSqlCommand)`**: Parses comma-separated tags and updates `TagIDs`.
- **`virtual void SetTags(string[] tagsText, Tags.GetSqlCommandDelegate getSqlCommand)`**: Adds/updates tags and sets `TagIDs`.
- **`string GetTagsAsCommaSeparatedString(Tags.GetSqlCommandDelegate getSqlCommand)`**: Returns tags as comma-separated string.
- **`virtual string[] GetTagsArray(Tags.GetSqlCommandDelegate getSqlCommand)`**: Returns array of tag text strings.
- **`virtual int[] GetTagIDs()`**: Returns `TagIDs`.
- **`virtual void RemoveTags(string[] tagsText)`**: Stub—no implementation provided.
- **`bool TagCompatible(string tags, Tags.GetSqlCommandDelegate getSqlCommand)`**: Returns `true` if any tag in `tags` matches this objects tags.
- **`virtual bool TagCompatible(int[] tags)`**: Returns `true` if `tags` is empty or has intersection with `TagIDs`.
- **`virtual bool HasIntersectingTag(int[] tags)`**: Returns `true` if `tags` and `TagIDs` share at least one ID.
- **`void InsertTagsFromCommaSeparatedString(int id, TagTypes tagType, string tags, Tags.GetSqlCommandDelegate getSqlCommand)`**: Sets tags and commits assignments.
- **`void Commit(int id, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand)`**: Deletes existing tag assignments for this object, then inserts new ones for current `TagIDs`.
- **`List<int> GetTagIdList(int objectId, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand)`**: Retrieves tag IDs for a given object ID and type from the database.
### `Utility`
- **`static byte[] GetBytesFromStringArray(string[] array, string separator)`**: Joins array with `separator`, returns UTF-8 bytes.
- **`static string GetAllErrorMessages(Exception ex)`**: Recursively aggregates exception messages (including inner exceptions).
- **`static bool PingNetwork(string hostNameOrAddress)`**: Pings host with 4s timeout; returns `true` on success.
- **`static ushort GetUShort(IDataReader reader, string column, ushort defaultValue = 0)`**
- **`static uint GetUInt(IDataReader reader, string column, uint defaultValue = 0)`**
- **`static string GetString(IDataReader reader, string column, string defaultValue = "")`**
- **`static string[] GetStringArray(IDataReader reader, string column, string[] defaultValue, string separator)`**: Reads byte array, decodes as UTF-8, splits by `separator`.
- **`static int GetInt(IDataReader reader, string column, int defaultValue = 0)`**
- **`static double GetDouble(IDataReader reader, string column, double defaultValue = 0D)`**
- **`static short GetShort(IDataReader reader, string column, short defaultValue = 0)`**
- **`static DateTime? GetNullableDateTime(IDataReader reader, string column)`**
- **`static ulong GetUlong(IDataReader reader, string column, ulong defaultValue = 0)`**
- **`static int? GetNullableInt(IDataReader reader, string column)`**
- **`static byte[] GetByteArray(IDataReader reader, string column)`**
- **`static bool GetBool(IDataReader reader, string column, bool defaultValue = false)`**
- **`static DateTime GetDateTime(IDataReader reader, string column, DateTime defaultValue)`**
- **`static long GetLong(IDataReader reader, string column, long defaultValue = 0)`**
All `Get*` methods:
- Return `defaultValue` if `column` is null/whitespace or value is `DBNull`.
- Log failures via `APILogger.Log(...)` with column name and value.
### `Tags`
- **`class Tag`**
- **`public const int INVALID_ID = -1`**
- **`int ID { get; set; }`**
- **`string Text { get; set; }`**
- **`bool IsObsolete { get; set; }`**
- **Constructors**: From `(string, int)`, `(Tag)`, `(IDataRecord)`, `(DataRow)`.
- **`object Clone()`**: Returns a copy.
- **`public delegate SqlCommand GetSqlCommandDelegate(bool bNewConnection)`**: Factory delegate for SQL commands.
- **`public static Tags GetTagsInstance(GetSqlCommandDelegate getSqlCommand)`**: Returns singleton instance (lazy-initialized per delegate).
- **`public static bool AddTag(string tagText, GetSqlCommandDelegate getSqlCommand)`**: Adds tag if not already present; returns `true` if added.
- **`public static bool MigrateTag(string tagText, GetSqlCommandDelegate getSqlCommand)`**: Commits tag (used for DB migration); returns `true`.
- **`public static bool[] AddRange(string[] tagText, GetSqlCommandDelegate getSqlCommand)`**: Adds multiple tags; trims leading whitespace.
- **`public static int GetIDFromTagText(string tagText, GetSqlCommandDelegate getSqlCommand)`**: Gets tag ID from text (calls DB); returns `Tag.INVALID_ID` if not found.
- **`public static int[] GetIDsFromTagText(string[] tagText, GetSqlCommandDelegate getSqlCommand)`**: Gets IDs for array of tag texts; filters out `INVALID_ID`.
- **`public static string GetTagTextFromID(int tagID, GetSqlCommandDelegate getSqlCommand)`**: Gets tag text from ID (from in-memory cache); returns `null` if invalid or not found.
- **`public static string[] GetTagTextFromIDs(int[] tagId, GetSqlCommandDelegate getSqlCommand)`**: Gets tag texts from IDs (from cache); filters invalid/empty.
- **`public bool ContainsTag(string text)`**: Checks if tag text exists in cache.
- **`public void UpdateList(GetSqlCommandDelegate getSqlCommand)`**: Refreshes in-memory cache by querying DB via `sp_TagsGet`.
## 3. Invariants
- **Singleton<T>**:
- Only one instance of `T` exists per AppDomain.
- `Instance` is lazily initialized in a static constructor.
- Direct instantiation via `new T()` throws `InvalidOperationException` if `Instance` already exists.
- If `T`s constructor throws, subsequent `Instance` access rethrows the captured exception.
- **ServiceQueue**:
- Work items execute sequentially in FIFO order.
- Only one `ServiceCall.WorkAction` runs at a time (via `Task.Run`).
- `MarkDone()` must be called by the executing code to trigger next item.
- Items not yet started can be removed from queue; only the first item is actively executed.
- **TagAwareBase**:
- `TagIDs` is never `null` (defaults to empty array).
- `TagsBlobBytes` and `TagIDs` are kept in sync via property setters.
- `Commit()` always deletes existing assignments before inserting new ones.
- `TagCompatible(string)` returns `true` if `tags` is null/empty/whitespace or if any tag matches.
- **Utility**:
- All `Get*` methods return `defaultValue` on `DBNull` or parse failure.
- All `Get*` methods log failures via `APILogger`.
- **Tags**:
- Tag text is trimmed only during `AddRange` (leading whitespace).
- `GetTagTextFromID` uses in-memory cache; `GetIDFromTagText` queries DB.
- `UpdateList` clears and repopulates `_tagsLookup`.
## 4. Dependencies
### This module depends on:
- **DTS.Common.Base**: `IBaseViewModel`, `BasePropertyChanged`.
- **DTS.Common.Enums**: `RecordingModes`, `CalibrationBehaviors`, `InputClockSource`, `OutputClockSource`.
- **DTS.Common.Interface.Sensors**: `IBaseViewModel` (used in `StatusAndProgressBarEventArgs.Requester`).
- **System**: `System.Windows`, `System.Data`, `System.Data.SqlClient`, `System.Net.NetworkInformation`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`.
- **DTS.Common.Utilities.Logging**: `APILogger`.
### This module is depended upon by:
- Any module requiring singleton behavior (`Singleton<T>`).
- Any module needing tag-aware objects (`TagAwareBase`).
- Any module performing data import (`ImportData`).
- Any module using service call queuing (`ServiceCall`, `ServiceQueue`).
- Any module needing UI region names (`RegionNames`).
- Any module requiring robust data access helpers (`Utility`).
- Any module managing tags (`Tags`).
## 5. Gotchas
- **Typo in RegionNames**: `ViewerFiterRegion` is likely intended to be `ViewerFilterRegion`.
- **Singleton<T> thread-safety**: Initialization is thread-safe (static constructor), but no further synchronization is applied to the singleton instance itself.
- **Tags caching**: `_tagsLookup` is populated only on first access and updated only when adding tags or calling `UpdateList`. It does not automatically refresh.
- **Tag text trimming**: `AddRange` trims leading whitespace, but `SetTagsFromCommaSeparatedString` does *not* trim (only `Split` and `TrimStart` in `AddRange`).
- **`TagCompatible(string)` behavior**: Returns `true` if *any* tag in the input matches *any* of the objects tags (logical OR), not AND.
- **`Tags.GetTag

View File

@@ -0,0 +1,166 @@
---
source_files:
- Common/DTS.CommonCore/Classes/ChannelCodes/TextPastedArgs.cs
- Common/DTS.CommonCore/Classes/ChannelCodes/ChannelCode.cs
generated_at: "2026-04-16T02:39:51.595748+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9a72b7f2cc9cf8aa"
---
# ChannelCodes
## Documentation: ChannelCode Module
---
### 1. Purpose
This module provides core data and command infrastructure for handling *channel codes*—named identifiers (e.g., ISO or user-defined codes) used to categorize or label channels in the system. It defines the `ChannelCode` class as the canonical implementation of `IChannelCode`, including persistence support via `IDataReader`, equality semantics, and property change notification. It also defines `PasteCommandClass`, a `ICommand` implementation that intercepts text paste operations in UI text boxes, processes clipboard content (including multi-line or delimited data), and publishes structured `TextPastedArgs` events for downstream handling—while suppressing default paste behavior to enable custom logic.
---
### 2. Public Interface
#### `class ChannelCode : BasePropertyChanged, IChannelCode`
- **`int Id { get; set; }`**
Unique numeric identifier for the channel code. Initialized to `-1` by default.
- **`UIItemStatus ItemStatus { get; set; }`**
Status of the item (e.g., `None`, `New`, `Modified`, `Deleted`). Uses `SetProperty` for change notification.
- **`string Code { get; protected set; }`**
The code string (e.g., `"A1"`, `"ISO-8601"`). Protected setter allows subclassing.
- **`string Name { get; protected set; }`**
Human-readable name for the channel code (e.g., `"Temperature Sensor"`).
- **`ChannelEnumsAndConstants.ChannelCodeType CodeType { get; set; }`**
Enumerated type of the code: `User` or `ISO`. Default is `ISO` in parameterless constructor.
- **`const string PASTE_ID = "ChannelCode"`**
Static identifier used to correlate paste operations with this channel code type.
- **`ICommand PasteCommand { get; set; } = null`**
Command bound to text boxes to handle paste operations. Defaults to `null` to avoid exceptions during UI construction.
- **`ChannelCode(IDataReader reader, IReadOnlyDictionary<short, string> channelTypeLookup)`**
Constructor that initializes the instance from a database record. Reads `Id`, `Code`, `Name`, and `CodeTypeInt` columns. Uses `channelTypeLookup` to map `CodeTypeInt` to `ChannelCodeType` (`User` or `ISO`) via string keys (`"User"` / `"ISO"`).
- **`ChannelCode()`**
Parameterless constructor. Sets `CodeType` to `ISO`.
- **`ChannelCode(IChannelCode channelCode)`**
Copy constructor. Copies `Id`, `Code`, `Name`, and `CodeType` from another `IChannelCode`.
- **`override bool Equals(object obj)`**
Equality comparison based on `Code`, `Name`, and `CodeType`. Returns `false` if `obj` is not a `ChannelCode`.
- **`~ChannelCode()`**
Finalizer that nulls `_code` and `_name` to reduce memory footprint if the object is held longer than expected.
#### `class PasteCommandClass : ICommand`
- **`string Id { get; }`**
Identifier passed at construction; used to tag paste events.
- **`bool CanExecute(object parameter)`**
Always returns `true`.
- **`void Execute(object parameter)`**
Handles paste logic:
- Requires `parameter` to be a `TextBox`.
- Attempts to resolve `IChannelCode` from `TextBox.DataContext`, with fallbacks to `ChannelCodeBuilder` or `ChannelNameBuilder` view models.
- Reads clipboard text.
- If clipboard contains **exactly one line** and **no delimiters** (`,`, `;`, `\t`), publishes a `PageModifiedEvent` and exits early (single-field paste is handled by `TextChanged`).
- Otherwise:
- Resets `Code` and `Name` properties (no-op assignment to trigger change notifications).
- Publishes a `TextPastedEvent` with a `TextPastedArgs` instance containing:
- `Text`: full clipboard content
- `Sender`: resolved `IChannelCode`
- `Id`: `PasteCommandClass.Id`
- `Tag`: `TextBox.Tag`
- Catches and reports exceptions via `PageErrorEvent`.
- **`PasteCommandClass(string id)`**
Constructor storing `id` in `Id` property.
#### `delegate string CoerceISOCodeDelegate(...)`
- **`string CoerceISOCodeDelegate(string val, bool uniqueISOCodesRequired, bool useISOCodeFilterMapping)`**
Signature for a delegate used to transform or validate incoming ISO codes. Not implemented in this file—only declared.
---
### 3. Invariants
- **`ChannelCode.Code` and `ChannelCode.Name` must be non-null**
Initialized to `string.Empty` and never set to `null` (via `SetProperty` and constructor defaults).
- **`ChannelCode.Id` defaults to `-1`**
A value of `-1` indicates the code has not been persisted or assigned.
- **`ChannelCode.CodeType` defaults to `ISO`**
Unless explicitly set otherwise (e.g., via constructor with `IDataReader` or copy constructor).
- **Equality is based on `Code`, `Name`, and `CodeType`**
`Id` is *not* part of equality semantics.
- **Paste command only processes `TextBox` parameters**
Non-`TextBox` inputs are silently ignored.
- **Clipboard text is split by `Environment.NewLine`**
Only single-line, non-delimited text bypasses `TextPastedEvent`; all other cases trigger it.
---
### 4. Dependencies
#### *This module depends on:*
- **`DTS.Common.Base`**
Provides `BasePropertyChanged` (base class for `ChannelCode`).
- **`DTS.Common.Interface.Channels.ChannelCodes`**
Defines `IChannelCode` interface.
- **`DTS.Common.Enums`**
Provides `UIItemStatus`, `ChannelEnumsAndConstants` (enum `ChannelCodeType`, string constants `"User"`, `"ISO"`).
- **`DTS.Common.Events`**
Defines `PageModifiedEvent`, `TextPastedEvent`, `PageErrorEvent`, and argument types (`PageModifiedArg`, `TextPastedArgs`, `PageErrorArg`).
- **`System.Data`**
For `IDataReader`.
- **`System.Windows` / `System.Windows.Controls` / `System.Windows.Input`**
For `UIElement`, `TextBox`, `ICommand`.
- **`Microsoft.Practices.Prism.Events`**
For `IEventAggregator`.
- **`Microsoft.Practices.ServiceLocation`**
For `ServiceLocator`.
#### *This module is depended on by:*
- Any UI layer components that bind `ChannelCode` instances to views (e.g., `ChannelCodeBuilder`, `ChannelNameBuilder`).
- Event handlers subscribed to `TextPastedEvent`.
- Code that constructs `ChannelCode` instances from database readers or clones them.
---
### 5. Gotchas
- **`PasteCommand` defaults to `null`**
To avoid exceptions during UI construction (per inline comment: *"putting a null here avoids wasteful exception"*). Consumers must explicitly assign a `PasteCommandClass` instance.
- **`ChannelCode.Equals` ignores `Id`**
Two codes with different IDs but identical `Code`, `Name`, and `CodeType` are considered equal. This may cause issues if IDs are expected to be unique in comparisons.
- **`~ChannelCode()` finalizer nulls fields but does not prevent GC of the object**
This is a cleanup heuristic, not a disposal pattern. No `IDisposable` implementation is present.
- **Single-line paste with delimiters still triggers `TextPastedEvent`**
Only *single-line, no-delimiter* text skips the event; multi-line or single-line with `,`, `;`, or `\t` always publish `TextPastedArgs`.
- **`PasteCommand.Execute` silently ignores invalid contexts**
If `parameter` is not a `TextBox`, or `DataContext` is not an `IChannelCode`/builder, the method returns without error or logging (except via `PageErrorEvent` on exception).
- **`CoerceISOCodeDelegate` is declared but not implemented here**
Its purpose is documented, but no concrete implementation is provided in this module.
- **`ChannelCode` constructor with `IDataReader` relies on column names and lookup dictionary**
If `channelTypeLookup` lacks the key from `CodeTypeInt`, or columns are missing, behavior is undefined (no explicit validation is present).

View File

@@ -0,0 +1,33 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Connection/NotConnectedException.cs
generated_at: "2026-04-16T02:39:10.292945+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ebd03ba552c1193d"
---
# Connection
1. **Purpose**
This module defines a custom exception type, `NotConnectedException`, used to signal operations that are attempted on a connection object when no active connection is established. It resides in the `DTS.Common.Classes.Connection` namespace, indicating its role in the common core infrastructure for managing connection state across the DTS system. Its purpose is to provide a semantically precise exception for connection-state violations, distinguishing them from generic `ApplicationException` or `InvalidOperationException` cases.
2. **Public Interface**
- **`NotConnectedException(string message)`**
Constructor that initializes the exception with a specified error message. It delegates to the base `ApplicationException` constructor. No additional properties or methods are exposed beyond those inherited from `Exception`.
3. **Invariants**
- The exception inherits all standard `Exception` invariants (e.g., `Message`, `StackTrace`, `InnerException` behavior).
- The exception is *only* intended for use when an operation requires an active connection but none exists; it is not a general-purpose connection error.
- No validation or state management is performed by this class itself—it is a passive data carrier.
4. **Dependencies**
- **Depends on**: `System.ApplicationException` (from `mscorlib`/`System.Runtime`).
- **Used by**: Presumably connection-handling classes (e.g., `Connection`, `Client`, or `Session` types in the `DTS.Common.Classes.Connection` namespace or related modules), though these are not visible in this file.
- **Not used by**: No other code in this file; this is a standalone type definition.
5. **Gotchas**
- `ApplicationException` is deprecated in modern .NET best practices (replaced by `Exception` or more specific built-in exceptions like `InvalidOperationException`), suggesting this may be legacy code or part of an older design pattern.
- The class provides no additional context (e.g., connection ID, endpoint, or timestamp), so callers must embed such details in the `message` string if needed for diagnostics.
- No serialization support is explicitly implemented (e.g., `[Serializable]` attribute or custom `GetObjectData`), though `ApplicationException` itself is serializable by default in .NET Framework—behavior may differ in .NET Core/.NET 5+.
- None identified from source alone.

View File

@@ -0,0 +1,201 @@
---
source_files:
- Common/DTS.CommonCore/Classes/DASFactory/TemperatureConfig.cs
- Common/DTS.CommonCore/Classes/DASFactory/TMSNConfig.cs
- Common/DTS.CommonCore/Classes/DASFactory/ATDStagger.cs
generated_at: "2026-04-16T02:41:35.863754+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b5e818821adb9531"
---
# DASFactory
## Documentation: DASFactory Configuration Classes
---
### 1. Purpose
This module provides strongly-typed configuration classes for DASFactory subsystems, encapsulating low-level data structures used for communication with hardware devices. Specifically, `TemperatureConfig` manages temperature/humidity logging channel selection and timing, `TMNSConfig` encapsulates TMNS (Telemetry Network Service) streaming parameters, and `ATDStagger` (currently commented out) was designed to serialize device command execution to avoid communication bottlenecks. These classes replace raw arrays with named fields and helper methods to improve maintainability, type safety, and clarity in configuration serialization/deserialization workflows.
---
### 2. Public Interface
#### `TemperatureConfig`
- **`public ushort LogEnable { get; set; }`**
Enables/disables logging (non-zero = enabled).
- **`public ushort LogIntervalSec { get; set; }`**
Logging interval in seconds.
- **`public ushort Channels { get; set; }`**
Bitfield representing enabled channels (16-bit value). Setting updates internal `BitArray`; reading converts `BitArray` to `ushort`.
- **`public const ushort Reserved = 0;`**
Reserved field value (always 0).
- **`public bool MCUTemp { get; set; }`**
Gets/sets the On-Board MCU Temperature channel (bit 0 of `_channels`).
- **`public bool OnBoardHumidity { get; set; }`**
Gets/sets the On-Board Humidity channel (bit 1 of `_channels`).
- **`public bool EnvironmentalCh1 { get; set; }`**
Gets/sets Environmental Channel 1 (bit 2 of `_channels`).
- **`public bool EnvironmentalCh2 { get; set; }`**
Gets/sets Environmental Channel 2 (bit 3 of `_channels`).
- **`public bool EnvironmentalCh3 { get; set; }`**
Gets/sets Environmental Channel 3 (bit 4 of `_channels`).
- **`public bool EnvironmentalCh4 { get; set; }`**
Gets/sets Environmental Channel 4 (bit 5 of `_channels`).
- **`public ushort[] ToUShortArray()`**
Returns `[LogEnable, LogIntervalSec, Channels, Reserved]` in that order.
- **`public TemperatureConfig()`**
Default constructor.
- **`public TemperatureConfig(ushort[] ushortArray)`**
Constructor from `ushort[]`. Reads indices 02; missing indices default to `0`. Does *not* initialize `Reserved`.
- **`public int[] GetChannelsArray()`**
Returns list of bit indices where `_channels` is set (e.g., `[0,2,4]` if MCUTemp, Ch1, Ch3 enabled).
- **`public S6DBDiagnosticChannelList[] GetMeasurementChannels()`**
Maps enabled channels to corresponding `S6DBDiagnosticChannelList` enum values (e.g., `DiagMcuTemperature`, `DiagEnv_1_Temperature`, etc.).
- **`public TempLogChannelBits GetChannelBitForDiagChannel(S6DBDiagnosticChannelList ch)`**
Maps a `S6DBDiagnosticChannelList` value to its corresponding `TempLogChannelBits` enum. Throws `NullReferenceException` if not found.
#### `TMNSConfig`
- **`public uint TMNS_PCMSubFrameId { get; set; }`**
TMNS PCM sub-frame ID.
- **`public uint TMNS_MsgId { get; set; }`**
TMNS message ID.
- **`public uint TMNS_PCMMinorPerMajor { get; set; }`**
TMNS PCM minor-per-major setting.
- **`public uint TMNS_TMATSPortNumber { get; set; }`**
TMNS TMATS port number.
- **`public uint IENAUDP_PortNumber { get; set; }`**
IENA UDP source port number.
- **`public uint TMNS5, TMNS6, TMNS7 { get; set; }`**
Reserved fields (57).
- **`public enum Fields { ... }`**
Ordered list of field indices: `TMNS_PCMSubFrameID`, `TMNS_MsgId`, `TMNS_PCMMinorPerMajor`, `TMNS_TMATSPortNumber`, `IENAUDP_PortNumber`, `TMNS5`, `TMNS6`, `TMNS7`.
- **`public TMNSConfig()`**
Default constructor; initializes `_values` array to length 8 with zeros.
- **`public TMNSConfig(uint[] parameters)`**
Constructor from `uint[]`. Copies up to 8 values; missing indices default to `0`.
- **`public TMNSConfig(string parameters)`**
Constructor from comma-separated string (e.g., `"(1,2,3)"`). Parses `uint` values; invalid tokens default to `0`.
- **`public void SetValue(Fields field, uint value)`**
Sets `_values[(int)field]`.
- **`public uint GetValue(Fields field)`**
Returns `_values[(int)field]`.
- **`public uint[] ToUintArray()`**
Returns a copy of `_values`.
- **`public string ToCSVString()`**
Returns string in format `"(x,y,z,...)"`.
- **`public static bool IsCh10(UDPStreamProfile profile)`**
Returns `true` if `profile` is one of the CH10 variants.
- **`public static bool IsIENA(UDPStreamProfile profile)`**
Returns `true` if `profile == UDPStreamProfile.IENA_PTYPE_STREAM`.
- **`public static bool IsTMNS(UDPStreamProfile profile)`**
Returns `true` if `profile` is `TMNS_PCM_STANDARD` or `TMNS_PCM_SUPERCOM`.
- **`public static bool IsUART(UDPStreamProfile profile)`**
Returns `true` if `profile == UDPStreamProfile.UART_STREAM`.
#### `ATDStagger` *(commented out)*
- **No public interface is active** — the entire class is commented out. The source includes only historical comments and implementation notes. No runtime behavior can be documented.
---
### 3. Invariants
- **`TemperatureConfig`**
- `_channels` is always a 16-bit `BitArray` (2 bytes), initialized to `0x0000`.
- `Channels` property setter always replaces `_channels` with a new `BitArray` constructed from the `ushort`s bytes.
- `LogEnable`, `LogIntervalSec`, and `Channels` are the only fields populated from `ushort[]` constructor; `Reserved` is ignored in constructor.
- `GetChannelBitForDiagChannel` throws `NullReferenceException` (not `KeyNotFoundException`) if the key is missing — a bug in implementation.
- **`TMNSConfig`**
- `_values` is always exactly 8 elements long (matching `Fields` enum count).
- `ToUintArray()` returns a *copy*, not a reference.
- `ToCSVString()` always includes parentheses and commas, even for empty/zero values.
- **`ATDStagger`**
- *N/A* — class is commented out; no invariants apply.
---
### 4. Dependencies
- **`TemperatureConfig`**
- **Imports**: `DTS.Common.Enums.DASFactory` (for `DFConstantsAndEnums`, `TempLogChannelBits`), `System`, `System.Collections`, `System.Collections.Generic`.
- **Uses**: `BitConverter`, `BitArray`.
- **Depends on**: `TempLogChannelBits` and `S6DBDiagnosticChannelList` enums (defined in `DTS.Common.Enums.DASFactory` and `DTS.Common.Enums`, respectively — not shown).
- **Used by**: Likely consumed by firmware/hardware communication layers to configure logging; inferred from usage of `ToUShortArray()` and `GetMeasurementChannels()`.
- **`TMNSConfig`**
- **Imports**: `DTS.Common.Enums`, `System`, `System.Linq`, `System.Text`.
- **Uses**: `UDPStreamProfile` enum (from `DTS.Common.Enums` — not shown).
- **Depends on**: `UDPStreamProfile` for `IsCh10`, `IsIENA`, `IsTMNS`, `IsUART` methods.
- **Used by**: Likely used by telemetry configuration modules (e.g., FWTU, DP — mentioned in summary).
- **`ATDStagger`**
- **Imports**: `DTS.Common.Interface.DASFactory`, `DTS.Common.Utilities.Logging`, `System`, `System.Collections.Generic`, `System.Data`, `System.Linq`.
- **Uses**: `IDASCommunication`, `ICommunication`, `APILogger`, `IDbCommand`.
- **Depends on**: Database schema (`[DataPro].[dbo].[DAS]` table with columns `SerialNumber`, `PositionOnDistributor`, `PositionOnChain`, `Port`, `ParentDAS`), and `IsSlice6Distributor()` extension method.
- **Used by**: Service execution logic (not visible in source).
---
### 5. Gotchas
- **`TemperatureConfig`**
- `Reserved` is a `const`, but the `ushort[]` constructor does *not* read index 3 — `Reserved` is always `0` regardless of input.
- `GetChannelBitForDiagChannel` throws `NullReferenceException` instead of `KeyNotFoundException` — misleading and non-idiomatic.
- `Channels` setter uses `BitConverter.ToUInt16(bytes, 0)` — assumes little-endian platform (standard on .NET, but not guaranteed by spec).
- `GetUShort` silently defaults to `0` for out-of-bounds indices — may hide configuration errors.
- **`TMNSConfig`**
- `ToCSVString()` always includes parentheses — callers expecting bare comma-separated values may need to strip them.
- String constructor allows `(1,2,3)` but does *not* validate length — extra tokens are ignored, missing tokens default to `0`.
- `IsCh10`, `IsIENA`, etc., are `static` and operate on `UDPStreamProfile` — not directly tied to `TMNSConfig` instance state.
- **`ATDStagger`**
- Entire class is commented out — do not use. Historical comments suggest it was intended for ATD device sequencing but was never enabled.
- Logic for assigning devices to ports (e.g., "even if we end up talking to 4 devices on one port itll be better...") is heuristic and not guaranteed optimal.
- **All Classes**
- No validation on `LogIntervalSec` (e.g., no minimum/maximum checks).
- No thread-safety guarantees beyond `lock` usage in `ATDStagger` (which is commented out). `TemperatureConfig` and `TMNSConfig` are not thread-safe.
- **None identified from source alone** for `ATDStagger` — class is inactive.
---

View File

@@ -0,0 +1,61 @@
---
source_files:
- Common/DTS.CommonCore/Classes/DTS.Viewer/Commands/RelayCommand.cs
generated_at: "2026-04-16T02:42:33.604683+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "63672ade54ed35d0"
---
# Commands
### **Purpose**
This module implements a concrete, reusable `ICommand`-based command class (`RelayCommand`) for WPF applications, enabling decoupling of UI actions (e.g., button clicks) from their execution logic. It serves as a lightweight command adapter that forwards `Execute` and `CanExecute` calls to user-provided delegates, supporting both mandatory execution logic and optional, parameterized execution guards. This pattern is foundational for implementing MVVM-style command binding in WPF.
---
### **Public Interface**
All members are public and part of the `RelayCommand` class.
- **`RelayCommand(Action<object> execute)`**
Constructor. Initializes the command with an execution delegate and no `CanExecute` guard (i.e., `CanExecute` always returns `true`). Throws `ArgumentNullException` if `execute` is `null`.
- **`RelayCommand(Action<object> execute, Predicate<object> canExecute)`**
Constructor. Initializes the command with both execution and guard delegates. Throws `ArgumentNullException` if `execute` is `null`. The `canExecute` parameter may be `null`, in which case `CanExecute` defaults to `true`.
- **`bool CanExecute(object parameter)`**
Implements `ICommand.CanExecute`. Invokes the stored `_canExecute` predicate (if non-null) with `parameter`; otherwise returns `true`.
- **`void Execute(object parameter)`**
Implements `ICommand.Execute`. Invokes the stored `_execute` action with `parameter`. No validation is performed on `parameter` beyond null-safety of the delegate itself.
- **`event EventHandler CanExecuteChanged`**
Implements `ICommand.CanExecuteChanged`. Subscribes/unsubscribes to `CommandManager.RequerySuggested`, enabling automatic re-evaluation of `CanExecute` when WPF detects relevant state changes (e.g., keyboard/mouse input, focus changes).
---
### **Invariants**
- `_execute` is **never null** after construction (enforced via `ArgumentNullException` in both constructors).
- `_canExecute` may be `null`; if so, `CanExecute` always returns `true`.
- `CanExecuteChanged` event handlers are **always** attached to `CommandManager.RequerySuggested`, ensuring WPFs command system triggers requery logic.
- No explicit validation is performed on the `parameter` passed to `Execute` or `CanExecute`; nulls are passed directly to the delegates.
---
### **Dependencies**
- **External Dependencies**:
- `System` (for `Action<T>`, `Predicate<T>`, `ArgumentNullException`)
- `System.Windows.Input` (for `ICommand`, `CommandManager`)
- **Internal Dependencies**:
- No other modules in the codebase are referenced (self-contained).
- **Depended Upon**:
- Likely consumed by WPF UI layers (e.g., `Button.Command` bindings) and view models throughout the `DTS.Viewer` subsystem.
---
### **Gotchas**
- **No manual `CanExecuteChanged` raising**: The class relies solely on `CommandManager.RequerySuggested` to trigger `CanExecute` re-evaluation. If the commands executability depends on non-UI state changes (e.g., background thread updates), callers must manually invoke `CommandManager.InvalidateRequerySuggested()` (or similar) to force updates.
- **Parameter handling**: The `parameter` passed to `Execute`/`CanExecute` is unvalidated. Passing `null` is permitted and will be forwarded to the delegates—consumers must handle `null` parameters explicitly if needed.
- **Thread affinity**: `CommandManager.RequerySuggested` is raised on the UI thread. If `CanExecute` delegates access non-UI-thread resources, thread-safety must be ensured by the caller.
- **No disposal pattern**: The class does not implement `IDisposable`, and event subscriptions (via `CanExecuteChanged`) are not explicitly cleaned up—relying on WPFs lifetime management. This is acceptable for typical view model lifetimes but may cause leaks in long-lived command instances.
- **No async support**: `Execute` is synchronous; asynchronous operations require manual wrapping (e.g., `async void` or fire-and-forget), which is error-prone.

View File

@@ -0,0 +1,62 @@
---
source_files:
- Common/DTS.CommonCore/Classes/DTS.Viewer/Reports/ChannelGRMSSummary.cs
generated_at: "2026-04-16T02:42:43.162304+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7b6bc8e72ad59bb8"
---
# Reports
### **Purpose**
This module defines the `ChannelGRMSSummary` class, a data container for summarizing GRMS (Gaussian Root Mean Square) vibration metrics for a single channel in a test or analysis report. It implements `INotifyPropertyChanged` to support data binding scenarios (e.g., UI views), enabling reactive updates when property values change. The class serves as a lightweight, observable model for reporting tools that visualize or export channel-level GRMS results.
---
### **Public Interface**
- **`ChannelName`** (`string` property)
Gets or sets the human-readable name of the channel (e.g., `"Ch1-Accel-X"`).
- **`SampleRate`** (`int` property)
Gets or sets the sample rate (in Hz) associated with the channels data.
- **`GRMS`** (`double` property)
Gets or sets the computed GRMS value (a scalar vibration intensity metric) for the channel.
- **`PropertyChanged`** (`event PropertyChangedEventHandler`)
Event raised when a property value changes. Used by data-binding frameworks (e.g., WPF, WinForms) to refresh UI elements.
- **`OnPropertyChanged(string propertyName)`** (`void` method)
Invokes the `PropertyChanged` event with the specified property name. Callers must ensure `propertyName` matches the actual property name (e.g., `"GRMS"`) to maintain binding correctness.
---
### **Invariants**
- `ChannelName` may be `null` or empty; no validation is enforced in the class itself.
- `SampleRate` is an `int`, but no constraints (e.g., positive values) are enforced.
- `GRMS` is a `double`; negative values are *not* logically invalid at the type level but may be semantically nonsensical (GRMS is typically ≥0).
- The `OnPropertyChanged` method does **not** validate whether `propertyName` corresponds to a real property; invalid names will still trigger the event.
- Thread safety is **not** guaranteed; `PropertyChanged` invocation is not synchronized.
---
### **Dependencies**
- **Depends on**:
- `System.ComponentModel` (for `INotifyPropertyChanged` via `PropertyChangedEventHandler` and `PropertyChangedEventArgs`).
- `DTS.Common.Interface` (for the `IChannelGRMSSummary` interface—implementation is implicit via class declaration).
- **Implements**:
- `IChannelGRMSSummary` (from `DTS.Common.Interface`), though the interface definition is not provided here.
- **Used by**:
- Presumably UI components (e.g., data grids, charts) that bind to GRMS summary reports.
- Report-generation logic that aggregates or filters channel-level results.
---
### **Gotchas**
- **No null-safety for `PropertyChanged`**: The null-conditional operator (`?.`) is used in `OnPropertyChanged`, but callers must still ensure `propertyName` is non-null to avoid runtime issues (though `null` would only cause no event to fire, not an exception).
- **No validation on `GRMS`**: Negative or `NaN` values are permitted; consumers must handle invalid values appropriately.
- **No explicit interface implementation**: The class declares `public event PropertyChangedEventHandler PropertyChanged` rather than explicit `INotifyPropertyChanged.PropertyChanged`, which may expose the event unnecessarily in some contexts.
- **No documentation of `IChannelGRMSSummary`**: Without the interface definition, it is unclear whether `IChannelGRMSSummary` enforces additional members (e.g., `ToString()`, comparison logic).
- **No constructor**: Relies on auto-implemented properties and default initialization; callers must explicitly set all properties post-instantiation.

View File

@@ -0,0 +1,300 @@
---
source_files:
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestMetadata.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestGraphs.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestSetupMetadata.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestRunMetadata.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestSummary.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestModule.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestChannel.cs
- Common/DTS.CommonCore/Classes/DTS.Viewer/TestMetadata/TestMetadataList.cs
generated_at: "2026-04-16T02:42:52.937741+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c38901448183a71b"
---
# Documentation: TestMetadata Module
## 1. Purpose
This module provides data structures and parsing logic for loading, representing, and managing test metadata from XML-based `.dts` files in the DTS Viewer system. It defines core domain models (`TestMetadata`, `TestRunMetadata`, `TestSetupMetadata`, `TestModule`, `TestChannel`, `TestGraphs`, `TestSummary`) that encapsulate test configuration, hardware setup, channel definitions, and summary information. The `TestMetadataList` class is responsible for deserializing XML metadata files into strongly-typed objects and constructing `TestSummary` instances for UI consumption, including timestamp resolution using PTP1588 timing data when available.
## 2. Public Interface
### `TestMetadataList`
#### `GetTestSummaryListAsync(IBaseViewModel parent, string path, string file, string pattern = "")`
- **Behavior**: Asynchronous wrapper (currently synchronous implementation) that returns an `ObservableCollection<ITestSummary>` by parsing `.dts` files in the specified directory. Uses `pattern` to filter files (default: `.dts`). Requires `parent` for view model hierarchy.
#### `GetTestSummaryList(IBaseViewModel parent, string path, string file = "", string pattern = "")`
- **Behavior**: Synchronously returns an `ObservableCollection<ITestSummary>` by parsing `.dts` files. Uses `parent` to set `TestSummary.Parent`.
#### `GetTestSummaryList(string path, string file = "", string pattern = "")`
- **Behavior**: Same as above but without a `parent` parameter (used when parent is not applicable or set later).
#### `GetTestMetadataList(XDocument xDoc, string path, string file)`
- **Behavior**: Parses an `XDocument` (loaded `.dts` XML) into a `List<ITestMetadata>`. Handles channel array initialization and publishes errors via `IEventAggregator` on failure. Returns empty list on exception.
### `TestMetadata`
- **Properties**:
- `ITestRunMetadata TestRun { get; set; }`
- `ITestSetupMetadata TestSetup { get; set; }`
- **Behavior**: Simple container for test run and setup metadata.
### `TestRunMetadata`
- **Properties**:
- `string Name { get; set; }` — Logical test name (from XML `@Id` attribute).
- `string Id { get; set; }` — File name without extension (derived from `@FilePath`).
- `string Description { get; set; }`
- `bool InlineSerializedData { get; set; }`
- `string TestGuid { get; set; }`
- `int FaultFlags { get; set; }`
- `string Software { get; set; }`
- `string SoftwareVersion { get; set; }`
- `string DataType { get; set; }`
- `DateTime FileDate { get; set; }`
- `string FilePath { get; set; }`
- `List<ITestModule> Modules { get; set; }`
- `List<ITestChannel> Channels { get; set; }`
- `List<ITestChannel> CalculatedChannels { get; set; }`
- `bool IsSelected { get; set; }`
- **Events**:
- `event PropertyChangedEventHandler PropertyChanged` — Implements `INotifyPropertyChanged`.
### `TestSetupMetadata`
- **Properties**:
- `string SetupName { get; set; }`
- `DateTime TimeStamp { get; set; }`
- `List<ITestGraphs> TestGraphs { get; set; }`
- `CalibrationBehaviors CalibrationBehavior { get; set; }`
### `TestGraphs`
- **Properties**:
- `string Name { get; set; }`
- `string HardwareChannelName { get; set; }`
- `List<string> ChannelIds { get; set; }`
- `List<ITestChannel> Channels { get; set; }`
### `TestModule`
- **Properties**:
- `string SerialNumber { get; set; }`
- `string BaseSerialNumber { get; set; }`
- `int AaFilterRateHz { get; set; }`
- `int Number { get; set; }`
- `int NumberOfSamples { get; set; }`
- `int UnsubsampledNumberOfSamples { get; set; }`
- `double RequestedPostTriggerSeconds { get; set; }`
- `double RequestedPreTriggerSeconds { get; set; }`
- `double PostTriggerSeconds { get; set; }`
- `double PreTriggerSeconds { get; set; }`
- `string RecordingMode { get; set; }`
- `int SampleRateHz { get; set; }`
- `int StartRecordSampleNumber { get; set; }`
- `int NumberOfChannels { get; set; }`
- `bool InlineSerializedData { get; set; }`
- `int StartRecordTimestampSec { get; set; }`
- `int StartRecordTimestampNanoSec { get; set; }`
- `int TriggerTimestampSec { get; set; }`
- `int TriggerTimestampNanoSec { get; set; }`
- `List<ulong> TriggerSampleNumbers { get; set; }`*Always empty* (see *Gotchas*).
- `bool PTPMasterSync { get; set; }`
- `int TiltSensorAxisX/Y/ZDegreesPre/Post { get; set; }`
- `int TemperatureLocation1/2/3/4Pre/Post { get; set; }`
- `List<ITestChannel> Channels { get; set; }`
- `List<ITestChannel> CalculatedChannels { get; set; }`
- `bool IsSelected { get; set; }`
- **Events**:
- `event PropertyChangedEventHandler PropertyChanged`
### `TestChannel`
- **Properties**:
- `string Group { get; set; }`
- `string SubGroup { get; set; }`
- `bool IsGraphChannel { get; set; }`
- `string GraphName { get; set; }`
- `string TestId { get; set; }`
- `string TestSetupName { get; set; }`
- `string ModuleSerialNumber { get; set; }`
- `string SerialNumber { get; set; }`
- `string ChannelId { get; set; }`
- `string ChannelDisplayName { get; set; }`
- `string Description { get; set; }`
- `string IsoCode { get; set; }`
- `string IsoChannelName { get; set; }`
- `string UserCode { get; set; }`
- `string UserChannelName { get; set; }`
- `string ChannelGroupName { get; set; }`
- `string ChannelType { get; set; }`
- `bool IsCalculatedChannel { get; set; }`
- `int Number { get; set; }`
- `string DigitalMultiplier { get; set; }`
- `string DigitalMode { get; set; }`
- `DateTime Start { get; set; }`
- `string Bridge { get; set; }`
- `double BridgeResistanceOhms { get; set; }`
- `double ZeroPoint { get; set; }`
- `string ChannelDescriptionString { get; set; }`
- `string ChannelName2 { get; set; }`
- `string HardwareChannelName { get; set; }`
- `double DesiredRange { get; set; }`
- `double ActualMaxRangeEu { get; set; }`
- `double ActualMinRangeEu { get; set; }`
- `double ActualMaxRangeAdc { get; set; }` — Always `short.MaxValue`
- `double ActualMinRangeAdc { get; set; }` — Always `short.MinValue`
- `double ActualMaxRangeMv { get; set; }`
- `double ActualMinRangeMv { get; set; }`
- `double Sensitivity { get; set; }`
- `string SoftwareFilter { get; set; }`
- `bool ProportionalToExcitation { get; set; }`
- `bool IsInverted { get; set; }`
- `string LinearizationFormula { get; set; }`
- `bool IsSubsampled { get; set; }`
- `int AbsoluteDisplayOrder { get; set; }`
- `DateTime LastCalibrationDate { get; set; }`
- `string SensorId { get; set; }`
- `int OffsetToleranceLowMv { get; set; }`
- `int OffsetToleranceHighMv { get; set; }`
- `int DataFlag { get; set; }`
- `string ExcitationVoltage { get; set; }`
- `string Eu { get; set; }`
- `bool CalSignalEnabled { get; set; }`
- `bool ShuntEnabled { get; set; }`
- `bool VoltageInsertionCheckEnabled { get; set; }`
- `bool RemoveOffset { get; set; }`
- `string ZeroMethod { get; set; }`
- `double ZeroAverageWindowBegin { get; set; }`
- `double ZeroAverageWindowEnd { get; set; }`
- `int InitialEu { get; set; }`
- `string InitialOffset { get; set; }`
- `int UnsubsampledSampleRateHz { get; set; }`
- `double MeasuredShuntDeflectionMv { get; set; }`
- `double TargetShuntDeflectionMv { get; set; }`
- `double MeasuredExcitationVoltage { get; set; }`
- `double FactoryExcitationVoltage { get; set; }`
- `double TimeOfFirstSample { get; set; }`
- `double Multiplier { get; set; }`
- `double UserOffsetEu { get; set; }`
- `int UnitConversion { get; set; }`
- `bool AtCapacity { get; set; }`
- `int CapacityOutputIsBasedOn { get; set; }`
- `string SourceChannelNumber { get; set; }`
- `string SourceModuleNumber { get; set; }`
- `string SourceModuleSerialNumber { get; set; }`
- `string Calculation { get; set; }`
- `int SampleRateHz { get; set; }`
- `string SensitivityUnits { get; set; }`
- `int SensorCapacity { get; set; }`
- `string SensorPolarity { get; set; }`
- `int ChannelNumber { get; set; }`
- `string BinaryFileName { get; set; }`
- `string BinaryFilePath { get; set; }`
- `double Xmax { get; set; }`
- `double Xmin { get; set; }`
- `int SequentialNumbers { get; set; }`
- `ITestSetupMetadata ParentTestSetup { get; set; }`
- `ITestModule ParentModule { get; set; }`
- `IBaseViewModel Parent { get; set; }`
- `Color ChannelColor { get; set; }`
- `string ErrorMessage { get; set; }`
- `bool IsError { get; set; }`
- `Color? ErrorColor { get; set; }` — Derived from `IsError`.
- `bool IsLocked { get; set; }`
- `bool CanLock { get; set; }`
- `bool CanSelectChannel { get; set; }`
- `bool IsExpanded { get; set; }`
- `bool IsSelected { get; set; }`
- `double MinADC/MaxADC/AveADC/StdDevADC/T0ADC { get; set; }`
- `double MinMV/MaxMV/AveMV/StdDevMV/T0MV { get; set; }`
- `double MinEU/MaxEU/AveEU/StdDevEU/T0EU { get; set; }`
- `double MinY/MaxY/AveY/StdDevY/T0Value { get; set; }`
- **Methods**:
- `void SetChannelDescriptionAndDisplayName(string channelDescription)` — Sets `ChannelDescriptionString` and `ChannelDisplayName`.
- `ITestChannel Copy()` — Shallow copy via `MemberwiseClone()`.
- `override string ToString()` — Returns `ChannelDescriptionString` or `"N/A"` if test-specific embedded.
- **Events**:
- `event PropertyChangedEventHandler PropertyChanged` — Inherited from `BasePropertyChanged`.
### `TestSummary`
- **Properties**:
- `string Id { get; set; }` — Concatenation of `TestRun.Id` and event number from `FilePath`.
- `string SetupName { get; set; }`
- `string Description { get; set; }`
- `int ChannelCount { get; set; }`
- `DateTime FileDate { get; set; }`
- `DateTime TimeStamp { get; set; }` — Derived from module PTP timestamps if valid, else `TestSetup.TimeStamp`.
- `string DataType { get; set; }`
- `bool IsSelected { get; set; }`
- `List<ITestGraphs> Graphs { get; set; }`
- `List<ITestChannel> Channels { get; set; }`
- `List<ITestChannel> CalculatedChannels { get; set; }`
- `IBaseViewModel Parent { get; set; }`
- `CalibrationBehaviors CalibrationBehavior { get; set; }` — Default: `NonLinearIfAvailable`.
- `ITestMetadata TestMetadata { get; set; }`
- **Commands**:
- `DelegateCommand IsSelectedCommand { get; }` — Toggles selection and updates `Parent.SelectedTestSummaryList`.
- **Methods**:
- `void SelectionChanged()` — Adds/removes `this` from `Parent.SelectedTestSummaryList` and calls `PublishSelectedTestSummaryList()` on parent.
- `void OnPropertyChanged(string propertyName)` — Raises `PropertyChanged`.
- **Events**:
- `event PropertyChangedEventHandler PropertyChanged`
- **Constants**:
- `public const string ROI_SUFFIX = @"_ROI Period";`
## 3. Invariants
- **`TestMetadata`**: Must contain non-null `TestRun` and `TestSetup` references after successful parsing.
- **`TestRunMetadata.Channels` and `TestRunMetadata.CalculatedChannels`**: Initialized as empty lists during parsing if missing in XML.
- **`TestModule.TriggerSampleNumbers`**: Always initialized as an empty list; never populated (see *Gotchas*).
- **`TestChannel.ChannelId`**: If missing or `-1` in XML, defaults to `m.GetHashCode().ToString()` (non-deterministic).
- **`TestChannel.HardwareChannelName`**: For calculated channels, always set to `"N/A"` (via `Strings.Strings.Table_NA`).
- **`TestChannel.SerialNumber`**: For calculated channels, always set to `"N/A"`.
- **`TestSummary.TimeStamp`**: Falls back to `TestSetup.TimeStamp` if PTP timestamps are invalid or unavailable.
- **`TestSummary.Id`**: Always includes event number extracted from `FilePath` via `ParseEventNumber`.
- **`TestChannel.IsCalculatedChannel`**: Must be `true` for channels loaded via `LoadTestCalculatedChannels`.
- **`TestSummary.IsSelected`**: Setter enforces selection logic via `SelectionChanged()` and `Parent` interaction.
## 4. Dependencies
### Internal Dependencies (from source):
- **Interfaces**:
- `DTS.Common.Interface.ITestMetadata`, `ITestRunMetadata`, `ITestSetupMetadata`, `ITestGraphs`, `ITestModule`, `ITestChannel`, `ITestSummary`, `IBaseViewModel`, `IGraphMainViewModel`
- **Enums**:
- `DTS.Common.Enums.Sensors.CalibrationBehaviors`
- **Utilities**:
- `DTS.Common.XMLUtils.TestMetadataXml`
- `DTS.Common.Base.BasePropertyChanged`
- `DTS.Common.Constants.EventNumber`
- `DTS.Common.Utils.TestUtils`, `PTP1588Timestamps`
- `DTS.Common.XMLUtils.TestMetadataFields`, `TestSetupMetadataFields`, `TestGraphsFields`, `TestModuleFields`, `TestChannelFields`
- `DTS.Common.Strings.Strings`
- **Prism Framework**:
- `Microsoft.Practices.Prism.Commands.DelegateCommand`
- `Microsoft.Practices.Prism.Events.IEventAggregator`, `Events.PageErrorEvent`
- `Microsoft.Practices.ServiceLocation.ServiceLocator`
### External Dependencies:
- `System.Xml.Linq`
- `System.Collections.ObjectModel`
- `System.ComponentModel`
- `System.Windows.Media` (for `Color`)
### Inferred Consumers:
- UI view models (`ITestSummaryListViewModel`, `IGraphMainViewModel`) that interact with `TestSummary` and `TestChannel`.
- XML loading utilities (`TestMetadataXml`) for parsing `.dts` files.
- Event aggregation system for error reporting.
## 5. Gotchas
- **`TestModule.TriggerSampleNumbers` is always empty**: The `LoadTriggerSampleNumbers` method ignores its input and returns `new List<ulong>()`. This field is likely unused or deprecated.
- **Non-deterministic `ChannelId` for missing IDs**: If `ChannelId` attribute is missing or `-1`, `m.GetHashCode().ToString()` is used, which is not stable across runs or app restarts.
- **Calculated channel data loss**: For calculated channels, many fields (e.g., `IsoCode`, `IsoChannelName`, `UserCode`, `UserChannelName`, `HardwareChannelName`, `SerialNumber`) are hardcoded to `"N/A"`. Some fields like `FactoryExcitationVoltage` and `TimeOfFirstSample` are incorrectly assigned values from unrelated attributes (e.g., `UnsubsampledSampleRateHz``FactoryExcitationVoltage`).
- **`TestRunMetadata.Id` vs `Name` confusion**: `Id` is derived from file name (`Path.GetFileNameWithoutExtension(FilePath)`), while `Name` comes from XML `@Id` attribute. This may be counterintuitive.
- **`TestSummary.TimeStamp` fallback behavior**: Uses `TestSetup.TimeStamp`

View File

@@ -0,0 +1,42 @@
---
source_files:
- Common/DTS.CommonCore/Classes/GroupTemplates/Constants.cs
generated_at: "2026-04-16T02:39:55.206044+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "2540e3fb9c96a388"
---
# GroupTemplates
### 1. Purpose
This module defines a集中 set of string constants used to identify and reference non-ISO test object types and naming conventions within the `DTS.Common.Classes.GroupTemplates` namespace. It serves as a centralized source of truth for special-case identifiers—likely used during test configuration, template processing, or data mapping—where standard ISO-compliant naming or channel types are not applicable. Its existence prevents hard-coded string duplication and reduces the risk of typos or inconsistencies across the codebase when handling non-standard test objects.
### 2. Public Interface
The module exposes only a single `public static class` with three `public const string` fields:
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE = "x_NonISOTestObjectType_x";`
A constant string used to represent the channel type identifier for non-ISO test objects. Appears to be a placeholder or marker value (note the surrounding `x_` delimiters).
- `public const string NON_ISO_TESTOBJECT_NAME = "x_NonISOTestObjectName_x";`
A constant string used as a placeholder or default name for non-ISO test objects, similarly wrapped in `x_` delimiters.
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE2 = "NONISO_x_";`
A second, distinct constant for non-ISO channel type identification, likely representing an alternative or legacy variant (note the trailing underscore and lack of leading `x_`).
### 3. Invariants
- All three constants are compile-time constants (`const`) and thus immutable at runtime.
- The values are fixed strings and must not be modified programmatically.
- The naming convention (`x_..._x` vs. `NONISO_x_`) suggests intentional structural differences: the first two are likely *delimited placeholders*, while the third may be a *prefix* for derived identifiers.
- No runtime validation or enforcement is present in this module; correctness relies on consistent usage elsewhere.
### 4. Dependencies
- **Internal**: This module resides in `DTS.Common.Classes.GroupTemplates`, implying it is part of a shared/common library (`DTS.CommonCore`). It is likely consumed by other modules in the `DTS.Common` assembly or downstream projects that handle test group templates or configuration.
- **External**: No external dependencies are declared (no `using` statements or references beyond the namespace).
- **Consumers**: Based on naming, classes such as `GroupTemplate`, `TestObject`, or configuration parsers (e.g., in `DTS.TestFramework` or `DTS.Configuration`) are probable consumers, though not evident from this file alone.
### 5. Gotchas
- The `x_` prefix/suffix in `NON_ISO_TESTOBJECT_CHANNEL_TYPE` and `NON_ISO_TESTOBJECT_NAME` may be misinterpreted as part of the actual value rather than a marker—developers might accidentally include them in output or comparisons.
- `NON_ISO_TESTOBJECT_CHANNEL_TYPE2` uses a different pattern (`NONISO_x_`), suggesting possible historical evolution or a distinct use case (e.g., a prefix for auto-generated IDs). Confusing it with `NON_ISO_TESTOBJECT_CHANNEL_TYPE` could lead to mismatches.
- No documentation comments (e.g., XML doc comments) are present in the source, so the intended semantics (e.g., whether these are *exact matches*, *prefixes*, or *wildcards*) are ambiguous without external context.
- None identified from source alone.

View File

@@ -0,0 +1,248 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Groups/GroupGRPImportError.cs
- Common/DTS.CommonCore/Classes/Groups/GroupGRPImportGroup.cs
- Common/DTS.CommonCore/Classes/Groups/GroupHardwareDbRecord.cs
- Common/DTS.CommonCore/Classes/Groups/TestSetupGroupRecord.cs
- Common/DTS.CommonCore/Classes/Groups/GroupDbRecord.cs
- Common/DTS.CommonCore/Classes/Groups/GroupGRPImportChannel.cs
- Common/DTS.CommonCore/Classes/Groups/ChannelDbRecord.cs
- Common/DTS.CommonCore/Classes/Groups/GroupHelper.cs
generated_at: "2026-04-16T02:40:36.766589+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "2f1b395f0369a2ed"
---
# Documentation: Group Import and Database Record Classes
## 1. Purpose
This module provides data structures and helper utilities for importing, representing, and managing group-based test configurations—specifically for `.GRP` files (TDC group files)—and their corresponding database records. It enables parsing of `.GRP` files into structured in-memory objects (`GroupGRPImportGroup`, `GroupGRPImportChannel`), tracking import errors (`GroupGRPImportError`), and mapping between in-memory group/channel representations and database entities (`GroupDbRecord`, `ChannelDbRecord`, `GroupHardwareDbRecord`, `TestSetupGroupRecord`). The module serves as the foundational data layer for group import workflows, supporting validation, error reporting, and persistence of group configurations in the DTS system.
## 2. Public Interface
### `GroupGRPImportError`
- **`Errors` enum**
Defines all possible error types during `.GRP` file import:
- `FileEmpty`, `InvalidISOCodeInput`, `InvalidFullScaleInput`, `InvalidSensorInput`, `InvalidInvertInput`, `SensorNotFound`, `InvalidInputMode`, `InvalidDefaultValue`, `InvalidActiveValue`, `InvalidFireMode`, `InvalidDelay`, `InvalidLimitDuration`, `InvalidDuration`, `InvalidCurrent`
- **`ErrorCode` (property, `Errors`)**
The specific error encountered during import.
- **`File` (property, `string`)**
Path or name of the file where the error occurred.
- **`Line` (property, `int`)**
Line number in the file where the error occurred.
- **`ExtraInfo` (property, `string`)**
Additional human-readable context for the error.
- **`ToString()`**
Returns `ExtraInfo`.
### `GroupGRPImportGroup`
- **`Included` (property, `bool`, default `true`)**
Indicates whether the group should be included in the import operation.
- **`Overwrite` (property, `bool`, default `true`)**
Indicates whether existing group data should be overwritten during import.
- **`GroupName` (property, `string`)**
Name of the group (from the `.GRP` file).
- **`GroupTags` (property, `string`)**
Tags associated with the group.
- **`ImportingUserTags` (property, `string`)**
User-provided tags during import.
- **`SourceFile` (property, `string`)**
Path to the source `.GRP` file.
- **`Channels` (property, `GroupGRPImportChannel[]`, default empty array)**
Array of channels parsed from the `.GRP` file.
- **`GroupErrors` (property, `GroupGRPImportError[]`, default `null`)**
List of errors encountered during import of the group (e.g., file-level errors).
- **`GroupNameHasError` (property, `bool`)**
Indicates whether the group name itself has an error; used for UI validation (e.g., red border on textbox).
### `GroupGRPImportChannel`
- **Field index constants** (`public const uint`)
`SerialNumberField`, `DisplayNameField`, `ISOCodeField`, `InvertField`, `CapacityField`, `InputModeField`, `DefaultValueField`, `ActiveValueField`, `FireModeField`, `DelayField`, `LimitDurationField`, `DurationField`, `CurrentField`
Represent column indices in `.GRP` file rows.
- **`SensorSerialNumber` (property, `string`)**
Serial number of the sensor associated with this channel.
- **`DisplayName` (property, `string`)**
Human-readable name for the channel.
- **`ISOCode` (property, `string`)**
ISO-compliant code for the channel.
- **`Invert` (property, `bool`)**
Whether the channel signal should be inverted.
- **`FullScale` (property, `double`)**
Full-scale value for analog channels.
- **`InputMode` (property, `InputModes?`, default `null`)**
Input mode for digital channels; enum values: `na`, `TLH`, `THL`, `CCNO`, `CCNC`. Default: `InputModes.CCNO`.
- **`DefaultValue`, `ActiveValue`, `Delay`, `Duration`, `Current` (properties, `double?`, defaults `0.0`, `1.0`, `0.0`, `10.0`, `1.5` respectively)**
Optional numeric parameters for channel configuration.
- **`FireMode` (property, `FireModes?`, default `null`)**
Fire mode for squib channels; enum values: `na`, `CD`, `CC`. Default: `FireModes.CD`.
- **`LimitDuration` (property, `bool?`, default `null`)**
Whether duration limiting is enabled. Default: `true`.
- **`Error` (property, `GroupGRPImportError`, default `null`)**
Channel-specific import error (if any).
- **`ParentGroup` (property, `GroupGRPImportGroup`)**
Reference to the parent group.
- **`GroupName` (property, `string`)**
Returns `ParentGroup.GroupName` or `"---"` if `ParentGroup` is `null`.
- **`GroupNameInvalidate()`**
Raises `PropertyChanged` for `GroupName` to force UI refresh.
### `GroupHardwareDbRecord`
- **`Id` (property, `int`, `[Key]`)**
Primary key in `GroupHardware` table.
- **`GroupId` (property, `int`)**
Foreign key to group.
- **`DASId` (property, `int`)**
Foreign key to DAS (Data Acquisition System).
- **`SerialNumber` (property, `string`)**
Serial number of hardware device.
- **Constructors**
- `GroupHardwareDbRecord()`
- `GroupHardwareDbRecord(IGroupHardwareDbRecord copy)`
- `GroupHardwareDbRecord(IDataReader reader)` — populates from database reader.
### `TestSetupGroupRecord`
- **`GroupId` (property, `int`)**
Database ID of the group.
- **`DisplayOrder` (property, `int`)**
Order in which the group appears in UI/test setup.
- **`Position` (property, `string`)**
ISO 13499 position field (may be mixed across channels).
- **`TestObjectType` (property, `string`)**
ISO 13499 test object field (may be mixed across channels).
- **`TestSetupId` (property, `int`)**
Database ID of the test setup.
- **Constructors**
- `TestSetupGroupRecord()`
- `TestSetupGroupRecord(ITestSetupGroupRecord copy)`
- `TestSetupGroupRecord(IDataReader reader)` — populates from database reader.
### `GroupDbRecord`
- **`Id` (property, `int`, `[Key]`)**
Primary key in group table.
- **`SerialNumber` (property, `string`)**
Serial number of the group (often derived from group name).
- **`Picture` (property, `string`)**
Path or identifier for group image.
- **`DisplayName` (property, `string`)**
Human-readable name.
- **`Description` (property, `string`)**
Optional description.
- **`Embedded` (property, `bool`)**
Whether the group is embedded (e.g., system-provided).
- **`LastModified` (property, `DateTime`)**
Timestamp of last modification.
- **`LastModifiedBy` (property, `string`)**
User who last modified the group.
- **`StaticGroupId` (property, `int?`)**
Optional ID for static groups.
- **`ExtraProperties` (property, `string`)**
JSON-serialized dictionary of additional properties.
- **Constructors**
- `GroupDbRecord()`
- `GroupDbRecord(IGroupDbRecord copy)`
- `GroupDbRecord(IGroup copy, List<KeyValuePair<string,string>> extraProperties)`
- `GroupDbRecord(IDataReader reader)` — populates from database reader.
### `ChannelDbRecord`
- **`Id` (property, `long`, `[Key]`)**
Primary key in channel table.
- **`GroupId` (property, `int`)**
Foreign key to group.
- **`IsoCode`, `IsoChannelName` (properties, `string`)**
ISO-compliant identifiers.
- **`UserCode`, `UserChannelName` (properties, `string`)**
User-defined identifiers.
- **`DASId`, `DASChannelIndex` (properties, `int`)**
DAS device and channel index.
- **`GroupChannelOrder`, `TestSetupOrder` (properties, `int`)**
Ordering within group and test setup.
- **`SensorId` (property, `int`)**
Foreign key to sensor.
- **`Disabled` (property, `bool`)**
Whether channel is disabled.
- **`IsDisabled` (property, `bool`)**
Backward-compatible alias for `Disabled`.
- **`LastModified`, `LastModifiedBy` (properties, `DateTime`, `string`)**
Timestamp and user of last modification.
- **Constructors**
- `ChannelDbRecord()`
- `ChannelDbRecord(IChannelDbRecord copy)`
- `ChannelDbRecord(IDataReader reader)` — populates from database reader.
### `GroupHelper` (abstract class)
- **Static group metadata caches**
All methods are static and operate on internal static dictionaries.
- `ClearStaticGroupNames()`, `SetStaticGroupName(int, string)`, `GetStaticGroupName(int)`
- `ClearEmbeddedGroupIdList()`, `SetEmbeddedGroupId(int)`, `IsGroupEmbedded(int)`
- `ClearTestSetupGroupIds()`, `SetTestSetupGroupId(int, int)`, `GetTestSetupGroupId(int)`
- `ClearGroupChannelIds()`, `AddGroupChannelId(int, int)`, `GetGroupIdsFromChannels(int)`
- `ClearDASIds()`, `SetDASId(string, int)`, `GetDASId(string)`
- `ClearBaseModuleChannelIndexList()`, `SetBaseModuleChannelIndexList(...)`, `GetChannelIndexes(string, string)`
- `ClearDASIdChannelIndexGroupIdList()`, `SetDASIdChannelIndexGroupIdList(...)`, `GetGroupIds(int, List<int>)`
- `ClearTestSetupHardwareIds()`, `AddTestSetupHardwareId(int, int)`, `GetTestSetupHardwareIds(int)`
- `ClearGroupHardwareIds()`, `AddGroupHardwareId(int, int)`, `GetGroupHardwareIds(int)`
*Note: These are caching utilities for runtime lookups, not persistent storage.*
## 3. Invariants
- **`GroupGRPImportChannel.InputMode`**
Must be `null` or one of `na`, `TLH`, `THL`, `CCNO`, `CCNC`. Default is `CCNO`.
- **`GroupGRPImportChannel.FireMode`**
Must be `null` or one of `na`, `CD`, `CC`. Default is `CD`.
- **`GroupGRPImportChannel.LimitDuration`**
Must be `null` or `true`/`false`. Default is `true`.
- **`GroupGRPImportChannel.DefaultValue`, `ActiveValue`, `Delay`, `Duration`, `Current`**
Must be `null` or a non-negative `double`. Defaults are defined as `0.0`, `1.0`, `0.0`, `10.0`, `1.5` respectively.
- **`GroupGRPImportChannel.Error`**
If non-`null`, indicates a channel-level import error; if `null`, the channel is valid.
- **`GroupGRPImportGroup.GroupErrors`**
If non-`null`, contains group-level errors (e.g., file corruption, invalid header). If `null`, no group-level errors were recorded.
- **`GroupDbRecord.ExtraProperties`**
Must be valid JSON (serialized `List<KeyValuePair<string,string>>`).
- **`ChannelDbRecord.IsDisabled`**
Always mirrors `Disabled`; setting either updates both.
## 4. Dependencies
### Dependencies *of* this module:
- **`DTS.Common.Base`**
Provides `BasePropertyChanged` (base class for `GroupGRPImportGroup`, `GroupGRPImportChannel`, `GroupHardwareDbRecord`, `TestSetupGroupRecord`, `GroupDbRecord`, `ChannelDbRecord`).
- **`DTS.Common.Interface.Groups`**
Defines interfaces: `IGroupHardwareDbRecord`, `ITestSetupGroupRecord`, `IGroupDbRecord`.
- **`DTS.Common.Interface.Channels`**
Defines interface: `IChannelDbRecord`.
- **`System.Data`**
Used for `IDataReader` in constructors.
- **`Newtonsoft.Json`**
Used in `GroupDbRecord` constructor to serialize `ExtraProperties`.
### Dependencies *on* this module:
- **Import/Export logic** (not shown)
Likely uses `GroupGRPImportGroup`, `GroupGRPImportChannel`, and `GroupGRPImportError` to parse `.GRP` files.
- **Database persistence layer**
Uses `GroupDbRecord`, `ChannelDbRecord`, `GroupHardwareDbRecord`, `TestSetupGroupRecord` for CRUD operations.
- **UI layer**
Binds to `GroupGRPImportGroup.GroupNameHasError`, `GroupGRPImportChannel.GroupName`, and `GroupGRPImportChannel.GroupNameInvalidate()` for validation and refresh.
## 5. Gotchas
- **`GroupGRPImportChannel.GroupName` is a computed property**
Returns `ParentGroup.GroupName` or `"---"`. UI bindings must call `GroupNameInvalidate()` after `ParentGroup` changes to refresh.
- **`ChannelDbRecord.IsDisabled` is a legacy alias**
Directly reads/writes `Disabled`; new code should use `Disabled` for clarity.
- **`GroupDbRecord.SerialNumber` is derived from `IGroup.Name`**
In the constructor `GroupDbRecord(IGroup, ...)`, `SerialNumber` is set to `copy.Name`, not a separate serial field.
- **`GroupHelper` caches are static and global**
State persists across operations; callers must explicitly clear caches (e.g., `ClearStaticGroupNames()`) to avoid stale data.
- **`GroupHardwareDbRecord.Id` uses `int` (not `long`)**
Contrasts with `ChannelDbRecord.Id`, which uses `long`.
- **`GroupGRPImportChannel.InputMode`, `FireMode`, etc., are nullable**
`null` indicates "not set" or "N/A", not a default value. Validation must handle `null` explicitly.
- **`GroupGRPImportGroup.Channels` defaults to empty array (not `null`)**
Safe to enumerate without null checks.
- **`GroupGRPImportGroup.GroupErrors` defaults to `null`**
Not an empty array—must check for `null` before enumeration.
- **`GroupHelper.GetChannelIndexes` and `GetGroupIds` use substring matching**
`GetChannelIndexes` matches `baseSerialNumberSubstring` exactly (not a substring search), despite the parameter name suggesting partial matching. Similarly, `GetGroupIds` requires exact `dasId` and `channelIndex` matches.

View File

@@ -0,0 +1,122 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Groups/ChannelSettings/ChannelSettingRecord.cs
- Common/DTS.CommonCore/Classes/Groups/ChannelSettings/GroupChannelSettingRecord.cs
- Common/DTS.CommonCore/Classes/Groups/ChannelSettings/ChannelSettingBase.cs
generated_at: "2026-04-16T02:42:22.673078+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "f67a48400fa70da5"
---
# ChannelSettings
## Documentation: Channel Settings Module
### 1. Purpose
This module defines core data structures for modeling channel configuration settings in the DTS system. It provides three key classes: `ChannelSettingRecord` (a metadata record describing a *type* of setting), `GroupChannelSettingRecord` (an *instance* of a setting applied to a specific channel), and `ChannelSettingBase` (a concrete implementation of `IChannelSetting` that supports typed value accessors and constant-based setting name definitions). Together, they enable storage, retrieval, and manipulation of channel-specific configuration values, with support for multiple channel types (analog, digital, squib, UART, etc.) and versioned database interactions.
---
### 2. Public Interface
#### `ChannelSettingRecord`
- **`ChannelSettingRecord()`**
Default constructor; initializes an empty record.
- **`ChannelSettingRecord(IDataReader reader)`**
Populates the record from an `IDataReader` by reading columns `"Id"`, `"SettingName"`, and `"DefaultValue"` using `Utility.GetInt` and `Utility.GetString`.
- **`int Id`**
Gets/sets the unique identifier for this setting definition.
- **`string SettingName`**
Gets/sets the canonical name of the setting (e.g., `"Range"`, `"SquibCurrent"`).
- **`string DefaultValue`**
Gets/sets the default value string for this setting.
#### `GroupChannelSettingRecord`
- **`GroupChannelSettingRecord()`**
Default constructor; initializes an empty record.
- **`GroupChannelSettingRecord(IDataReader reader, int storedProcedureVersionUsed)`**
Populates the record from an `IDataReader`. Behavior depends on `storedProcedureVersionUsed`:
- If `>= Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`, reads `"ChannelId"` via `Utility.GetLong`; otherwise sets `ChannelId = 0`.
- Always reads `"SettingId"` (via `Utility.GetInt`) and `"SettingValue"` (via `Utility.GetString`).
- **`GroupChannelSettingRecord(long channelId, int settingId, string settingValue)`**
Constructor for programmatic creation; directly assigns `ChannelId`, `SettingId`, and `SettingValue`.
- **`long ChannelId`**
Gets/sets the channel identifier the setting applies to.
- **`int SettingId`**
Gets/sets the foreign key referencing `ChannelSettingRecord.Id`.
- **`string SettingValue`**
Gets/sets the actual value string for this channels setting instance.
#### `ChannelSettingBase`
- **`ChannelSettingBase(int settingType, string name, string defaultValue)`**
Constructor initializing `SettingTypeId`, `SettingName`, and `DefaultValue`.
- **`IChannelSetting Clone()`**
Returns a new `ChannelSettingBase` instance with all properties copied from the current instance.
- **`long ChannelId { get; set; }`**
Channel ID the setting applies to.
- **`int SettingTypeId { get; protected set; }`**
Type identifier for the setting (e.g., analog, digital).
- **`string SettingName { get; protected set; }`**
Name of the setting (e.g., `"Range"`).
- **`string DefaultValue { get; protected set; }`**
Default value string for this setting.
- **`string Value { get; set; }`**
Current value string for this setting instance.
- **`double DoubleValue { get; set; }`**
Gets/sets `Value` as a `double`. Falls back to `DoubleDefaultValue` on parse failure.
- **`double DoubleDefaultValue { get; }`**
Parses `DefaultValue` as a `double` using `CultureInfo.InvariantCulture`.
- **`int IntValue { get; set; }`**
Gets/sets `Value` as an `int`. Falls back to `IntDefaultValue` on parse failure.
- **`int IntDefaultValue { get; }`**
Parses `DefaultValue` as an `int` using `CultureInfo.InvariantCulture`.
- **`bool BoolValue { get; set; }`**
Gets/sets `Value` as a `bool`. Falls back to `BoolDefaultValue` on parse failure.
- **`bool BoolDefaultValue { get; }`**
Parses `DefaultValue` as a `bool` (uses default `bool.Parse` behavior).
#### Constants (public static fields in `ChannelSettingBase`)
- **Analog**: `RANGE`, `CFC`, `FilterClass`, `POLARITY`, `POSITION`, `ZEROMETHOD`, `ZEROMETHODSTART`, `ZEROMETHODEND`, `USERVALUE1`, `USERVALUE2`, `USERVALUE3`, `INITIAL_OFFSET`, `ACCouplingEnabled`
- **Deprecated**: `LIMIT_DURATION`, `DURATION`, `DELAY` (commented out)
- **Bridge/Insertion**: `BRIDGE_TYPE`
- **Squib**: `SQUIB_CURRENT`, `SQUIB_LIMIT_DURATION`, `SQUIB_DURATION`, `SQUIB_DELAY`, `SQMODE`
- **Digital Out**: `DIGITALOUT_LIMIT_DURATION`, `DIGITALOUT_DURATION`, `DIGITALOUT_DELAY`, `OUTPUT_MODE`
- **Digital In**: `DIMODE`, `DEFAULT_VALUE`, `ACTIVE_VALUE`
- **UART**: `BAUD_RATE`, `DATA_BITS`, `STOP_BITS`, `PARITY`, `FLOW_CONTROL`, `DATA_FORMAT`
- **Stream Out**: `UDP_PROFILE`, `UDP_ADDRESS`, `UDP_TIME_CHID`, `UDP_DATA_CHID`, `UDP_TMNS_CONFIG`, `IRIG_TDP_INTERVAL_MS`, `TMATS_INTERVAL_MS`
- **Stream In**: `UDP_ADDRESS_IN`
---
### 3. Invariants
- **`ChannelSettingRecord.Id`** must be non-negative (implied by `int` type and database usage).
- **`GroupChannelSettingRecord.SettingId`** must correspond to a valid `ChannelSettingRecord.Id` in the database (enforced by foreign key at persistence layer, not here).
- **`GroupChannelSettingRecord.ChannelId`** may be `0` *only* when constructed from `IDataReader` with `storedProcedureVersionUsed < Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`. Otherwise, it must be positive.
- **`ChannelSettingBase.Value`** is stored as a string; numeric/boolean accessors (`DoubleValue`, `IntValue`, `BoolValue`) parse it at runtime and fall back to defaults on failure.
- **`ChannelSettingBase.DefaultValue`** must be parseable as the corresponding type (`double`, `int`, `bool`) for `DoubleDefaultValue`, `IntDefaultValue`, and `BoolDefaultValue` to succeed; otherwise, runtime exceptions may occur during parsing.
---
### 4. Dependencies
- **Internal Dependencies**:
- `DTS.Common.Interface.Channels` (interfaces `IChannelSettingRecord`, `IGroupChannelSettingRecord`, `IChannelSetting`)
- `DTS.Common.Base.BasePropertyChanged` (base class for `ChannelSettingRecord`)
- `DTS.Common.Base.BasePropertyChanged` (base class for `GroupChannelSettingRecord`)
- `DTS.Common.Interface.Channels` (interface `IChannelSetting`)
- `System.Data` (`IDataReader`)
- `Utility` class (static methods: `GetInt`, `GetString`, `GetLong`)
- `Constants` class (reference to `BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`)
- **External Dependencies**:
- `System` (core types, `CultureInfo`, `NumberStyles`)
- `DTS.Common.Interface.Channels` (consumed by other modules for channel configuration management)
---
### 5. Gotchas
- **`GroupChannelSettingRecord` constructor with `IDataReader` silently sets `ChannelId = 0`** when `storedProcedureVersionUsed < Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`. This may mask missing data if the stored procedure version is misconfigured.
- **`ChannelSettingBase` parsing methods (`DoubleValue`, `IntValue`, `BoolValue`) do not distinguish between parse failure and a valid default value**—e.g., if `Value = "0"` and `DefaultValue = "1"`, `IntValue` returns `0`, not `1`. The fallback only occurs on *parse failure* (e.g., `Value = "abc"`).
- **`BoolDefaultValue` uses `bool.Parse(DefaultValue)` without `CultureInfo.InvariantCulture`**, unlike numeric defaults. This may cause culture-dependent failures if `DefaultValue` is not `"True"`/`"False"` (case-sensitive).
- **`ChannelSettingBase` is mutable** (`Value`, `ChannelId`, etc., have public setters). Cloning via `Clone()` is shallow but may be insufficient if consumers modify nested objects (none present here, but worth noting).
- **`ChannelSettingBase` has no validation on `SettingName` or `DefaultValue`**—invalid names or unparseable defaults may only surface at runtime during type conversion.
- **`ChannelSettingBase` constants are string literals**; typos in usage (e.g., `"Rang"` instead of `"Range"`) will compile but cause runtime mismatches with database or UI expectations.

View File

@@ -0,0 +1,172 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Hardware/ExternalTilt.cs
- Common/DTS.CommonCore/Classes/Hardware/DragAndDropPayload.cs
- Common/DTS.CommonCore/Classes/Hardware/SerializableAAF.cs
- Common/DTS.CommonCore/Classes/Hardware/DASDBRecord.cs
- Common/DTS.CommonCore/Classes/Hardware/DASChannelDBRecord.cs
- Common/DTS.CommonCore/Classes/Hardware/DASMonitorInfo.cs
generated_at: "2026-04-16T02:39:04.354265+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ae82d579176b397b"
---
# Hardware Data Models Documentation
## 1. Purpose
This module defines core data models for representing hardware devices, channels, and associated metadata within the DTS (Data Acquisition System) ecosystem. It provides structured classes for serializing/deserializing hardware configuration data to/from databases (via `DASDBRecord`, `DASChannelDBRecord`), file-based monitoring state (`DASMonitorInfo`), and lightweight data transfer objects (`ExternalTilt`, `DragAndDropPayload`). These models serve as the canonical in-memory representation of hardware state for configuration, persistence, and UI binding, enabling consistent handling of DAS (Data Acquisition System) units, modules, channels, and tilt sensors across the system.
## 2. Public Interface
### `ExternalTilt`
- **`ExternalTilt()`**
Parameterless constructor.
- **`SerialNumber`** (`string`, public get/set)
Serial number of the external tilt sensor.
- **`TiltID`** (`byte`, public get/set)
Identifier for the tilt sensor.
- **`SystemID`** (`string`, public get/set)
Identifier of the system the tilt sensor belongs to.
- **`SystemLocation`** (`string`, public get/set)
Physical or logical location of the tilt sensor within the system.
### `DragAndDropPayload`
- **`FORMAT`** (`const string`)
`"RESOLVECHANNELS_HARDWARETABLE"` — Primary clipboard/data transfer format identifier.
- **`ALT_FORMAT`** (`const string`)
`"ALT_RESOLVECHANNELS_HARDWARETABLE"` — Alternate format identifier.
- **`CTRL_FORMAT`** (`const string`)
`"CTRL_RESOLVECHANNELS_HARDWARETABLE"` — Control-modifier variant format identifier.
### `SerializableAAF`
- **`DAS_TYPE`** (`enum`)
- `TDAS = 0`
- `SLICE = 1`
- **`GetSerializedKey()`** (`string`)
Returns a string key in the format `"{DAS_TYPE}_{SampleRate}"` (e.g., `"0_10000"`).
- **`GetSerializedValue()`** (`string`)
Returns the AAF value as a culture-invariant string.
- **`FromSerializedStrings(string key, string value)`**
Parses `key` and `value` to populate internal fields. Throws `NotSupportedException` if the key format is invalid (must contain exactly two tokens separated by `"_x_"`).
*Note: All properties (`DasType`, `SampleRate`, `AAF`) are currently commented out in the source and not active.*
### `DASDBRecord`
- **`INVALID_DATE`** (`static DateTime`)
`new DateTime(1970, 1, 1)` — Sentinel value for unset date fields.
- **Constructors**
- `DASDBRecord()` — Default constructor.
- `DASDBRecord(IDASDBRecord copy)` — Deep copy constructor.
- `DASDBRecord(IDataReader reader)` — Populates fields from database reader. Handles `DBNull` and special date parsing (e.g., `FIRST_USE_DATE_NOT_SET`).
- **Key Properties**
- `DASId` (`int`, `[Key]`, `[Column("DASId")]`) — Primary key.
- `SerialNumber` (`string`, `[Required]`, `[StringLength(50)]`) — Unique hardware identifier.
- `DASType` (`int`) — Numeric type code (e.g., `0` = TDAS, `1` = SLICE).
- `MaxSampleRate`, `MinSampleRate` (`double`, `[Column(TypeName = "decimal(18, 0)")]`) — Hardware sample rate limits.
- `CalDate` (`DateTime`, defaults to `INVALID_DATE`) — Calibration date.
- `ChannelTypes` (`int[]`, `[StringLength(255)]`) — Array of channel type codes. Parsed from comma-separated string.
- `FirstUseDate` (`DateTime?`) — Nullable first-use date. `IsFirstUseValid` indicates if it is set and valid.
- `MaxAAFRate` (`double`, `[Column("MaxAAFRate", TypeName = "decimal(18, 0)")]`) — Maximum analog anti-aliasing filter rate.
- `IsFirstUseValid` (`bool`) — Indicates whether `FirstUseDate` is supported and set.
- `StandIn`, `IsModule`, `IsProgrammable`, `IsReconfigurable` (`bool`) — Hardware capability flags.
- `Position`, `Connection`, `FirmwareVersion`, `LastModifiedBy`, `LastUsedBy` (`string`) — Metadata strings.
- `PositionOnChain`, `PositionOnDistributor`, `Port`, `ProtocolVersion`, `Version`, `Channels`, `MaxModules`, `MaxMemory` (`int`/`long`) — Configuration parameters.
- `ParentDAS` (`string`, `[Column("ParentDAS")]`) — Serial number of parent DAS (for modules).
- `TestId`, `GroupId` (`int?`) — Nullable foreign keys.
### `DASChannelDBRecord`
- **`HardwareId`** (`string`) — Identifier for the parent hardware (`serialnumber_dastype`).
- **`DaschannelId`** (`int`, `[Key]`, `[Column("DASChannelId")]`) — Primary key.
- **`Dasid`** (`int?`) — Foreign key to `DASDBRecord.DASId`.
- **`ChannelIdx`** (`int`, with `SetProperty` change notification) — Physical channel index on the DAS.
- **`SupportedBridges`** (`int`, default `DEFAULT_SUPPORTED_BRIDGES = 12`)
Bitmask:
- Bit 1 (value 2): Quarter bridge
- Bit 2 (value 4): Half bridge
- Bit 3 (value 8): Full bridge
*(IEPE, digital input, squib fire, etc., are defined in other bitmasks below)*
- **`SupportedExcitations`** (`int`, default `DEFAULT_SUPPORTED_EXCITATIONS = 16`)
Bitmask:
- Bit 4 (value 16): 5V (default)
- Bits 06: Invalid, 2V, 2.5V, 3V, 5V, 10V, 1V
- **`DASDisplayOrder`** (`int`) — Display order (may differ from physical order).
- **`SupportedDigitalInputModes`** (`int`, default `16`)
Bitmask for digital input modes (e.g., CCNC, TLH, THL).
- **`SupportedSquibFireModes`** (`int`, default `16`)
Bitmask for squib fire modes (capacitor discharge, constant current, AC discharge).
- **`SupportedDigitalOutputModes`** (`int`, default `16`)
Bitmask for digital output modes (FVLH, FVHL, CCNO, CCNC).
- **`ModuleSerialNumber`** (`string`) — Serial number of the module this channel belongs to.
- **`ModuleArrayIndex`** (`int`) — Array index of the module among modules on the DAS/rack.
- **Constructors**
- `DASChannelDBRecord()` — Default.
- `DASChannelDBRecord(IDataReader reader)` — Populates from database.
- `DASChannelDBRecord(IDASChannelDBRecord copy)` — Copy constructor.
### `DASMonitorInfo`
- **`ReadFromFile(string path)`**
Reads monitor info from a text file (one field per line, in `Fields` enum order). Silently returns on file not found or parse errors (logs via `APILogger`).
- **`WriteToFile(string path)`**
Writes monitor info to a text file. Logs exceptions via `APILogger`.
- **`GetChannelName(int index)`** (`string`)
Returns channel name (format: `"Ch#XX"` if not set). Uses `_channelNames` array.
- **`GetOffsetTolerancemVHigh(int index)` / `GetOffsetTolerancemVLow(int index)`** (`double`)
Returns tolerance values (0 if index out of bounds).
- **Constructors**
- `DASMonitorInfo(string path)` — Loads from file.
- `DASMonitorInfo(IDASCommunication das, IsoViewMode mode)` — Populates from live DAS communication object.
- **Properties**
- `SerialNumber` (`string`)
- `TiltSensorCals` (`double[18]`) — Calibration coefficients.
- `TiltSensorDataPre` (`short[3]`) — Pre-processed tilt sensor data.
- `TiltAxes` (`DFConstantsAndEnums.TiltAxes`) — Axis configuration (default `IXIYIZ`).
- `AxisIgnored` (`int`) — Bitmask of ignored axes.
- `MountOffsetAxisOne`, `MountOffsetAxisTwo` (`double`) — Mounting offsets (default `NaN`).
- `_channelNames` (`string[]`) — Channel names (private).
- `_offsetTolerancesHigh`, `_offsetTolerancesLow` (`double[6]`) — Tolerance arrays (private).
- **`Fields`** (`enum`) — Defines ordered file fields:
`SerialNumber`, `TiltSensorCals`, `TiltSensorDataPre`, `TiltAxes`, `AxesIgnored`, `MountOffsetAxisOne`, `MountOffsetAxisTwo`, `ChannelNames`, `OffsetTolerancesLow`, `OffsetTolerancesHigh`.
## 3. Invariants
- **`DASDBRecord`**
- `SerialNumber` is required and non-empty (enforced by `[Required]`).
- `Position` is required and non-empty (enforced by `[Required]`).
- `CalDate` defaults to `INVALID_DATE` (1970-01-01) if unset.
- `FirstUseDate` is nullable; `IsFirstUseValid` must be `true` for it to be considered valid.
- `ChannelTypes` is parsed from a comma-separated string; invalid tokens are silently skipped.
- `IsProgrammable` is mapped from database column `"Reprogramable"` (note the typo).
- **`DASChannelDBRecord`**
- `SupportedBridges`, `SupportedExcitations`, etc., use default bitmasks (e.g., `12` for bridges, `16` for excitations).
- `ChannelIdx` uses `SetProperty` for change notifications (implements `INotifyPropertyChanged`).
- **`DASMonitorInfo`**
- File format is strictly ordered by `Fields` enum values (10 lines).
- Parsing uses `CultureInfo.InvariantCulture` for numeric values.
- `TiltSensorCals` is fixed-length (`double[18]`); arrays from file are truncated/padded to this length.
- `NoModules(das)` check returns empty arrays/`NaN` if `das.ConfigData` or `das.ConfigData.Modules` is null/empty.
## 4. Dependencies
- **Imports/Usings**
- `DTS.Common.Base` (`BasePropertyChanged`)
- `DTS.Common.Enums`, `DTS.Common.Enums.DASFactory` (e.g., `TiltAxes`, `IsoViewMode`)
- `DTS.Common.Interface.DataRecorders` (`IDASDBRecord`, `IDASChannelDBRecord`)
- `DTS.Common.Interface.Hardware` (`IDASCommunication`, `ITiltSensorCalAware`)
- `System.Data` (`IDataReader`)
- `System.ComponentModel.DataAnnotations` (EF Core attributes)
- `DTS.Common.Utilities.Logging` (`APILogger`)
- **External Dependencies**
- `Utility` class (static helper for `GetDateTime`, `GetString`, `GetInt`, etc.).
- `DFConstantsAndEnums.FIRST_USE_DATE_NOT_SET` (for date validation).
- `Strings.Strings.Ch` (for default channel names).
- **Depended Upon**
- `DASDBRecord` and `DASChannelDBRecord` implement `IDASDBRecord`/`IDASChannelDBRecord` interfaces, likely consumed by data access layers.
- `DASMonitorInfo` depends on `IDASCommunication` and `IsoViewMode` (from `DTS.Common.Enums`).
## 5. Gotchas
- **`SerializableAAF`** is **non-functional** in the current source: All properties and the constructor are commented out. The class is effectively a stub.
- **`DASDBRecord.IsProgrammable`** maps to database column `"Reprogramable"` (misspelled).
- **`DASChannelDBRecord.SupportedBridges`** defaults to `12` (half + full bridge), but the summary comments incorrectly state "half (4) + full (8)" — this sums to `12`, but bit positions are 2 and 3 (values 4 and 8), not 4 and 8.
- **`DASMonitorInfo`** uses `float.NaN` in `GetMountOffsetAxisOne/Two` but assigns to `double` properties (implicit conversion).
- **`DASMonitorInfo.ToShortArray`** has a bug: It parses `line` instead of `token` in `short.TryParse`.
- **`DASMonitorInfo`** file format assumes exactly 10 fields in `Fields` order; extra/missing lines are ignored or cause misalignment.
- **`DASDBRecord.ChannelTypes`** is stored as a comma-separated string in the DB but mapped to `int[]` in code; parsing silently drops invalid tokens.
- **`DASMonitorInfo`** uses `double[]` arrays of fixed size (e.g., `TiltSensorCals[18]`), but file parsing may produce arrays of arbitrary length (truncated to size in code? Not explicitly handled).

View File

@@ -0,0 +1,91 @@
---
source_files:
- Common/DTS.CommonCore/Classes/ISO/IsoCode.cs
generated_at: "2026-04-16T02:39:28.985647+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e833a8924b8a2f43"
---
# ISO
## Documentation: `IsoCode` Class
### 1. Purpose
The `IsoCode` class encapsulates a fixed-length 16-character ISO-standard location code, representing hierarchical spatial and physical metadata (e.g., for document or object tracking). It provides structured access to semantically meaningful substrings—such as test object, position, main/fine locations, physical dimension, direction, and filter class—while enforcing a strict 16-character internal representation. The class ensures consistent formatting (e.g., padding with `'?'` or truncating) and serves as a domain-specific abstraction over raw string manipulation for ISO-compliant codes.
### 2. Public Interface
- **`public IsoCode(string isoCode)`**
Constructor. Initializes the 16-character internal buffer `_isoCodeFull`. If `isoCode` is `null`, treats it as `""`. Truncates to 16 characters if longer; pads with `'?'` if shorter. Assigns each character directly to `_isoCodeFull[i]`.
- **`public string StringRepresentation { get; set; }`**
Gets/sets the full 16-character ISO code as a string.
- **Getter**: Returns `_isoCodeFull` concatenated into a string.
- **Setter**: Assigns characters from `value` to `_isoCodeFull`. If `value` is shorter than 16 chars, pads remaining positions with `'0'`. Does *not* use `'?'` padding in setter.
- **`public string TestObject { get; set; }`**
Gets/sets the first character (`_isoCodeFull[0]`).
- **Setter**: If `value` is `null` or empty, sets to `'?'`; otherwise uses `value[0]`.
- **`public string Position { get; set; }`**
Gets/sets the second character (`_isoCodeFull[1]`).
- **Setter**: Same behavior as `TestObject`.
- **`public string MainLocation { get; set; }`**
Gets/sets characters at indices 25 (4 chars).
- **Setter**: Truncates to 4 chars if longer; pads right with `'?'` if shorter.
- **`public string FineLocation1 { get; set; }`**
Gets/sets characters at indices 67 (2 chars).
- **Setter**: Pads right with `'?'` if shorter than 2; truncates if longer (implicitly via `ToCharArray(0, 2)`).
- **`public string FineLocation2 { get; set; }`**
Gets/sets characters at indices 89 (2 chars).
- **Setter**: Same padding/truncation behavior as `FineLocation1`.
- **`public string FineLocation3 { get; set; }`**
Gets/sets characters at indices 1011 (2 chars).
- **Setter**: Same padding/truncation behavior as `FineLocation1`.
- **`public string PhysicalDimension { get; set; }`**
Gets/sets characters at indices 1213 (2 chars).
- **Setter**: Truncates to 2 chars if longer; pads right with `'?'` if shorter.
- **`public string Direction { get; set; }`**
Gets/sets character at index 14 (1 char).
- **Setter**: If `value` is `null` or empty, sets to `'?'`; otherwise uses `value[0]`.
- **`public string FilterClass { get; set; }`**
Gets/sets character at index 15 (1 char).
- **Setter**: Same behavior as `Direction`.
### 3. Invariants
- `_isoCodeFull` is *always* exactly 16 characters long.
- For all public properties (`TestObject`, `Position`, `FineLocation*`, `PhysicalDimension`, `Direction`, `FilterClass`), the setter ensures the underlying character(s) are set to `'?'` when input is `null`/empty (except `StringRepresentation`, which uses `'0'` in setter).
- `MainLocation` and `PhysicalDimension` truncate to 4 and 2 chars respectively if input exceeds length; all fine location fields truncate to 2 chars.
- The constructor *always* produces a 16-character buffer (via truncation or `'?'` padding).
- `StringRepresentation` setter does *not* use `'?'` padding—uses `'0'` for missing characters.
### 4. Dependencies
- **Internal**: Uses `System.Text.StringBuilder` (for `StringRepresentation` getter).
- **External**: No external dependencies beyond `System` (no third-party or framework-specific APIs beyond core types).
- **Consumers**: Presumably used by other modules in `DTS.Common` namespace (e.g., parsing/serialization logic, UI binding, or ISO code validation services), though not explicit in this file.
### 5. Gotchas
- **Inconsistent padding in setters**:
- Public property setters (`TestObject`, `Position`, etc.) use `'?'` for missing/empty input.
- `StringRepresentation` setter uses `'0'` for missing characters. This discrepancy may cause unexpected behavior if `StringRepresentation` is set directly after using property setters (or vice versa).
- **Off-by-one error in `_fineLocation*` setters**:
In `_fineLocation1`, `_fineLocation2`, and `_fineLocation3` private setters, the condition `value.Length < i` should be `value.Length <= i` to correctly handle `i == value.Length - 1`. As written, `value[i]` will throw `ArgumentOutOfRangeException` when `value.Length == i`.
Example: For `value = "A"` (length 1), when `i = 1`, `value.Length (1) < i (1)` is false, so it attempts `value[1]` → invalid.
- **Redundant `string.IsNullOrEmpty` checks**:
Properties like `TestObject` and `Position` check `string.IsNullOrEmpty(value)` before accessing `value[0]`, but `value[0]` would throw `IndexOutOfRangeException` for empty strings anyway—so the check is defensive but not strictly necessary.
- **No validation of character content**:
The class accepts any character (including non-alphanumeric) without validation. ISO compliance (e.g., allowed character set) is not enforced.
- **`_mainLocation` setter has inconsistent padding**:
Uses `'0'` if `value.Length <= i`, but public `MainLocation` setter pads with `'?'`. This mismatch is hidden by the public setter, but could cause confusion if private setter is used directly (unlikely, but possible in reflection scenarios).
- **No immutability guarantees**:
Though `_isoCodeFull` is `readonly`, its *contents* are mutable via public setters. The class is not thread-safe.
None identified beyond the above.

View File

@@ -0,0 +1,51 @@
---
source_files:
- Common/DTS.CommonCore/Classes/ISO/ExtraProperties/TextPastedArgs.cs
generated_at: "2026-04-16T02:41:57.941514+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0e778602f67f4f38"
---
# ExtraProperties
### 1. Purpose
`TextPastedArgs` is a concrete implementation of the `ITextPastedEventArgs` interface, used to encapsulate event data for text-paste operations within the ISO Extra Properties subsystem. It carries contextual information—including the pasted text, the originating `IExtraProperty` instance (as `Sender`), a unique identifier (`Id`), and an arbitrary user-defined object (`Tag`)—to event handlers subscribed to text-paste events. This class enables decoupled communication between components that trigger text paste actions and those that consume or react to them.
### 2. Public Interface
- **`TextPastedArgs(string text, IExtraProperty extraProperty, string id, object tag)`**
Constructor initializing all properties. Assigns `text` to `Text`, `extraProperty` to `Sender`, `id` to `Id`, and `tag` to `Tag`. All assignments are direct and unvalidated (no null checks or transformations are performed in the constructor).
- **`string Text { get; }`**
Read-only property containing the text that was pasted. Value is set at construction and immutable thereafter.
- **`object Sender { get; }`**
Read-only property referencing the `IExtraProperty` instance that triggered the paste event. Stored as `object` (not strongly typed) per interface contract.
- **`string Id { get; }`**
Read-only property holding a string identifier associated with the paste operation. Likely used to correlate events or identify the source property.
- **`object Tag { get; }`**
Read-only property for attaching arbitrary user-defined state or metadata to the event. Can be `null`.
### 3. Invariants
- `Text`, `Sender`, `Id`, and `Tag` are immutable after construction (no setters beyond initialization).
- `Sender` is *intended* to hold an instance implementing `IExtraProperty`, though the property type is `object`, allowing non-conforming values if passed incorrectly.
- No validation is enforced on input arguments (e.g., `text` or `id` may be `null` or empty; `extraProperty` may be `null`).
- The class itself is not thread-safe; concurrent access to instances is not guaranteed safe.
### 4. Dependencies
- **Depends on**:
- `System` (core types: `string`, `object`, `EventArgs` implied via interface)
- `DTS.Common.Events` (likely contains `ITextPastedEventArgs` definition)
- `DTS.Common.Interface.ISO.ExtraProperties` (contains `IExtraProperty` interface)
- **Depended on by**:
- Event publishers/consumers in the ISO Extra Properties subsystem that raise or handle `TextPasted` events (e.g., UI components or property editors invoking paste operations).
- Any code expecting an `ITextPastedEventArgs` implementation (e.g., event handlers with signature `void OnTextPasted(object sender, ITextPastedEventArgs e)`).
### 5. Gotchas
- `Sender` is stored as `object` despite being initialized from an `IExtraProperty`; callers must cast it back to `IExtraProperty` to access its members, risking `InvalidCastException` if misused.
- No null-safety: passing `null` for `text`, `extraProperty`, `id`, or `tag` is permitted and will result in `null` property values—handlers must defensively check for null.
- The `Id` and `Tag` parameters are not validated for uniqueness or type; misuse (e.g., passing mutable objects as `Tag`) could lead to unexpected side effects.
- The class name `TextPastedArgs` (with past-tense "Pasted") may be inconsistent with naming conventions (e.g., `TextPasteEventArgs`), potentially causing confusion during discovery or search.
- No documentation comments are present in the source; behavioral assumptions (e.g., semantics of `Id` or `Tag`) are inferred solely from usage context.

View File

@@ -0,0 +1,90 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Locking/LockRecord.cs
- Common/DTS.CommonCore/Classes/Locking/LockError.cs
generated_at: "2026-04-16T02:40:09.269029+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ee1fc4660f405448"
---
# Locking
### **Purpose**
This module defines core data structures for representing and handling locking state and errors within the DTS system. Specifically, `LockRecord` encapsulates the metadata of an active lock (e.g., who holds it, when it was created, and what resource it pertains to), while `LockError` provides a structured way to represent lock-related error conditions—including recoverable states like lock theft or loss—enabling callers to programmatically respond to specific failure modes. Together, they serve as the foundational data models for a locking service, likely used in distributed or multi-user scenarios where resource contention must be managed.
---
### **Public Interface**
#### `LockRecord`
A read-only data class representing the state of a lock.
- **Constructor**:
```csharp
public LockRecord(string user, string machine, DateTime createTime, DateTime lastUpdate, string itemKey, int itemCategory, int itemId)
```
Initializes a new instance with the specified lock metadata. All properties are set once at construction and immutable thereafter.
- **Properties**:
- `string LockingUserName` The username of the entity holding the lock.
- `string LockingMachineName` The machine name of the entity holding the lock.
- `DateTime CreationTime` Timestamp when the lock was first acquired.
- `DateTime LastUpdated` Timestamp of the last lock maintenance (e.g., heartbeat or renewal).
- `string ItemKey` A string-based identifier for the locked item (e.g., a unique key or path).
- `int ItemCategory` An integer category code (corresponding to `LockCategories` in the database) classifying the type of item being locked.
- `int ItemId` A numeric identifier for the locked item (likely a primary key in a database table).
#### `LockError`
A read-only data class representing an error condition in lock operations.
- **Constructor**:
```csharp
public LockError(int error, string message, string user = null, string machine = null)
```
Initializes a new instance with an error code, descriptive message, and optional context about the locking user/machine.
- **Properties**:
- `int ErrorCode` The numeric error code (read-only after construction).
- `string Message` Human-readable error description (read-only after construction).
- `string LockingUser` Username associated with the error (defaults to `string.Empty` if `null`).
- `string LockingMachine` Machine name associated with the error (defaults to `string.Empty` if `null`).
- `bool LockStolen` `true` if `ErrorCode == LOCKSTOLEN_ERROR` (i.e., `998`).
- `bool LockLost` `true` if `ErrorCode == LOCKDOESNTEXIST_ERROR` (i.e., `997`).
- **Constants**:
- `BAD_NETPATH_ERROR = 994` Network path error (e.g., lost remote DB connection).
- `SEM_TIMEOUT_ERROR = 995` Semaphore timeout (e.g., connection failure).
- `ITEM_NOT_FOUND = 996` Referenced item does not exist.
- `LOCKDOESNTEXIST_ERROR = 997` Lock record no longer exists (e.g., expired or deleted).
- `LOCKSTOLEN_ERROR = 998` Lock was forcibly released by another party.
- `UNKNOWN_ERROR = 999` Generic/unspecified error.
---
### **Invariants**
- `LockRecord` instances are **immutable** after construction: all properties are `readonly` (via auto-properties with `private set` implied by lack of setters) and initialized only in the constructor.
- `LockError.ErrorCode`, `Message`, `LockingUser`, and `LockingMachine` are immutable after construction (via `private set`).
- `LockingUser` and `LockingMachine` in `LockError` are never `null`; if `null` is passed to the constructor, they default to `string.Empty`.
- `LockStolen` and `LockLost` are derived solely from `ErrorCode` and are guaranteed to be consistent with the defined constants.
---
### **Dependencies**
- **Internal dependencies**:
- `System` (for `DateTime`, `string`, `object`, etc.).
- `System.Data` (imported but unused in these files; may indicate legacy or future use).
- **External dependencies (inferred)**:
- Likely consumed by other modules in `DTS.CommonCore` (e.g., a locking service or database persistence layer).
- `ItemCategory` suggests integration with a database-defined `LockCategories` table (not present in source, but referenced in XML doc).
- Error constants (`994``999`) imply coupling to SQL Server or ADO.NET error handling (per comments referencing `SqlClient`).
---
### **Gotchas**
- **`System.Data` import is unused**: The `using System.Data;` statement in `LockRecord.cs` serves no purpose in the current implementation and may be legacy or placeholder.
- **`LockingUser`/`LockingMachine` null-safety**: While `LockError` constructor normalizes `null` inputs to `string.Empty`, callers must be aware that `null` is *not* preserved—this may mask missing context if not handled explicitly.
- **No validation in constructor**: Neither `LockRecord` nor `LockError` validates inputs (e.g., empty strings, negative `ItemId`/`ItemCategory`). Callers must ensure data integrity externally.
- **`LockLost` vs. `LockStolen` semantics**: The distinction between `LOCKDOESNTEXIST_ERROR` (`LockLost`) and `LOCKSTOLEN_ERROR` (`LockStolen`) is subtle:
- `LockLost` implies the lock vanished *without* explicit release (e.g., timeout, crash).
- `LockStolen` implies another party *intentionally* released the lock (e.g., admin override).
This distinction may be critical for retry or conflict-resolution logic but is not enforced programmatically.
- **No versioning or extensibility mechanism**: The classes are simple DTOs with no support for forward/backward compatibility (e.g., new fields would require breaking changes).

View File

@@ -0,0 +1,225 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Sensors/DisplayedCalibrationBehavior.cs
- Common/DTS.CommonCore/Classes/Sensors/SensorDbRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/ZeroRef.cs
- Common/DTS.CommonCore/Classes/Sensors/CalMode.cs
- Common/DTS.CommonCore/Classes/Sensors/StreamInputRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/UARTRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/ParseParameters.cs
- Common/DTS.CommonCore/Classes/Sensors/DigitalInputScaleMultiplier.cs
- Common/DTS.CommonCore/Classes/Sensors/DigitalOutDbRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/SensorCalDbRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/StreamOutputRecord.cs
- Common/DTS.CommonCore/Classes/Sensors/ZeroMethod.cs
generated_at: "2026-04-16T02:39:12.436129+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "f64af1453db763cc"
---
# Sensor Data Model Documentation
## 1. Purpose
This module defines core data structures for representing sensor metadata, calibration, and configuration within the DTS system. It provides concrete implementations of interfaces for database persistence (`SensorDbRecord`, `StreamInputRecord`, `UARTRecord`, `StreamOutputRecord`, `DigitalOutDbRecord`, `SensorCalDbRecord`), helper classes for parsing and serializing configuration strings (`ZeroRef`, `CalMode`, `DigitalInputScaleMultiplier`), and supporting infrastructure for calibration and zeroing behavior (`ZeroMethod`, `ZeroMethods`, `DisplayedCalibrationBehavior`). These classes serve as the foundational data layer for sensor management, enabling consistent representation of sensor properties across database operations, CSV import/export workflows, and UI binding contexts.
## 2. Public Interface
### `DisplayedCalibrationBehavior`
- **`CalibrationBehavior`** (`DTS.Common.Enums.Sensors.CalibrationBehaviors`): Stores the underlying calibration behavior enum value.
- **`DisplayString`** (`string`): Human-readable string representation of the calibration behavior.
- **`ToString()`** (`override string`): Returns `DisplayString`.
### `SensorDbRecord`
- **`id`** (`int`): Database ID of the sensor model record.
- **`SensorType`** (`short`): Sensor type identifier.
- **`SerialNumber`** (`string`): Serial number of the sensor model.
- **`TagType`** (`override TagTypes`): Returns `TagTypes.SensorModels`.
- **Constructor `SensorDbRecord(IDataReader reader)`**: Initializes fields from database reader using `Utility.GetInt`, `Utility.GetShort`, and `Utility.GetString`.
### `ZeroRef`
- **`ZeroType`** (`enum`): Defines zeroing methods:
- `AverageOverTime` (serialized as `"0"`)
- `UsePreEventDiagnostics` (serialized as `"1"`)
- `UseZeroMv` (serialized as `"2"`)
- **`ZeroMethod`** (`ZeroType`): The selected zeroing method.
- **Constructor `ZeroRef(string zeroref)`**: Parses string (`"0"`, `"1"`, or `"2"`) into `ZeroMethod`; throws `NotSupportedException` for invalid input.
- **Constructor `ZeroRef(ZeroType type)`**: Initializes `ZeroMethod` directly.
- **`ToString()`** (`override string`): Returns `"0"`, `"1"`, or `"2"` based on `ZeroMethod`.
### `CalMode`
- **`ShuntCheck`** (`bool`): `true` if shunt check enabled (`'S'` in position 0), `false` otherwise (`'I'`).
- **`FullBridge`** (`bool`): `true` if full bridge mode (`'D'` in position 1), `false` otherwise (`'S'`).
- **`Filter`** (`bool`): `true` if filter enabled (`'F'` in position 2), `false` otherwise (`'B'`).
- **Constructor `CalMode(string value)`**: Parses 3-character string (e.g., `"SDF"`) into properties; throws `NotSupportedException` for invalid characters at any position.
- **Constructor `CalMode()`**: Default constructor initializes all properties to `false`.
- **`ToString()`** (`override string`): Serializes to 3-character string (e.g., `"SDF"`).
### `StreamInputRecord`
- **`Id`** (`int`): Database ID of the sensor.
- **`SerialNumber`** (`string`): Sensor serial number.
- **`LastModified`** (`DateTime`): Timestamp of last modification.
- **`LastUpdatedBy`** (`string`): User who last modified the record.
- **`DoNotUse`** (`bool`): Flag indicating sensor should be excluded from use.
- **`Broken`** (`bool`): Flag indicating sensor is broken.
- **`StreamInUDPAddress`** (`string`): UDP address for streaming input; defaults to `"UDP://239.1.2.10:8400"`.
- **`TagType`** (`override TagTypes`): Returns `TagTypes.Sensors`.
- **Constructor `StreamInputRecord(ISensorData sd)`**: Initializes from `ISensorData` interface; logs exceptions via `APILogger`.
- **Constructor `StreamInputRecord(IDataReader reader)`**: Initializes from database reader; logs exceptions via `APILogger`.
### `UARTRecord`
- **`Id`** (`int`): Database ID.
- **`SerialNumber`** (`string`): Serial number.
- **`UartBaudRate`** (`uint`): Baud rate; default `57600`.
- **`UartDataBits`** (`uint`): Data bits; default `8`.
- **`UartStopBits`** (`StopBits`): Stop bits; default `StopBits.None`.
- **`UartParity`** (`Parity`): Parity; default `Parity.None`.
- **`UartFlowControl`** (`Handshake`): Flow control; default `Handshake.None`.
- **`UartDataFormat`** (`UartDataFormat`): Data format; default `UartDataFormat.Binary`.
- **`LastModified`** (`DateTime`): Last modification timestamp.
- **`LastUpdatedBy`** (`string`): Last modifier.
- **`DoNotUse`** (`bool`): Exclusion flag.
- **`Broken`** (`bool`): Broken flag.
- **`TagType`** (`TagTypes`): Returns `TagTypes.Sensors`.
- **Constructor `UARTRecord(ISensorData sensor)`**: Initializes from `ISensorData`.
- **Constructor `UARTRecord(IDataReader reader)`**: Initializes from database reader; parses enum fields via `Enum.Parse`; logs exceptions.
### `ParseParameters`
- **`SensorData`** (`ISensorData`): Sensor data source.
- **`ImportCulture`** (`IFormatProvider`): Culture for parsing during import.
- **`Errors`** (`List<string>`): Accumulated errors during parsing.
- **`IrtraccExponent`** (`double`): Exponent for IrTracc scaling.
- **`SensorCal`** (`ISensorCalibration`): Calibration data.
- **`Sensitivity`** (`double`): Sensitivity value.
- **`SavedIsProportional`** (`bool`): Proportional flag.
- **`SavedRemoveOffset`** (`bool`): Remove offset flag.
- **`StripBackslash`** (`bool`): Backslash stripping flag.
- **`OriginalOffset`** (`double`): Original offset value.
- **`ZeroType`** (`ZeroMethodType`): Zero method type.
- **`ZeroEnd`** (`double`): Zero method end value.
- **`ZeroStart`** (`double`): Zero method start value.
- **`SquibDefaults`** (`ISquibSettingDefaults`): Squib defaults.
- **`DigitalOutDefaults`** (`IDigitalOutDefaults`): Digital output defaults.
- **`SensorGroupNameLookup`**, **`SensorGroupTypeLookup`**, etc.: Multiple `Dictionary<string, string>` fields for mapping group names, ISO codes, user codes, DAS serial numbers, and channel indices.
- **`SensorTestObject`** (`string`): Test object identifier.
- **`UseISOCodeFilterMapping`**, **`UseZeroForUnfiltered`** (`bool`): Filtering flags.
- **`SensorISOCode`**, **`SensorUserCode`**, etc.: Dictionaries for channel mappings.
### `DigitalInputScaleMultiplier`
- **`Form`** (`Forms`): Scaling form; defaults to `Forms.ArbitraryLowAndHigh`.
- **`DefaultValue`** (`double`): Value displayed for digital input `0` (OFF); defaults to `0`.
- **`ActiveValue`** (`double`): Value displayed for digital input `1` (ON); defaults to `1`.
- **`SimpleEquals(IDigitalInputScaleMultiplier rhs)`** (`bool`): Compares `Form`, `DefaultValue`, and `ActiveValue`.
- **`Equals(object obj)`** (`override bool`): Deep equality check.
- **`GetHashCode()`** (`override int`): Hash code using primes `31` and `79`.
- **Constructor `DigitalInputScaleMultiplier()`**: Initializes `DefaultValue = 0`.
- **Constructor `DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy)`**: Copy constructor.
- **`ToSerializeDbString()`** (`string`): Serializes to format `"ArbitraryLowAndHigh,defaultValue,activeValue"`.
- **`FromDbSerializeString(string s)`** (`void`): Deserializes from string; throws `NotSupportedException` on invalid format.
### `DigitalOutDbRecord`
- **`SerialNumber`** (`string`): Serial number.
- **`DODelay`** (`double`): Digital output delay in ms; default `0`.
- **`DODuration`** (`double`): Digital output duration in ms; default `0`.
- **`ModifiedBy`** (`string`): Last modifier.
- **`LastModified`** (`DateTime`): Last modification timestamp.
- **`DatabaseId`** (`int`): Database ID; default `-1`.
- **`ISOCode`**, **`ISOChannelName`**, **`UserCode`**, **`UserChannelName`** (`string`): Channel identification fields.
- **`Broken`** (`bool`): Broken flag; default `false`.
- **`DoNotUse`** (`bool`): Exclusion flag; default `false`.
- **`DOMode`** (`DigitalOutputModes`): Output mode; default `DigitalOutputModes.CCNC`.
- **`LimitDuration`** (`bool`): Duration limit flag; default `true`.
- **`Version`** (`int`): Record version; default `0`.
- **`TagsBlobBytes`** (`byte[]`): Binary tags blob.
- **Constructor `DigitalOutDbRecord()`**: Default constructor.
- **Constructor `DigitalOutDbRecord(ISensorData copy, byte[] tagsBlobBytes)`**: Initializes from `ISensorData` and tags blob.
- **Constructor `DigitalOutDbRecord(IDigitalOutDbRecord copy)`**: Copy constructor.
- **Constructor `DigitalOutDbRecord(IDataReader reader)`**: Initializes from database reader.
### `SensorCalDbRecord`
- **`CalibrationId`** (`int?`): Database calibration ID; `null` if unknown.
- **`SerialNumber`** (`string`): Sensor serial number.
- **`CalibrationDate`** (`DateTime`): Calibration date.
- **`Username`** (`string`): User who performed calibration.
- **`LocalOnly`** (`bool`): Local-only flag.
- **`NonLinear`** (`bool`): Non-linear calibration flag; setting to `true` sets `RemoveOffset = false`.
- **`Records`** (`ICalibrationRecords`): Calibration records.
- **`ModifyDate`** (`DateTime`): Last modification date.
- **`IsProportional`** (`bool`): Proportional calibration flag.
- **`RemoveOffset`** (`bool`): Remove offset flag.
- **`ZeroMethods`** (`ZeroMethods`): Zeroing method definitions.
- **`CertificationDocuments`** (`string[]`): Array of certification document paths.
- **`InitialOffsets`** (`InitialOffsets`): Initial offset definitions.
- **`LinearAdded`** (`bool`): Indicates if linear calibration is added (requires non-linear, polynomial, and multiple zero methods).
- **Constructor `SensorCalDbRecord()`**: Default constructor.
- **Constructor `SensorCalDbRecord(ISensorCalDbRecord copy)`**: Copy constructor; deep copies arrays and marks linearization valid.
- **Constructor `SensorCalDbRecord(IDataReader reader)`**: Initializes from database reader; logs exceptions.
### `StreamOutputRecord`
- **`Id`** (`int`): Database ID.
- **`SerialNumber`** (`string`): Serial number.
- **`LastModified`** (`DateTime`): Last modification timestamp.
- **`LastUpdatedBy`** (`string`): Last modifier.
- **`DoNotUse`** (`bool`): Exclusion flag.
- **`Broken`** (`bool`): Broken flag.
- **`StreamOutUDPProfile`** (`UDPStreamProfile`): Stream profile; default `UDPStreamProfile.CH10_ANALOG_2HDR`.
- **`StreamOutUDPAddress`** (`string`): UDP address; defaults to `"UDP://239.1.2.10:8400"`.
- **`StreamOutUDPTimeChannelId`** (`ushort`): Time channel ID; range `[10, 100]`, default `1`.
- **`StreamOutUDPDataChannelId`** (`ushort`): Data channel ID; range `[10, 100]`, default `3`.
- **`StreamOutUDPTmNSConfig`** (`string`): TMNS configuration; default `"(1,6,60,0,0,0,0,0)"`.
- **`StreamOutIRIGTimeDataPacketIntervalMs`** (`ushort`): IRIG time data packet interval; range `[10, 1000]`, default `500`.
- **`StreamOutTMATSIntervalMs`** (`ushort`): TMATS interval; range `[0, 65535]`, default `1000`.
- **`TagType`** (`override TagTypes`): Returns `TagTypes.Sensors`.
- **`AvailableUDPStreamProfiles(int ConnectionDbVersion, bool UseAdvancedStreamingProfiles)`** (`static UDPStreamProfile[]`): Returns list of supported profiles based on version and profile type.
- **Constructor `StreamOutputRecord(ISensorData sd)`**: Initializes from `ISensorData`.
- **Constructor `StreamOutputRecord(IDataReader reader, int ClientDbVersion, int ConnectionDbVersion)`**: Initializes from database reader; conditionally reads `TMATS_IntervalMS` if versions permit.
### `ZeroMethod`
- **`Method`** (`ZeroMethodType`): Zeroing method type; defaults to `SensorConstants.DefaultZeroMethodType`.
- **`Start`** (`double`): Start value for zeroing window; defaults to `SensorConstants.DefaultZeroMethodStart`.
- **`End`** (`double`): End value for zeroing window; defaults to `SensorConstants.DefaultZeroMethodEnd`.
- **`PropertyChanged`** (`event PropertyChangedEventHandler`): Implements `INotifyPropertyChanged`.
- **Constructor `ZeroMethod(ZeroMethodType zm, double start, double end)`**: Initializes all fields.
- **Constructor `ZeroMethod(string zm, CultureInfo culture)`**: Parses `"Method,Start,End"` string.
- **Constructor `ZeroMethod(ZeroMethod copy)`**: Deep copy constructor.
- **`ToDbString()`** (`string`): Serializes to `"Method,Start,End"`.
- **`ToXElement(string prefix)`** (`XElement`): Serializes to XML element.
- **`Update(XElement elem, string prefix)`** (`void`): Updates XML element in-place.
- **`ToSerializeString()`** (`string`): Same as `ToDbString()`.
- **`ToDisplayString(...)`** (`string`): Human-readable display string based on `Method`.
### `ZeroMethods`
- **`Methods`** (`ZeroMethod[]`): Array of zero methods.
- **Constructor `ZeroMethods()`**: Default (empty array).
- **Constructor `ZeroMethods(string methods)`**: Parses serialized string using `"__x__"` separator.
- **Constructor `ZeroMethods(ZeroMethod[] copyMethods)`**: Deep copy constructor.
- **`FromSerializedString(string s)`** (`void`): Parses serialized string.
- **`ToSerializedString()`** (`string`): Serializes using `"__x__"` separator; escapes separator characters.
- **`ToDisplayString(...)`** (`string`): Human-readable display string for all methods.
- **`ToString()`** (`override string`): Calls `ToDisplayString` with localized format strings.
## 3. Invariants
- **`ZeroRef`**: String serialization is strictly `"0"`, `"1"`, or `"2"`; invalid inputs throw `NotSupportedException`.
- **`CalMode`**: String serialization is exactly 3 characters; positions 0, 1, 2 must be `S/I`, `D/S`, and `F/B` respectively; invalid inputs throw `NotSupportedException`.
- **`DigitalInputScaleMultiplier`**: Serialization format is `"Form,DefaultValue,ActiveValue"`; only `Forms.ArbitraryLowAndHigh` is supported; invalid formats throw `NotSupportedException`.
- **`ZeroMethod`**: Serialization format is `"Method,Start,End"`; XML serialization uses `"UsePreCalZero"` as legacy alias for `UsePreEventDiagnosticsZero`.
- **`ZeroMethods`**: Serialization uses `"__x__"` as primary separator and `"___xx___"` as backup escape sequence; `ToString()` uses localized format strings.
- **`SensorCalDbRecord.NonLinear`**: Setting to `true` forces `RemoveOffset = false`.
- **`StreamOutputRecord.StreamOutUDPTimeChannelId`** and **`StreamOutUDPDataChannelId`**: Valid range is `[10, 100]`.
- **`StreamOutputRecord.StreamOutIRIGTimeDataPacketIntervalMs`**: Valid range is `[10, 1000]`.
- **`UARTRecord`**: All UART configuration fields have defined default values (`UartBaudRate=57600`, `UartDataBits=8`, `UartStopBits=None`, `UartParity=None`, `UartFlowControl=None`, `UartDataFormat=Binary`).
- **`StreamInputRecord.StreamInUDPAddress`**: Defaults to `"UDP://239.1.2.10:8400"`.
- **`StreamOutputRecord.StreamOutUDPAddress`**: Defaults to `"UDP://239.1.2.10:8400"`.
- **`DigitalOutDbRecord.DatabaseId`**: Default is `-1` (indicating no database assignment).
- **`DigitalOutDbRecord.LimitDuration`**: Defaults to `true`.
- **`DigitalOutDbRecord.DOMode`**: Defaults to `DigitalOutputModes.CCNC`.
## 4. Dependencies
### Dependencies *of* this module:
- **`DTS.Common.Base`**: Provides `BasePropertyChanged` (used by `DigitalOutDbRecord`, `SensorCalDbRecord`, `ZeroMethod`).
- **`DTS.Common.Interface.Tags`**: Provides `TagAwareBase` (base class for `SensorDbRecord`, `StreamInputRecord`, `StreamOutputRecord`).
- **`DTS.Common.Interface.Sensors`**: Provides core interfaces (`ISensorData`, `ISensorCalDbRecord`, `IDigitalOutDbRecord`, `IDigitalInputScaleMultiplier`, `IUARTRecord`, `IStreamInputRecord`, `IStreamOutputRecord`, `ISensorCalibration`, `ISquibSettingDefaults`, `IDigitalOutDefaults`).
- **`

View File

@@ -0,0 +1,48 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Sensors/SensorsList/DragAndDropPayload.cs
generated_at: "2026-04-16T02:41:47.536416+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c4ab033f3383cdef"
---
# SensorsList
### 1. **Purpose**
The `DragAndDropPayload` class encapsulates data transferred during drag-and-drop operations involving sensor items in the UI. It serves as a serializable container that wraps an array of `IDragAndDropItem` objects, enabling consistent handling of drag-and-drop payloads across components that interact with sensors (e.g., reordering, copying, or moving sensors in a list). Its inclusion of multiple format strings supports different drag contexts (e.g., standard, Alt-modified, Ctrl-modified operations), facilitating platform-agnostic or framework-specific drag-and-drop mechanisms.
### 2. **Public Interface**
- **`public IDragAndDropItem[] Items { get; }`**
A read-only property exposing the array of drag-and-drop items contained in the payload. The array is set at construction and cannot be modified afterward.
- **`public DragAndDropPayload(IDragAndDropItem[] items)`**
Constructor that initializes the payload with the provided array of `IDragAndDropItem` instances. The array is stored directly (no defensive copy is made, per source).
- **`public const string FORMAT`**
A constant string `"DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing the primary data format identifier for the payload.
- **`public const string ALT_FORMAT`**
A constant string `"ALT_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing an alternative format, likely used when the Alt key is held during drag.
- **`public const string CTRL_FORMAT`**
A constant string `"CTRL_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing a format used when the Ctrl key is held during drag (e.g., for copy vs. move semantics).
### 3. **Invariants**
- `Items` is non-null and initialized to the exact array passed to the constructor (no validation or defensive copying is performed in the constructor).
- The `FORMAT`, `ALT_FORMAT`, and `CTRL_FORMAT` constants are immutable and uniquely identify the payload type in drag-and-drop operations.
- The class is immutable from the callers perspective after construction (only `Items` is exposed, and it is read-only via the property).
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Interface.Sensors.SensorsList.IDragAndDropItem` (via the `Items` property type). This interface defines the contract for items that can be dragged/dropped in the sensors list context.
- **Depended on by**:
- UI components or services that handle drag-and-drop for sensors (e.g., drag source initiators, drop target handlers) would serialize/deserialize payloads using the `FORMAT`/`ALT_FORMAT`/`CTRL_FORMAT` strings.
- Serialization logic (e.g., for clipboard or drag-drop operations) likely relies on these format strings to reconstruct `DragAndDropPayload` instances.
### 5. **Gotchas**
- **No defensive copy**: The constructor assigns the `items` array directly to the `Items` property. Modifications to the array *after* construction (if the caller retains a reference) will mutate the payloads contents, violating immutability expectations. Callers must not retain or modify the passed array.
- **No null/empty validation**: The constructor does not validate that `items` is non-null or non-empty. Passing `null` or an empty array is allowed and may lead to downstream `NullReferenceException`s or unexpected behavior if not handled.
- **Format string semantics are not self-documenting**: While the constants suggest context-specific behavior (e.g., `ALT_FORMAT`, `CTRL_FORMAT`), their exact usage (e.g., how they map to operations like copy vs. move) is not defined in this file and must be inferred from consumers.
- **No serialization attributes**: The class lacks explicit serialization attributes (e.g., `[Serializable]`, `[DataContract]`), implying reliance on framework-specific drag-drop serialization (e.g., `DataObject` in WinForms or `DragEventArgs` in WPF). Compatibility may be fragile if used outside intended UI frameworks.
- **No documentation on format string usage**: It is unclear how `ALT_FORMAT` and `CTRL_FORMAT` are registered or consumed—e.g., whether they are used as fallbacks or in parallel with `FORMAT`.

View File

@@ -0,0 +1,97 @@
---
source_files:
- Common/DTS.CommonCore/Classes/TMAT/TMTTemplate.cs
generated_at: "2026-04-16T02:40:28.075233+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "759eebf6c2f0302e"
---
# TMAT
## Documentation: `TMTTemplate` Module
### 1. Purpose
This module provides infrastructure for processing template files (`.tmt` files) used in test configuration and reporting workflows. It enables programmatic substitution of predefined placeholders (e.g., `{NAME OF PROGRAM}`, `{{CHANNEL {0} NAME}}`) with runtime values. The module decouples template structure from data population, supporting both global metadata (e.g., test ID, serial number) and per-channel properties (e.g., hardware channel number, scaling factors). It is part of the `DTS.Common.Classes.TMAT` namespace and serves as a foundational component for generating or modifying test configuration files dynamically.
---
### 2. Public Interface
#### Enums
- **`TMTGlobalKeys`**
Enumerates global placeholder keys used in templates. Each member is decorated with a `[TMTKey]` attribute specifying the literal pattern to search for.
Examples:
- `NameOfProgram` → pattern: `"{NAME OF PROGRAM}"`
- `DASSerialNumber` → pattern: `"{DAS SERIAL NUMBER}"`
- `UdpStreamTimeChannelId` → pattern: `"{UDP STREAM TIME CHANNEL ID}"`
- **`TMTChannelKeys`**
Enumerates per-channel placeholder keys. Each pattern includes a format specifier `{0}` for the channel number.
Examples:
- `HardwareChannelNumber` → pattern: `"{{CHANNEL {0} HARDWARE CHANNEL NUMBER}}"`
- `ChannelName` → pattern: `"{{CHANNEL {0} NAME}}"`
- `ScaleFactorEU` → pattern: `"{{CHANNEL {0} SCALEFACTOR EU}}"`
#### Attribute
- **`TMTKeyAttribute`**
- `public string Key { get; }` Stores the literal pattern string (e.g., `"{NAME OF PROGRAM}"`).
- `public TMTKey(string key)` Constructor initializing `Key`.
- `public static string GetKey(TMTGlobalKeys key)` Returns the pattern string for a global key.
- `public static string GetKey(TMTChannelKeys key, int channelNumber)` Returns the pattern string for a channel key, with `{0}` replaced by `channelNumber`.
#### Interface
- **`ITMTTemplate`**
- `void UpdateValue(TMTGlobalKeys key, string value)`
Replaces all occurrences of the pattern associated with `key` in the template with `value`.
- `void UpdateValue(TMTChannelKeys key, string value, int channelNumber)`
Replaces all occurrences of the pattern associated with `key` (formatted with `channelNumber`) in the template with `value`.
- `string[] GetAllLines()`
Returns the current content of the template as an array of lines.
#### Class
- **`TMTTemplate : ITMTTemplate`**
- `public TMTTemplate(string templateLocation)`
Loads all lines from the file at `templateLocation` into internal storage.
- `public TMTTemplate(string[] lines)`
Initializes the template with the provided `lines` (e.g., for in-memory templates).
- `public void UpdateValue(TMTGlobalKeys key, string value)`
Iterates through all lines; for each line containing the pattern for `key`, replaces the pattern with `value`.
- `public void UpdateValue(TMTChannelKeys key, string value, int channelNumber)`
Iterates through all lines; for each line containing the formatted pattern for `key` (with `channelNumber`), replaces the pattern with `value`.
- `public string[] GetAllLines()`
Returns a copy of the internal line list as an array.
---
### 3. Invariants
- **Template file existence is not enforced at construction**: If `templateLocation` is invalid or the file does not exist, `_allLines` remains empty (no exception thrown).
- **Pattern replacement is literal and non-semantic**:
- `Contains(pattern)` is used for matching, so partial matches (e.g., `"{NAME OF PROGRA}"` inside `"{NAME OF PROGRAM}"`) may cause unintended replacements.
- Replacements are done via `string.Replace`, which replaces *all* occurrences of the pattern in a line (not just the first).
- **Channel keys require exact formatting**: The pattern for channel keys includes double braces (`{{...}}`) to support `string.Format`, but the module does not validate that `channelNumber` produces a syntactically valid pattern (e.g., negative numbers are allowed).
- **No deduplication or ordering guarantees**: Multiple updates to the same key in a single line will overwrite each other in sequence, but the final state depends on line order and replacement count.
---
### 4. Dependencies
- **Internal dependencies**:
- `System.Collections.Generic` (for `List<string>`)
- `System.IO` (for `File.Exists`, `File.ReadAllLines`)
- Reflection (`System.Type.GetMember`, `Attribute.GetCustomAttribute`) for pattern extraction from enums.
- **External dependencies**:
- Consumers must provide valid `.tmt` template files (or line arrays) to `TMTTemplate` constructors.
- The module is used by other components (e.g., test execution or reporting systems) that populate template values.
- **No external libraries or services** beyond core .NET types.
---
### 5. Gotchas
- **Case sensitivity**: Pattern matching via `Contains` is case-sensitive. A template line `" {NAME OF PROGRAM} "` will match, but `" {name of program} "` will not.
- **Brace escaping in channel keys**: The `{{CHANNEL {0} ...}}` pattern relies on `string.Format` semantics. If `channelNumber` is `0`, the pattern becomes `"{{CHANNEL 0 ...}}"`, which is correct. However, if `channelNumber` is negative (e.g., `-1`), the result is `"{{CHANNEL -1 ...}}"`—syntactically valid but semantically questionable.
- **No validation of placeholder presence**: `UpdateValue` silently does nothing if the pattern is not found in any line.
- **No thread safety**: The class is not thread-safe; concurrent calls to `UpdateValue` on the same instance may cause race conditions.
- **Memory overhead**: All template lines are held in memory (`_allLines`) during processing. Large templates may consume significant memory.
- **No error handling for malformed templates**: If a template line contains unbalanced braces or invalid `string.Format` syntax (e.g., `{{CHANNEL {0} NAME`), `string.Format` in `GetKey(TMTChannelKeys, int)` will throw an exception.
- **Historical quirk (commented)**:
- `UdpStreamTimeChannelId`/`UdpStreamDataChannelId` and `CreateDate` were added in fixes FB 26736 and FB 29996, respectively—suggesting these keys were added post-initial design.

View File

@@ -0,0 +1,223 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Tags/TagAssignment.cs
- Common/DTS.CommonCore/Classes/Tags/Tag.cs
- Common/DTS.CommonCore/Classes/Tags/TagAwareBase.cs
- Common/DTS.CommonCore/Classes/Tags/TagsInstance.cs
generated_at: "2026-04-16T02:41:01.456676+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3dfbd6a973f4cede"
---
# Tags
## Documentation: Tagging Infrastructure (`DTS.Common.Classes.Tags`)
---
### 1. Purpose
This module provides a tag-based metadata system for associating arbitrary textual labels with domain objects (e.g., assets, events, configurations). It enables objects to be tagged with human-readable strings (e.g., `"Urgent"`, `"Critical"`, `"Legacy"`) and persisted via database assignments. The system supports lazy caching of tag definitions in memory for fast lookup, and provides base infrastructure (`TagAwareBase`) for domain classes to integrate tagging functionality. Tags themselves are immutable (no edit/delete/obsolete operations), and new tags are auto-created on first use.
---
### 2. Public Interface
#### `TagAssignment` class
Represents a database assignment record linking a tag to an object.
- **`TagAssignment()`**
Default constructor.
- **`TagAssignment(IDataReader reader)`**
Constructor that populates fields from a database reader. Reads `TagID`, `ObjectID`, and `ObjectType` (as `short` cast to `TagTypes`).
- **`int ObjectID`**
Gets/sets the ID of the object being tagged.
- **`int TagID`**
Gets/sets the ID of the tag being assigned.
- **`TagTypes ObjectType`**
Gets/sets the *type* of the object being tagged (e.g., `TagTypes.Asset`, `TagTypes.Event`). *Note: Property name is `ObjectType`, not `TagType`.*
#### `Tag` class
Represents a single tag: an immutable ID-text pair (text is mutable via property, but DB behavior is immutable per comment).
- **`Tag()`**
Default constructor.
- **`Tag(string tagText, int tagId)`**
Constructor with explicit ID and text.
- **`Tag(Tag copy)`**
Copy constructor.
- **`Tag(IDataReader reader)`**
Constructor that populates fields from DB reader: `TagId`, `Obsolete`, `TagText`.
- **`int ID`**
Gets/sets the tags database ID.
- **`string Text`**
Gets/sets the tags display text.
- **`bool IsObsolete`**
Gets/sets whether the tag is obsolete (currently not enforced by UI logic per comment).
- **`const int INVALID_ID = -1`**
Sentinel value for uninitialized or missing tag IDs.
- **`object Clone()`**
Returns a new `Tag` instance with identical `ID`, `Text`, and `IsObsolete`.
#### `TagAwareBase` abstract class
Base class for domain objects that support tagging.
- **`abstract TagTypes TagType { get; }`**
Must be implemented by derived classes to specify the objects tag type.
- **`int[] TagIDs`**
Gets/sets the list of tag IDs associated with this object.
- **`byte[] TagsBlobBytes`**
Gets/sets `TagIDs` as a binary blob (using `Buffer.BlockCopy`). Setter logs exceptions via `APILogger`.
- **`void SetTagsFromCommaSeparatedString(string tagText, ...)`**
Parses comma-separated tag strings (e.g., `"Urgent, Critical"`), ensures tags exist in DB/cache, and updates `TagIDs`. Trims leading whitespace per implementation.
- **`virtual void SetTags(string[] tagsText, ...)`**
Same as above, but accepts an array of tag strings.
- **`string GetTagsAsCommaSeparatedString(TagsGetDelegate tagsGet)`**
Returns comma-separated tag *text* (e.g., `"Urgent,Critical"`), using `tagsGet` to resolve IDs to text.
- **`virtual string[] GetTagsArray(TagsGetDelegate tagsGet)`**
Returns array of tag *text* values corresponding to `TagIDs`.
- **`virtual int[] GetTagIDs()`**
Returns current `TagIDs`.
- **`virtual void RemoveTags(string[] tagsText)`**
*Stub implementation only* — no-op. Comment says `// remove tags!!!`.
- **`bool TagCompatible(string tags, TagsGetDelegate tagsGet)`**
Returns `true` if *any* tag in the input comma-separated string matches *any* tag currently assigned to this object.
- **`virtual bool TagCompatible(int[] tags)`**
Returns `true` if `tags` array is empty *or* if there is any intersection with `TagIDs`.
- **`virtual bool HasIntersectingTag(int[] tags)`**
Returns `true` if `tags` and `TagIDs` share at least one ID.
- **`void InsertTagsFromCommaSeparatedString(int id, TagTypes tagType, string tags, ...)`**
Calls `SetTagsFromCommaSeparatedString`, then `Commit(id, tagType, ...)`. Used to persist tags after modification.
- **`void Commit(int id, TagTypes tagType, ...)`**
Deletes existing assignments for `(tagType, id)` via `tagAssignmentsDelete`, then inserts new assignments for each ID in `TagIDs` via `tagAssignmentInsert`.
- **`List<int> GetTagIdList(int objectId, TagTypes tagType, TagAssignmentsGet tagAssignmentsGet)`**
Retrieves all tag assignments for a given `(tagType, objectId)` from DB, filters to match `objectId`, and returns list of unique `TagID`s.
#### `TagsInstance` class
Singleton-like manager for tag metadata (cached in memory, populated on first use or explicit `UpdateList`).
- **`static TagsInstance GetTagsInstance(TagsGetDelegate tagsGet)`**
Returns the singleton instance, initializing it with `tagsGet` if not already created.
- **`static bool AddTag(string tagText, ...)`**
Adds `tagText` to DB if not already present (case-sensitive, per dictionary key). Returns `false` if tag already exists or input is null/empty.
- **`static bool MigrateTag(string tagText, ...)`**
Adds/updates tag during DB migration (e.g., to reassign IDs). Does *not* check for existence before inserting.
- **`static bool[] AddRange(string[] tagText, ...)`**
Adds multiple tags (trims leading whitespace per element). Returns array of `true`/`false` per tag.
- **`static int GetIDFromTagText(string tagText, TagsGetDelegate tagsGet, TagsGetIdDelegate tagsGetId)`**
Looks up tag ID from DB using `tagsGetId`. Returns `Tag.INVALID_ID` (`-1`) if not found.
- **`static int[] GetIDsFromTagText(string[] tagText, ...)`**
Returns array of tag IDs for input texts, skipping `INVALID_ID`s.
- **`static string GetTagTextFromID(int tagID, TagsGetDelegate tagsGet)`**
Looks up tag text from in-memory cache. Returns `null` if ID is invalid or not found.
- **`static string[] GetTagTextFromIDs(int[] tagId, TagsGetDelegate tagsGet)`**
Returns array of tag texts for IDs, skipping invalid/missing entries.
- **`void UpdateList(TagsGetDelegate tagsGet)`**
Refreshes in-memory cache by calling `tagsGet(null, out tags)` and repopulating `_tagsLookup`.
- **`bool ContainsTag(string text)`**
Returns `true` if `text` exists in in-memory cache.
#### Delegates (used for decoupling DB operations)
- `TagsGetDelegate(int? id, out ITag[] tags)`
Retrieves tags by ID (or all if `id == null`).
- `TagsGetIdDelegate(string text, out int? id)`
Retrieves tag ID by text.
- `TagsInsertDelegate(ref ITag tag)`
Inserts a new tag (assigns `ID` on success).
- `GetSqlCommandDelegate(bool bNewConnection)`
Returns a `SqlCommand` (likely for transactional operations).
- `TagAssignmentsGet(TagTypes? tagType, out ITagAssignment[] records)`
Retrieves tag assignments (optionally filtered by `tagType`).
- `TagAssignmentsDelete(TagTypes objectType, int objectId)`
Deletes all assignments for given object.
- `TagAssignmentsInsert(ITagAssignment tagAssignment)`
Inserts a single assignment.
---
### 3. Invariants
- **Tag immutability (by design)**: The `Tag` class comment states: *“we don't currently let you obsolete, delete, or edit tags, just add”*. While `IsObsolete` and `Text` are settable, the `Commit` logic in `TagsInstance` only updates IDs (via `UpdateAll`), and no DB update path for text exists.
- **`Tag.INVALID_ID == -1`** is the canonical sentinel for missing/invalid tag IDs.
- **`TagsInstance` is a singleton per AppDomain**: Initialized only once via `GetTagsInstance`, with caching done in-memory on startup and updated only on explicit `AddTag`/`UpdateList`.
- **`TagIDs` is never `null`**: The `TagIDs` setter in `TagAwareBase` replaces `null` with `new int[0]`.
- **`TagsBlobBytes` size must be a multiple of `sizeof(int)`**: Setter silently returns if `value.Length < sizeof(int)`.
- **Tag assignment deletion happens before insertion in `Commit`**: Ensures no stale assignments persist.
---
### 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Base.BasePropertyChanged` (base class for `INotifyPropertyChanged`).
- `DTS.Common.Interface.Tags` (interfaces `ITag`, `ITagAssignment`, `ITagAware`).
- `DTS.Common.Utilities.Logging.APILogger` (used for logging exceptions in `TagsBlobBytes` setter and `TagsInstance.Commit`).
- `System.Data` (`IDataReader`, `SqlCommand`).
- `System.Linq` (used in `TagAwareBase` and `TagsInstance`).
- **External dependencies**:
- DB layer via delegates (`TagsGetDelegate`, `TagsGetIdDelegate`, etc.) — concrete implementations must be provided by the consuming application.
- `Utility` class (static methods `GetInt`, `GetBool`, `GetString`, `GetShort`) — assumed to be in `DTS.Common.Base` or `DTS.Common.Utilities`.
- **Depended upon by**:
- Any domain class inheriting from `TagAwareBase` (e.g., `Asset`, `Event`, `Configuration` — not shown here).
- UI or service layers that need to parse/set tags via `SetTagsFromCommaSeparatedString`, `GetTagsAsCommaSeparatedString`, etc.
---
### 5. Gotchas
- **`ObjectType` vs `TagType`**: The `TagAssignment` class has a property named `ObjectType`, but the interface likely expects `TagType`. This mismatch may cause confusion.
- **`TagTypes` enum usage**: `ObjectType` in `TagAssignment` is cast from a `short` (`Utility.GetShort`), implying `TagTypes` is a `short`-backed enum. Ensure alignment with DB schema.
- **Leading whitespace trimming only**: `SetTagsFromCommaSeparatedString` and `AddRange` trim *leading* whitespace (`TrimStart`), but not trailing. `"tag1 , tag2 "` becomes `["tag1 ", "tag2 "]` — trailing spaces remain.
- **`TagCompatible` semantics**: Returns `true` if *any* tag matches (logical OR), not *all* tags (logical AND). This may be counterintuitive for filtering.
- **`RemoveTags` is a stub**: The method body is empty — calling it has no effect.
- **`TagsInstance` is not thread-safe for writes**: While `_tagsLookup` is locked during updates, `AddTag`/`MigrateTag` do *not* use a lock around the entire operation (only inside `Commit`). Concurrent calls may result in duplicate DB inserts or cache inconsistencies.
- **`TagsBlobBytes` setter silently fails**: If `value.Length` is not a multiple of `sizeof(int)`, only the full chunks are copied; remainder is discarded and no error is raised.
- **`GetTagTextFromIDs` filters out `null`/empty strings**: Even if `GetTagTextFromID` returns `null`, it is excluded from the result array — but this may hide missing tag IDs.
- **`TagAssignment` constructor from `IDataReader` uses `"ObjectType"` column name**, while `Tag` uses `"TagId"` and `"Obsolete"` — ensure DB schema matches exactly.
None identified beyond these.

View File

@@ -0,0 +1,172 @@
---
source_files:
- Common/DTS.CommonCore/Classes/TestMetaData/TestEngineerDetailsDbRecord.cs
- Common/DTS.CommonCore/Classes/TestMetaData/CustomerDetailsDbRecord.cs
- Common/DTS.CommonCore/Classes/TestMetaData/LabratoryDetailsDbRecord.cs
generated_at: "2026-04-16T02:39:45.898460+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7adaa8e0587cfc54"
---
# Documentation: Test Metadata Database Record Classes
---
## 1. Purpose
These three classes—`TestEngineerDetailsDbRecord`, `CustomerDetailsDbRecord`, and `LabratoryDetailsDbRecord`—represent immutable data transfer objects (DTOs) for loading and encapsulating metadata about test engineers, customers, and laboratories from a database. They implement the `INotifyPropertyChanged` pattern via inheritance from `Base.BasePropertyChanged`, enabling data binding in UI layers, and provide constructors to initialize from an `IDataReader` (for database hydration) or from another instance of the same interface type (for cloning). Each class serves as a strongly-typed, schema-bound representation of rows in corresponding database tables, used throughout the test execution and reporting pipeline to ensure consistent metadata access.
---
## 2. Public Interface
All three classes share a common structural pattern. Below, each class is documented individually.
### `TestEngineerDetailsDbRecord`
- **Namespace**: `DTS.Common.Classes.TestEngineerDetails`
- **Interface**: `ITestEngineerDetailsDbRecord`
- **Base Class**: `Base.BasePropertyChanged`
#### Constructors
- `TestEngineerDetailsDbRecord()`
Default constructor; initializes all fields to their default values (`-1` for IDs, `""` for strings, `false` for booleans, `DateTime.MinValue` for dates).
- `TestEngineerDetailsDbRecord(ITestEngineerDetailsDbRecord testEngineerDetailsDbRecord)`
Copy constructor; copies all property values from the provided interface instance.
- `TestEngineerDetailsDbRecord(IDataReader reader)`
Database constructor; reads values from an `IDataReader` using `Utility.GetString`, `Utility.GetInt`, `Utility.GetDateTime`, and `Utility.GetBool` helper methods.
#### Properties
| Property | Type | Attributes | Description |
|---------|------|------------|-------------|
| `TestEngineerId` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Primary key identifier for the test engineer. Default: `-1`. |
| `Name` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | Internal/system name (e.g., login or DB key). Default: `""`. |
| `TestEngineerName` | `string` | `[DisplayResource("TestEngineerName")]` | Display-friendly name (e.g., full name). Default: `"NOVALUE"`. |
| `TestEngineerPhone` | `string` | `[DisplayResource("TestEngineerPhone")]` | Contact phone number. Default: `"NOVALUE"`. |
| `TestEngineerFax` | `string` | `[DisplayResource("TestEngineerFax")]` | Contact fax number. Default: `"NOVALUE"`. |
| `TestEngineerEmail` | `string` | `[DisplayResource("TestEngineerEmail")]` | Contact email address. Default: `"NOVALUE"`. |
| `LocalOnly` | `bool` | `[Browsable(false)]`, `[ReadOnly(true)]` | Indicates if record is local-only (not synchronized). Default: `false`. |
| `LastModified` | `DateTime` | `[Browsable(false)]`, `[ReadOnly(true)]` | Timestamp of last modification. Default: `DateTime.MinValue`. |
| `LastModifiedBy` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | User who last modified the record. Default: `""`. |
| `Version` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Concurrency/version token. Default: `-1`. |
#### Methods
- `bool IsInvalidBlank()`
Returns `true` if `Name` is `null`, empty, or whitespace; otherwise `false`.
---
### `CustomerDetailsDbRecord`
- **Namespace**: `DTS.Common.Classes.CustomerDetails`
- **Interface**: `ICustomerDetailsDbRecord`
- **Base Class**: `Base.BasePropertyChanged`
#### Constructors
- `CustomerDetailsDbRecord()`
Default constructor.
- `CustomerDetailsDbRecord(ICustomerDetailsDbRecord customerDetailsDbRecord)`
Copy constructor.
- `CustomerDetailsDbRecord(IDataReader reader)`
Database constructor.
#### Properties
| Property | Type | Attributes | Description |
|---------|------|------------|-------------|
| `CustomerId` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Primary key identifier. Default: `-1`. |
| `Name` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | Internal/system name. Default: `""`. |
| `CustomerName` | `string` | `[DisplayResource("CustomerName")]` | Display name. Default: `""`. |
| `CustomerTestRefNumber` | `string` | `[DisplayResource("CustomerTestRefNumber")]` | Customer-provided test reference number. Default: `""`. |
| `ProjectRefNumber` | `string` | `[DisplayResource("ProjectRefNumber")]` | Project reference number. Default: `"NOVALUE"`. |
| `CustomerOrderNumber` | `string` | `[DisplayResource("CustomerOrderNumber")]` | Customer order number. Default: `"NOVALUE"`. |
| `CustomerCostUnit` | `string` | `[DisplayResource("CustomerCostUnit")]` | Cost center/unit. Default: `"NOVALUE"`. |
| `LocalOnly` | `bool` | `[Browsable(false)]`, `[ReadOnly(true)]` | Local-only flag. Default: `false`. |
| `LastModified` | `DateTime` | `[Browsable(false)]`, `[ReadOnly(true)]` | Last modification timestamp. Default: `DateTime.MinValue`. |
| `LastModifiedBy` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | Last modifier. Default: `""`. |
| `Version` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Version token. Default: `-1`. |
#### Methods
- `bool IsInvalidBlank()`
Returns `true` if `Name` is `null`, empty, or whitespace.
---
### `LabratoryDetailsDbRecord`
- **Namespace**: `DTS.Common.Classes.LabratoryDetails`
- **Interface**: `ILabratoryDetailsDbRecord`
- **Base Class**: `Base.BasePropertyChanged`
#### Constructors
- `LabratoryDetailsDbRecord()`
Default constructor.
- `LabratoryDetailsDbRecord(ILabratoryDetailsDbRecord labratoryDetailsDbRecord)`
Copy constructor.
- `LabratoryDetailsDbRecord(IDataReader reader)`
Database constructor.
#### Properties
| Property | Type | Attributes | Description |
|---------|------|------------|-------------|
| `LabratoryId` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Primary key identifier. Default: `-1`. |
| `Name` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | Internal/system name. Default: `""`. |
| `LabratoryName` | `string` | `[DisplayResource("LabratoryName")]` | Display name of lab. Default: `""`. |
| `LabratoryContactName` | `string` | `[DisplayResource("LabratoryContactName")]` | Primary contact name. Default: `""`. |
| `LabratoryContactPhone` | `string` | `[DisplayResource("LabratoryContactPhone")]` | Contact phone. Default: `"NOVALUE"`. |
| `LabratoryContactFax` | `string` | `[DisplayResource("LabratoryContactFax")]` | Contact fax. Default: `"NOVALUE"`. |
| `LabratoryContactEmail` | `string` | `[DisplayResource("LabratoryContactEmail")]` | Contact email. Default: `"NOVALUE"`. |
| `LabratoryTestRefNumber` | `string` | `[DisplayResource("LabratoryTestRefNumber")]` | Lab-provided test reference. Default: `""`. |
| `LabratoryProjectRefNumber` | `string` | `[DisplayResource("LabratoryProjectRefNumber")]` | Lab project reference. Default: `""`. |
| `LocalOnly` | `bool` | `[Browsable(false)]`, `[ReadOnly(true)]` | Local-only flag. Default: `false`. |
| `LastModified` | `DateTime` | `[Browsable(false)]`, `[ReadOnly(true)]` | Last modification timestamp. Default: `DateTime.MinValue`. |
| `LastModifiedBy` | `string` | `[Browsable(false)]`, `[ReadOnly(true)]` | Last modifier. Default: `""`. |
| `Version` | `int` | `[Browsable(false)]`, `[ReadOnly(true)]` | Version token. Default: `-1`. |
#### Methods
- `bool IsInvalidBlank()`
Returns `true` if `Name` is `null`, empty, or whitespace.
---
## 3. Invariants
- **`Name` is required**: All classes enforce that `Name` must be non-null and non-whitespace for a record to be considered valid. This is validated by the `IsInvalidBlank()` method.
- **Default sentinel values**: String properties not marked with `[DisplayResource]` default to `""` (e.g., `Name`, `LastModifiedBy`). String properties *with* `[DisplayResource]` default to `"NOVALUE"` (except `CustomerName` and `CustomerTestRefNumber`, which default to `""`).
- **Numeric defaults**: `*Id` and `Version` fields default to `-1`; `LastModified` defaults to `DateTime.MinValue`.
- **Read-only metadata fields**: Properties `*Id`, `Name`, `LocalOnly`, `LastModified`, `LastModifiedBy`, and `Version` are marked `[ReadOnly(true)]` and `[Browsable(false)]`, indicating they are not intended for user editing in UI contexts.
- **Property change notification**: All properties use `SetProperty`, implying `INotifyPropertyChanged` events will fire on changes (via base class `Base.BasePropertyChanged`).
---
## 4. Dependencies
### Internal Dependencies
- `DTS.Common.Base.Classes.BasePropertyChanged` — Base class providing `SetProperty` and `INotifyPropertyChanged` implementation.
- `DTS.Common.Interface.TestMetaData.*` — Interfaces `ITestEngineerDetailsDbRecord`, `ICustomerDetailsDbRecord`, `ILabratoryDetailsDbRecord`.
- `DTS.Common.Utilities.Logging` — Imported but *not used* in the provided code (likely legacy or for future use).
- `System.Data` — Required for `IDataReader` constructor.
- `System.ComponentModel` — Required for `[Browsable]`, `[ReadOnly]`, `[DisplayResource]` attributes.
### External Dependencies
- `Utility` class (static/internal) — Provides helper methods: `GetString`, `GetInt`, `GetDateTime`, `GetBool`. These are assumed to be safe null-handling wrappers around `IDataReader` accessors.
### Inferred Usage
- These classes are likely consumed by:
- Data access layers (DALs) that populate them from database queries.
- UI layers (e.g., WPF) via data binding (justified by `INotifyPropertyChanged` and `[DisplayResource]` attributes).
- Serialization layers (e.g., XML via `XmlSerializer`, inferred from `using System.Xml.Serialization`).
---
## 5. Gotchas
- **Typo in namespace/class name**: The namespace and class `LabratoryDetailsDbRecord` uses the misspelled "Labratory" (should be "Laboratory"). This is consistent across files and may be intentional legacy, but is a potential source of confusion.
- **Inconsistent default values for `[DisplayResource]` strings**:
- `CustomerName` and `CustomerTestRefNumber` default to `""`, while other `[DisplayResource]` fields default to `"NOVALUE"`. This inconsistency may indicate incomplete refactoring or differing business semantics.
- **`IsInvalidBlank()` only checks `Name`**: Validation is minimal and only considers the internal `Name` field. Other required fields (e.g., `TestEngineerName` for engineers) are not validated, potentially allowing partially populated records.
- **`[DisplayResource]` attribute behavior unknown**: The `[DisplayResource("...")]` attribute is used, but its implementation and how it interacts with localization/resource loading are not visible here. Its effect is assumed to be runtime (e.g., via a custom `TypeConverter` or binding converter), but this is not documented in the source.
- **No immutability enforcement**: Despite being used as DTOs, properties have public setters and are not immutable. The `Copy` constructor does not prevent mutation of the source object.
- **No null-safety guarantees in `Utility` methods**: The behavior of `Utility.GetString`, `Utility.GetBool`, etc., on `DBNull` or missing columns is not visible. Assumed safe (e.g., returning defaults), but not guaranteed by this code.
None identified beyond the above.

View File

@@ -0,0 +1,320 @@
---
source_files:
- Common/DTS.CommonCore/Classes/TestSetups/SimpleHardware.cs
- Common/DTS.CommonCore/Classes/TestSetups/TestSetupHelper.cs
- Common/DTS.CommonCore/Classes/TestSetups/ROIPeriodChannelRecord.cs
- Common/DTS.CommonCore/Classes/TestSetups/ExtraProperties.cs
- Common/DTS.CommonCore/Classes/TestSetups/TestSetupHardwareRecord.cs
- Common/DTS.CommonCore/Classes/TestSetups/TestSetupROIsRecord.cs
- Common/DTS.CommonCore/Classes/TestSetups/CalculatedChannelRecord.cs
- Common/DTS.CommonCore/Classes/TestSetups/ISFFile.cs
- Common/DTS.CommonCore/Classes/TestSetups/GraphRecord.cs
- Common/DTS.CommonCore/Classes/TestSetups/RegionOfInterest.cs
- Common/DTS.CommonCore/Classes/TestSetups/ISFSensorRecord.cs
generated_at: "2026-04-16T02:42:02.216397+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b14dada51ccb8b95"
---
# TestSetups Module Documentation
## 1. Purpose
This module provides core data structures and helper utilities for representing and managing test setup configurations within the DTS system. It defines record classes that model database entities (e.g., hardware assignments, ROIs, calculated channels, graphs) and supporting types for handling ISF sensor file I/O and test setup naming. The module serves as the data layer abstraction for test setup management, enabling persistence, serialization, and UI binding for test configuration data.
## 2. Public Interface
### `SimpleHardware`
- **`SimpleHardware(string serialNumber, string parentDAS, int dasId, int dasType)`**
Constructor initializing a tuple-based record for hardware metadata.
- **`SerialNumber` (string)**
Gets the hardware serial number (from `Item1`).
- **`ParentDAS` (string)**
Gets the parent DAS identifier (from `Item2`).
- **`DASId` (int)**
Gets the DAS identifier (from `Item3`).
- **`DASType` (int)**
Gets the DAS type identifier (from `Item4`).
### `TestSetupHelper`
- **`ClearTestSetupNames()`**
Clears the internal dictionary mapping IDs to test setup names.
- **`SetTestSetupName(int id, string name)`**
Sets or updates the name for a given test setup ID.
- **`GetTestSetupName(int Id)` → string**
Returns the name associated with the given ID, or `string.Empty` if not found.
### `ROIPeriodChannelRecord`
- **`TestSetupROIId` (int)**
Gets/sets the foreign key to `TestSetupROIs.TestSetupROIId`.
- **`ChannelName` (string)**
Gets/sets the channel name assigned to this ROI period.
- **`ROIPeriodChannelRecord(IDataReader reader)`**
Constructor populating fields from a database reader using `Utility.GetInt`/`Utility.GetString`.
### `ExtraProperty`
- **`Key` (string)**
Gets/sets the property key; raises `PropertyChanged` on change.
- **`Value` (string)**
Gets/sets the property value; raises `PropertyChanged` on change.
- **`PasteCommand` (ICommand)**
Gets/sets the paste command; raises `PropertyChanged` on change.
- **`ItemStatus` (UIItemStatus)**
Gets/sets the UI item status; raises `PropertyChanged` on change.
- **`ExtraProperty(IExtraProperty iep)` / `ExtraProperty(string key, string value)` / `ExtraProperty()`**
Constructors for copying, initializing with key/value, or default initialization.
### `TestSetupHardwareRecord`
- **`DASId` (int)**
Gets/sets the DAS identifier.
- **`TestSetupId` (int)**
Gets/sets the test setup identifier.
- **`AddDAS` (bool)**
Gets/sets whether to add (true) or remove (false) the DAS.
- **`SamplesPerSecond` (int)**
Gets/sets the sampling rate.
- **`IsClockMaster` (bool)**
Gets/sets whether this DAS is the clock master.
- **`PTPDomainId` (byte)**
Gets/sets the PTP domain ID.
- **`AntiAliasFilterRate` (int)**
Gets/sets the anti-alias filter rate.
- **`TestSetupHardwareRecord()`**
Default constructor.
- **`TestSetupHardwareRecord(IDataReader reader)`**
Constructor populating fields from a database reader.
- **`TestSetupHardwareRecord(ITestSetupHardwareRecord copy)`**
Copy constructor.
### `TestSetupROIsRecord`
- **`TestSetupROIId` (int)**
Gets/sets the primary key.
- **`TestSetupId` (int)**
Gets/sets the foreign key to `TestSetups`.
- **`Suffix` (string)**
Gets/sets the ROI period suffix (e.g., `"_ROI Period 1"`).
- **`ROIStart` (double)**
Gets/sets the start time of the ROI period.
- **`ROIEnd` (double)**
Gets/sets the end time of the ROI period.
- **`IsEnabled` (bool)**
Gets/sets whether the ROI period is enabled.
- **`IsDefault` (bool)**
Gets/sets whether this is the default ROI period.
- **`TestSetupROIsRecord(IDataReader reader)`**
Constructor populating fields from a database reader.
### `CalculatedChannelRecord`
- **`Name` (string)**
Gets/sets the calculated channel name.
- **`TestSetupName` (string)**
Gets/sets the associated test setup name.
- **`Id` (int)**
Gets/sets the database record ID.
- **`Operation` (Operations)**
Gets/sets the operation to apply (e.g., `SUM`).
- **`CalculatedValueCode` (string)**
Gets/sets the ISO/user code associated with the calculated value.
- **`InputChannelIds` (string[])**
Gets/sets the array of input channel IDs (CSV-separated in DB).
- **`CFCForInputChannels` (string)**
Gets/sets the CFC to apply to input channels.
- **`ChannelFilterClassForOutput` (string)**
Gets/sets the CFC to apply to the output.
- **`TestSetupId` (int)**
Gets/sets the test setup database ID.
- **`ViewInRealtime` (bool)**
Gets/sets whether the channel is viewable in real-time.
- **`ClipLength` (int)**
Gets/sets the clip length for calculations (e.g., max over clip).
- **`CalculatedChannelRecord()` / `CalculatedChannelRecord(ICalculatedChannelRecord record)` / `CalculatedChannelRecord(IDataReader reader)`**
Constructors for default, copy, and database population.
### `ISFFile`
- **`HeaderLine1` (char[])**
Gets/sets the first header line (80 chars); padding with spaces.
- **`TestSetupName` (char[8])**
Gets/sets the test setup name at offset 7.
- **`NumberOfRecords` (char[5])**
Gets/sets the number of records at offset 15.
- **`TestType` (char[22])**
Gets/sets the test type at offset 20.
- **`TestDivision` (char[30])**
Gets/sets the test division at offset 42.
- **`TCFile` (char[8])**
Gets/sets the TC file name (without extension) at offset 72.
- **`Records` (IISFSensorRecord[])**
Gets the array of sensor records.
- **`AddRecord(IISFSensorRecord record)`**
Adds a record, sets its data channel number, and updates `NumberOfRecords`.
- **`WriteToFile(string pathToFile)`**
Writes the ISF file to disk (HeaderLine13 + all records).
- **`AddSensors(ISensorData[] sensors)`**
Converts `ISensorData` to `ISFSensorRecord`s and adds them.
- **`ISFFile()`**
Constructor initializing header with spaces.
### `GraphRecord`
- **`GraphId` (int)**
Gets/sets the graph database ID.
- **`TestSetupId` (int)**
Gets/sets the test setup database ID.
- **`GraphName` (string)**
Gets/sets the graph name (max 50 chars).
- **`GraphDescription` (string)**
Gets/sets the graph description (max 50 chars).
- **`ChannelsString` (string)**
Gets/sets the channel list (max 2048 chars).
- **`UseDomainMin` / `DomainMin` (bool/double)**
Gets/sets domain axis min constraints.
- **`UseDomainMax` / `DomainMax` (bool/double)**
Gets/sets domain axis max constraints.
- **`UseRangeMin` / `RangeMin` (bool/double)**
Gets/sets range axis min constraints.
- **`UseRangeMax` / `RangeMax` (bool/double)**
Gets/sets range axis max constraints.
- **`ThresholdsString` (string)**
Gets/sets threshold/line definitions (max 2048 chars).
- **`LocalOnly` (bool)**
Gets/sets whether to sync with central DB (deprecated).
- **`GraphRecord()` / `GraphRecord(IGraphRecord copy)` / `GraphRecord(IDataReader reader)`**
Constructors.
### `RegionOfInterest`
- **`Deserializing` (static bool)**
Flag to suppress notifications during deserialization.
- **`Suffix` (string)**
Gets/sets the ROI suffix (ensures leading underscore).
- **`Start` (double)**
Gets/sets ROI start time; clamps if ≥ `End`.
- **`End` (double)**
Gets/sets ROI end time; clamps if ≤ `Start`.
- **`IsEnabled` (bool)**
Gets/sets whether ROI is active.
- **`IsDefault` (bool)**
Gets/sets whether this is the default ROI.
- **`ChannelNames` (string[])**
Gets/sets channel names; raises `RegionOfInterestChangedEvent` on change (unless `Deserializing`).
- **`RegionOfInterest(string suffix, bool isDefault, double start, double end)`**
Constructor with parameters.
- **`ResetSuffix()`**
Clears the suffix.
- **`SetChannelNamesNoNotify(string[] names)`**
Sets channel names without raising notifications.
- **`GetAnalogChanName(...)` / `GetChanName(...)` / `RemoveParentDASName(...)` / `RemoveAssignedByIDFromHardwareString(...)`**
Static utility methods for channel name formatting and parsing.
### `ISFSensorRecord`
- **`Record1``Record4` (char[80] each)**
Raw ISF record buffers.
- **`Tag` (char[2])**
Sensor tag at offset 75 of Record1.
- **`DataChannelNumber` (char[5])**
Data channel number at offset 7 of Record1.
- **`UserIdSensorIDIsNotSpecified` (bool)**
Gets/sets bit at offset 15 of Record1.
- **`CapacityCharacters` / `SetCapacity(...)` / `GetCapacity()`**
Capacity field (offset 19) with conversion helpers.
- **`SerialNumber` (char[12])**
Serial number at offset 30 of Record1.
- **`Sensitivity` / `SetSensitivity(...)` / `GetSensitivity()`**
Sensitivity field (offset 42) with conversion helpers.
- **`BridgeResistance` / `SetBridgeResistance(...)`**
Bridge resistance field (offset 53).
- **`EngineeringUnits` (char[12])**
Engineering units at offset 7 of Record2.
- **`C1` / `SetC1(...)` / `GetC1()`**
Calibration coefficient C1 (offset 20 of Record2).
- **`EID` (char[17])**
EID at offset 31 of Record2.
- **`TOMConfigurationName` (char[8])**
TOM config name (default `"STANDARD"`).
- **`FireDelay` / `SetFireDelay(...)`**
Fire delay (offset 55 of Record2, TOM-only).
- **`CommentPart1``CommentPart3` / `SetSensorComment(...)`**
Comment fields across Records 3 & 4.
- **`SensorType` (char[20])**
Sensor type (offset 30 of Record4).
- **`C2` / `SetC2(...)` / `C3` / `SetC3(...)`**
Calibration coefficients C2/C3 (offsets 50/61 of Record4).
- **`Write(BinaryWriter writer)`**
Writes all four records to stream.
- **`ISFSensorRecord()`**
Constructor initializing all records with spaces.
- **`SetSensor(ISensorData sensor)`**
Populates record fields from `ISensorData`.
### Extension Methods (`ArrayExtensions`)
- **`Fill<T>(this T[] source, T with)`**
Fills entire array with value.
- **`SubFill<T>(this T[] source, T with, int startIndex, int finalIndex)`**
Fills from `startIndex` to `finalIndex` (exclusive).
- **`SetValues<T>(this T[] source, T[] with, int startIndex, int length, T pad)`**
Copies `with` into `source` starting at `startIndex`, padding remainder with `pad`.
- **`GetValues<T>(this T[] source, int startIndex, int length)` → T[]**
Returns a copy of `length` elements starting at `startIndex`.
## 3. Invariants
- **`SimpleHardware`**: Inherits from `Tuple<string, string, int, int>`; fields are immutable after construction.
- **`TestSetupROIsRecord.TestSetupId`**: In the constructor, the database column `"TestSetupROIId"` is used for *both* `TestSetupROIId` and `TestSetupId`. This is likely a bug (see *Gotchas*).
- **`RegionOfInterest.Start` and `End`**: `Start` is clamped to be `< End`, and `End` is clamped to be `> Start` (with a 0.01 minimum gap).
- **`RegionOfInterest.Suffix`**: Automatically prepends `"_"` if missing and not whitespace-only; ensures format `"_<name>"`.
- **`ISFFile.NumberOfRecords`**: Updated to `Records.Length * 4` on each `AddRecord` call (4 physical records per logical record).
- **`ISFSensorRecord.TOMConfigurationName`**: Defaults to `"STANDARD"` in constructor.
- **`CalculatedChannelRecord.InputChannelIds`**: Stored as `string[]`; in DB, stored as CSV using `CultureInfo.InvariantCulture.ListSeparator`.
- **`GraphRecord.ChannelsString` / `ThresholdsString`**: Max length enforced via `[MaxLength]` attribute (50 for name/description, 2048 for strings).
- **`ExtraProperty`**: Implements `INotifyPropertyChanged`; all property setters raise `PropertyChanged`.
## 4. Dependencies
### Internal Dependencies
- **`DTS.Common.Base`**: Base classes (`BasePropertyChanged`) used by `ROIPeriodChannelRecord`, `TestSetupROIsRecord`, `CalculatedChannelRecord`, `GraphRecord`.
- **`DTS.Common.Interface.*`**: Interfaces implemented by record classes (e.g., `ITestSetupHardwareRecord`, `IROIPeriodChannelRecord`, `ICalculatedChannelRecord`, `IGraphRecord`, `IISFSensorRecord`, `IExtraProperty`, `IRegionOfInterest`).
- **`DTS.Common.Enums`**: `Operations` enum used by `CalculatedChannelRecord`.
- **`DTS.Common.Enums.Sensors`**: `SensorConstants` used by `RegionOfInterest`.
- **`DTS.Common.Events.RegionOfInterest`**: `IEventAggregator`, `RegionOfInterestChangedEvent` used for ROI change notifications.
- **`Microsoft.Practices.Prism.Events`**: Prism event aggregator for ROI notifications.
- **`Microsoft.Practices.ServiceLocation`**: `ServiceLocator` used in `RegionOfInterest.NotifyChanged`.
- **`System.Data`**: `IDataReader` used in record constructors.
- **`System.ComponentModel.DataAnnotations`**: `[MaxLength]` attributes on `GraphRecord`.
- **`DTS.Common.Base`**: `Utility` class for safe DB value extraction (`GetInt`, `GetString`, `GetDouble`, `GetBool`, `GetStringArray`).
### External Dependencies
- **`System`**: Core types (`string`, `Action`, `EventHandler`, etc.).
- **`System.IO`**: `FileStream`, `BinaryWriter`, `FileMode`, `File.Exists` used in `ISFFile.WriteToFile`.
- **`System.Linq`**: Used in `CalculatedChannelRecord` copy constructor (`Any()`).
## 5. Gotchas
- **`TestSetupROIsRecord` constructor bug**:
`TestSetupId = Utility.GetInt(reader, "TestSetupROIId");`
Should likely be `"TestSetupId"` instead of `"TestSetupROIId"` (same as `TestSetupROIId`). This will cause incorrect `TestSetupId` values.
- **`ISFFile.NumberOfRecords` semantics**:
`NumberOfRecords` is set to `Records.Length * 4`, implying it counts *physical* records (4 per logical sensor), not logical sensors. This may be non-intuitive.
- **`RegionOfInterest.Deserializing` static flag**:
A global flag to suppress notifications during deserialization. This is fragile in multi-threaded or concurrent deserialization scenarios and may cause missed notifications.
- **`RegionOfInterest.GetAnalogChanName` logic**:
The condition `!hardwareChannelName.StartsWith($"[{startOfHardware}")` is unusual and may be error-prone if `startOfHardware` changes or is not consistently formatted.
- **`ISFSensorRecord.GetCapacity()` / `GetSensitivity()` etc.**:
Use `CapacityCharacters.ToString()` (which yields a `string` representation of the `char[]` array, *not* the string content). This is likely a bug; should use `new string(CapacityCharacters).Trim()`.
- **`ISFFile.HeaderLine1` setter**:
Uses `Array.Copy(value, _HeaderLine1, Math.Min(...))` which may truncate or misalign if `value.Length` ≠ 80. Padding is only applied *before* copy via `Fill(' ')`, but copy may overwrite padding.
- **`CalculatedChannelRecord.InputChannelIds` copy constructor**:
Uses `new string[record.InputChannelIds.Length]; record.InputChannelIds.CopyTo(_inputChannelIds, 0);` — but `_inputChannelIds` is initialized to `new[] { "-1" }`. This is safe, but the initial value is overwritten.
- **`ExtraProperty` paste command**:
`_pasteCommand` is never initialized; consumers must set it explicitly.
- **`GraphRecord.LocalOnly`**:
Marked as `[deprecated]` but still present in data model and copy constructor.
- **`RegionOfInterest` channel name formatting**:
Methods like `GetChanName` and `RemoveParentDASName` assume specific formats (e.g

View File

@@ -0,0 +1,193 @@
---
source_files:
- Common/DTS.CommonCore/Classes/WinApi/WindowsAPIHelpers.cs
generated_at: "2026-04-16T02:41:05.548844+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "74033c59308d77b1"
---
# WinApi
## Documentation: `WindowsAPIHelpers.cs`
---
### 1. **Purpose**
This module provides low-level Windows API interop helpers for managing window placement and sizing behavior, specifically to ensure that maximized windows align with the *work area* (i.e., excluding taskbar, docked toolbars) of the appropriate monitor in multi-monitor setups. It defines P/Invoke signatures and supporting structures (`POINT`, `RECT`, `MINMAXINFO`, `MONITORINFO`, `WINDOWPOS`) and exposes a helper method `GetMinMaxInfo` that adjusts the `ptMaxSize` and `ptMaxPosition` fields of a `MINMAXINFO` structure during a `WM_GETMINMAXINFO` message. This ensures windows maximize correctly to the visible screen area of the monitor containing the window, rather than the primary monitors full screen bounds.
---
### 2. **Public Interface**
#### Structs & Classes
- **`POINT`**
```csharp
[StructLayout(LayoutKind.Sequential)]
public struct POINT { public int x; public int y; public POINT(int x, int y); }
```
Represents a point in screen coordinates. Used as a field in `MINMAXINFO` and elsewhere.
- **`MINMAXINFO`**
```csharp
[StructLayout(LayoutKind.Sequential)]
public struct MINMAXINFO
{
public POINT ptReserved;
public POINT ptMaxSize;
public POINT ptMaxPosition;
public POINT ptMinTrackSize;
public POINT ptMaxTrackSize;
}
```
Used in `WM_GETMINMAXINFO` to specify minimum/maximum tracking sizes and maximized window geometry. The `ptMaxSize` and `ptMaxPosition` fields are modified by `GetMinMaxInfo`.
- **`MONITORINFO`**
```csharp
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class MONITORINFO
{
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
public RECT rcMonitor = new RECT();
public RECT rcWork = new RECT();
public int dwFlags = 0;
}
```
Container for monitor-specific information. `cbSize` is auto-initialized to the correct size. `rcMonitor` holds the full monitor bounds; `rcWork` holds the work area (usable screen space).
- **`RECT`**
```csharp
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct RECT
{
public int left, top, right, bottom;
public static readonly RECT Empty;
public int Width => Math.Abs(right - left);
public int Height => bottom - top;
public bool IsEmpty => left >= right || top >= bottom;
// ... constructors, equality, operators ...
}
```
Represents a rectangle in screen coordinates. Includes computed properties (`Width`, `Height`, `IsEmpty`) and value-based equality (`==`, `!=`, `Equals`, `GetHashCode`). Note: `Height` is computed as `bottom - top` (not `Math.Abs`), so negative heights are possible if `bottom < top`.
- **`WINDOWPOS`**
```csharp
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPOS
{
public IntPtr hwnd;
public IntPtr hwndInsertAfter;
public int x, y, cx, cy;
public int flags;
}
```
Mirrors the Win32 `WINDOWPOS` structure used in `WM_WINDOWPOSCHANGING`/`WM_WINDOWPOSCHANGED`.
#### Enums
- **`WM`**
```csharp
public enum WM
{
WINDOWMAX = 0x0024,
WINDOWPOSCHANGING = 0x0046
}
```
Subset of Windows message constants. *Note:* `WINDOWMAX` is likely a typo/misnomer for `WM_WINDOWMAXIMIZED` (which does not exist); standard `WM_SYSCOMMAND` with `SC_MAXIMIZE` is more common. `WINDOWPOSCHANGING` is correctly `WM_WINDOWPOSCHANGING`.
- **`SWP`**
```csharp
public enum SWP
{
NOMOVE = 0x0002
}
```
Subset of `SetWindowPos` flags. `NOMOVE` preserves current position when resizing.
#### Methods
- **`GetMinMaxInfo(IntPtr hwnd, IntPtr lParam)`**
```csharp
public static void GetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
```
Reads a `MINMAXINFO` structure from `lParam`, queries the monitor containing `hwnd`, retrieves its work area (`rcWork`) and full monitor area (`rcMonitor`), then updates `mmi.ptMaxPosition` and `mmi.ptMaxSize` to align the maximized window with the work area of the *current* monitor. Writes the modified structure back to `lParam`. This is intended to be called in response to `WM_GETMINMAXINFO` (0x0024).
- **`GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi)`**
```csharp
[DllImport("user32")]
public static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
```
P/Invoke wrapper for `GetMonitorInfoW`. Fills `lpmi` with monitor data. Caller must set `lpmi.cbSize` (handled by `MONITORINFO`s field initializer).
- **`MonitorFromWindow(IntPtr handle, int flags)`**
```csharp
[DllImport("User32")]
public static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
```
P/Invoke wrapper for `MonitorFromWindow`. Returns `IntPtr.Zero` on failure. Used with `MONITOR_DEFAULTTONEAREST` (`0x00000002`).
---
### 3. **Invariants**
- **`MONITORINFO.cbSize` must be set correctly before calling `GetMonitorInfo`**:
The `MONITORINFO` class initializes `cbSize` to `Marshal.SizeOf(typeof(MONITORINFO))` in its field initializer, ensuring correctness for P/Invoke.
- **`RECT` dimensions assume left ≤ right and top ≤ bottom**:
`Width` uses `Math.Abs(right - left)`, but `Height` does *not* (`bottom - top`). If `bottom < top`, `Height` will be negative. No validation enforces non-negative dimensions.
- **`GetMinMaxInfo` modifies `ptMaxSize` and `ptMaxPosition` only**:
Other `MINMAXINFO` fields (`ptReserved`, `ptMinTrackSize`, `ptMaxTrackSize`) are preserved as-is.
- **Monitor query uses `MONITOR_DEFAULTTONEAREST`**:
If `hwnd` is invalid or no monitor contains it, `MonitorFromWindow` returns `IntPtr.Zero`, and `GetMinMaxInfo` skips modification (no crash, but no adjustment either).
---
### 4. **Dependencies**
- **Runtime Dependencies**:
- `System.Runtime.InteropServices` (for `StructLayout`, `Marshal`, `DllImport`)
- `System.Windows` (though no WPF types are used in this file—likely a legacy/unused reference)
- Win32 `user32.dll` (for `GetMonitorInfo`, `MonitorFromWindow`)
- **Consumers (inferred)**:
This module is designed to be used by code handling `WM_GETMINMAXINFO` (e.g., in a WPF/WinForms window procedure). The method `GetMinMaxInfo` is called with the window handle and `lParam` from the message. No other direct dependencies are visible in the source.
- **Missing Dependencies**:
- `RECT` is used but not defined in this file—*this is a contradiction*. The source defines `RECT` here, but the `RECT` used in `MONITORINFO` is initialized as `new RECT()`. This implies `RECT` must be defined *here* (and it is), so no external dependency is needed.
- No `using` for `System.Drawing` or other types—`RECT` is self-contained.
---
### 5. **Gotchas**
- **`RECT.Height` is not absolute**:
`Height => bottom - top` (not `Math.Abs`). If `bottom < top`, `Height` is negative. This may cause unexpected behavior if consumers assume non-negative height.
- **`MONITORINFO` is a `class`, not a `struct`**:
This is unusual for P/Invoke marshaling (where `struct` is typical). While it works due to `cbSize` initialization and `Marshal.PtrToStructure`/`StructureToPtr`, using a `class` here risks reference-type semantics (e.g., accidental sharing). A `struct` would be safer and more conventional.
- **`GetMinMaxInfo` silently fails if monitor query fails**:
If `MonitorFromWindow` returns `IntPtr.Zero` (e.g., invalid `hwnd`), no adjustment occurs. No error is logged or thrown—consumers must verify behavior.
- **`WM.WINDOWMAX` is likely incorrect**:
`0x0024` is `WM_SYSCOMMAND`, not a maximization message. `WM_GETMINMAXINFO` is `0x0024`—*this is the same value*. The enum name `WINDOWMAX` is misleading; it should be `GETMINMAXINFO`. This is a naming bug.
- **`RECT.IsEmpty` uses `>=` (not `>`)**:
`IsEmpty => left >= right || top >= bottom` correctly handles degenerate rectangles (e.g., `left == right`), but consumers may overlook that empty rectangles have zero area.
- **No thread-safety guarantees**:
`GetMinMaxInfo` mutates a `MINMAXINFO` via `Marshal.PtrToStructure`/`StructureToPtr`. While the operation is read-modify-write on a *copy* (safe), the use of `MONITORINFO` as a `class` (reference type) could introduce issues if reused across threads without copying.
- **`MONITORINFO.rcMonitor` and `rcWork` are initialized to `new RECT()`**:
`RECT()` sets all fields to `0`, so `rcMonitor` and `rcWork` start as `(0,0,0,0)`. This is safe for P/Invoke since `GetMonitorInfo` overwrites them.
- **No handling of DPI scaling**:
All coordinates are in *physical* pixels (Win32 convention). If the application is DPI-aware, callers must ensure `hwnd` corresponds to the correct DPI context. No DPI scaling is applied in `GetMinMaxInfo`.
---
*No other issues are apparent from the source alone.*

View File

@@ -0,0 +1,43 @@
---
source_files:
- Common/DTS.CommonCore/Classes/WindowsFolder/WindowsFolder.cs
generated_at: "2026-04-16T02:41:11.633722+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "643a986ef3dcd404"
---
# WindowsFolder
## 1. Purpose
This module provides a utility method to open the folder containing application manuals using the systems default file explorer. It exists to abstract the platform-specific logic of launching `explorer.exe` with a path derived from a base directory and a constant folder name (`Constants.ManualsFolder`). The class assumes the `path` argument passed to `OpenManualsFolder` is a valid base directory (e.g., application installation root), and that the `Manuals` folder resides directly under it—this is guaranteed by the applications deployment structure, as noted in the documentation.
## 2. Public Interface
- **`OpenManualsFolder(string path)`**
*Signature:* `public static void OpenManualsFolder(string path)`
*Behavior:* Combines the input `path` with the constant `Constants.ManualsFolder` to form a full folder path, then launches Windows Explorer (`explorer.exe`) to open that folder. Throws if `path` is `null`, empty, or invalid, or if `Process.Start` fails (e.g., `explorer.exe` not found or path inaccessible). Does not return a value.
## 3. Invariants
- `path` must be a valid directory path (though not validated explicitly in this method—reliance is on caller correctness and OS-level validation during `Process.Start`).
- The `Manuals` folder must exist at `Path.Combine(path, Constants.ManualsFolder)` for the folder to open meaningfully; if missing, Explorer will open to the path but show an empty or error state.
- The method assumes `Constants.ManualsFolder` and `Constants.WindowsExplorer` are non-null, non-empty strings defined elsewhere (in `Constants.cs` or similar).
- The method is synchronous and blocks only during process launch (not while Explorer is open).
## 4. Dependencies
- **Internal dependencies:**
- `System.IO.Path` (for `Path.Combine`)
- `System.Diagnostics.Process` (for launching Explorer)
- `Constants.ManualsFolder` (string constant, e.g., `"Manuals"`)
- `Constants.WindowsExplorer` (string constant, expected to be `"explorer.exe"`)
- **External dependencies:**
- Windows OS (due to use of `explorer.exe`)
- The calling application must ensure `path` is set to a directory where `Manuals` is a subfolder (e.g., application root).
- **Depended on by:** Unknown from this file alone—no references to callers are present.
## 5. Gotchas
- **Path validation is absent**: The method does not validate that `path` exists or that `manualsPath` points to an existing directory. Failure occurs only at `Process.Start`, potentially with a generic OS error.
- **Hardcoded assumption about `CurrentDirectory`**: The XML comment states the method assumes the `Manuals` folder is in `CurrentDirectory`, but the implementation uses the passed `path`, not `Environment.CurrentDirectory`. This is inconsistent and may cause confusion—likely a documentation artifact or legacy assumption.
- **No error handling**: Exceptions from `Process.Start` (e.g., `Win32Exception`, `InvalidOperationException`) are not caught or logged, potentially crashing the caller if unhandled.
- **Platform lock-in**: This method only works on Windows; will fail on Linux/macOS if ever ported.
- **No cancellation or async support**: Not suitable for UI contexts where blocking the calling thread is undesirable.
- **`Constants` type location unspecified**: The source does not show where `Constants.ManualsFolder` or `Constants.WindowsExplorer` are defined—caller must locate and verify their values.

View File

@@ -0,0 +1,132 @@
---
source_files:
- Common/DTS.CommonCore/Constant/XamlConstants.xaml.cs
- Common/DTS.CommonCore/Constant/DigitalInputs.cs
- Common/DTS.CommonCore/Constant/EmbeddedSensors.cs
- Common/DTS.CommonCore/Constant/Constants.cs
generated_at: "2026-04-16T02:15:13.844234+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "02cf11f3a90b1f89"
---
# Documentation: `DTS.Common.Constant` Namespace
## 1. Purpose
This module centralizes application-wide constants used across the DTS (Data Acquisition and Test System) platform. It consolidates magic numbers, thresholds, limits, and configuration flags—primarily for embedded sensor specifications, digital input behavior, XAML UI concerns, and general system behavior—into strongly-typed, versioned, and documented constants. This avoids duplication, improves maintainability, and ensures consistency between UI, firmware, and data processing layers. The constants are not dynamically loaded from storage; instead, they serve as static defaults or hard limits, with runtime values expected to be set separately via configuration or user input.
## 2. Public Interface
### `DTS.Common.Constant.XamlConstants`
- **Type**: `public partial class`
- **Details**: Empty class with no members exposed in the provided source. Likely a placeholder for XAML-specific constants (e.g., resource keys, UI layout values) that may be defined elsewhere (e.g., in partial class extensions or in XAML files). No behavior can be inferred from the current source.
### `DTS.Common.Constant.DigitalInputs`
- **Type**: `public static class`
- **Fields**:
- `public const double ConstantCurrentBreakPointDefault = 19005D;`
Default threshold (ADC count) for detecting a *Contact Closure* digital input transition (bit flips at ~19005).
- `public const double VoltageInputBreakPointDefault = 19661D;`
Default threshold (ADC count) for *Voltage Input* digital mode (1.5V with signal grounded).
- `public const bool DisplaySPDADCDefault = false;`
Default setting for whether to display SLICE Pro Digital ADC in UI.
- **Properties** (read-write, static, initialized from defaults):
- `public static double ConstantCurrentBreakPoint { get; set; }`
Current active threshold for contact-closure detection. *Not* queried from persistent storage; must be set externally.
- `public static double VoltageInputBreakPoint { get; set; }`
Current active threshold for voltage-input detection. *Not* queried from persistent storage; must be set externally.
- `public static bool DisplaySPDADC { get; set; }`
Current setting for SLICE Pro Digital ADC visibility. *Not* queried from persistent storage; must be set externally.
### `DTS.Common.Constant.EmbeddedSensors`
- **Type**: `public static class`
- **Fields**: All `public const double` or `public const int` values defining hardware limits and defaults for embedded sensors:
- **Inactivity/Timeout Limits**:
- `MotionDetectInactivitySMaximum = 300` (5 minutes)
- `MagnetTimeoutMsMaximum = 300000` (5 minutes)
- **Sensor Ranges** (e.g., accelerometer, gyroscope, humidity, pressure, temperature):
- `EmbeddedLowGLinearAccelerometerRange = 8`
- `EmbeddedHighGLinearAccelerometerRange = 400`
- `EmbeddedAngularAccelerometerRange = 2000`
- `EmbeddedAngularRateSensorRange = 2000`
- `HumidityMinimum = 10`, `HumidityMaximum = 100`
- `PressureMinimum = 5`, `PressureMaximum = 15`
- `TemperatureMinimum = 0`, `TemperatureMaximum = 65`
- **Timed Event Limits**:
- `TimedIntervalEventDurationMsMinimum = 30`, `Maximum = 300000`
- `TimedIntervalNumberOfEventsMaximum = 100`
- `IntervalBetweenEventStartsMinutesMaximum = 1440` (24 hours)
- **Sample Rate Limits** (per sensor type, min/max in Hz):
- e.g., `EmbeddedLowGLinearAccelerometerSampleRateMinimum = 1`, `Maximum = 6400`
- **Default Sample Rates** (all `int`):
- `DefaultEmbeddedLowGLinearAccelerometerSampleRate = 6400`
- `DefaultEmbeddedHighGLinearAccelerometerSampleRate = 5120`
- `DefaultEmbeddedAngularAccelerometerSampleRate = 1600`
- `DefaultEmbeddedAngularAccelerometerAndRateSensorSampleRate = 5120`
- `DefaultEmbeddedAtmosphericSensorSampleRate = 157`
### `DTS.Common.Constants`
- **Type**: `public static class`
- **Fields & Properties** (selected highlights):
- **Tags & Strings**:
- `ROI_TAG = "ROI"`, `ALL_TAG = "ALL"`, `USB = "USB"`, `DAS_CONFIGS = "DASConfigs"`, `REPORT_DIR_NAME = "Reports"`, etc.
- **Graph Auto-Zoom**:
- `GRAPH_MIN_AUTOZOOM = 0.01D` (1% full scale)
- `GRAPH_MAX_AUTOZOOM = 1.2D` (120% full scale)
- **Realtime Polling**:
- `CheckStatusLinesInRealtime = true` (static property, mutable)
- `UpdateIntervalRealtimeCharts = 100` (ms)
- **File/Storage**:
- `BACKUP_HEADER_EXTENSION = ".header.bak"`, `BACKUP_FILE_EXTENSION = ".bak"`, `TEMP_FILE_EXTENSION = ".tmp"`, `MAX_USER_CHANNEL_NAME_LENGTH = 100`
- **Data Formats & Protocols**:
- `XML_STORE_MAGIC_BYTES = {0xAA, 0x55, 0xA5, 0x5A}`
- `BITS_PER_MINOR_FRAME_S6A = 128`, `BITS_PER_MINOR_FRAME_TSRAIR = 320`
- `UDP_STREAMPROFILES_MAX = 15`, `UART_MODE_MAX_SAMPLERATE = 30000`
- `SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE = 10000`
- `SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE_20k = 20000`
- **Clock Sync Profiles** (read-only arrays of `ClockSyncProfile` enum):
- `MasterProfiles`, `SlaveProfiles`, `OnePPSOutProfiles` (see source for exact contents)
- **Recording Modes** (read-only array of `RecordingModes` enum):
- `NonStreamingRecordingModes` (e.g., `CircularBuffer`, `Recorder`, `Scheduled`, etc.)
- **NMEA Parsing**:
- `NMEA_GPRMC_HEADER = "$GPRMC"`, `NMEA_GPGGA_HEADER = "$GPGGA"`
+ Positional constants for fields (e.g., `NMEA_GPRMC_LAT_POSN = 3`)
- **Database Versioning**:
- `ROITables_DB_VERSION = 92`, `UNIX_EPOCH_TIME = 93`, `MULTIPLE_EVENT_UART_DB_VERSION = 96`, etc.
- **Miscellaneous**:
- `ADC_MIDPOINT = 32767` (16-bit midpoint)
- `PING_ICMP_TIMEOUT = 500` (ms, mutable static property)
- `EXECUTABLE_TIMEOUT = 30000` (ms)
- `MAX_VIEWER_POINTS = 45000000`
## 3. Invariants
- **Static Defaults Only**: All `static` properties (e.g., `DigitalInputs.ConstantCurrentBreakPoint`, `Constants.CheckStatusLinesInRealtime`) are initialized from `const` defaults but are *not* persisted or auto-loaded. Their values must be explicitly set by the application (e.g., via config file or UI) before use.
- **Hard Limits**: All `const` values in `EmbeddedSensors` represent *absolute hardware limits* (e.g., sensor ranges, max sample rates). Exceeding them may cause undefined behavior or device errors.
- **No Runtime Validation**: Constants are not validated at runtime; it is the callers responsibility to ensure values (e.g., sample rates, durations) fall within documented min/max bounds.
- **No Dynamic Configuration**: Constants are not read from storage (e.g., registry, config files). They are compile-time or static runtime defaults.
- **Versioning Semantics**: Database version constants (e.g., `ROITables_DB_VERSION`) indicate schema compatibility. Values are incremented only when breaking changes occur.
## 4. Dependencies
- **Imports/Usings**:
- `DTS.Common.Constant` namespace depends on `System.Collections.Generic` (used in `Constants.ExportNameFilters`).
- `Constants` references enums `ClockSyncProfile` and `RecordingModes` (from `DTS.Common.Enums`), implying a dependency on `DTS.Common.Enums`.
- **Consumers** (inferred from usage patterns):
- UI layer (e.g., `XamlConstants` likely used in XAML resource dictionaries).
- Data acquisition firmware/drivers (e.g., `EmbeddedSensors` for sensor configuration).
- Data processing pipelines (e.g., `Constants` for graph scaling, file I/O, NMEA parsing).
- Configuration management (e.g., `DigitalInputs` thresholds may be set via config).
- **No external libraries**: No third-party dependencies are evident from the source.
## 5. Gotchas
- **Mutable Static Properties**: Properties like `DigitalInputs.ConstantCurrentBreakPoint` and `Constants.CheckStatusLinesInRealtime` are *mutable statics*. Changes affect all consumers globally—this may cause race conditions in multi-threaded scenarios if not synchronized.
- **Ambiguous `XamlConstants`**: The `XamlConstants` class is empty in the provided source. Its purpose is unclear; it may be a placeholder or rely on partial class definitions not included here.
- **Threshold Units**: `DigitalInputs` thresholds are in *ADC counts*, not physical units (e.g., volts). Conversion requires knowledge of the ADC reference and scaling (not provided here).
- **Historical Comments**: Comments reference internal Jira cases (e.g., `http://manuscript.dts.local/f/cases/29416`) and legacy code moves (e.g., `FB 25526 Moved from SLICE6AIR`). These may become outdated and obscure the rationale for future maintainers.
- **Hardcoded Limits**: Values like `MAX_VIEWER_POINTS = 45000000` or `ALLOWED_DOWNLOAD_FILE_LENGTH = 260` may conflict with OS/file system constraints (e.g., Windows MAX_PATH), requiring validation at the call site.
- **No Validation on Constants**: There is no runtime enforcement of min/max bounds (e.g., setting `EmbeddedSensors.TimedIntervalEventDurationMsMinimum` to 20 would not fail). Invalid values may cause silent errors or device misbehavior.
None identified from source alone.

View File

@@ -0,0 +1,134 @@
---
source_files:
- Common/DTS.CommonCore/Constant/DASSpecific/TDAS.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE.cs
- Common/DTS.CommonCore/Constant/DASSpecific/PowerPRO.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE2_TOM.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICEDB.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE2.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE1_5.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE6DB.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE6AIRBR.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE6.cs
- Common/DTS.CommonCore/Constant/DASSpecific/TSRAIR.cs
- Common/DTS.CommonCore/Constant/DASSpecific/SLICE6AIR.cs
generated_at: "2026-04-16T02:46:21.143359+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e300fc25f12eca5b"
---
# DASSpecific Constants Module Documentation
## 1. Purpose
This module defines hardware-specific constant values and protocol version requirements for various Data Acquisition Systems (DAS) in the DTS ecosystem. It serves as a centralized repository of device capabilities—including maximum anti-aliasing filter rates, minimum required protocol versions for features, and support flags for recording modes, streaming profiles, and clock synchronization profiles—enabling runtime validation and feature gating based on the detected DAS model and its firmware version. Each DAS family (e.g., SLICE, SLICE6, TSRAIR) is represented by a dedicated static class containing only constants and static helper methods; no stateful logic or side effects occur.
## 2. Public Interface
All types reside in the `DTS.Common.Constant.DASSpecific` namespace.
### Constants (public `const` fields)
| Class | Name | Type | Value | Description |
|-------|------|------|-------|-------------|
| `TDAS` | `MaxAAFilterRateHz` | `uint` | `4300` | Maximum anti-aliasing filter rate (Hz) for TDAS hardware. |
| `SLICE` | `MaxAAFilterRateHz` | `uint` | `30000` | Maximum anti-aliasing filter rate (Hz) for SLICE hardware. |
| `PowerPRO` | `MaxAAFilterRateHz` | `uint` | `20000` | Maximum anti-aliasing filter rate (Hz) for PowerPRO hardware. |
| `PowerPRO` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version required for basic functionality. |
| `PowerPRO` | `DIAGNOS_SHUNT_DAC` | `byte` | `2` | Protocol version at which shunt DAC diagnostics became available. |
| `PowerPRO` | `MIN_PROTOCOL_QUERYMACTABLE` | `byte` | `9` | Minimum protocol version to support querying MAC table (firmware B0H3+). |
| `PowerPRO` | `MIN_PROTOCOL_MEASUREPOWERPROALLDIAGNOSTICCHANNEL` | `byte` | `12` | Minimum protocol version to support measuring all diagnostic channels. |
| `SLICEDB` | `MaxAAFilterRateHz` | `uint` | `200000` | Maximum anti-aliasing filter rate (Hz) for SLICEDB hardware. |
| `SLICEDB` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version required for basic functionality. |
| `SLICEDB` | `MIN_PROTOCOL_ARM` | `byte` | `2` | Minimum protocol version to support arming. |
| `SLICEDB` | `MIN_PROTOCOL_ENABLEFAULTCHECKING` | `byte` | `2` | Alias of `MIN_PROTOCOL_ARM`. |
| `SLICEDB` | `MIN_PROTOCOL_DIAGNOSTICS` | `byte` | `3` | Minimum protocol version for diagnostics support. |
| `SLICEDB` | `MIN_PROTOCOL_ONOVERRIDE` | `byte` | `4` | Minimum protocol version for override support. |
| `SLICEDB` | `MIN_PROTOCOL_OMAP_GPIO` | `byte` | `4` | Alias of `MIN_PROTOCOL_ONOVERRIDE`. |
| `SLICEDB` | `MIN_PROTOCOL_INITHARDWAREINPUTLINES` | `byte` | `4` | Alias of `MIN_PROTOCOL_ONOVERRIDE`. |
| `SLICEDB` | `MIN_PROTOCOL_BASECALDATE` | `byte` | `5` | Minimum protocol version for base calibration date support (FB 16049). |
| `SLICEDB` | `MIN_PROTOCOL_QUERYMACTABLE` | `byte` | `9` | Minimum protocol version to support querying MAC table (firmware B0H3+). |
| `SLICEDB` | `MIN_PROTOCOL_TILT` | `byte` | `14` | Minimum protocol version for tilt support. |
| `SLICE2` | `MaxAAFilterRateHz` | `uint` | `200000` | Maximum anti-aliasing filter rate (Hz) for SLICE2 hardware. |
| `SLICE2` | `SLICE1_5_BASETYPE` | `int` | `2` | Base type identifier for SLICE1.5. |
| `SLICE2` | `SLICEPRO_DIM_BASETYPE` | `int` | `3` | Base type identifier for SLICE Pro DIM. |
| `SLICE2` | `SLICEPRO_TOM_BASETYPE` | `int` | `5` | Base type identifier for SLICE Pro TOM. |
| `SLICE2` | `MIN_PROTOCOL_VER` | `byte` | `128` | Minimum protocol version required for basic functionality (gen3+). |
| `SLICE2` | `FILE_DATA` | `int` | `133` | Protocol command ID for file data operations. |
| `SLICE2` | `MULTIPLE_EVENTS` | `int` | `134` | Protocol command ID for multiple events. |
| `SLICE2` | `STACK_SENSORS` | `int` | `136` | Protocol command ID for stacked sensors. |
| `SLICE2` | `STACK_FIRMWARE_UPDATE` | `int` | `137` | Protocol command ID for stacked firmware update. |
| `SLICE2` | `DIAGNOSTIC_TWO_VOLT_EXCITATION` | `int` | `138` | Protocol command ID for 2V excitation diagnostics. |
| `SLICE2` | `QUERY_ARM_AND_TRIGGER_STATUS_TIME_LEFT_IN_ARM` | `int` | `139` | Protocol command ID for querying arming status. |
| `SLICE2` | `MIN_PROTOCOL_VER_GEN3` | `byte` | `140` | Minimum protocol version for gen3 features. |
| `SLICE2` | `SLICE2_ONE_WIRE_ID` | `int` | `142` | Protocol command ID for one-wire ID. |
| `SLICE2` | `EVENT_ARM_ATTEMPTS` | `int` | `145` | Protocol command ID for event arming attempts. |
| `SLICE2` | `MEASURE_INTERNAL_OFFSET` | `int` | `149` | Protocol command ID for internal offset measurement. |
| `SLICE2` | `START_REC_DELAY_IN_SECONDS` | `int` | `150` | Protocol command ID for delayed recording start. |
| `SLICE2` | `START_REALTIME_STREAM` | `int` | `152` | Protocol command ID for starting real-time streaming. |
| `SLICE2` | `HALF_BRIDGE_SIG_PLUS_SUPPORT` | `int` | `154` | Protocol command ID for half-bridge SIG+ support. |
| `SLICE1_5` | `MaxAAFilterRateHz` | `uint` | `40000` | Maximum anti-aliasing filter rate (Hz) for SLICE1.5 hardware. |
| `SLICE1_5` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version required for basic functionality. |
| `SLICE1_5` | `QUERY_ARM_AND_TRIGGER_STATUS_TIME_LEFT_IN_ARM` | `int` | `2` | Protocol command ID for querying arming status. |
| `SLICE1_5` | `IGNORE_SHORTED_START_EVENT` | `int` | `4` | Protocol command ID for ignoring shorted start events. |
| `SLICE1_5` | `START_REC_DELAY_IN_SECOND` | `int` | `5` | Protocol command ID for delayed recording start (note: singular "SECOND"). |
| `SLICE1_5` | `MEASURE_INTERNAL_OFFSET` | `int` | `6` | Protocol command ID for internal offset measurement. |
| `SLICE1_5` | `START_REALTIME_STREAM` | `int` | `7` | Protocol command ID for starting real-time streaming. |
| `SLICE1_5` | `BASE_PLUS_MIN_MULTIEVENT_HYBRID_PROTOCOL` | `int` | `8` | Minimum protocol version for `MultipleEventHybridRecorder` mode support. |
| `SLICE6DB` | `MaxAAFilterRateHz` | `uint` | `200000` | Maximum anti-aliasing filter rate (Hz) for SLICE6DB hardware. |
| `SLICE6DB` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version required for basic functionality. |
| `SLICE6DB` | `MIN_PROTOCOL_QUERYTEMPLOGFILE` | `byte` | `8` | Minimum protocol version for querying temperature log file. |
| `SLICE6DB` | `MIN_PROTOCOL_QUERYMACTABLE` | `byte` | `9` | Minimum protocol version to support querying MAC table (firmware B0H3+). |
| `SLICE6DB` | `MIN_PROTOCOL_TILT` | `byte` | `14` | Minimum protocol version for tilt support. |
| `SLICE6DB` | `CLOCKSYNCPROFILE` | `int` | `18` | Minimum protocol version for clock sync profile support. |
| `SLICE6DB` | `PTP_DOMAIN_ID_VER` | `int` | `18` | Minimum protocol version for PTP Domain ID support (per 30472). |
| `SLICE6` | `MaxAAFilterRateHz` | `uint` | `20000` | Maximum anti-aliasing filter rate (Hz) for SLICE6 hardware. |
| `SLICE6` | `MIN_PROTOCOL_VER` | `int` | `1` | Minimum protocol version required for basic functionality. |
| `SLICE6` | `DIAGNOS_SHUNT_DAC` | `int` | `2` | Protocol version at which shunt DAC diagnostics became available. |
| `SLICE6` | `START_REC_DELAY_IN_SECONDS` | `int` | `3` | Protocol command ID for delayed recording start. |
| `SLICE6` | `IN_SLICE_TILT_SENSOR_ADC_PRE` | `int` | `4` | Protocol command ID for in-slice tilt sensor ADC pre-scaling. |
| `SLICE6` | `STACK_SENSORS` | `int` | `5` | Protocol command ID for stacked sensors. |
| `SLICE6` | `START_REALTIME_STREAM` | `int` | `11` | Protocol command ID for starting real-time streaming. |
| `SLICE6` | `UDP_REALTIME_STREAM` | `int` | `14` | Protocol command ID for UDP real-time streaming. |
| `SLICE6` | `CLOCKSYNCPROFILE` | `int` | `21` | Minimum protocol version for clock sync profile support. |
| `SLICE6` | `PTP_DOMAIN_ID_VER` | `int` | `21` | Minimum protocol version for PTP Domain ID support (per 30472). |
| `TSRAIR` | `MaxAAFilterRateHz` | `uint` | `200000` | Maximum anti-aliasing filter rate (Hz) for TSRAIR hardware. |
| `TSRAIR` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version required for basic functionality. |
| `TSRAIR` | `VOLTAGE_INSERTION` | `int` | `2` | Protocol command ID for voltage insertion. |
| `TSRAIR` | `START_REC_DELAY_IN_SECONDS` | `int` | `3` | Protocol command ID for delayed recording start. |
| `TSRAIR` | `STACK_SENSORS` | `int` | `5` | Protocol command ID for stacked sensors. |
| `TSRAIR` | `WAKEUP_MOTION_TIMEOUT` | `int` | `10` | Protocol command ID for wakeup motion timeout. |
| `TSRAIR` | `IRIG_GPS_PPSIN_SYNC` | `int` | `25` | Minimum protocol version for IRIG/GPS/PPS input sync support. |
| `TSRAIR` | `DISABLE_STREAMING_FEATURE` | `int` | `25` | Protocol command ID for disabling streaming feature (same version as above). |
| `SLICE6AIR` | `IENA_PTYPE_STREAM_MIN_PROTOCOL` | `uint` | `39` | Minimum protocol version for IENA PTYPE stream support. |
| `SLICE6AIR` | `UART_STREAM_MIN_PROTOCOL` | `uint` | `41` | Minimum protocol version for UART stream support. |
| `SLICE6AIR` | `MaxAAFilterRateHz` | `uint` | `50000` | Maximum anti-aliasing filter rate (Hz) for SLICE6AIR hardware. |
| `SLICE6AIR` | `MaxSampleRateHz` | `uint` | `400000` | Maximum sample rate (Hz) for SLICE6AIR hardware. |
| `SLICE6AIR` | `MaxSampleRateHz_OBRDDR` | `uint` | `uint.MaxValue` | Maximum sample rate (Hz) for Ethernet-based recording (unlimited). |
| `SLICE6AIR` | `MIN_PROTOCOL_VER` | `int` | `1` | Minimum protocol version required for basic functionality. |
| `SLICE6AIR` | `UDP_REALTIME_STREAM` | `int` | `1` | Protocol command ID for UDP real-time streaming (available from base protocol). |
| `SLICE6AIR` | `SET_DSP_FILTER_SETTINGS` | `int` | `28` | Protocol command ID for setting DSP filter settings. |
| `SLICE6AIR` | `RECORD_AND_STREAM_SUBSAMPLE` | `int` | `29` | Minimum protocol version for record-and-stream subsampling. |
| `SLICE6AIR` | `UART_MULTIPLE_EVENT_MIN_PROTOCOL` | `int` | `45` | Minimum protocol version for UART + multiple event modes. |
| `SLICE6AIR` | `RECORD_ON_BOOT_PROTOCOL` | `int` | `46` | Minimum protocol version for record-on-boot mode. |
| `SLICE6AIR` | `REMOVE_LEAP_SECONDS_VER` | `int` | `42` | Minimum protocol version for leap second removal support (per 31747). |
| `SLICE6AIR` | `ADC_SAMPLES_PER_PACKET_VER` | `int` | `43` | Minimum protocol version for exposing ADC samples per packet (per 31754). |
| `SLICE6AIR` | `AC_COUPLER_ENABLE` | `int` | `36` | Minimum protocol version for AC coupler enable (per 18294). |
| `SLICE6AIR` | `PPS_OUT_CLOCKS` | `int` | `39` | Minimum protocol version for PPS OUT clock types (per 29842). |
### Static Methods
| Class | Method | Signature | Description |
|-------|--------|-----------|-------------|
| `SLICE2_TOM` | `IsRecordingModeSupported` | `bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)` | Returns `true` if the given `RecordingModes` value is supported (supports all standard recorder modes). |
| `SLICE1_5` | `IsRecordingModeSupported` | `bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)` | Returns `true` if the given `RecordingModes` value is supported. `MultipleEventHybridRecorder` requires `protocolVersion >= BASE_PLUS_MIN_MULTIEVENT_HYBRID_PROTOCOL` (8). |
| `SLICE6DB` | `IsClockSyncProfileSupported` | `bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion)` | Returns `true` if the given `ClockSyncProfile` is supported. `Manual` is supported at all versions; `Master_E2E`/`Slave_E2E` require `protocolVersion >= CLOCKSYNCPROFILE` (18). |
| `SLICE6AIR` | `IsRecordingModeSupported` | `bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)` | Returns `true` if the given `RecordingModes` value is supported. Complex logic: e.g., `MultipleEventCircularBufferAndStream` requires `protocolVersion >= RECORD_AND_STREAM_SUBSAMPLE` (29); `UART` variants require `UART_MULTIPLE_EVENT_MIN_PROTOCOL` (45); `RecordOnBoot` requires `RECORD_ON_BOOT_PROTOCOL` (46). |
| `SLICE6AIR` | `IsStreamingProfileSupported` | `bool IsStreamingProfileSupported(UDPStreamProfile profile, int protocolVersion)` | Returns `true` if the given `UDPStreamProfile` is supported. `IENA_PTYPE_STREAM` requires `protocolVersion >= IENA_PTYPE_STREAM_MIN_PROTOCOL` (39); `UART_STREAM` requires `UART_STREAM_MIN_PROTOCOL` (41). |
| `SLICE6AIR` | `IsClockSyncProfileSupported` | `bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion)` | Returns `true` if the given `ClockSyncProfile` is supported. Explicitly excludes `PPS_OUT`-related profiles unless `protocolVersion >= PPS_OUT_CLOCKS` (39); `GPS`-only profiles are explicitly unsupported. |
| `SLICE6` | `IsRecordingModeSupported` | `bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)` | Returns `true` if the given `RecordingModes` value is supported. Includes `MultipleEventRAMActive` and `RAMActive`. |
| `SLICE6` | `IsStreamingProfileSupported` | `bool IsStreamingProfileSupported(UDPStreamProfile profile, int protocolVersion)` | Returns `true` only for `RTCStreaming` and `DTS_UDP`. Comment notes these are *realtime-only*, not boot-and-stream. |
| `SLICE6` | `IsClockSyncProfileSupported` | `bool IsClockSyncProfileSupported(ClockSyncProfile profile, int protocolVersion)` | Returns `true` for `None`, `Manual` (if `protocolVersion < CLOCKSYNCPROFILE`), and `Slave_E2E` (if `protocolVersion >= CLOCKSYNCPROFILE`). |
| `TSRAIR` | `IsRecordingModeSupported` | `bool IsRecordingModeSupported(RecordingModes mode, int protocolVersion)` | Returns `true` for a broad set of modes including `Active`, `Streaming`, `S6A_DeviceStreamingOnly`, `Scheduled`, and `Interval`. |
| `TS

View File

@@ -0,0 +1,244 @@
---
source_files:
- Common/DTS.CommonCore/Controls/RoundedBox.xaml.cs
- Common/DTS.CommonCore/Controls/TestIDView.xaml.cs
- Common/DTS.CommonCore/Controls/checkbox.xaml.cs
- Common/DTS.CommonCore/Controls/GridLengthAnimation.cs
- Common/DTS.CommonCore/Controls/ISOPopup.xaml.cs
- Common/DTS.CommonCore/Controls/LookupPopup.xaml.cs
- Common/DTS.CommonCore/Controls/TestIdPreFixSuffixHelper.cs
- Common/DTS.CommonCore/Controls/AutoSizedGridView.cs
- Common/DTS.CommonCore/Controls/DynamicGrid.cs
- Common/DTS.CommonCore/Controls/TestIDViewModel.cs
- Common/DTS.CommonCore/Controls/TestIDControl.xaml.cs
- Common/DTS.CommonCore/Controls/GridViewColumnHeaderSelectable.xaml.cs
- Common/DTS.CommonCore/Controls/GridViewColumnHeaderSearchable.xaml.cs
- Common/DTS.CommonCore/Controls/GridViewColumnHeaderSearchableCheckBox.xaml.cs
generated_at: "2026-04-16T02:14:42.933303+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1aa96c65b3ed084a"
---
# Documentation: `DTS.Common.Controls` Module
## 1. Purpose
This module provides a collection of reusable WPF UI controls and supporting types for the DTS (presumably "Data Test System") application. Its primary role is to encapsulate common UI patterns—such as test ID generation, lookup selection, dynamic grid layout, and enhanced `GridView` column headers with filtering/searching capabilities—into self-contained, declarative components. These controls reduce duplication across UI layers and enforce consistent behavior for test configuration, data display, and user interaction. The module does not contain business logic but serves as a bridge between XAML UI definitions and underlying data/event infrastructure (e.g., Prism EventAggregator, ServiceLocator).
---
## 2. Public Interface
### Classes
#### `RoundedBox : UserControl`
- **`public void Connect(int connectionId, object target)`**
Stub method intended for connection management; currently throws `NotImplementedException`. Not functional.
#### `TestIDView : UserControl`
- **`public TestIDView()`**
Constructor; initializes component via `InitializeComponent()`. No additional public members exposed.
#### `checkbox : UserControl`
- **`public void ToolTipEventHandler(object sender, ToolTipEventArgs e)`**
Handles `ToolTip` events by publishing a `HelpTextEvent` via `IEventAggregator`, including the `sender` and `e` in a `HelpTextEventArg`.
#### `GridLengthAnimation : AnimationTimeline`
- **`public GridLength From { get; set; }`**
Starting `GridLength` for the animation.
- **`public GridLength To { get; set; }`**
Ending `GridLength` for the animation.
- **`public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)`**
Computes interpolated `GridLength` based on `animationClock.CurrentProgress`. Handles both `Pixel` and `Star` unit types. Assumes `From` and `To` are non-null and valid.
#### `ISOPopup : Popup`
- **`public ISOPopup()`**
Constructor; initializes component via `InitializeComponent()`.
- **`private void ISOPart_OnPreviewKeyUp(object sender, KeyEventArgs e)`**
Filters keyboard input: only allows alphanumeric keys, numeric keypad digits, control keys (Enter, Tab, Backspace, etc.), and `OemQuestion` (`?`). Sets `e.Handled = true` for disallowed keys.
- **`private void ISOPart_OnGotMouseCapture(object sender, MouseEventArgs e)`**
If `sender` is a `TextBox`, selects all text (`tb.SelectAll()`).
- **`private void ISOPart_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)`**
Same behavior as `ISOPart_OnGotMouseCapture`.
#### `LookupPopup : Popup`
- **`public IEnumerable<IChannelCode> AllChannelCodes { get; private set; }`**
Property for channel codes (not used in current implementation).
- **`public event ChannelCodeSelectedEventHandler ChannelCodeSelected`**
Event raised when a channel code is selected via double-click in the `DataGrid`.
- **`public IList PossibleChannels { get; set; }`**
DP-backed property; default value is an empty list of anonymous objects with `Code` and `Name` properties.
- **`private void PossibleChannels_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)`**
Raises `ChannelCodeSelected` with `Code` and `Name` extracted via reflection from the selected `DataGrid` item.
#### `TestIdPreFixSuffixHelper : Base.BasePropertyChanged`
- **`public TestIdPreFixSuffix TestIdPreFixSuffix { get; }`**
Holds the underlying prefix/suffix configuration.
- **`public override string ToString()`**
Returns localized string via `Strings.Strings.ResourceManager.GetString(...)`, or fallback to internal string if not found.
- **`public override bool Equals(object obj)`**
Compares `TestIdPreFixSuffix.FixedValue`; for `NotFixed`, also compares string representation.
#### `TestIdPreFixSuffix`
- **`public TestIdFixedPrefixSuffixValues FixedValue { get; }`**
Enum value indicating fixed prefix/suffix type.
- **`public TestIdPreFixSuffix(TestIdFixedPrefixSuffixValues fixedPrefixSuffix)`**
Constructor for enum-based initialization.
- **`public TestIdPreFixSuffix(string dbPrefixSuffix)`**
Constructor for arbitrary string-based initialization.
- **`public override string ToString()`**
Returns internal `_tempString` (e.g., `"TESTID_PREFIX_SUFFIX_1"` for `TimeStamp`).
#### `enum TestIdFixedPrefixSuffixValues`
- `NotFixed = -1`, `None = 0`, `TimeStamp = 1`, `TestSetupName = 2`
#### `TestIDViewModel : INotifyPropertyChanged`
- **`public string TestSetupLabel { get; set; }`**
DP-backed property; raising `TestSetupLabelVisibility` change on update.
- **`public Visibility TestSetupLabelVisibility { get; }`**
Computed property: `Collapsed` if `TestSetupLabel` is null/empty, else `Visible`.
- **`public string TestIdEditableText { get; set; }`**
Editable test ID component.
- **`public void PopulateAllTestIdPrefixSuffixValues(string[] serializedValues)`**
Populates `_allTestIdPrefixSuffixValues` with built-in items (`None`, `TimeStamp`, `TestSetupName`) and DB-provided values.
- **`public TestIdPreFixSuffixHelper[] AllTestIdPrefixSuffixValues { get; }`**
Read-only array of available prefix/suffix helpers.
- **`public TestIdPreFixSuffixHelper SelectedTestIdPrefixValueItem { get; set; }`**
Selected prefix helper (default: `None`).
- **`public TestIdPreFixSuffixHelper SelectedTestIdSuffixValueItem { get; set; }`**
Selected suffix helper (default: `TimeStamp`).
- **`public string TestName { get; set; }`**
Used for `TestSetupName` prefix/suffix.
- **`public string GetTestId()`**
Constructs test ID by concatenating prefix, `TestSetupLabel`, `TestIdEditableText`, and suffix with `_` separator.
- **`private string GetRunTimeTestIdPrefixOrSuffix(TestIdPreFixSuffixHelper prefixOrSuffix)`**
Returns runtime value: `TestName` for `TestSetupName`, timestamp for `TimeStamp`, or string representation for `NotFixed`.
- **`public string GetTestIdTimestamp()`**
Returns formatted timestamp: `"yyyy_MM_dd HH_mm"`.
#### `TestIdControl : UserControl, INotifyPropertyChanged`
- **Identical public interface to `TestIDViewModel`** (same properties, methods, and behavior).
*Note: Code comments indicate this control is deprecated and should be removed after TTS migration.*
#### `GridViewColumnHeaderSelectable : UserControl, IBasePropertyChanged`
- **`public string ListviewId { get; set; }`**
DP-backed; used to correlate with `ListViewStatusEvent`.
- **`public string HeaderTitle { get; set; }`**
DP-backed; default `"Awesome"`.
- **`public bool ToggleButtonIsChecked { get; set; }`**
Controls popup state; raises `OpenChanged` event and `ToggleIconGeometry` change.
- **`public Geometry ToggleIconGeometry { get; }`**
Computed based on `HeaderSearchTerm` (not implemented—uses `dtsGridViewColumnHeader.FindResource(...)`).
- **`public event RoutedEventHandler OpenChanged`**
Raised when popup state changes.
- **`public event RoutedEventHandler ClickHandler`**
Raised on header click (via `PreviewLeftButtonUp`).
- **`public event RoutedEventHandler SelectAll`**
Raised on "Select All"/"Clear All" button clicks.
#### `GridViewColumnHeaderSearchable : UserControl, IBasePropertyChanged`
- **`public string ListviewId { get; set; }`**
DP-backed; used to correlate with `ListViewStatusEvent`.
- **`public string HeaderTitle { get; set; }`**
DP-backed; default `"Awesome"`.
- **`public bool ToggleButtonIsChecked { get; set; }`**
Controls popup state; raises `OpenChanged` event and `ToggleIconGeometry` change.
- **`public string HeaderSearchTerm { get; set; }`**
DP-backed; default `""`. Raises `Search` event on change.
- **`public Geometry ToggleIconGeometry { get; }`**
Computed based on `HeaderSearchTerm` (uses `dtsGridViewColumnHeader.FindResource(...)`).
- **`public event RoutedEventHandler OpenChanged`**
Raised when popup state changes.
- **`public event RoutedEventHandler ClickHandler`**
Raised on header click (suppresses click if inside `Popup`).
- **`public event RoutedEventHandler Search`**
Raised when `HeaderSearchTerm` changes or Enter key pressed.
#### `BoolToInvertedBoolConverter : IValueConverter`
- **`public object Convert(object value, ...)`**
Converts `bool` to inverted `bool`.
- **`public object ConvertBack(...)`**
Throws `NotImplementedException`.
#### `GridViewColumnHeaderSearchableCheckBox : UserControl, IBasePropertyChanged`
- **`public string ListviewId { get; set; }`**
DP-backed; used to correlate with `ListViewStatusEvent`.
- **`public string HeaderTitle { get; set; }`**
DP-backed; default `"Awesome"`.
- **`public bool ToggleButtonIsChecked { get; set; }`**
Controls popup state; raises `OpenChanged` event and `ToggleIconGeometry` change.
- **`public string HeaderSearchTerm { get; set; }`**
DP-backed; default `""`. Raises `Search` event on change.
- **`public Geometry ToggleIconGeometry { get; }`**
Computed based on `HeaderSearchTerm` (uses `dtsGridViewColumnHeader.FindResource(...)`).
- **`public event RoutedEventHandler OpenChanged`**
Raised when popup state changes.
- **`public event RoutedEventHandler ClickHandler`**
Raised on header click.
- **`public event RoutedEventHandler Search`**
Raised when `HeaderSearchTerm` changes (named `SearchCheckBox` in event registration).
- **`public event RoutedEventHandler Filter`**
Raised on "All"/"True"/"False" button clicks.
#### `AutoSizedGridView : GridView`
- **`protected override void PrepareItem(ListViewItem item)`**
Ensures columns with `"Auto"` width are measured correctly by forcing remeasurement. Preserves bound column bindings.
#### `DynamicGrid : Grid, INotifyPropertyChanged`
- **`public byte GridColumns { get; set; }`**
Number of columns; triggers `Refresh()` on change.
- **`public void Refresh()`**
Dynamically rebuilds `ColumnDefinitions` and `RowDefinitions` to fit children in a left-to-right, top-to-bottom flow. Last column is `*` (star), others are `Auto`. Adds a final `*` row.
- **`protected override void OnVisualChildrenChanged(...)`**
Calls `Refresh()` on child addition/removal.
---
## 3. Invariants
- **`GridLengthAnimation.GetCurrentValue`** assumes `From` and `To` are non-null and their `Value` properties are finite. No validation is performed.
- **`TestIdPreFixSuffixHelper.ToString()`** relies on `Strings.Strings.ResourceManager` existing and containing keys matching `TestIdPreFixSuffix.ToString()` output. Falls back to internal string if not found.
- **`LookupPopup.PossibleChannels`** must contain objects with `Code` and `Name` properties (via reflection); no compile-time or runtime validation.
- **`ISOPopup` key filtering** is strict: only allows specific keys (alphanumeric, numeric keypad, control keys, `?`). Other keys are rejected (`e.Handled = true`).
- **`DynamicGrid.Refresh()`** assumes `Children` contains only `UIElement`s; no type checking.
- **`TestIdControl` and `TestIDViewModel`** share identical logic but are separate implementations (tech debt).
- **`GridViewColumnHeader*` controls** depend on `dtsGridViewColumnHeader` resource dictionary containing `"DownArrowIconGeometry"` and `"FilterIconGeometry"` resources.
---
## 4. Dependencies
### External Dependencies
- **WPF Framework**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Media.Animation`, etc.
- **Prism Library**: `Microsoft.Practices.Prism.Events` (`IEventAggregator`, `EventBase`).
- **Enterprise Library**: `Microsoft.Practices.ServiceLocation` (`ServiceLocator`).
- **DTS Common Core**:
- `DTS.Common.Base.IBasePropertyChanged`
- `DTS.Common.Events.*` (`HelpTextEvent`, `ListViewStatusEvent`)
- `DTS.Common.Interface.Channels.ChannelCodes.IChannelCode`
- `DTS.Common.Utilities.Logging.*`
- `DTS.Common.Strings` (for `Strings.Strings.ResourceManager`)
### Internal Dependencies
- **Controls**:
- `TestIDViewModel` and `TestIdControl` share logic but are not interdependent.
- `GridViewColumnHeader*` controls depend on shared XAML resources (`dtsGridViewColumnHeader`).
- **Data Models**:
- `TestIdPreFixSuffix` and `TestIdPreFixSuffixHelper` are tightly coupled.
- `AutoSizedGridView` depends on `GridViewColumn` metadata (`Width`, bindings).
---
## 5. Gotchas
- **`RoundedBox.Connect` is unimplemented** and will throw `NotImplementedException` if called.
- **`LookupPopup.PossibleChannels` uses reflection** (`item.GetType().GetProperty(...)`) to extract `Code`/`Name`. Fails silently if properties are missing or inaccessible (returns `null`).
- **`TestIdControl` is deprecated** (comment: *"Remove this control after deleting the TTS module..."*). Prefer `TestIDViewModel`.
- **`GridViewColumnHeader*` controls** assume `dtsGridViewColumnHeader` resource dictionary exists and contains required geometries. Missing resources cause runtime exceptions.
- **`BoolToInvertedBoolConverter.ConvertBack` is unimplemented**—throws `NotImplementedException`.
- **`DynamicGrid.Refresh()` adds a final `*` row** regardless of content, which may cause unexpected spacing.
- **`GridLengthAnimation` does not handle `NaN` or negative `GridLength.Value`**—may produce invalid interpolated values.
- **`ISOPopup` key filtering** is overly restrictive (e.g., no spaces, punctuation beyond `?`), potentially limiting user input.
- **`TestIDViewModel` and `TestIdControl` duplicate logic**—changes must be applied in both places.
- **`AutoSizedGridView` uses `GetHashCode()` for column tracking**—not robust if columns are reused or recreated (hash collisions possible).

View File

@@ -0,0 +1,448 @@
---
source_files:
- Common/DTS.CommonCore/Converters/BooleanToBorderThicknessConverter.cs
- Common/DTS.CommonCore/Converters/BooleanToBorderBrushConverter.cs
- Common/DTS.CommonCore/Converters/BooleanOrMultiConverter.cs
- Common/DTS.CommonCore/Converters/BooleanToGreenBorderConverter.cs
- Common/DTS.CommonCore/Converters/DateTimeWithMillisecondsToStringConverter.cs
- Common/DTS.CommonCore/Converters/EnumVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/InverseEnumVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/ActiveContentConverter.cs
- Common/DTS.CommonCore/Converters/FaultedTextConverter.cs
- Common/DTS.CommonCore/Converters/TriggerTextConverter.cs
- Common/DTS.CommonCore/Converters/NullableFloatConverter.cs
- Common/DTS.CommonCore/Converters/TriggerColorConverter.cs
- Common/DTS.CommonCore/Converters/FaultedColorConverter.cs
- Common/DTS.CommonCore/Converters/DateConverter.cs
- Common/DTS.CommonCore/Converters/InverseEnumEnabledConverter.cs
- Common/DTS.CommonCore/Converters/IsLessThanConverter.cs
- Common/DTS.CommonCore/Converters/ListToStringConverter.cs
- Common/DTS.CommonCore/Converters/IsGreaterThanConverter.cs
- Common/DTS.CommonCore/Converters/NonZeroToColorConverter.cs
- Common/DTS.CommonCore/Converters/HeightConverter.cs
- Common/DTS.CommonCore/Converters/ErrorToBooleanConverter.cs
- Common/DTS.CommonCore/Converters/WidthConverter.cs
- Common/DTS.CommonCore/Converters/StringListToVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/StatusToBorderThicknessConverter.cs
- Common/DTS.CommonCore/Converters/ArrayVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/ErrorToColorConverter.cs
- Common/DTS.CommonCore/Converters/GreaterThanToBoolConverter.cs
- Common/DTS.CommonCore/Converters/BooleanToColorConverter.cs
- Common/DTS.CommonCore/Converters/BooleanToItalicFontStyleConverter.cs
- Common/DTS.CommonCore/Converters/IntervalToVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/DiagStatusShuntColorConverter.cs
- Common/DTS.CommonCore/Converters/DiagStatusOffsetColorConverter.cs
- Common/DTS.CommonCore/Converters/InverseBooleanToOpacityConverter.cs
- Common/DTS.CommonCore/Converters/StatusToColorConverter.cs
- Common/DTS.CommonCore/Converters/ColorToSolidColorBrushConverter .cs
- Common/DTS.CommonCore/Converters/BooleanAndToVisibiltyMultiConverter.cs
- Common/DTS.CommonCore/Converters/BooleanOrToVisibilityMultiConverter.cs
- Common/DTS.CommonCore/Converters/DoubleFromThousandthUnitToBaseUnit.cs
- Common/DTS.CommonCore/Converters/BooleanToOpacityConverter.cs
- Common/DTS.CommonCore/Converters/DASStatusArmTextConverter.cs
- Common/DTS.CommonCore/Converters/EnumBooleanConverter.cs
- Common/DTS.CommonCore/Converters/InitialOffsetToIEPESensorOffsetConverter.cs
- Common/DTS.CommonCore/Converters/DASStatusColorConverter.cs
- Common/DTS.CommonCore/Converters/DASStatusArmColorConverter .cs
- Common/DTS.CommonCore/Converters/PercentConverter.cs
- Common/DTS.CommonCore/Converters/NumericStringFormatConverter.cs
- Common/DTS.CommonCore/Converters/VisibilityToRowHeightConverter.cs
- Common/DTS.CommonCore/Converters/GroupImportErrorToStringConverter.cs
- Common/DTS.CommonCore/Converters/GroupNameToVisibilityConverter.cs
- Common/DTS.CommonCore/Converters/FilePathsToShortStringConverter.cs
- Common/DTS.CommonCore/Converters/InverseBooleanConverter.cs
- Common/DTS.CommonCore/Converters/EnumDescriptionTypeConverter.cs
- Common/DTS.CommonCore/Converters/TestDataToRegionOfInterestMaximumConverter.cs
generated_at: "2026-04-16T02:13:46.908964+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "8cec2e1657d13038"
---
# DTS.Common.Converters Module Documentation
## 1. Purpose
This module provides a collection of WPF `IValueConverter` and `IMultiValueConverter` implementations used for data binding in the DTS application UI. Its primary role is to transform raw data values (booleans, enums, numerics, dates, collections, etc.) into UI-appropriate representations (visibility, colors, text, dimensions, etc.) without modifying the underlying view models. These converters enable declarative UI logic in XAML, reducing code-behind and promoting separation of concerns.
## 2. Public Interface
All converters are public classes in the `DTS.Common.Converters` namespace implementing `IValueConverter` or `IMultiValueConverter`. Only converters with non-trivial behavior or special parameters are listed with full detail.
### `BooleanToBorderThicknessConverter`
```csharp
public class BooleanToBorderThicknessConverter : IValueConverter
```
- **Convert**: Returns `1` if input `bool` is `true`, otherwise `2`.
- **ConvertBack**: Always returns `null`.
### `BooleanToBorderBrushConverter`
```csharp
public class BooleanToBorderBrushConverter : IValueConverter
```
- **Convert**: Returns `BrushesAndColors.Brush_Warning` if input is non-null `true`; otherwise `Brushes.Transparent`.
- **ConvertBack**: Always returns `null`.
### `BooleanOrMultiConverter`
```csharp
public class BooleanOrMultiConverter : IMultiValueConverter
```
- **Convert**: Returns `true` if *any* input in the array is a non-null `bool` with value `true`; otherwise `false`. Validates all inputs are `bool` before evaluating.
- **ConvertBack**: Throws `NotImplementedException`.
### `BooleanToGreenBorderConverter`
```csharp
public class BooleanToGreenBorderConverter : IValueConverter
```
- **Convert**: Returns `BrushesAndColors.BrushApplicationStatusPowerGreen` if input is non-null `true`; otherwise `BrushesAndColors.BrushFlatControlDarkForeground`.
- **ConvertBack**: Always returns `null`.
### `DateTimeWithMillisecondsToStringConverter`
```csharp
public class DateTimeWithMillisecondsToStringConverter : IValueConverter
```
- **Convert**: Converts `DateTime` input to string via `Utils.Utils.FormatTimeStamp`.
- **ConvertBack**: Always returns `null`.
### `EnumVisibilityConverter`
```csharp
public class EnumVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Visible` if input `value` equals `parameter`; otherwise `Visibility.Hidden`.
- **ConvertBack**: Returns `parameter` if input `value` is `Visibility.Visible`; otherwise `Binding.DoNothing`.
### `InverseEnumVisibilityConverter`
```csharp
public class InverseEnumVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Hidden` if input `value` equals `parameter`; otherwise `Visibility.Visible`.
- **ConvertBack**: Returns `parameter` if input `value` is `Visibility.Hidden`; otherwise `Binding.DoNothing`.
### `ActiveContentConverter`
```csharp
public class ActiveContentConverter : IValueConverter
```
- **Convert/ConvertBack**: Returns input `value` if it is a `ContentControl`; otherwise `Binding.DoNothing`.
### `FaultedTextConverter`
```csharp
public class FaultedTextConverter : IValueConverter
```
- **Convert**: Returns `Strings.Strings.Faulted` if input is `true`; `Strings.Strings.FaultsClear` if `false` or non-bool; defaults to `Strings.Strings.FaultsClear`.
- **ConvertBack**: Always returns `null`.
### `TriggerTextConverter`
```csharp
public class TriggerTextConverter : IValueConverter
```
- **Convert**: Returns `Strings.Strings.Triggered` if input is `true`; `Strings.Strings.TriggerClear` if `false` or non-bool; defaults to `Strings.Strings.TriggerClear`.
- **ConvertBack**: Always returns `null`.
### `NullableFloatConverter`
```csharp
public class NullableFloatConverter : IValueConverter
```
- **Convert**: Returns input `float` if non-null; otherwise `string.Empty`.
- **ConvertBack**: Returns input `float` if non-null; otherwise `string.Empty`.
### `TriggerColorConverter`
```csharp
public class TriggerColorConverter : IValueConverter
```
- **Convert**: Returns `BrushesAndColors.Brush_ApplicationStatus_Failed.Color` if input is `true`; `BrushesAndColors.Brush_ApplicationStatus_Waiting.Color` if `false`; `Brushes.Transparent.Color` otherwise.
- **ConvertBack**: Always returns `null`.
### `FaultedColorConverter`
```csharp
public class FaultedColorConverter : IValueConverter
```
- **Convert**: Returns `BrushesAndColors.Brush_ApplicationStatus_Failed.Color` if input is `true`; `BrushesAndColors.Brush_ApplicationStatus_Complete.Color` if `false`; `Brushes.Transparent.Color` otherwise.
- **ConvertBack**: Always returns `null`.
### `DateConverter`
```csharp
public class DateConverter : IValueConverter
```
- **Convert**: Returns input `DateTime` if non-null; otherwise `Strings.Strings.Table_NA`.
- **ConvertBack**: Returns input `DateTime` if non-null; otherwise `Strings.Strings.Table_NA`.
### `InverseEnumEnabledConverter`
```csharp
public class InverseEnumEnabledConverter : IValueConverter
```
- **Convert**: Returns `false` if input `value` equals `parameter`; otherwise `true`.
- **ConvertBack**: Returns `parameter` if input `value` is `false`; otherwise `Binding.DoNothing`.
### `IsLessThanConverter`
```csharp
public class IsLessThanConverter : IValueConverter
```
- **Convert**: Parses `value` and `parameter` as `decimal`; returns `true` if `value < parameter`. Defaults to `0` on parse failure.
- **ConvertBack**: Returns `DependencyProperty.UnsetValue`.
### `ListToStringConverter`
```csharp
public class ListToStringConverter : IValueConverter
```
- **Convert**: Joins `List<string>` elements with `", "` separator. Throws `InvalidOperationException` if target is not `string` or input is `null`.
- **ConvertBack**: Throws `NotImplementedException`.
### `IsGreaterThanConverter`
```csharp
public class IsGreaterThanConverter : IValueConverter
```
- **Convert**: Parses `value` and `parameter` as `decimal`; returns `true` if `value > parameter`. Defaults to `0` on parse failure.
- **ConvertBack**: Returns `DependencyProperty.UnsetValue`.
### `NonZeroToColorConverter`
```csharp
public class NonZeroToColorConverter : IValueConverter
```
- **Convert**: Returns `BrushesAndColors.BrushApplicationStatusPowerGreen` if input string is `"0"`; `BrushesAndColors.BrushApplicationStatusPowerClear` if `"---"`; otherwise `BrushesAndColors.BrushApplicationStatusPowerRed`.
- **ConvertBack**: Always returns `null`.
### `HeightConverter`
```csharp
public class HeightConverter : MarkupExtension, IValueConverter
```
- **Convert**: Returns `value - parameter` (both converted to `double`/`int`).
- **ConvertBack**: Always returns `null`.
- **Note**: Implements `MarkupExtension` for XAML usage as `{local:HeightConverter}`.
### `ErrorToBooleanConverter`
```csharp
class ErrorToBooleanConverter : IValueConverter // internal (class, not public)
```
- **Convert**: Returns `true` if input is non-null and non-empty string; `null` otherwise.
- **ConvertBack**: Throws `NotImplementedException`.
### `WidthConverter`
```csharp
public class WidthConverter : MarkupExtension, IValueConverter
```
- **Convert**: Returns `value * parameter` (both converted to `double`).
- **ConvertBack**: Throws `NotImplementedException`.
- **Note**: Implements `MarkupExtension`.
### `StringListToVisibilityConverter`
```csharp
public class StringListToVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Visible` if input `List<string>` is non-empty; `Visibility.Collapsed` otherwise. Throws `InvalidOperationException` if target is not `Visibility` or input is `null`.
- **ConvertBack**: Throws `NotImplementedException`.
### `StatusToBorderThicknessConverter`
```csharp
public class StatusToBorderThicknessConverter : IValueConverter
```
- **Convert**: Returns `2` if input `UIItemStatus` is `Success`, `Failed`, `Error`, or `Warning`; otherwise `1`.
- **ConvertBack**: Always returns `null`.
### `ArrayVisibilityConverter`
```csharp
public class ArrayVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Hidden` if input is `null`; `Visibility.Visible` if input is non-empty `IList` or `Array`; `Visibility.Collapsed` if empty; otherwise `Visibility.Visible`.
- **ConvertBack**: Always returns `null`.
### `ErrorToColorConverter`
```csharp
public class ErrorToColorConverter : IValueConverter
```
- **Convert**: Returns `new SolidColorBrush(Colors.Red)` if input is non-null non-empty string; `new SolidColorBrush(Colors.Black)` otherwise.
- **ConvertBack**: Throws `NotImplementedException`.
### `GreaterEqualThanToBoolConverter`
```csharp
public class GreaterEqualThanToBoolConverter : IValueConverter
```
- **Convert**: Returns `true` if `value >= parameter` for `int`, `double`, or `ushort` pairs; otherwise `false`.
- **ConvertBack**: Always returns `false`.
### `BooleanToColorConverter`
```csharp
public class BooleanToColorConverter : IValueConverter
```
- **Properties**:
- `Background` (bool, default `false`)
- `Inverted` (bool, default `false`)
- `AttentionBrush` (bool, default `false`)
- `WarningBrush` (bool, default `false`)
- **Convert**: Applies inversion if `Inverted`; returns `BrushesAndColors.Brush_NoError` (or `Brushes.Transparent` if `Background`) if `true`; otherwise returns `Brush_Attention`, `Brush_Warning`, or `Brush_Error` based on flags.
- **ConvertBack**: Always returns `null`.
### `BooleanToItalicFontStyleConverter`
```csharp
public class BooleanToItalicFontStyleConverter : IValueConverter
```
- **Convert**: Returns `FontStyles.Italic` if input is non-null `true`; otherwise `FontStyles.Normal`.
- **ConvertBack**: Always returns `null`.
### `IntervalToVisibilityConverter`
```csharp
public class IntervalToVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Visible` if `value >= parameter` for `int`, `double`, or `ushort`; otherwise `Visibility.Collapsed`.
- **ConvertBack**: Always returns `false`.
### `DiagStatusShuntColorConverter`
```csharp
public class DiagStatusShuntColorConverter : IValueConverter
```
- **Convert**: Returns `Brush_ApplicationStatus_Idle` if input `DiagStatuses.NoResults`; `Brush_ApplicationStatus_Failed` if `FailedShunt` flag set; otherwise `Brush_ApplicationStatus_Complete`.
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `DiagStatusOffsetColorConverter`
```csharp
public class DiagStatusOffsetColorConverter : IValueConverter
```
- **Convert**: Returns `Brush_ApplicationStatus_Idle` if input `DiagStatuses.NoResults`; `Brush_ApplicationStatus_Failed` if `FailedOffset` flag set; otherwise `Brush_ApplicationStatus_Complete`.
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `InverseBooleanToOpacityConverter`
```csharp
public class InverseBooleanToOpacityConverter : IValueConverter
```
- **Convert**: Returns `1.0` if input is non-null `true`; otherwise `0.5`.
- **ConvertBack**: Always returns `null`.
### `StatusToColorConverter`
```csharp
public class StatusToColorConverter : IValueConverter
```
- **Convert**: Maps `UIItemStatus` to colors:
- `None``Brushes.Black`
- `Success``Brush_ApplicationStatus_Complete`
- `Failed``Brush_ApplicationStatus_Failed`
- `Error``Brushes.Red`
- `Warning``Brushes.OrangeRed`
- Default → `Brushes.Black`
- **ConvertBack**: Always returns `null`.
### `ColorToSolidColorBrushConverter`
```csharp
public class ColorToSolidColorBrushConverter : IValueConverter
```
- **Convert**: Returns `new SolidColorBrush(color)` if input is `Color`; otherwise `null`.
- **ConvertBack**: Throws `NotImplementedException`.
### `BooleanAndToVisibilityMultiConverter`
```csharp
public class BooleanAndToVisibilityMultiConverter : IMultiValueConverter
```
- **Convert**: Evaluates `values.All(val => (bool)val)`. Supports `parameter` flags `"FALSE"` (treat `false` as visible) and `"HIDE"` (use `Hidden` instead of `Collapsed`).
- **ConvertBack**: Throws `NotImplementedException`.
### `BooleanOrToVisibilityMultiConverter`
```csharp
public class BooleanOrToVisibilityMultiConverter : IMultiValueConverter
```
- **Convert**: Evaluates `values.Any(val => (bool)val)`. Same parameter flags as `BooleanAndToVisibilityMultiConverter`.
- **ConvertBack**: Throws `NotImplementedException`.
### `DoubleFromThousandthUnitToBaseUnit`
```csharp
public class DoubleFromThousandthUnitToBaseUnit : IValueConverter
```
- **Convert**: Returns `value / 1000.0` for `double`; `0D` otherwise (handles `NaN`).
- **ConvertBack**: Returns `value * 1000.0` for `double`; `0D` otherwise.
### `BooleanToOpacityConverter`
```csharp
public class BooleanToOpacityConverter : IValueConverter
```
- **Convert**: Returns `0.5` if input is non-null `true`; otherwise `1`.
- **ConvertBack**: Always returns `null`.
### `DASStatusArmTextConverter`
```csharp
public class DASStatusArmTextConverter : IValueConverter
```
- **Convert**: Maps `DASStatuses` to text:
- `MissingNotBooted`, `BootedNotArmedYet`, `BootedNeverArmed`, `ReadyForDownload``Strings.Strings.Table_NA` or `Strings.Strings.NotArmed`
- `ArmedReady`, `ArmedButFailedDiag``Strings.Strings.Armed`
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `EnumBooleanConverter`
```csharp
public class EnumBooleanConverter : IValueConverter
```
- **Convert**: Returns `true` if `value.Equals(parameter)`.
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `InitialOffsetToIEPESensorOffsetConverter`
```csharp
public class InitialOffsetToIEPESensorOffsetConverter : IValueConverter
```
- **Constants**: `IEPE_MIDPOINT = 12.25`
- **Convert**: Returns `(value / 1000.0) + IEPE_MIDPOINT` for `double`; `0D` otherwise.
- **ConvertBack**: Returns `(value - IEPE_MIDPOINT) * 1000.0` for `double`; `0D` otherwise.
### `DASStatusColorConverter`
```csharp
public class DASStatusColorConverter : IValueConverter
```
- **Convert**: Maps `DASStatuses` to colors:
- `MissingNotBooted``Brush_ApplicationStatus_Idle`
- `BootedNotArmedYet``Brush_ApplicationStatus_Busy`
- `BootedNeverArmed``Brush_ApplicationStatus_Failed`
- `ArmedReady`, `ReadyForDownload``Brush_ApplicationStatus_Complete`
- `ArmedButFailedDiag``Brush_ApplicationStatus_Failed`
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `DASStatusArmColorConverter`
```csharp
public class DASStatusArmColorConverter : IValueConverter
```
- **Convert**: Maps `DASStatuses` to colors:
- `MissingNotBooted`, `BootedNotArmedYet`, `BootedNeverArmed``Brush_ApplicationStatus_Failed`
- `ArmedReady``Brush_ApplicationStatus_Complete`
- `ArmedButFailedDiag``Brush_ApplicationStatus_Busy`
- `ReadyForDownload``Brush_ApplicationStatus_Idle`
- **ConvertBack**: Returns `parameter` if input is `true`; otherwise `Binding.DoNothing`.
### `PercentConverter`
```csharp
public class PercentConverter : IValueConverter
```
- **Convert**: Formats decimal as `"{0:F1}%"`.
- **ConvertBack**: Throws `NotImplementedException`.
### `NumericStringFormatConverter`
```csharp
public class NumericStringFormatConverter : IMultiValueConverter
```
- **Convert**: Takes two values: `[0]` numeric (`int`/`double`/`float`/`decimal`), `[1]` format string. Returns formatted string or `Strings.Strings.Table_NA` for `NaN`. Returns `null` on error.
- **ConvertBack**: Throws `NotImplementedException`.
### `VisibilityToRowHeightConverter`
```csharp
public class VisibilityToRowHeightConverter : DependencyObject, IValueConverter
```
- **Properties**:
- `InvertSource` (bool, default `false`)
- **Convert**: Returns `0` if input `Visibility.Collapsed`; otherwise returns `parameter` (or `0` if `null`). Inverts source if `InvertSource`.
- **ConvertBack**: Always returns `null`.
### `GroupImportErrorToStringConverter`
```csharp
public class GroupImportErrorToStringConverter : IValueConverter
```
- **Convert**: Returns `error.ExtraInfo` if input is `GroupImportError`; otherwise `string.Empty`.
- **ConvertBack**: Throws `NotImplementedException`.
### `GroupNameToVisibilityConverter`
```csharp
public class GroupNameToVisibilityConverter : IValueConverter
```
- **Convert**: Returns `Visibility.Visible` if input string starts with `"Graph"` (after trimming); otherwise `Visibility.Collapsed`.
- **ConvertBack**: Always returns `null`.
### `FilePathsToShortStringConverter`
```csharp
public class FilePathsToShortStringConverter : IValueConverter
```
- **Convert**: Returns `string.Empty` if input is `null` or empty; `Strings.Strings.MultipleFiles` if >1 path; otherwise `FileInfo.Name`.
- **ConvertBack**: Throws `NotImplementedException`.
### `Inverse

View File

@@ -0,0 +1,138 @@
---
source_files:
- Common/DTS.CommonCore/Dialogs/IRegionManagerAware.cs.cs
- Common/DTS.CommonCore/Dialogs/IPopupWindowActionAware.cs
- Common/DTS.CommonCore/Dialogs/ConfirmationEx.cs
- Common/DTS.CommonCore/Dialogs/ConfirmationWindow.xaml.cs
- Common/DTS.CommonCore/Dialogs/NotificationWindow.xaml.cs
- Common/DTS.CommonCore/Dialogs/PopupWindowAction.cs
- Common/DTS.CommonCore/Dialogs/BrowseForFolderDialog.cs
generated_at: "2026-04-16T02:16:28.079269+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e520922d284c9033"
---
# Dialogs Module Documentation
## 1. Purpose
This module provides infrastructure for displaying modal and non-modal popup windows in WPF applications using Prisms `IInteractionRequest` pattern, along with specialized dialog implementations for confirmations and notifications. It enables consistent UI behavior for user interactions by abstracting window creation, positioning, and content preparation logic. The module also includes a Win32-based folder browser dialog wrapper (`BrowseForFolderDialog`) for legacy folder selection scenarios. Key components include interfaces for content awareness (`IRegionManagerAware`, `IPopupWindowActionAware`), concrete window types (`ConfirmationWindow`, `NotificationWindow`), and the core trigger action (`PopupWindowAction`) that orchestrates dialog display and lifecycle.
## 2. Public Interface
### Interfaces
- **`IRegionManagerAware`**
- `IRegionManager RegionManager { get; set; }`
- Allows content (view or view model) to receive a scoped `RegionManager` instance for region-based navigation within popup windows.
- **`IPopupWindowActionAware`**
- `Window HostWindow { get; set; }`
- `Notification HostNotification { get; set; }`
- Enables content (view or view model) to access the host window and the original `Notification`/`Confirmation` that triggered the dialog.
### Classes
- **`ConfirmationEx`**
- Inherits `Microsoft.Practices.Prism.Interactivity.InteractionRequest.Confirmation`
- ` MessageBoxButton Buttons { get; set; } = MessageBoxButton.OKCancel;`
- ` MessageBoxImage Image { get; set; } = MessageBoxImage.Question;`
- ` MessageBoxResult Result { get; set; }`
- Extended confirmation payload with configurable button set, icon, and result (used to communicate user choice back to caller).
- **`ConfirmationWindow`**
- ` static readonly DependencyProperty ConfirmationTemplateProperty`
- ` DataTemplate ConfirmationTemplate { get; set; }`
- ` public ConfirmationWindow()` — Constructor; removes system menu (close button) via Win32 `SetWindowLong`.
- ` public void Connect(int connectionId, object target)` — Throws `NotImplementedException`; unused.
- **`NotificationWindow`**
- Inherits `Window`
- ` static readonly DependencyProperty NotificationTemplateProperty`
- ` DataTemplate NotificationTemplate { get; set; }`
- ` static readonly DependencyProperty ImageUriProperty`
- ` Uri ImageUri { get; set; }` — Defaults to `warning_48.png`.
- ` public NotificationWindow()` — Constructor; removes system menu (close button) via Win32 `SetWindowLong`.
- ` public void Connect(int connectionId, object target)` — No-op stub.
- ` private void CoppyToClibord_Click(...)` — Copies `"Hello, clipboard"` to clipboard (note: typo in method name).
- **`PopupWindowAction`**
- Inherits `TriggerAction<FrameworkElement>`
- ` enum WindowPositions { CenterOwner, CenterScreen }`
- ` static readonly DependencyProperty WindowContentProperty`
- ` FrameworkElement WindowContent { get; set; }`
- ` static readonly DependencyProperty ContentTemplateProperty`
- ` DataTemplate ContentTemplate { get; set; }`
- ` static readonly DependencyProperty IsModalProperty`
- ` bool IsModal { get; set; }`
- ` static readonly DependencyProperty StartupPositionProperty`
- ` WindowPositions StartupPosition { get; set; } = CenterScreen`
- ` static readonly DependencyProperty AllowMultipleNotificationWindowsProperty`
- ` bool AllowMultipleNotificationWindows { get; set; }`
- ` protected override void Invoke(object parameter)` — Main logic: creates/positions window, sets up content, shows dialog.
- ` protected void PrepareContentForWindow(Notification notification, Window wrapperWindow)` — Injects `RegionManager` and sets `HostWindow`/`HostNotification` on content implementing `IRegionManagerAware`/`IPopupWindowActionAware`.
- ` protected Window GetWindow(Notification notification)` — Returns window instance (uses `WindowContent` if provided, else creates `ConfirmationWindow`/`NotificationWindow`).
- ` protected Window CreateWindow(Notification notification)` — Factory for `ConfirmationWindow` or `NotificationWindow` based on notification type.
- ` private Uri GetImageUri(PopupWindowImage windowImage)` — Maps `PopupWindowImage` enum to image URI (e.g., `error_48.png`).
- **`BrowseForFolderDialog`**
- ` public string SelectedFolder { get; protected set; }`
- ` public string Title { get; set; }`
- ` public string InitialFolder { get; set; }`
- ` public string InitialExpandedFolder { get; set; }`
- ` public string OKButtonText { get; set; }`
- ` public BROWSEINFOW BrowseInfo { get; protected set; }`
- ` public BrowseInfoFlags BrowserDialogFlags { get; set; }`
- ` public BrowseForFolderDialog()` — Initializes `BROWSEINFOW` with default flags (`BIF_NEWDIALOGSTYLE`).
- ` public Nullable<bool> ShowDialog()` / `ShowDialog(Window owner)` — Shows Win32 folder browser dialog; returns `true` if folder selected, `false` otherwise.
- ` private int BrowseEventHandler(...)` — Callback for dialog events (`BFFM_INITIALIZED`, `BFFM_SELCHANGED`, etc.); sets initial selection, OK text, and updates `SelectedFolder`.
### Enums & Constants
- **`BrowseInfoFlags`** — Flags for `BROWSEINFOW.ulFlags` (e.g., `BIF_RETURNONLYFSDIRS`, `BIF_NEWDIALOGSTYLE`, `BIF_USENEWUI`).
- **`MessageFromBrowser`** — Win32 messages *from* the dialog (`BFFM_INITIALIZED`, `BFFM_SELCHANGED`, `BFFM_VALIDATEFAILEDW`).
- **`MessageToBrowser`** — Win32 messages *to* the dialog (`BFFM_SETSELECTIONW`, `BFFM_SETOKTEXT`, `BFFM_SETEXPANDED`).
- **`PopupWindowImage`** — Used by `GetImageUri` (values: `Error`, `Question`, `Warning`, `Information`).
## 3. Invariants
- **System menu removal**: Both `ConfirmationWindow` and `NotificationWindow` unconditionally remove the system menu (close button) by clearing `WS_SYSMENU` in the window style during `SourceInitialized`. This is non-negotiable and applies to all instances.
- **RegionManager injection**: `PrepareContentForWindow` ensures that if `WindowContent` (or its `DataContext`) lacks a `RegionManager`, a new scoped `RegionManager` is created and assigned. This is required for region support inside popups.
- **Content ownership**: `PopupWindowAction.Invoke` skips dialog creation if `WindowContent.Parent != null` (content already in visual tree).
- **Single notification window**: When `AllowMultipleNotificationWindows` is `false`, only one `NotificationWindow` is tracked via `_openedNotificationWindow`; subsequent notifications reuse the same window (implementation detail inferred from assignment in `Invoke`).
- **Default image**: `NotificationWindow.ImageUri` defaults to `warning_48.png` unless overridden.
- **Default button/image for `ConfirmationEx`**: `Buttons = OKCancel`, `Image = Question`, `Result = default` (uninitialized).
## 4. Dependencies
### External Dependencies
- **Prism Library**:
- `Microsoft.Practices.Prism.Regions` (`IRegionManager`, `RegionManager.RegionManagerProperty`)
- `Microsoft.Practices.Prism.Interactivity.InteractionRequest` (`IInteractionRequest`, `Notification`, `Confirmation`, `InteractionRequestedEventArgs`)
- **WPF Framework**:
- `System.Windows`, `System.Windows.Interop`, `System.Windows.Data`
- `System.Windows.Interactivity` (`TriggerAction`)
- **Win32 APIs** (via P/Invoke):
- `user32.dll`: `SetWindowLong`, `GetWindowLong`, `SendMessageW`
- `shell32.dll`: `SHBrowseForFolderW`, `SHGetPathFromIDList`
- **.NET Base**:
- `System.Runtime.InteropServices`, `System.Text`, `System.Reflection`
### Internal Dependencies
- **`DTS.Common.Enums`**: Uses `PopupWindowImage` enum (referenced in `PopupWindowAction.GetImageUri`).
- **`DTS.Common.Events`**: Referenced in `PopupWindowAction.cs` imports (no usage in provided source).
## 5. Gotchas
- **Typo in clipboard method**: `NotificationWindow.CoppyToClibord_Click` has misspelled method name (`CoppyToClibord` instead of `CopyToClipboard`).
- **`Connect` methods are stubs**: Both `ConfirmationWindow.Connect` and `NotificationWindow.Connect` throw `NotImplementedException` or do nothing; they are not functional.
- **`BrowseForFolderDialog` uses ANSI/Unicode marshaling inconsistently**: `SendMessageW` is overloaded for both `uint` and `MessageToBrowser`, but the `string` overload uses `[MarshalAs(UnmanagedType.LPWStr)]`. Ensure correct usage to avoid encoding issues.
- **`BrowseForFolderDialog` does not validate `InitialExpandedFolder`**: If `InitialExpandedFolder` is invalid, the dialog may fail silently or behave unexpectedly.
- **`PopupWindowAction.Invoke` does not handle `WindowContent` reuse**: If `WindowContent` is reused across multiple invocations, its parent check (`WindowContent.Parent != null`) may prevent display.
- **`ConfirmationWindow`/`NotificationWindow` lack close button**: Users cannot close via the title bar; must rely on dialog buttons or code-triggered close.
- **`BrowseForFolderDialog` does not expose `BROWSEINFO.hwndOwner` setter**: `ShowDialog(Window owner)` sets `hwndOwner`, but direct manipulation of `BrowseInfo.hwndOwner` after construction may be overwritten.
- **`PopupWindowAction` uses deprecated `CenterOverAssociatedObject` logic**: The property is commented out in `Invoke`, but remains in the source; developers may mistakenly use it.
- **`BrowseForFolderDialog` uses fixed buffer size (260)**: Assumes `MAX_PATH`; may fail for paths >260 characters (Windows limitation, but not documented in API).
- **`ConfirmationEx.Timeout` and `TimeoutResult` are commented out**: No timeout functionality is active despite being defined in source comments.
- **`PopupWindowAction.AllowMultipleNotificationWindows` only affects `NotificationWindow`**: Behavior for `ConfirmationWindow` is unchanged regardless of this flag.

View File

@@ -0,0 +1,152 @@
---
source_files:
- Common/DTS.CommonCore/Enums/IsoRestrictionLevels.cs
- Common/DTS.CommonCore/Enums/GPSSentenceTypes.cs
- Common/DTS.CommonCore/Enums/UartDataFormat.cs
- Common/DTS.CommonCore/Enums/NetworkSelection.cs
- Common/DTS.CommonCore/Enums/ScriptTypes.cs
- Common/DTS.CommonCore/Enums/InitializationTypes.cs
- Common/DTS.CommonCore/Enums/Strings.cs
- Common/DTS.CommonCore/Enums/MigrationResult.cs
- Common/DTS.CommonCore/Enums/SLICE6MulticastProperties.cs
- Common/DTS.CommonCore/Enums/RibbonTabNames.cs
- Common/DTS.CommonCore/Enums/IsoSupportLevels.cs
- Common/DTS.CommonCore/Enums/ImportFormats.cs
- Common/DTS.CommonCore/Enums/TabControlOperation.cs
- Common/DTS.CommonCore/Enums/IncludeOverwriteName.cs
- Common/DTS.CommonCore/Enums/RibbonControlOperation.cs
- Common/DTS.CommonCore/Enums/UICultures.cs
- Common/DTS.CommonCore/Enums/T0Mode.cs
- Common/DTS.CommonCore/Enums/VelocityUnit.cs
- Common/DTS.CommonCore/Enums/ImportStatus.cs
- Common/DTS.CommonCore/Enums/IsoViewMode.cs
- Common/DTS.CommonCore/Enums/PopupWindowImage.cs
- Common/DTS.CommonCore/Enums/UIItemStatus.cs
- Common/DTS.CommonCore/Enums/DigitalOutputs.cs
- Common/DTS.CommonCore/Enums/DigitalInputs.cs
- Common/DTS.CommonCore/Enums/DataFlag.cs
- Common/DTS.CommonCore/Enums/Squibs.cs
- Common/DTS.CommonCore/Enums/SupportedExportFormatBitFlags.cs
- Common/DTS.CommonCore/Enums/UartBaudRate.cs
- Common/DTS.CommonCore/Enums/EnumBindingSourceExtension.cs
- Common/DTS.CommonCore/Enums/UDPStreamProfile.cs
- Common/DTS.CommonCore/Enums/ExcitationVoltageOptions.cs
- Common/DTS.CommonCore/Enums/RecordingModes.cs
- Common/DTS.CommonCore/Enums/ApplicationStatusTypes.cs
- Common/DTS.CommonCore/Enums/ExportHeaderLine.cs
- Common/DTS.CommonCore/Enums/StreamDigitalFilterTypes.cs
- Common/DTS.CommonCore/Enums/CFCFilter.cs
- Common/DTS.CommonCore/Enums/ClockSource.cs
generated_at: "2026-04-16T02:13:09.317699+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b809df2688f575c2"
---
# DTS.CommonCore Enums Module Documentation
## 1. Purpose
This module defines a comprehensive set of enumerations used throughout the DTS (Data Acquisition and Test System) codebase to represent system states, configuration options, data formats, and hardware capabilities. It serves as a centralized source of truth for typed constants, enabling type safety, consistent behavior across modules, and UI integration (e.g., via `EnumDescriptionTypeConverter` and `EnumBindingSourceExtension`). These enums are foundational for configuration, data processing, device communication, and user interface rendering.
## 2. Public Interface
### Enums (No classes or methods are public *functions*; only types and static members)
#### Core Data & Communication
- `GPSSentenceTypes`: Specifies supported GPS NMEA sentence types: `GPGGA`, `GPRMC`.
- `UartDataFormat`: Defines UART data formats: `Binary`, `PlainText`, `NMEA`.
- `UartBaudRate`: Enumerates standard UART baud rates (e.g., `_9600 = 9600`, `_115200 = 115200`) as `uint`.
- `UDPStreamProfile`: Defines UDP streaming profiles for S6A devices (e.g., `RTCStreaming`, `DTS_UDP`, `CH10_MANUAL_CONFIG`, `UART_STREAM`), typed as `byte`.
- `SLICE6Properties`: Specifies SLICE6 multicast autodiscovery properties: `SLICE6MulticastAddress`, `SLICE6MulticastCommandPort`, `SLICE6MulticastResponsePort`.
#### Import/Export & Data Formats
- `ImportFormats`: Defines supported import file formats (e.g., `DTS_XML`, `ISF`, `TSF`, `CrashDesigner_XML`, `E2X`), values 19.
- `ImportExtraStatus`: Tracks detailed import progress states (e.g., `ReadingChannels`, `ReadingCalibrations`, `NormalizingIds`).
- `PossibleStatus`: High-level import status states: `Waiting`, `Working`, `Done`, `Failed`, `Reading`, `Importing`.
- `SupportedExportFormatBitFlags`: Bitwise flags for export formats (e.g., `csvunfiltered = 0x1`, `isounfiltered = 0x4`, `HDFMV = 0x40000`, `Ch10FilteredEU = 0x1000000`). Marked with `[Flags]`.
- `FtssHeaderLine` / `XLSXExportHeaderLine`: Header line constants for CSV and XLSX exports (e.g., `TestDate`, `SampleRate`, `EngineeringUnits`). Each has `[Description]` attribute for display text.
#### Configuration & Setup
- `RecordingModes`: Lists all supported DAS recording modes (e.g., `CircularBuffer`, `Recorder`, `S6A_DeviceStreamingOnly`, `MultipleEventActive`, `Scheduled`, `Streaming`). Over 30 values.
- `NonStreamingRecordingModeItemsSource`: Concrete `RecordingModeItemsSource` subclass that filters to non-streaming modes.
- `RecordingModeItemsSource`: Abstract base class for populating UI item sources from `RecordingModes[]`.
- `ClockSyncProfile`: Defines clock synchronization profiles (e.g., `Manual`, `Slave_E2E`, `Master_E2E_GPS`, `IRIG`, `EXT_PPS`, `GPS_PPS_OUT`). Values span `byte` range (0255).
- `InputClockSource`: Bitwise flags for input clock sources (`PTP`, `IRIG`, `GPS`, `1PPS`, and combinations).
- `OutputClockSource`: Bitwise flags for output clock sources (e.g., `PTPMasterE2E`, `OnePPS`, `PTPMasterE2E_OnePPS`).
- `T0Mode`: Defines T0 trigger modes: `DAS = 0`, `Test = 1`.
- `VelocityUnit`: Velocity units: `KilometerPerHour = 0`, `MeterPerSecond = 1`.
- `IsoSupportLevels`: ISO channel support levels: `ISO_ONLY`, `TRANSITORY`, `NO_ISO`.
- `IsoViewMode`: View modes for ISO channel display: `ISOOnly`, `ISOAndUserCode`, `UserCodeOnly`, `ChannelNameOnly`.
- `IsoViewModeStatic`: Abstract static class holding current `IsoViewMode` (`public static IsoViewMode ViewMode { get; set; }`).
- `ExcitationVoltageOptions.ExcitationVoltageOption`: Excitation voltage options (e.g., `Volt2 = 2`, `Volt5 = 16`, `Volt10 = 32`) with `[VoltageMagnitude]` attribute.
- `ExcitationVoltageOptions.VoltageMagnitudeAttribute`: Custom attribute storing voltage magnitude (`double Value`).
- `ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder`: Helper class to extract magnitude values.
#### Digital I/O & Sensors
- `DigitalInputModes`: Digital input modes (bitwise flags): `NONE`, `TLH`, `THL`, `CCNO`, `CCNC`.
- `DigitalOutputModes`: Digital output modes (bitwise flags): `NONE`, `FVLH`, `FVHL`, `CCNO`, `CCNC`.
- `SquibMeasurementType`: Squib measurement options (bitwise flags): `NONE`, `CURRENT`, `INIT_SIGNAL`, `VOLTAGE`.
- `SquibFireMode`: Squib firing modes (bitwise flags): `NONE`, `CAP`, `CONSTANT`, `AC`.
#### Data Quality & Processing
- `DataFlag`: Data quality flags: `None`, `Normal`, `Saturated`, `ZeroCrossing`, `BrokenWire`, `Other`.
- `CFCFilter`: Software filter classes (CFC = Composite Functional Characteristic): `None`, `Unfiltered`, `Class10 = 17`, `Class60 = 100`, `Class180 = 300`, `Class600 = 1000`, `Class1000 = 1650`.
- `CFCFilterDTSFileStringConverter`: Static utility class for converting between `CFCFilter` enum and string representations (e.g., `"CFC 10"`, `"Q"`, `"0"`).
- `StreamDigitalFilterTypes`: DSP filter profiles for S6A streaming (e.g., `NO_DSP_FILTER`, `CH10_IIR_6TH_OPTION_80X`, `ALL_RT_FIR_45T65T_OPTION_80X`).
#### UI & Localization
- `UICultures`: Supported UI languages (e.g., `en_US`, `de_DE`, `ja_JP`) with `[DescriptionResource]` attributes.
- `PopupWindowImage`: Popup dialog icon types: `Warning`, `Error`, `Question`, `Information`.
- `UIItemStatus`: UI status indicators: `None`, `Success`, `Failed`, `Error`, `Warning`.
- `SelectedItemsStatus`: Abstract static class managing per-object updating state via `SetUpdating(object, bool)` and `GetUpdating(object)`.
- `RibbonTabNames`: Static class with tab name constants (`Tab1`, `Tab2`, `Tab3`), all currently `"TBD"`.
- `TabControlOperation`: Tab control operations: `AddedItem`, `RemovedItem`.
- `RibbonControlOperation`: Ribbon control operations: `AddedItem`, `RemovedItem`.
- `ScriptTypes`: Script execution types: `Migration`, `Initialization`.
- `InitializationTypes`: Initialization script types: `Aero`, `Crash`, `TSRAIR`.
- `StringReplacementMode`: String replacement modes: `All`, `First`, `Last`.
- `MigrationResult`: Migration operation results: `OK`, `ExceptionThrown`, `WarningAllowStreamingModesWasNotMigrated`.
- `IncludeOverwriteName`: UI control states: `IncludedCheckBox`, `OverwriteCheckBox`, `ImportingTestSetupName`.
- `ExportChoices`: Export configuration options: `ExportType`, `UnfilteredEUCheckBox`, `FilteredEUCheckBox`, `MVCheckBox`, `ADCCheckBox`.
#### Extension & Helpers
- `EnumBindingSourceExtension`: WPF `MarkupExtension` for binding to enum values in XAML. Validates enum type and returns values (including `null` for nullable enums).
- `HeaderLineExtension.GetDescription(Enum)`: Extension method to retrieve `[Description]` attribute text from any enum.
## 3. Invariants
- **Bitwise Flags**: Enums marked `[Flags]` (`SupportedExportFormatBitFlags`) and those with explicit bit-shifted values (`DigitalInputModes`, `DigitalOutputModes`, `SquibMeasurementType`, `SquibFireMode`, `InputClockSource`, `OutputClockSource`) must be combined using bitwise OR (`|`) and checked with bitwise AND (`&`).
- **Numeric Values**: `UartBaudRate` values are strictly `uint` and match standard baud rates (e.g., `_9600 = 9600`). `ClockSyncProfile` values are `byte` and span 0255, with reserved ranges commented out.
- **Enum Descriptions**: Enums with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` rely on resource strings (via `[Description]` or `[DescriptionResource]`) for UI display. The converter must be registered in XAML or code-behind.
- **CFC Filter Values**: `CFCFilter` uses non-sequential integer values (e.g., `Class10 = 17`, `Class60 = 100`) for compatibility with legacy DTS file formats; conversion utilities (`CFCFilterDTSFileStringConverter`) must be used for serialization/deserialization.
- **Static State**: `IsoViewModeStatic.ViewMode` holds a *copy* of the DB value; it is not automatically synchronized. `SelectedItemsStatus` uses thread-safe locking (`lock(MyLock)`) for its internal dictionary.
- **Null Handling**: `CFCFilterDTSFileStringConverter.GetFilterFromString` returns `CFCFilter.Unfiltered` for null/empty input or unrecognized strings.
## 4. Dependencies
### Dependencies *of* this module:
- **DTS.Common.Converters**: Used by `EnumDescriptionTypeConverter` (applied to many enums).
- **DTS.Common.Base.Classes**: Used by `IItemsSource` implementations (e.g., `T0ModeItemSource`, `RecordingModeItemsSource`, `ProfileSourceItemsSource`).
- **DTS.Common.Utils**: Used by `EnumUtil.GetValuesList<T>()` (e.g., in `T0ModeItemSource`, `CFCFilterItemSource`).
- **System.ComponentModel**: Provides `DescriptionAttribute`, `TypeConverter`.
- **Xceed.Wpf.Toolkit.PropertyGrid.Attributes**: Provides `IItemsSource` and `ItemCollection` for property grid integration.
- **System.Windows.Markup**: Required for `EnumBindingSourceExtension` (WPF markup extension).
- **DTS.Common.Enums.Sensors**, **DTS.Common.Interface.Sensors.SoftwareFilters**: Referenced by `CFCFilter` for `IFilterClass` conversion.
### Dependencies *on* this module:
- **DTS.CommonCore** (other modules): All enums are in `DTS.Common.Enums` namespace and are widely referenced across the codebase for configuration, state management, and UI binding.
- **UI Layer**: WPF bindings use `EnumBindingSourceExtension` and `EnumDescriptionTypeConverter` for dropdowns and labels.
## 5. Gotchas
- **Reserved Enum Values**: `ClockSyncProfile` has commented-out P2P profiles (e.g., `Slave_P2P`, `Master_P2P`) and reserved ranges (`_TDB_*`), indicating future work or device-specific support not yet implemented.
- **CFC Filter String Conversion**: `CFCFilterDTSFileStringConverter.GetIsoCodeFromString` and `CFCFilterToCFC` use single-letter codes (`"Q"`, `"D"`, `"C"`, `"B"`, `"A"`, `"P"`, `"S"`, `"0"`) for ISO channel codes—these must be matched exactly in downstream systems.
- **`UICultures` Resource Keys**: `[DescriptionResource]` attributes reference keys like `"UICultures_en-US"`; these must exist in the application's resource files.
- **`RibbonTabNames`**: All tab names are `"TBD"`; this is likely placeholder code.
- **`T0ModeItemSource`/`CFCFilterItemSource`**: These `IItemsSource` implementations use `EnumUtil.GetValuesList<T>()`—ensure `EnumUtil` is available and correctly implemented.
- **`SelectedItemsStatus`**: Uses `Dictionary<object, bool>`; key objects must be stable (e.g., not recreated instances) to maintain state correctly.
- **`IsoViewModeStatic`**: The static `ViewMode` property is *not* persisted or synchronized with the database; it must be explicitly set and cleared by consumers.
- **`ExcitationVoltageOptions`**: The `VoltageMagnitudeAttributeCoder` is a generic helper—ensure `AttributeCoder<TEnum, TAttr, TValue>` is defined and functional.
- **`EnumBindingSourceExtension`**: For nullable enums, it prepends `null` to the value array; consumers must handle this case.
- **`HeaderLineExtension.GetDescription`**: Falls back to `enum.ToString()` if no `[Description]` attribute is found—ensure all enums used in headers have descriptions.

View File

@@ -0,0 +1,66 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Channels/ChannelCodeType.cs
generated_at: "2026-04-16T02:44:43.138694+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "de8650eabd4f19a6"
---
# Channels
### **Purpose**
This module defines shared enumerations and constants related to channel code types within the DTS system. It standardizes the representation and validation of channel codes—specifically distinguishing between standardized ISO 13499-compliant codes and custom user-defined codes—ensuring consistency across modules that handle channel identification and data exchange.
---
### **Public Interface**
All members are defined in the nested `ChannelCodeType` enum and constant fields inside the `ChannelEnumsAndConstants` class:
- **`ChannelEnumsAndConstants.ChannelCodeType`**
*Type:* `enum`
*Values:*
- `ISO` — Represents an ISO 13499-compliant channel code.
- `User` — Represents a user-defined channel code.
- **`ChannelEnumsAndConstants.IsoCodeTypeString`**
*Type:* `const string`
*Value:* `"ISO 13499"`
*Purpose:* Human-readable identifier for the ISO channel code type; likely used for serialization, logging, or UI display.
- **`ChannelEnumsAndConstants.UserCodeTypeString`**
*Type:* `const string`
*Value:* `"User"`
*Purpose:* Human-readable identifier for the user-defined channel code type.
- **`ChannelEnumsAndConstants.ISO_CODE_LENGTH`**
*Type:* `const int`
*Value:* `16`
*Purpose:* Expected fixed length (in characters) of an ISO-compliant channel code string.
- **`ChannelEnumsAndConstants.USER_CODE_LENGTH`**
*Type:* `const int`
*Value:* `50`
*Purpose:* Maximum allowed length (in characters) of a user-defined channel code string.
---
### **Invariants**
- A channel code string of type `ISO` **must** be exactly `16` characters long (`ISO_CODE_LENGTH`).
- A channel code string of type `User` **must not exceed** `50` characters (`USER_CODE_LENGTH`).
- The enum `ChannelCodeType` has only two valid values: `ISO` and `User`. No other states are defined.
- The string constants `IsoCodeTypeString` and `UserCodeTypeString` are fixed and must not be modified at runtime.
---
### **Dependencies**
- **Internal:** Depends only on core .NET types (`string`, `int`, `enum`). No external NuGet or third-party dependencies.
- **Consumers:** Likely referenced by modules handling channel configuration, message parsing, or data validation (e.g., serialization/deserialization logic, UI components, or database mapping layers). The namespace `DTS.Common.Enums.Channels` suggests it is part of a shared `DTS.CommonCore` library used across multiple components.
---
### **Gotchas**
- The `ChannelCodeType` enum is defined *inside* a class (`ChannelEnumsAndConstants`) rather than as a top-level type—this is unconventional for enums and may cause confusion (e.g., `ChannelEnumsAndConstants.ChannelCodeType` vs. `ChannelCodeType`).
- No validation logic is provided in this module; consumers must enforce length constraints (`ISO_CODE_LENGTH`, `USER_CODE_LENGTH`) themselves.
- The `IsoCodeTypeString` and `UserCodeTypeString` values are hardcoded strings; mismatched usage (e.g., `"ISO"` instead of `"ISO 13499"`) could cause interoperability issues if external systems expect exact string matches.
- No documentation is provided on how `ChannelCodeType` maps to actual channel code strings (e.g., encoding scheme for ISO codes).

View File

@@ -0,0 +1,47 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Communication/CommunicationConstantsAndEnums.cs
generated_at: "2026-04-16T02:44:19.261971+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "fb3a2f656d5788aa"
---
# Communication
## 1. Purpose
This module defines core enumerations and delegates used for representing the outcomes and callback mechanisms of communication operations within the DTS system. It serves as a shared contract between communication implementations (e.g., network, serial, or custom transport layers) and higher-level consumers, enabling consistent reporting of connection, disconnection, send, receive, and cancellation states. The `CommunicationResult` enum standardizes status reporting, while the `CommunicationCallback` delegate provides a standardized way to handle asynchronous or event-driven communication reports.
## 2. Public Interface
### `CommunicationResult` enum
A set of named constants representing the possible outcomes of communication operations:
- `ConnectOK`, `ConnectFailed`, `ConnectTimeout` — outcomes for connection attempts
- `DisconnectOK`, `DisconnectFailed`, `DisconnectTimeout` — outcomes for disconnection attempts
- `SendOK`, `SendFailed`, `SendTimeout` — outcomes for send operations
- `ReceiveOK`, `ReceiveFailed`, `ReceiveTimeout` — outcomes for receive operations
- `Canceled` — indicates an operation was canceled (e.g., via cancellation token)
### `CommunicationCallback` delegate
```csharp
public delegate bool CommunicationCallback(ICommunicationReport report);
```
A callback function type used to process `ICommunicationReport` instances. It returns `true` to indicate the callback handled the report successfully or wishes to continue processing, and `false` to signal termination or failure. The actual behavior of the callback (e.g., logging, UI update, state transition) is implementation-defined, but the delegate contract requires a boolean return value.
## 3. Invariants
- The `CommunicationResult` enum values are exhaustive for the categories of operations: connect, disconnect, send, receive, and cancellation. No other result codes are defined in this module.
- The `CommunicationCallback` delegate must accept an `ICommunicationReport` parameter (from `DTS.Common.Interface.Communication`) and return a `bool`. The semantics of the return value are *not* defined in this file and must be inferred from usage or documentation of the calling code.
- No runtime validation or enforcement is performed on the enum values or callback invocations within this module — it is purely a definition layer.
## 4. Dependencies
- **Depends on**:
- `DTS.Common.Interface.Communication` namespace (specifically for `ICommunicationReport` used in `CommunicationCallback`).
- **Used by**:
- Any module implementing or consuming communication operations (e.g., transport layer implementations, communication managers, UI components).
- The `ICommunicationReport` interface (from the `DTS.Common.Interface.Communication` namespace) must be defined elsewhere; this module assumes its existence and contract.
## 5. Gotchas
- The `CommunicationCallback` return value semantics (`true`/`false`) are not specified in this file — callers and implementers must coordinate on interpretation (e.g., `false` may mean “stop processing” or “retry failed” depending on context).
- The `Canceled` result is distinct from timeout/failure modes but does not imply *why* it was canceled (e.g., user action, timeout, resource exhaustion).
- No constants (e.g., timeout durations, buffer sizes) are defined in this file despite the class name `CommunicationConstantsAndEnums` — only the `CommunicationResult` enum and `CommunicationCallback` delegate are present.
- None identified from source alone.

View File

@@ -0,0 +1,196 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DASFactory/WakeupTriggers.cs
- Common/DTS.CommonCore/Enums/DASFactory/UseCasesTSRAIR.cs
- Common/DTS.CommonCore/Enums/DASFactory/S6DBDiagnosticChannelList.cs
- Common/DTS.CommonCore/Enums/DASFactory/ConstantsAndEnums.cs
- Common/DTS.CommonCore/Enums/DASFactory/DFConstantsAndEnums.cs
generated_at: "2026-04-16T02:44:53.233679+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "79cc4aa25a4a023c"
---
# DASFactory Enums Module Documentation
## 1. Purpose
This module (`DTS.Common.Enums.DASFactory`) defines core enumerations, constants, and extension methods used across the DAS (Data Acquisition System) Factory product line. It serves as a centralized source of truth for device type identifiers, recording modes, channel configurations, diagnostic channels, and protocol-related flags. These definitions enable consistent behavior across modules handling device communication, configuration, diagnostics, and data acquisition workflows. The module supports legacy and modern device families (e.g., SLICE, TSR, TSR AIR, S6DB, TDAS) and includes mappings between internal and external enum representations.
## 2. Public Interface
### Enumerations
#### `WakeupTriggers`
- **Definition**: `public enum WakeupTriggers`
- **Values**:
- `MotionDetect`: Triggered by motion detection.
- **Attributes**: Uses `EnumDescriptionTypeConverter` for localized descriptions.
#### `UseCasesTSRAIR`
- **Definition**: `public enum UseCasesTSRAIR : byte`
- **Values**:
- `AEROSPACE`
- `AEROSPACE_with_motion`
- `VIBRATION`
- `SCHEDULED`
- `INTERVAL`
- `STREAMING`
- `PRETRIGGER_TEST`
- **Attributes**: Uses `EnumDescriptionTypeConverter`.
#### `S6DBDiagnosticChannelList`
- **Definition**: `public enum S6DBDiagnosticChannelList`
- **Values**:
- `InputVoltage = 0`
- `BackupVoltage = 1`
- `TemperatureC = 2`
- `BatterySoc = 3`
- `DiagInputVoltage = 100`
- `DiagMcuTemperature = 101`
- `DiagChargerPower = 102`
- `DiagChargerInputCurrent = 103`
- `DiagEnv_1_Temperature = 104`
- `DiagEnv_1_Humidity = 105`
- `DiagEnv_2_Temperature = 106`
- `DiagEnv_2_Humidity = 107`
- `DiagEnv_3_Temperature = 108`
- `DiagEnv_3_Humidity = 109`
- `DiagEnv_4_Temperature = 110`
- `DiagEnv_4_Humidity = 111`
- `DiagEnv_5_Temperature = 112`
- `DiagEnv_5_Humidity = 113`
- `DiagBatterySoc = 114`
- `DiagBatteryPackVoltage = 115`
- `DiagBatteryPackCurrent = 116`
- `DiagBatteryFgTemperature = 117`
- `DiagBatteryThermistor1Temperature = 118`
- `DiagBatteryThermistor2Temperature = 119`
- **Note**: Values 03 are legacy base channels; 100+ are additional diagnostic channels.
#### `ConstantsAndEnums.DASType`
- **Definition**: `public enum DASType` (nested in `ConstantsAndEnums`)
- **Values**: Includes `NONE`, `HID_SLICE`, `WINUSB_SLICE`, `G5`, `SIM`, `TOM`, `DIM`, `TSR`, `HEADS`, `MINIDAU`, `ETHERNET_SLICE`, `ETHERNET_RIBEYE`, `SLICE_DB`, `TSR2`, `ETHERNET_TDAS`, `CDCUSB_SLICE`, `ETHERNET_SLICE2`, `WINUSB_SLICE1_5`, `ETHERNET_SLICE1_5`, `ETHERNET_SLICE6`, `ETHERNET_SLICE6AIR`, `WINUSB_SLICE6`, `WINUSB_SLICE6AIR`, `ETHERNET_SLICE6DB`, `SERIAL_TDAS`, and others.
- **Purpose**: Identifies device hardware type.
#### `ConstantsAndEnums.VoltageStatusColor`
- **Definition**: `public enum VoltageStatusColor`
- **Values**: `Green`, `Red`, `Yellow`, `Off`
#### Constants in `ConstantsAndEnums`
- `EVENT_NUMBER_PRETEST_DIAG = -1`
- `EVENT_NUMBER_POSTTEST_DIAG = -2`
- `EVENT_NUMBER_MEASURE_BRIDGE = -3`
#### `DFConstantsAndEnums` Static Properties & Methods
- `AlwaysShowUnsignedADC`: `bool` (default `false`)
- `OneShotWaitTimeMs`: `int` (default `3000`)
- `TemperatureLogTimeFormat`: `string` (default `"MM-dd-yyyy HH:mm:ss"`)
- `TemperatureLogValueFormat`: `string` (default `"N2"`)
- `TSR_AIR_HIGH_G_CUTOFF_RATE_SPS`: `int` (value `500`)
- `TSRAIR_ValidSampleRates`: `int[]` (values: `[100, 500, 1000, 5000, 10000, 15000, 20000]`)
- `UseDropDownForTestObjectAndPosition`: `bool` (default `false`)
- `AllowEnableFaultCheckingOnS6DB`: `bool` (default `true`)
- `TDASRemoveOffsetWeighting`: `double` (default `1.0`)
- `TDASShuntEmulationWeighting`: `double` (default `0.5`)
- `ExpectedMaxTDASDiagnosticRunTimePerChannelMS`: `int` (default `8000`)
- `IsSLICE6ERFirmware(string firmwareVersion)`: `bool` — Returns `true` if firmware version ends with `"G1"` or `"G3"` (indicating EDR firmware).
- `UseUDPForAutoArmATDMonitor`: `bool` (default `false`)
- `ArmStateIdle = 0`: `byte`
- `MADEUPEVENT_TESTID = "__MadeUp__"`: `string`
- `NO_CONFIGURATION = "NO_CONFIGURATION"`: `string`
- `TOMSWITCH_ARMED = "TOMSAFETY_ARMED"`: `string`
- `SAFETYSWITCH_EXCEPTION = "SAFETYSWITCH_EXCEPTION"`: `string`
- `CHANNEL_SEPARATOR = "_"`: `string`
- `SERIAL_SEPARATOR = "-"`: `string`
- Serial append strings (e.g., `LOWG_SERIAL_APPEND = "Low g"`, `HIGHG_SERIAL_APPEND = "High g"`, etc.)
- Channel index constants: `CHANNEL_X = 0`, `CHANNEL_Y = 1`, `CHANNEL_Z = 2`, `CHANNEL_TEMPERATURE = 0`, `CHANNEL_HUMIDITY = 1`, `CHANNEL_PRESSURE = 2`
- User channel names: `USER_CHANNEL_NAME_LOWG`, `USER_CHANNEL_NAME_HIGHG`, etc.
- `ExtraCommunicationLogging`: `bool` (default `false`)
- `ReceiveBufferSizeBytes`: `int` (default `65536`)
- `SendBufferSizeBytes`: `int` (default `65536`)
- `RemoteKeepAliveSeconds`: `uint` (default `60`)
- `RemoteKeepAliveRetryIntervalSeconds`: `uint` (default `5`)
- `LocalKeepAliveTimeOutMS`: `uint` (default `5000`)
- `LocalKeepAliveRetryIntervalMS`: `uint` (default `1000`)
- `HeartbeatAsyncConnectTimeoutMS`: `int` (default `10000`)
- `WaitTimeBetweenUnitConnects`: `int` (default `100`)
- `DontDoSDL`: `bool` (default `false`)
- `SCHEDULE_AHEAD_IN_MINUTES = 2`: `int`
- High-g sensor indices: `High_g_Linear_1_Index = 3`, `High_g_Linear_2_Index = 4`, `High_g_Linear_3_Index = 5`
- `RealtimeUDPAddress`: `string` (default `"UDP://239.1.2.10:8400"`)
- `FIRST_USE_DATE_NOT_SET`: `DateTime` (value: `SqlDateTime.MinValue`)
#### `DFConstantsAndEnums` Enumerations
- `FaultFlags` ([Flags] enum): Bitwise flags for legacy SLICE 1 ARM status faults (e.g., `IncomingStatusLineDropped = 1 << 0`, `ADCBufferOverrun = 1 << 1`, ..., `NO_DATA = 1 << 13`)
- `ExcitationStatus`: `Off`, `On`, `Unknown`
- `T0CorrectionStatus`: `ScanningForPowerLoss`, `ScanningForPeaksAndTroughs`, `SettingAttributes`
- `ModuleType`: Lists module types (e.g., `SliceBridge`, `G5Analog`, `EmbeddedLinearAccelHighG`, `UART`, `StreamOut`, etc.)
- `RecordingMode`: Full list of recording modes (e.g., `CircularBuffer`, `RecorderMode`, `AutoActiveMode`, `Aerospace`, `Scheduled`, `Streaming`, `RAMActive`, `a14_NormalRecorderAndStreamSubSampleMode`, etc.) with descriptions and hex values.
- `TiltAxes`: 48-axis orientation configurations for Slice 6 Bubble level tilt feature (e.g., `XYZ = 0`, `XYIZ = 6`, `IXYIZ = 30`, etc.)
- `ConfigMode`: Channel configuration modes (`Disabled`, `Normal`, `DummyArm`, `Clock`, `UART`, `StreamOut`, `StreamIn`)
- `MultiCastDeviceClasses`: [Flags] enum for device classes in UDP broadcast (e.g., `Slice6 = 1 << 0`, `SDB = 1 << 1`, ..., `NextOne = 1 << 10`, `Any = 0xFFFF`)
- `ProtocolLimitedCommands`: List of commands limited by protocol version (e.g., `DiangosShuntDAC`, `Arm`, `Diagnostics`, `SetUARTSettings`, etc.)
- `CommandStatus`: Comprehensive set of command status codes (e.g., `StatusNoError = 0x00`, `StatusInvalidParameter`, ..., `StatusNoResponse`)
- `QATSExtendedFault`: [Flags] enum for extended fault reporting (e.g., `EXT_FAULT_TYPE_STATUSLINE_PORT_1_DROPPED`, `FAULT_FLAG__DEVICE__KX134`, `EXT_FAULT_TYPE_STATUSLINE_SUPER_CAP`, etc.)
- `TMAT_TEMPLATES`: TMAT template identifiers (e.g., `S6Air_PCM`, `TSRAIR_ANALOG`)
#### Extension Methods in `RecordingModeExtensions`
- `UsesTestLength(RecordingModes mode)`: Returns `true` if mode uses test length (e.g., `Recorder`, `Scheduled`, `Interval`)
- `IsTSRAIROnlyRecordingMode(RecordingModes mode)`: Returns `true` for `Active`, `MultipleEventActive`, `Scheduled`, `Interval`
- `IsTSRAirRecordingMode(RecordingModes mode)`: Returns `true` for `Active`, `MultipleEventActive`, `Scheduled`, `Interval`, `Streaming`
- `SupportsT0Correction(DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for circular buffer or hybrid recorder modes
- `ToRecordingModesAlt(DFConstantsAndEnums.RecordingMode mode)`: Maps to `RecordingModes` via alternate lookup
- `ToRecordingModes(DFConstantsAndEnums.RecordingMode mode)`: Maps to `RecordingModes` (fallback: `CircularBuffer`)
- `FromRecordingModes(this RecordingModes mode)`: Maps `RecordingModes``DFConstantsAndEnums.RecordingMode`
- `IsACircularBufferMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for circular buffer variants
- `DoesModeSupportAutoArm(RecordingModes mode)`: Returns `false` for `Active`, `MultipleEventActive`, `Scheduled`, `Interval`, `Streaming`
- `IsARecorderMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for recorder variants
- `IsAHybridRecorderMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for hybrid recorder variants
- `IsAMultipleEvent(RecordingModes mode)`: Returns `true` for multiple-event modes
- `CanBeAMultipleEvent(RecordingModes mode)`: Returns `true` if mode supports multiple-event capability
- `IsAStreamMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for streaming modes
- `TestWillBeStreaming(RecordingModes recordingMode, bool streaming)`: Returns `true` if mode is streaming or `streaming` flag is set
- `IsAUartMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for UART-enabled modes
- `IsAnOpenEndedRecordingMode(RecordingModes/DFConstantsAndEnums.RecordingMode mode)`: Returns `true` for open-ended modes (e.g., `ContinuousRecorder`, `RecordOnBoot`)
## 3. Invariants
- **Enum Values Are Fixed**: All enum values are explicitly assigned and must not be changed without coordination across firmware and host software.
- **`DASType` Duplication**: `DASType` is defined in both `ConstantsAndEnums` and `DFConstantsAndEnums`. The latter is the canonical version (includes more entries like `ETHERNET_TSR_AIR`, `WINUSB_TSR_AIR`, etc.).
- **`RecordingMode` Value Mapping**: The mapping between `DFConstantsAndEnums.RecordingMode` and `RecordingModes` is bi-directional and must be kept consistent. Extension methods (`ToRecordingModes`, `FromRecordingModes`) enforce this.
- **`RecordingModes` Values Are Not Reused**: Each `RecordingModes` value maps to exactly one `DFConstantsAndEnums.RecordingMode` and vice versa.
- **`WakeupTriggers` Has One Value**: Only `MotionDetect` is defined; no other triggers are supported.
- **`S6DBDiagnosticChannelList` Channel Ranges**: Base diagnostic channels (03) and extended channels (100+) are disjoint and non-overlapping.
- **`FaultFlags` Is a Flags Enum**: Values are powers of two and combinable via bitwise OR.
## 4. Dependencies
### Dependencies *of* this module:
- **`DTS.Common.Base.Classes`**: Used for base classes (imported but not directly used in provided enums).
- **`DTS.Common.Converters`**: Required for `EnumDescriptionTypeConverter` (used in `WakeupTriggers` and `UseCasesTSRAIR`).
- **`System.ComponentModel`**: Required for `[Description]` attribute.
- **`System`**: Core types (`bool`, `int`, `string`, `DateTime`, `HashSet`, `Dictionary`, etc.)
### Dependencies *on* this module:
- **`DASFactory` modules**: All modules that handle device configuration, diagnostics, or communication rely on these enums for:
- Device type identification (`DASType`)
- Recording mode selection (`RecordingMode`)
- Channel configuration (`ConfigMode`)
- Diagnostic channel addressing (`S6DBDiagnosticChannelList`)
- Protocol command/status handling (`CommandStatus`, `ProtocolLimitedCommands`)
- TSR AIR-specific behavior (`UseCasesTSRAIR`, `TSR_AIR_HIGH_G_CUTOFF_RATE_SPS`, `TSRAIR_ValidSampleRates`)
## 5. Gotchas
- **`DASType` Duplication**: `DASType` is defined in both `ConstantsAndEnums` and `DFConstantsAndEnums`. The latter is the extended version and should be preferred.
- **`RecordingMode` Value Conflicts**: Some `DFConstantsAndEnums.RecordingMode` values map to the same `RecordingModes` value (e.g., `AutoActiveMode` and `Aerospace` both map to `RecordingModes.Active`). This is intentional per comments.
- **`Interval` vs `Scheduled`**: `RecordingModes.Interval` maps to `DFConstantsAndEnums.RecordingMode.Scheduled`, but `DFConstantsAndEnums.RecordingMode.Interval` maps to `RecordingModes.Interval`. This asymmetry may cause confusion.
- **`T0Correction` Support**: Only circular buffer and hybrid recorder modes support T0 correction. Other modes (e.g., `RecorderMode`) do not.
- **`IsTSRAIROnlyRecordingMode` Excludes `Streaming`**: While `Streaming` is a TSR AIR mode, it is not considered "TSR AIR only" per this method.
- **`NO_CONFIGURATION` vs `NO_DATA`**: `NO_CONFIGURATION` (`"NO_CONFIGURATION"`) indicates missing config on device; `NO_DATA` (`1 << 13` in `FaultFlags`) is a runtime fault flag.
- **`FIRST_USE_DATE_NOT_SET`**: Uses `SqlDateTime.MinValue`, not `DateTime.MinValue`, to represent unset date.
- **`IsSLICE6ERFirmware` Logic**: Relies on firmware version string ending with 4-character token starting with `"G1"` or `"G3"`. May break if version format changes.
- **`S6DBDiagnosticChannelList.DiagEnv_X_Temperature` Off-by-One**: `DiagEnv_1_Temperature = 104`, but `DiagChargerDischargeCurrent = 104` is commented out. Ensure no active code uses the old value.
- **`RecordingModeExtensions` Uses `RecordingModes`**: The extension methods operate on `RecordingModes`, not `DFConstantsAndEnums.RecordingMode`, requiring conversion via `ToRecordingModes`/`FromRecordingModes`.
- **`AlwaysShowUnsignedADC` Is a Static Property**: Its value is not persisted; must be set per-session.

View File

@@ -0,0 +1,99 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DBExport/TestObjectFields.cs
- Common/DTS.CommonCore/Enums/DBExport/CustomDirectionFields.cs
- Common/DTS.CommonCore/Enums/DBExport/CustomFinLoc2Fields.cs
- Common/DTS.CommonCore/Enums/DBExport/CustomFinLoc1Fields.cs
- Common/DTS.CommonCore/Enums/DBExport/CustomFinLoc3Fields.cs
- Common/DTS.CommonCore/Enums/DBExport/CustomFilterFields.cs
- Common/DTS.CommonCore/Enums/DBExport/PositionFields.cs
- Common/DTS.CommonCore/Enums/DBExport/MainLocationFields.cs
- Common/DTS.CommonCore/Enums/DBExport/PhysicalDimensionFields.cs
- Common/DTS.CommonCore/Enums/DBExport/TopLevelFields.cs
generated_at: "2026-04-16T02:43:28.798360+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "fd04c3848328d69e"
---
# Documentation: DBExport Enumerations
## 1. Purpose
This module defines a set of strongly-typed enumerations used to represent field names (tags) for various database-exported objects in XML or structured data formats. These enums serve as canonical identifiers for fields associated with core domain entities—such as test objects, locations (fine and main), filters, positions, physical dimensions, and directions—within the DTS (Data Transfer System) ecosystem. They ensure consistency across serialization/deserialization logic, mapping XML element names or database column aliases to compile-time-safe identifiers, and are likely consumed by data export/import modules (e.g., XML exporters, database mappers, or UI binding layers).
## 2. Public Interface
All public members are `public enum` types in the `DTS.Common.Enums.DBExport` namespace.
### `TestObjectFields`
- **Members**: `s_GUID`, `TEST_OBJECT`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`
- **Purpose**: Represents field names for `ISODll.TestObject` entities.
### `CustomDirectionFields`
- **Members**: `Direction`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.MMEDirection` entities.
### `CustomFinLoc1Fields`
- **Members**: `Date`, `Expired`, `Fine_Loc_1`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.FineLocation1` entities.
### `CustomFinLoc2Fields`
- **Members**: `Date`, `Expired`, `Fine_Loc_2`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.FineLocation2` entities.
### `CustomFinLoc3Fields`
- **Members**: `Date`, `Expired`, `Fine_Loc_3`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.MMEFineLocation3` entities.
### `CustomFilterFields`
- **Members**: `Date`, `Expired`, `Filter_Class`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.MME_FilterClass` entities.
### `PositionFields`
- **Members**: `Date`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Position`, `RecordType`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version`
- **Purpose**: Represents field names for `ISODll.MMEPositions` entities.
### `MainLocationFields`
- **Members**: `Date`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Picture_ShortName`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Trans_Main_Loc`, `Type`, `Version`
- **Purpose**: Represents field names for `ISODll.MMETransducerMainLocation` entities.
### `PhysicalDimensionFields`
- **Members**: `Amount_Of_Substance_EXP`, `Date`, `Default_Unit`, `Electric_Current_EXP`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Length_EXP`, `Luminous_Intensity_Exp`, `Mass_EXP`, `Physical_Dimension`, `RecordType`, `Remarks`, `S_GUID`, `SortKey`, `Temperature_EXP`, `Text_L1`, `Text_L2`, `Time_EXP`, `Version`
- **Purpose**: Represents field names for `ISODll.MMEPhysicalDimension` entities.
### `TopLevelFields`
- **Members**: `CustomerDetails`, `TestEngineerDetails`, `LabDetails`, `DASList`, `SensorModels`, `Sensors`, `Calibrations`, `CustomDirections`, `CustomFilterClasses`, `CustomTestObjects`, `CustomFinLoc1s`, `CustomFinLoc2s`, `CustomFinLoc3s`, `CustomMainLocs`, `CustomPhysicalDimensions`, `CustomPositions`, `CustomChannels`, `GroupTemplates`, `Groups`, `TestSetups`, `Users`, `GlobalSettings`, `SensorChangeHistory`
- **Purpose**: Represents top-level XML element names (root tags) in exported data structures. Includes a comment indicating `SensorChangeHistory` was introduced in version 7.
## 3. Invariants
- **Consistent casing and naming**: All enum members use `PascalCase` for multi-word identifiers (e.g., `Last_Change`, `Fine_Loc_1`, `Amount_Of_Substance_EXP`). Underscores are used to separate words or components (e.g., `Last_Change_Text`, `Electric_Current_EXP`).
- **Field name alignment**: For most entity-specific enums, the following fields appear consistently: `S_GUID`/`GUID`, `DATE`, `VERSION`, `EXPIRED`, `HISTORY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `REMARKS`, `SORTKEY`, `TEXT_L1`, `TEXT_L2`. Notable exceptions:
- `TestObjectFields` uses `s_GUID` (lowercase `s`) instead of `S_GUID`.
- `MainLocationFields` includes `Picture_ShortName`, `Trans_Main_Loc`, and `Type` instead of `Fine_Loc_*` fields.
- `PhysicalDimensionFields` includes SI base unit exponent fields (`Length_EXP`, `Mass_EXP`, etc.) and `Default_Unit`, `RecordType`.
- `PositionFields` includes `RecordType` and `Position`.
- **Top-level enum scope**: `TopLevelFields` enumerates *only* root-level XML elements, not nested fields. Its values map to container elements in the XML schema.
## 4. Dependencies
- **Namespace usage**: All enums reside in `DTS.Common.Enums.DBExport`, implying they are part of a shared `DTS.CommonCore` library.
- **External references (inferred)**: Each enum is explicitly documented as mapping to an `ISODll.*` type (e.g., `ISODll.FineLocation1`, `ISODll.MME_FilterClass`). This suggests a dependency on the `ISODll` native or interop library (likely containing COM or P/Invoke definitions).
- **Consumers (inferred)**: These enums are likely used by:
- XML serialization/deserialization logic (e.g., custom `XmlSerializer`-based exporters/importers).
- Database export modules (e.g., `DTS.Export` or `DTS.DataExport`).
- UI components that bind to field names (e.g., grid column headers, filter builders).
- Code generators or template engines that produce XML schemas or data contracts.
## 5. Gotchas
- **Inconsistent GUID field naming**: `TestObjectFields` uses `s_GUID`, while all other location/filter enums use `S_GUID` or `GUID`. This may cause mismatches if logic assumes uniformity (e.g., case-insensitive matching or pattern-based field resolution).
- **Mixed underscore usage**: Some fields use underscores in the middle (`Last_Change`, `Fine_Loc_1`), while others do not (`Date`, `Version`). This is likely intentional but may confuse developers expecting consistent naming.
- **`S_GUID` vs `GUID`**: `CustomDirectionFields` uses `GUID`, while others use `S_GUID`. This inconsistency could lead to bugs if field resolution is case- or prefix-sensitive.
- **`PhysicalDimensionFields` exponent naming**: Exponent fields use inconsistent casing (`Length_EXP`, `Luminous_Intensity_Exp`, `Electric_Current_EXP`). The last two differ in suffix casing (`_Exp` vs `_EXP`). This may reflect legacy naming or external schema requirements but is error-prone.
- **`TopLevelFields` includes `CustomTestObjects` but no corresponding `TestObjectFields` enum member is named `CustomTestObjects`**: This enum is for *root tags*, not field names, but the naming similarity could cause confusion.
- **No documentation for field semantics**: The enums define *names*, not meanings. For example, `Expired` likely indicates soft-deletion status, but this is not stated. Consumers must infer or reference external documentation.
- **`SensorChangeHistory` comment**: The inline comment `//introduce in V7,` and `//15390 Store the ZMO in EU in the DataPRO DB` suggest a version-specific addition. Developers working with older versions may encounter missing support or unexpected behavior if this enum value is used unconditionally.
None identified beyond the above.

View File

@@ -0,0 +1,78 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DTS.Viewer/ChartOptions/TimeUnitType.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/ChartOptions/FilterOption.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/ChartOptions/YRangeScale.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/ChartOptions/WakeMethodType.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/ChartOptions/ChartUnitType.cs
generated_at: "2026-04-16T02:45:21.946060+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "50e4739cba57afa5"
---
# Chart Options Enumerations Documentation
## 1. Purpose
This module defines a set of strongly-typed enumerations used to configure chart display and behavior in the DTS Viewer application. Each enumeration represents a distinct chart configuration option—such as time unit, filtering strategy, Y-axis scaling, wake-up method, and unit type—and provides associated metadata (e.g., user-facing descriptions) and item source implementations for UI binding (e.g., property grid dropdowns). These enums are part of the `DTS.Common.Enums.Viewer` namespace and serve as foundational configuration primitives for chart rendering and user interaction.
## 2. Public Interface
All public types reside in the `DTS.Common.Enums.Viewer` namespace.
### Enumerations
| Name | Values | Description |
|------|--------|-------------|
| `TimeUnitTypeEnum` | `MS = 0` (displayed as `"ms"`), `Seconds = 1` (displayed as `"Seconds"`) | Specifies the time axis unit for chart display. |
| `FilterOptionEnum` | `Unfiltered = 0` (`"Unfiltered"`), `TestSetupDefault = 1` (`"Test Setup Default"`), `Custom = 2` (`"Custom"`) | Defines the filtering strategy applied to chart data. |
| `YRangeScaleEnum` | `AutoRange = 0` (`"Auto Range"`), `FullScale = 1` (`"% Full Scale"`), `Fixed = 2` (`"Fixed"`), `Manual = 3` (`"Manual"`) | Controls how the Y-axis range is determined for a chart. |
| `WakeMethodTypeEnum` | `None = 0` (`"None"`), `MotionDetect = 1` (`"Motion detect"`), `TimeSession = 2` (`"Time session"`), `Magnet = 3` (`"Magnet"`) | Specifies the method used to trigger or wake a data acquisition session. |
| `ChartUnitTypeEnum` | `EU = 0` (`"EU"`), `mV = 1` (`"mV"`), `ADC = 2` (`"ADC"`), `FFT = 3` (`"FFT"`), `PSD = 4` (`"PSD"`) | Defines the unit type displayed on the Y-axis of a chart. Includes support for FFT and PSD (Power Spectral Density) as noted in inline comments. |
### Item Source Classes
Each enum has a corresponding `IItemsSource` implementation for populating UI controls (e.g., property grid dropdowns). All use `EnumUtil.GetValuesList<T>()` internally.
| Name | Returns | Purpose |
|------|---------|---------|
| `TimeUnitTypeItemSource` | `ItemCollection` of `TimeUnitTypeEnum` values | Provides list of time unit options for UI binding. |
| `FilterOptionEnumItemSource` | `ItemCollection` of `FilterOptionEnum` values | Provides list of filter options for UI binding. |
| `YRangeScaleItemSource` | `ItemCollection` of `YRangeScaleEnum` values | Provides list of Y-axis scaling modes for UI binding. |
| `WakeMethodTypeItemSource` | `ItemCollection` of `WakeMethodTypeEnum` values | Provides list of wake-up methods for UI binding. |
| `ChartUnitTypeItemSource` | `ItemCollection` of `ChartUnitTypeEnum` values | Provides list of chart unit types for UI binding. |
All enums are decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`, indicating they support localized or descriptive string conversion (e.g., for display in UI).
## 3. Invariants
- **Enum values are stable**: The underlying integer values (`0`, `1`, `2`, etc.) are fixed and must not be changed without backward-compatibility review.
- **Descriptions are non-empty**: Each enum member has a `[Description(...)]` attribute with a non-null, non-empty string; this is required for correct UI rendering via `EnumDescriptionTypeConverter`.
- **Item sources are exhaustive**: Each `IItemsSource.GetValues()` implementation returns *all* defined enum values via `EnumUtil.GetValuesList<T>()`, ensuring UI controls show all available options.
- **Namespace consistency**: All types reside in `DTS.Common.Enums.Viewer`; no cross-namespace inheritance or extension is present.
## 4. Dependencies
### Internal Dependencies
- `DTS.Common.Converters.EnumDescriptionTypeConverter`: Used for type conversion (e.g., enum → display string).
- `DTS.Common.Utils.EnumUtil`: Provides `GetValuesList<T>()` for populating `ItemCollection`s.
- `Xceed.Wpf.Toolkit.PropertyGrid.Attributes.IItemsSource`: Interface implemented by item source classes for WPF property grid integration.
### External Dependencies
- `System.ComponentModel`: For `DescriptionAttribute` and `TypeConverterAttribute`.
- `Xceed.Wpf.Toolkit`: For `IItemsSource` and `ItemCollection` types.
### Consumers (Inferred)
- UI components using property grids (e.g., chart configuration panels) likely consume these item sources to populate dropdowns.
- Chart rendering logic likely consumes these enums to configure axis units, scaling, filtering, and time base.
## 5. Gotchas
- **`ChartUnitTypeEnum.FFT` and `PSD` are marked with issue references** (`//6402` and `//25554`), indicating incomplete or future implementation. These values may be present in the enum but lack full runtime support.
- **No validation logic is present in the enums themselves**: The enums are pure data definitions; validation (e.g., ensuring `Custom` filter option has associated parameters) must be handled elsewhere.
- **Descriptions are hard-coded strings**: Changes to `[Description(...)]` values may affect localization or UI consistency if not coordinated across resources.
- **No deprecation markers**: Older enum values (e.g., `TimeUnitTypeEnum.MS`) are not marked obsolete, even if deprecated in practice.
- **No documentation for `EnumDescriptionTypeConverter` behavior**: It is unclear whether descriptions are localized or culture-sensitive—this is implementation-specific to `DTS.Common.Converters`.
None identified beyond the above.

View File

@@ -0,0 +1,37 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DTS.Viewer/Filter/SearchEnum.cs
generated_at: "2026-04-16T02:45:06.628654+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "4c091220b50d19ae"
---
# Filter
1. **Purpose**
This module defines a simple enumeration (`FilterEnum`) used to represent the two supported filter types within the DTS Viewer subsystem: `Test` and `Graph`. It serves as a type-safe mechanism to distinguish between filter categories, likely used in UI components, filtering logic, or configuration handling related to data visualization or test result presentation.
2. **Public Interface**
- **`enum FilterEnum`**
A two-valued enumeration defined in namespace `DTS.Common.Enums.Viewer` with the following members:
- `Test`: Represents a filter type for test-related data or views.
- `Graph`: Represents a filter type for graph-based data or visualizations.
No methods, properties, or additional members are defined on the enum.
3. **Invariants**
- The enum contains exactly two members: `Test` and `Graph`.
- No other values are permitted by the type definition.
- The underlying type is the default `int` (not explicitly specified).
- No runtime validation or additional constraints are enforced by this enum itself.
4. **Dependencies**
- **Depends on**: None (no external imports or references in the source file).
- **Depended on by**: Not visible in this file; likely referenced in other modules (e.g., UI components, filtering services, configuration parsers) within the `DTS.CommonCore` or related assemblies. Based on the namespace (`DTS.Common.Enums.Viewer`), it is part of a shared/common library used across the DTS system.
5. **Gotchas**
- The enum name `FilterEnum` is generic and may be ambiguous without context; consumers must rely on documentation or usage sites to interpret `Test` vs `Graph`.
- No XML documentation comments are present in the source, reducing discoverability of intended semantics.
- The `// ReSharper disable CheckNamespace` directive suggests this file may reside in a non-default folder structure that intentionally overrides the default namespace inference—developers should verify the actual compiled namespace matches expectations.
- None identified from source alone.

View File

@@ -0,0 +1,87 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowAveragingType.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/Reports/PowerSpectralDensity/PassFilterType.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowWidth.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowType.cs
generated_at: "2026-04-16T02:45:34.185690+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "4301849ff5429f6c"
---
# PowerSpectralDensity
## Documentation: Power Spectral Density Configuration Enums
### 1. Purpose
This module defines a set of strongly-typed enumerations used to configure parameters for Power Spectral Density (PSD) analysis in the DTS Viewer reporting system. These enums standardize user-facing display labels and internal representation for key signal processing choices—namely, how frequency-domain data is averaged (`WindowAveragingType`), which analog filter type is applied (`PassFilterType`), the FFT window size (`WindowWidth`), and the time-domain windowing function (`WindowType`). They serve as the canonical source of valid options for PSD configuration UIs and serialization layers, ensuring consistency across client and server components.
### 2. Public Interface
All types are `public enum`s in the `DTS.Common.Enums.Viewer.Reports` namespace. Each enum value is annotated with a `[Description]` attribute (via `System.ComponentModel`) that provides a human-readable label.
- **`WindowAveragingType`**
```csharp
public enum WindowAveragingType
```
Specifies the method used to average spectral estimates across multiple frames/windows.
- `Averaging`: Linear (mean) averaging of spectral magnitudes.
- `PeakHoldMax`: For each frequency bin, retain the maximum magnitude observed across frames.
- `PeakHoldMin`: For each frequency bin, retain the minimum magnitude observed across frames.
- **`PassFilterType`**
```csharp
public enum PassFilterType
```
Specifies the analog filter type used for anti-aliasing or pre-filtering before digitization/FFT.
- `Bessel`: Maximally flat group delay (linear phase).
- `Butterworth`: Maximally flat magnitude response.
- `Chebyshev`: Equiripple behavior in passband (type I).
*Note:* `CriticalDamping` is commented out and not available for use.
- **`WindowWidth`**
```csharp
public enum WindowWidth
```
Specifies the number of samples in the analysis window (i.e., FFT length).
- `FiveTwelve` = 512
- `TenTwentyFour` = 1024
- `TwentyFortyEight` = 2048
- `FortyNinetySix` = 4096
- `EightyOneNinetyTwo` = 8192
- **`WindowType`**
```csharp
public enum WindowType
```
Specifies the time-domain window function applied to data prior to FFT.
- `Rectangle`: No windowing (rectangular window).
- `Hamming`: Minimizes nearest-neighbor sidelobes.
- `Hanning`: Also known as Hann; smooths edges.
- `Blackman`: Low sidelobes, wider main lobe.
- `BlackmanHarris`: Very low sidelobes (4-term).
- `FlatTop`: Minimizes amplitude error for frequency estimation.
### 3. Invariants
- All enum values are explicitly assigned underlying `int` values (via `= N` syntax) **only** for `WindowWidth`; all others use default sequential `int` values starting at 0.
- Each enum value *must* have a `[Description]` attribute; missing descriptions are not permitted in the current implementation.
- `PassFilterType` is *not* extensible at runtime—no mechanism for dynamic addition of filter types exists.
- `CriticalDamping` is commented out and *must not* be used; its presence is explicitly marked as a known technical debt ("REMOVE THIS HACK").
- Enum names use PascalCase, and `[Description]` strings use title case with spaces and hyphens as appropriate (e.g., `"Blackman-Harris"`).
### 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (used via `[TypeConverter]` attribute for UI binding/deserialization).
- `System.ComponentModel` (for `[Description]` and `TypeConverter`).
- **Consumers (inferred)**:
- Likely consumed by UI layers (e.g., WPF/WinForms controls) via the `EnumDescriptionTypeConverter` to render user-friendly labels.
- Likely used in serialization (e.g., JSON, XML) where the `[Description]` value is mapped to/from the enum name.
- Part of a larger `DTS.Common.Enums.Viewer.Reports` hierarchy (suggesting related enums exist for other report types).
### 5. Gotchas
- **`PassFilterType` has a disabled value**: `CriticalDamping` is commented out but not removed. Do *not* assume it is available—attempting to use it will result in invalid state or runtime errors.
- **`WindowWidth` values are powers of two**: All valid values are `2^9` through `2^13`. No validation is enforced at the enum level; callers must ensure input aligns with FFT constraints elsewhere in the system.
- **`Hanning` vs. `Hann`**: The enum uses `Hanning` (a common misspelling), not `Hann`. This may cause confusion if consumers expect standard naming.
- **No `None` or `Auto` option**: All enums require an explicit selection; there is no fallback or default value defined in the enum itself.
- **Description strings are fixed**: Changing `[Description]` values will affect UI text and potentially serialized data contracts.
- **No XML documentation comments**: The source provides no `<summary>` or `<remarks>`—all documentation must be inferred from enum names and `[Description]` attributes.

View File

@@ -0,0 +1,79 @@
---
source_files:
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/ChannelGroups.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/TestGraphsFields.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/TestSetupFields.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/TestRunMetadataFields.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/TestModuleFields.cs
- Common/DTS.CommonCore/Enums/DTS.Viewer/TestMetadata/TestChannelFields.cs
generated_at: "2026-04-16T02:45:19.428554+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5089f69caf0a7cb3"
---
# Documentation: Test Metadata Enumerations
## 1. Purpose
This module defines a set of strongly-typed enumerations that represent field names and groupings used for test metadata in the DTS Viewer system. These enums serve as standardized keys for accessing, serializing, deserializing, and querying structured metadata associated with test runs, modules, channels, graphs, and setup information. They enable type-safe handling of metadata schemas across the application—particularly in UI components, data serialization layers, and metadata validation logic—by providing a fixed set of valid field identifiers and channel group categories.
## 2. Public Interface
All types are `public enum`s in the `DTS.Common.Enums.Viewer` namespace. No classes, methods, or properties are exposed.
### `ChannelGroups`
- **Members**:
- `Channel`: Represents raw or physical channels.
- `Graph`: Represents graph-based visualizations (likely aggregations or derived views).
- `CalculatedChannel`: Represents channels whose values are computed from other channels (e.g., via formulas).
- **Purpose**: Categorizes channels into logical groups for filtering or UI rendering.
### `TestGraphsFields`
- **Members**:
- `Name`, `HardwareChannelName`, `Channels`, `Channel`, `ChannelId`
- **Purpose**: Defines valid field names for objects representing test graphs (e.g., in JSON schemas or metadata structures).
### `TestSetupMetadataFields`
- **Members**:
- `Name`, `DateOfTheTest`, `Graphs`, `Timestamp`, `CalibrationBehavior`
- **Purpose**: Specifies fields applicable to top-level test setup metadata (e.g., configuration or session-level data).
### `TestRunMetadataFields`
- **Members**:
- `Id`, `Description`, `InlineSerializedData`, `Guid`, `FaultFlags`, `Software`, `SoftwareVersion`, `DataType`, `FileDate`, `FilePath`, `Modules`, `Module`, `Channels`, `CalculatedChannels`, `CalculatedChannel`
- **Purpose**: Defines top-level fields for a test runs metadata, including references to nested entities (modules, channels, etc.) and runtime context.
### `TestModuleFields`
- **Members**:
- Includes identifiers (`SerialNumber`, `BaseSerialNumber`, `Number`), timing (`StartRecordTimestampSec`, `TriggerTimestampSec`, etc.), sampling (`NumberOfSamples`, `UnsubsampledNumberOfSamples`, `SampleRateHz`, `StartRecordSampleNumber`), configuration (`RecordingMode`, `RequestedPreTriggerSeconds`, `AaFilterRateHz`), sensor data (`TiltSensorAxisXDegreesPre`, `TemperatureLocation1Pre`, etc.), and metadata (`InlineSerializedData`, `PTPMasterSync`).
- **Purpose**: Represents all known fields for a test modules metadata, including pre/post-trigger conditions, sensor readings, and acquisition parameters.
### `TestChannelFields`
- **Members**:
- Includes identifiers (`SerialNumber`, `ChannelId`, `HardwareChannelName`, `SensorId`), configuration (`Description`, `ChannelDescriptionString`, `ChannelName2`, `UnitConversion`, `LinearizationFormula`, `ZeroMethod`, `ZeroAverageWindowBegin`, `ZeroAverageWindowEnd`), calibration (`LastCalibrationDate`, `Sensitivity`, `SensitivityUnits`, `CalSignalEnabled`, `ShuntEnabled`, `MeasuredShuntDeflectionMv`, `TargetShuntDeflectionMv`), acquisition (`Start`, `IsSubsampled`, `AbsoluteDisplayOrder`, `SampleRateHz`, `UnsubsampledSampleRateHz`, `TimeOfFirstSample`), electrical properties (`ExcitationVoltage`, `MeasuredExcitationVoltage`, `FactoryExcitationVoltage`, `BridgeResistanceOhms`, `OffsetToleranceLowMv`, `OffsetToleranceHighMv`), derived values (`InitialEu`, `InitialOffset`, `UserOffsetEU`, `ScaleFactorEU`), and metadata (`IsoCode`, `UserCode`, `HIC`, `SourceModuleSerialNumber`, `Calculation`, `DataFlag`, `AtCapacity`, `SensorPolarity`, `UseEUScaler`, `T1`, `T2`).
- **Purpose**: Provides exhaustive field coverage for channel-level metadata, supporting both raw and calculated channels.
## 3. Invariants
- **No overlap across enums**: Each enum defines a distinct set of field names for a specific metadata entity (e.g., `TestChannelFields` vs. `TestModuleFields`). There is no guarantee of uniqueness across enums (e.g., `Name`, `Channels`, `Module` appear in multiple enums), but within each enum, all members are unique.
- **Field names are string-literal keys**: These enums are intended to map to string-based keys (e.g., in JSON or dictionaries). Their values are implicitly `int`-backed, but the *semantic meaning* comes from their *names*, not their numeric values.
- **No ordering guarantees**: The enums are not ordered by importance, hierarchy, or sequence. `AbsoluteDisplayOrder` in `TestChannelFields` is a *field name*, not an ordering directive for the enum itself.
- **No validation logic**: These are *pure data definitions*; no runtime validation or constraints are enforced by the enums themselves.
## 4. Dependencies
- **Internal usage**: These enums are defined in `DTS.CommonCore`, indicating they are part of a shared common library. They are likely consumed by:
- UI components (e.g., metadata viewers, configuration panels)
- Serialization/deserialization logic (e.g., JSON converters, DTOs)
- Metadata querying or filtering systems
- **No external dependencies**: The source files contain no `using` statements, implying no dependencies on other project types or external libraries. They rely solely on the base .NET runtime.
## 5. Gotchas
- **Ambiguity in field semantics**: While enum names are precise, their *intended usage* (e.g., whether `Channels` in `TestGraphsFields` refers to a list or a single channel) is not clarified by the enum alone. Context (e.g., JSON schema or usage site) is required.
- **Redundant field names across enums**: Fields like `Module`, `Channels`, `CalculatedChannel`, `Name`, and `ChannelId` appear in multiple enums (`TestRunMetadataFields`, `TestSetupMetadataFields`, `TestGraphsFields`, `TestChannelFields`). This may indicate shared schema concepts but risks misuse if enums are used interchangeably.
- **No deprecation markers**: The enums do not indicate obsolete or legacy fields (e.g., `ChannelName2`, `UserChannelName`, `UserCode`), which may complicate maintenance or migration.
- **Tilt/temperature fields assume pre/post sensor states**: `TestModuleFields` includes many `Pre`/`Post`-suffixed fields (e.g., `TiltSensorAxisXDegreesPre`, `TemperatureLocation4Post`). This implies a rigid assumption about test procedures involving pre/post events; deviations may cause misinterpretation.
- **No documentation on `InlineSerializedData`**: Its purpose (e.g., binary vs. JSON, encoding) is not evident from the enum alone.
None identified beyond the above ambiguities and design assumptions.

View File

@@ -0,0 +1,36 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Database/DbType.cs
generated_at: "2026-04-16T02:42:49.967232+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c0a6812741ff89b5"
---
# Database
### 1. Purpose
This module defines the `DbType` enumeration, which categorizes database instances according to their deployment and access pattern—specifically distinguishing between databases that are exclusively remote, exclusively local, or a hybrid of both. It serves as a foundational type for configuring or routing data access logic within the DTS system, enabling consistent semantic interpretation of database type across the codebase.
### 2. Public Interface
The module exposes a single public type:
- **`DbType`** (`enum`)
- `RemoteOnly = 0`: Indicates the database is accessible only via a remote connection (e.g., cloud or remote server).
- `LocalOnly = 1`: Indicates the database is accessible only locally (e.g., embedded or on-disk instance on the same machine).
- `RemoteLocalHybrid = 2`: Indicates the database supports both remote and local access modes, likely with logic to switch or synchronize between them.
### 3. Invariants
- The enum values are explicitly assigned integer constants (`0`, `1`, `2`) and must not be changed without considering serialization or persistence compatibility.
- Only the three defined values are valid; no other values are permitted by the type definition itself (though runtime casting from `int` could bypass this at compile time).
- No additional validation or runtime checks are present in this file to enforce usage constraints.
### 4. Dependencies
- **No external dependencies**: This file contains only a self-contained `enum` definition with no `using` statements or references to other types.
- **Consumers**: Based on namespace (`DTS.Common.Enums.Database`) and naming conventions, this type is likely referenced by higher-level configuration, data access, or connection management modules (e.g., `DTS.CommonCore.Data`, `DTS.Server.Database`, or similar), though such consumers are not visible in this source file.
### 5. Gotchas
- **No validation or parsing logic**: The enum does not include helper methods (e.g., `TryParse`, `IsValid`) or attributes (e.g., `[Flags]`), so callers must manually handle invalid values or parsing if needed.
- **No documentation comments**: The source lacks XML doc comments (e.g., `/// <summary>`), so semantic intent beyond the field names is not explicitly stated—e.g., it is unclear whether `RemoteLocalHybrid` implies active synchronization, fallback behavior, or dual-mode selection.
- **Potential for misuse via casting**: Since enums in C# allow casting from any `int`, invalid values (e.g., `(DbType)99`) are possible at runtime unless guarded elsewhere.
- **None identified from source alone.**

View File

@@ -0,0 +1,68 @@
---
source_files:
- Common/DTS.CommonCore/Enums/GroupTemplates/GroupTemplateChannelFields.cs
- Common/DTS.CommonCore/Enums/GroupTemplates/GroupTemplateFields.cs
generated_at: "2026-04-16T02:44:06.705516+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e8a5b65535302547"
---
# GroupTemplates
## Documentation: Group Template Field Enumerations
### 1. Purpose
This module defines two strongly-typed enumerations—`GroupTemplateFields` and `GroupTemplateChannelFields`—that represent the set of valid field names used when referencing or manipulating group template data structures within the system. These enums serve as standardized identifiers for field-level operations (e.g., filtering, sorting, mapping, or validation) related to group templates and their associated channels, ensuring consistency across layers that consume or produce group template metadata.
### 2. Public Interface
No classes, methods, or properties are exposed. Only two `public enum` types are defined:
- **`GroupTemplateFields`**
```csharp
public enum GroupTemplateFields
{
Name,
Description,
Channels,
LastModifiedBy,
LastModified,
AssociatedGroups
}
```
Represents top-level fields of a group template entity. Values correspond to core properties of a group template (e.g., `Name`, `Description`) or nested collections (`Channels`, `AssociatedGroups`), as well as audit metadata (`LastModifiedBy`, `LastModified`).
- **`GroupTemplateChannelFields`**
```csharp
public enum GroupTemplateChannelFields
{
Required,
Name,
ISOCode,
Custom,
DisplayOrder
}
```
Represents fields of individual channel objects *within* a group templates `Channels` collection. Includes both required metadata (`Name`, `ISOCode`), configuration flags (`Required`, `Custom`), and ordering (`DisplayOrder`).
### 3. Invariants
- All enum values are *exhaustive* for their respective domains (i.e., no additional fields are defined beyond those listed).
- `GroupTemplateFields.Channels` is the only field in `GroupTemplateFields` that contains *nested* data; its value is expected to be a collection of objects, each describable via `GroupTemplateChannelFields`.
- `GroupTemplateChannelFields.Required` and `GroupTemplateChannelFields.Custom` are boolean-like flags (though represented as enum values, not booleans), implying they are used as discrete states rather than numeric values.
- No ordering guarantees are implied by the enum definitions themselves (i.e., `DisplayOrder` is a *field name*, not an ordering of the enum values).
### 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Enums.GroupTemplates` namespace (inferred from `namespace` declaration).
- Likely consumed by modules handling group template serialization/deserialization, UI form generation, or data mapping (e.g., ORM or DTO layers), though no direct imports are visible in the provided source.
- **External dependencies**: None (no `using` statements present in the source).
- **Depended upon**: Other modules in the `DTS.CommonCore` assembly (or downstream projects) that require field-level metadata for group templates or channels.
### 5. Gotchas
- **No semantic validation**: The enums themselves do not enforce constraints (e.g., `Required` is not validated against `Custom` or `ISOCode` behavior). Consumers must implement business logic around field relationships.
- **Ambiguity in `Custom`**: The meaning of `GroupTemplateChannelFields.Custom` is unclear without additional context—it may indicate user-defined fields, non-standard channel types, or a flag for dynamic extensibility.
- **No versioning**: The enums are static; adding new fields requires a breaking change.
- **Case sensitivity**: As with all C# enums, string comparisons (e.g., in JSON or database mappings) must preserve exact casing (`"Name"` ≠ `"name"`).
- **`LastModified` type ambiguity**: While `GroupTemplateFields.LastModified` is listed, the underlying type (e.g., `DateTime`, `string`, `long`) is not defined here and must be inferred from consuming code.
None identified beyond the above.

View File

@@ -0,0 +1,40 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Groups/GroupImport.cs
generated_at: "2026-04-16T02:44:10.436858+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "035d6557ffbc8e0b"
---
# Groups
## 1. Purpose
This module defines a strongly-typed enumeration for the sequential steps involved in a group import workflow. It resides in the `DTS.Common.Enums.Groups` namespace and serves as a centralized, type-safe reference for the distinct phases—`Options`, `Preview`, and `Import`—that constitute the group import process. Its role is to ensure consistency across the codebase when referencing or routing through these steps, particularly in UI navigation, state management, or workflow orchestration logic.
## 2. Public Interface
The module exposes a single nested `enum` type:
- **`GroupImportEnums.Steps`**
An `enum` with three named constants:
- `Options`: Represents the initial step where user-provided configuration or selection options are collected.
- `Preview`: Represents the step where imported data is displayed for review before final commitment.
- `Import`: Represents the final step where the data is committed or persisted.
All values are implicitly of type `int`, with default underlying values (`Options = 0`, `Preview = 1`, `Import = 2`), though the source does not explicitly declare numeric values.
## 3. Invariants
- The sequence of steps is strictly ordered: `Options``Preview``Import`.
- No other steps are defined beyond these three; any extension requires modifying this enum.
- The enum is declared as `public abstract class GroupImportEnums` containing the nested `enum Steps`, but since `GroupImportEnums` is abstract and contains no instance members, it serves solely as a namespace-like container for `Steps`. (Note: This is a common C# pattern for grouping enums, though the class itself is never instantiated.)
## 4. Dependencies
- **Internal**: Depends on the .NET runtime (`System` namespace implicitly, via `enum`).
- **External usage**: Inferred to be consumed by modules handling group import workflows (e.g., UI layers, import services), though no direct dependencies are visible in this file.
- **No external dependencies** are declared in this source file (no `using` directives present).
## 5. Gotchas
- The outer class `GroupImportEnums` is `abstract` but serves no functional purpose beyond namespacing the `Steps` enum; it cannot be instantiated and contains no static members. This may confuse developers expecting utility methods or constants.
- The enum values are not explicitly assigned numeric values, relying on default sequential ordering. While stable in practice, this could break if reordering or inserting intermediate steps without updating consumers that assume specific numeric values.
- No validation or conversion helpers (e.g., `TryParse`, `GetDescription`) are provided in this file—any such functionality must exist elsewhere.
- None identified from source alone.

View File

@@ -0,0 +1,47 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Groups/GroupList/GroupFields.cs
generated_at: "2026-04-16T02:45:01.417346+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "2f4786cffbcd013b"
---
# GroupList
## 1. Purpose
This module defines a strongly-typed enumeration `GroupFields` used to represent standardized field names for group entities within the DTS system. It serves as a canonical source of field identifiers—particularly for UI labeling, data binding, serialization, or query construction—where consistent field naming and localized description strings are required. The use of `Description` attributes and a custom `TypeConverter` indicates this enum is intended for scenarios requiring human-readable display text (e.g., column headers, form labels) while maintaining type safety and compile-time correctness.
## 2. Public Interface
The module exposes a single public type:
- **`DTS.Common.Enums.Groups.GroupList.GroupFields`**
An enum with the following members (all marked with `[Description]` attributes):
- `Name` → Description: `"GroupField_Name"`
- `DisplayName` → Description: `"GroupField_DisplayName"`
- `Description` → Description: `"GroupField_Description"`
- `ChannelCount` → Description: `"GroupField_ChannelCount"`
- `LastModified` → Description: `"GroupField_LastModified"`
- `LastModifiedBy` → Description: `"GroupField_LastModifiedBy"`
- `AssociatedTestSetups` → Description: `"GroupField_AssociatedTestSetups"`
Each members description string is retrieved via the `EnumDescriptionTypeConverter` (from `DTS.Common.Converters`), enabling automatic conversion to localized or display-friendly strings.
## 3. Invariants
- All enum values are explicitly annotated with `[Description]` attributes; no member lacks a description.
- The enum is sealed (implicit, as enums are sealed in C#) and non-extensible at runtime.
- The `Description` attribute values are string literals (no dynamic resolution), implying the descriptions are fixed at compile time.
- The enum is intended for use *only* with the `EnumDescriptionTypeConverter`; behavior with other converters is unspecified.
## 4. Dependencies
- **Depends on**:
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverter`)
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter implementation)
- **Used by**:
- Unknown from source alone. Likely consumed by UI layers (e.g., data grid column definitions), serialization logic, or data mapping components that require consistent field identification and display text.
## 5. Gotchas
- The `Description` attribute values (e.g., `"GroupField_Name"`) appear to be *keys* rather than human-readable strings themselves, suggesting they are intended for localization via resource lookup (e.g., `ResourceManager.GetString("GroupField_Name")`). This is not explicit in the source, so consumers must verify how `EnumDescriptionTypeConverter` resolves these keys.
- No validation or runtime checks ensure enum values are only used in contexts expecting *group-related* fields; misuse in non-group contexts is possible.
- The enum name `GroupFields` (plural) may be misleading since it represents *singular* field identifiers (e.g., `GroupFields.Name` refers to the *Name* field, not multiple fields).
- None identified from source alone.

View File

@@ -0,0 +1,169 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Hardware/HardwareListTags.cs
- Common/DTS.CommonCore/Enums/Hardware/SLICEConfigurations.cs
- Common/DTS.CommonCore/Enums/Hardware/HardwareTypes.cs
generated_at: "2026-04-16T02:44:03.050936+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3948c1a76438f900"
---
# Hardware Enums and Constants Documentation
## 1. Purpose
This module defines core enumerations and static utility methods for hardware type identification, configuration, and capability querying within the DTS system. It serves as a foundational layer for hardware abstraction—enabling consistent representation of device types (`HardwareTypes`), SLICE configurations (`SLICEConfigurations`), and metadata tags (`HardwareListTags`) across the codebase. The `HardwareConstants` class centralizes hardware-specific logic, such as feature support checks (e.g., trigger inversion, recording modes), embedded sensor detection, and sample rate constraints, ensuring consistent behavior across modules that interact with diverse data acquisition systems (DAS).
---
## 2. Public Interface
### Enumerations
#### `HardwareListTags`
- **Namespace**: `DTS.Common.Enums.Hardware`
- **Purpose**: Defines metadata tags used to identify or display hardware attributes in UI or data structures.
- **Values**:
- `Included`, `SerialNumber`, `HardwareType`, `ChannelCount`, `Firmware`, `MaxSampleRate`, `TestSampleRate`, `CalDate`, `CalDueDate`, `IPAddress`, `FirstUseDate`
#### `SLICEConfigurations`
- **Namespace**: `DTS.Common.Enums.Hardware`
- **Purpose**: Represents SLICE hardware configuration variants. Uses `EnumDescriptionTypeConverter` for localized descriptions.
- **Values**:
- `MEGA` → Description: `"SLICE_CONFIGURATION_MEGA"`
- `EIGHT_HUNDRED` → Description: `"SLICE_CONFIGURATION_800K"`
- `SEVEN_HUNDRED` → Description: `"SLICE_CONFIGURATION_700K"`
- `SIX_HUNDRED` → Description: `"SLICE_CONFIGURATION_600K"`
#### `HardwareTypes`
- **Namespace**: `DTS.Common.Enums.Hardware`
- **Purpose**: Enumerates all supported hardware device types in the system. Uses `EnumDescriptionTypeConverter`. Includes legacy, embedded, and infrastructure devices.
- **Key Values**:
- `SLICE_Base` (0), `SLICE_Bridge` (1), `SLICE_Distributor` (2), `TDAS_Pro_Rack` (3)
- `SLICE2_IEPE_Hi` (4) through `SLICE2_SLD` (30)
- Embedded modules: `EMB_LIN_ACC_LO` (44) to `EMB_RTC_NS_PAD` (54)
- Infrastructure: `TSR_AIR` (40), `TSR_AIR_RevB` (41), `DKR` (42), `DIR` (43)
- `UNDEFINED` (38) for uninitialized/unknown devices
#### `SLICEBridgeTypes`
- **Namespace**: `DTS.Common.Enums.Hardware`
- **Purpose**: Specifies bridge module types for SLICE devices.
- **Values**:
- `Bridge`, `IEPE`, `ARS`, `ACC`, `RTC`, `UART`, `StreamOut`
- All use `EnumDescriptionTypeConverter` with descriptive strings (e.g., `"BRIDGETYPE_BRIDGE_DESCRIPTION"`).
#### `RackSizes`
- **Namespace**: `DTS.Common.Enums.Hardware`
- **Purpose**: Defines rack size configurations.
- **Values**:
- `FOUR` → Description: `"RACK_SIZE_4M"`
- `EIGHT` → Description: `"RACK_SIZE_8M"`
### Static Methods in `HardwareConstants`
#### `GetBrushForVoltageStatus(VoltageStatusColor status)`
- **Return Type**: `SolidColorBrush`
- **Behavior**: Maps a `VoltageStatusColor` enum value to a WPF `SolidColorBrush` for UI rendering.
- `Green``BrushesAndColors.BrushApplicationStatusPowerGreen`
- `Red``BrushesAndColors.BrushApplicationStatusPowerRed`
- `Yellow``BrushesAndColors.BrushApplicationStatusPowerYellow`
- `Off` or default → `BrushesAndColors.BrushApplicationStatusPowerClear`
#### `SupportsTriggerInversion(HardwareTypes type, int protocolVersion)`
- **Return Type**: `bool`
- **Behavior**: Returns `true` if the device supports trigger inversion. Currently supported devices include:
- `SLICE1_5_Micro_Base`, `SLICE_Base`, `SLICE2_Base`, `SLICE_IEPE`, `SLICE1_5_Nano_Base`, `SLICE_Micro_Base`, `SLICE_NANO_Base`, `SLICE2_SIM`, `SLICE2_DIM`, `SLICE2_TOM`, `SLICE2_SLS`, `SLICE1_G5Stack`, `SLICE2_SLT`, `SLICE2_SLD`
- **Note**: `protocolVersion` parameter is unused in current implementation.
#### `SupportsStartInversion(HardwareTypes type, int protocolVersion)`
- **Return Type**: `bool`
- **Behavior**: Returns `true` if the device supports start inversion. Includes all devices from `SupportsTriggerInversion`, plus `SLICE6_AIR`.
- **Note**: `protocolVersion` parameter is unused.
#### `IsEthernetRecorder(HardwareTypes type)`
- **Return Type**: `bool`
- **Behavior**: Returns `true` only for `HardwareTypes.S6A_EthernetRecorder`.
#### `HasEmbeddedSensors(HardwareTypes hardware)`
- **Return Type**: `bool`
- **Behavior**: Returns `true` for embedded sensor modules:
- `EMB_ANG_ACC`, `EMB_ANG_ARS`, `EMB_ATM`, `EMB_LIN_ACC_HI`, `EMB_LIN_ACC_LO`, `EMB_MAG`, `EMB_MAG_SWITCH`, `EMB_MIC`, `EMB_OPT`, `EMB_RTC_NS_PAD`, `EMB_RTC_S_MARK`, `TSR_AIR`, `TSR_AIR_RevB`, `DIR`, `DKR`
#### `HasEmbeddedChannelType(HardwareTypes hardware, string channelType)`
- **Return Type**: `bool`
- **Behavior**: Determines if a given `channelType` (e.g., `"LOWG_SERIAL_APPEND"`) is supported on the device.
- `TSR_AIR`/`TSR_AIR_RevB`: All channel types return `true`.
- `DIR`: Supports `HIGHG_SERIAL_APPEND`.
- `DKR`: Only supports embedded channels (per `HasEmbeddedSensors`).
- Other devices: Strict per-channel-type logic (e.g., `MICROPHONE_SERIAL_APPEND` supported on all except `DKR`).
#### `IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
- **Return Type**: `bool`
- **Behavior**: Checks if a `RecordingModes` value is supported by the hardware.
- Non-`TSR_AIR` devices: Support `CircularBuffer` and `Recorder` (and optionally their UART variants).
- `SLICE6DB_InDummy`, `SLICE6DB3`, `SLICE6DB`: Support `RAMActive` and `MultipleEventRAMActive`.
- Specific devices delegate to dedicated static classes (e.g., `SLICE6AIR.IsRecordingModeSupported`).
- Unsupported devices (`DIM`, `G5INDUMMY`, `Ribeye`, `TDAS_Pro_Rack`, etc.) return `false`.
#### `MaxSampleRateForRecordingMode(IDASHardware h, RecordingModes mode, int protocolVersion = 1, uint baudRate = 9600)`
- **Return Type**: `double`
- **Behavior**: Returns the maximum sample rate for a given recording mode.
- For `SLICE6_AIR`: Delegates to `SLICE6AIR.MaxSampleRateHzForRecordingMode`.
- For `S6A_EthernetRecorder`: Returns `SLICE6AIR.MaxSampleRateHz_OBRDDR`.
- Otherwise: Calls `h.GetMaxSampleRateDouble()`.
#### `IsStreamingProfileSupported(UDPStreamProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
- **Return Type**: `bool`
- **Behavior**: Checks streaming support. Only `SLICE6_Base`, `SLICE6_AIR`, `SLICE6_AIR_BR`, `TSR_AIR`, and `TSR_AIR_RevB` support streaming. Others return `false`.
#### `IsClockSyncProfileSupported(ClockSyncProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly, bool master)`
- **Return Type**: `bool`
- **Behavior**: Checks clock sync support. Delegates to device-specific classes (`SLICE6`, `SLICE6AIR`, `TSRAIR`, `SLICE6DB`). Unsupported devices return `false`.
---
## 3. Invariants
- **HardwareType Values**:
- `UNDEFINED` (38) is reserved for uninitialized/unknown devices.
- Values 058 are explicitly defined; gaps (e.g., 22, 35) indicate deprecated/unused entries.
- **Embedded Sensors**:
- Devices with `HasEmbeddedSensors(hardware) == true` must only expose channels defined in `HasEmbeddedChannelType`.
- **Recording Modes**:
- `TSR_AIR`/`TSR_AIR_RevB` devices have restricted recording mode support (handled by `TSRAIR.IsRecordingModeSupported`).
- `SLICE6DB_InDummy`, `SLICE6DB3`, `SLICE6DB` have unique support for `RAMActive` modes.
- **Trigger/Start Inversion**:
- Supported only for SLICE-family devices (SLICE1, SLICE1.5, SLICE2) and embedded modules (`TSR_AIR`, `DIR`, `DKR`).
- USB connectivity is implied as a prerequisite (per comments), though not enforced in code.
- **Ethernet Recorders**:
- Only `S6A_EthernetRecorder` is recognized as an Ethernet recorder.
---
## 4. Dependencies
### Imports/References
- **`DTS.Common.Converters`**: `EnumDescriptionTypeConverter` for UI localization.
- **`System.ComponentModel`**: `DescriptionAttribute` for enum descriptions.
- **`System.Windows.Media`**: `SolidColorBrush` and `BrushesAndColors` for UI rendering.
- **`DTS.Common.Constant.DASSpecific`**: Constants like `LOWG_SERIAL_APPEND` used in `HasEmbeddedChannelType`.
- **`DTS.Common.Interface.DataRecorders`**: `IDASHardware` interface for `MaxSampleRateForRecordingMode`.
- **`DFConstantsAndEnums`**: `VoltageStatusColor` and serial append constants (e.g., `LOWG_SERIAL_APPEND`).
### Used By
- UI layers (via `HardwareListTags` and `GetBrushForVoltageStatus`).
- Device configuration and discovery modules (via `HardwareTypes`, `SLICEConfigurations`).
- Recording/streaming logic (via `IsRecordingModeSupported`, `IsStreamingProfileSupported`).
- Embedded sensor validation (via `HasEmbeddedSensors`, `HasEmbeddedChannelType`).
---
## 5. Gotchas
- **`protocolVersion` Unused**: Parameters in `SupportsTriggerInversion`, `SupportsStartInversion`, and `IsRecordingModeSupported` are declared but not used in current implementation.
- **`AllowSoftDisconnects` Global State**: A mutable static property (`HardwareConstants.AllowSoftDisconnects`) must be set by the application; its default (`false`) may cause unexpected behavior if not explicitly configured.
- **Embedded Channel Logic**: `HasEmbeddedChannelType` returns `true` for all channel types on `TSR_AIR`/`TSR_AIR_RevB`, but `false` for others—even if embedded sensors exist (e.g., `EMB_ATM` has no channel type mapping).
- **`IsRecordingModeSupported` "HACK"**: Non-`TSR_AIR` devices unconditionally support UART variants (`CircularBufferPlusUART`, `RecorderPlusUART`) unless `includeNativeSupportOnly=true`, which may mislead callers expecting strict mode validation.
- **`SLICE6DB_AIR` Commented Out**: The enum value `SLICE6DB_AIR = 35` is commented as "doesn't exist", but the infrastructure comment suggests future use.
- **`SLICE6AIRBR` vs `SLICE6_AIR_BR`**: The enum uses `SLICE6_AIR_BR` (with underscore), but the code references `SLICE6AIRBR` (no underscore) in `IsRecordingModeSupported`—indicating a potential naming inconsistency.
- **`MaxSampleRateForRecordingMode` Signature**: Uses `IDASHardware` interface, but `SLICE6AIR.MaxSampleRateHz_OBRDDR` is a static property—suggesting tight coupling to specific implementations.

View File

@@ -0,0 +1,30 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Reports/ReportConstantsAndEnums.cs
generated_at: "2026-04-16T02:44:33.797924+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "2ac723ba5793b971"
---
# Reports
1. **Purpose**
This file is a placeholder or stub for a C# namespace `DTS.Common.Enums.Reports` intended to house constants and enumerations related to reporting functionality within the DTS codebase. As written, it contains no actual declarations—no enums, constants, or types—so it currently serves no functional purpose beyond establishing the namespace structure. Its existence suggests future extensibility for report-related enums (e.g., report types, statuses, output formats), but no such functionality is implemented here.
2. **Public Interface**
No public types, functions, properties, or constants are defined in this file. The namespace `DTS.Common.Enums.Reports` is declared but empty.
3. **Invariants**
No invariants apply, as the file contains no logic or state. The only implicit invariant is that the namespace remains valid and empty.
4. **Dependencies**
The file imports standard .NET namespaces (`System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`), but does not reference any project-internal or third-party dependencies. No other modules depend on this file, as it exposes nothing.
5. **Gotchas**
- **Empty file**: Developers may assume this file contains report-related enums or constants (e.g., `ReportType`, `ReportStatus`, `OutputFormat`) based on its name and location, but none are present.
- **Namespace mismatch risk**: If other code references types in `DTS.Common.Enums.Reports`, those types must be defined elsewhere—this file alone will not compile such references.
- **Potential tech debt**: The presence of unused `using` directives (e.g., `System.Threading.Tasks`) suggests this file may have been auto-generated or copied from a template and never populated.
- **No documentation**: The file provides zero insight into intended report-related enumerations, making it difficult to design or migrate to a future implementation without additional context.
None identified beyond the above.

View File

@@ -0,0 +1,251 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Sensors/SensorChangeTypes.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorStatus.cs
- Common/DTS.CommonCore/Enums/Sensors/PossibleFilters.cs
- Common/DTS.CommonCore/Enums/Sensors/LinearizationFormula.cs
- Common/DTS.CommonCore/Enums/Sensors/CalibrationEnforcement.cs
- Common/DTS.CommonCore/Enums/Sensors/CalibrationBehaviors.cs
- Common/DTS.CommonCore/Enums/Sensors/InitialOffsetTypes.cs
- Common/DTS.CommonCore/Enums/Sensors/FilterClassType.cs
- Common/DTS.CommonCore/Enums/Sensors/ZeroMethodType.cs
- Common/DTS.CommonCore/Enums/Sensors/CSVImportTags.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorConstants.cs
generated_at: "2026-04-16T02:43:43.565732+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5790c6a0caacf995"
---
# Sensor Enums and Constants Module Documentation
## 1. Purpose
This module defines a comprehensive set of enumerations and constants used throughout the DTS system to represent sensor metadata, configuration, calibration behavior, and I/O channel types. It serves as the canonical source of truth for sensor-related semantic values—enabling consistent interpretation of sensor data, configuration, and import/export formats across the application. The module supports legacy compatibility (e.g., CSV import versions, zero method ordering), provides unit and range defaults for specific sensor families (e.g., TSR AIR), and includes helper methods for serial number classification and sensitivity unit parsing.
## 2. Public Interface
### Enums
#### `SensorChangeTypes`
- **Members**: `OffsetTolerance`
- **Purpose**: Represents types of changes that can be tracked for sensors. Currently only supports `OffsetTolerance`.
#### `SensorStatus`
- **Members**: `Available`, `InUse`, `OutForService`, `OutForCalibration`, `Retired`
- **Purpose**: Represents the current lifecycle status of a physical sensor.
#### `PossibleFilters`
- **Members**: `All`, `Analog`, `Squib`, `DigitalIn`, `DigitalOut`, `UART`, `StreamOut`, `StreamIn`
- **Purpose**: Specifies filter categories for channel/sensor selection (e.g., in UI or channel grouping).
#### `NonLinearStyles`
- **Members**: `IRTraccManual`, `IRTraccDiagnosticsZero`, `IRTraccZeroMMmV`, `IRTraccAverageOverTime`, `Polynomial`, `IRTraccCalFactor`
- **Purpose**: Defines nonlinear calibration styles for sensors (primarily IR-TRACC).
#### `NonLinearSLICEWareStyles`
- **Members**: `Manual`, `DiagnosticZeroMMmV`, `ZeroMMmV`, `AverageOverTime`, `Polynomial`
- **Purpose**: Defines nonlinear calibration styles specific to SLICEWare devices.
#### `CalibrationEnforcement`
- **Members**: `None`, `NonLinear`, `Linear`
- **Purpose**: Indicates whether calibration enforcement is applied and which type (linear/nonlinear). Uses `EnumDescriptionTypeConverter` and `[Description]` attributes.
#### `CalibrationBehaviors`
- **Members**: `LinearIfAvailable`, `NonLinearIfAvailable`, `UseBothIfAvailable`
- **Purpose**: Specifies preference for calibration style when both linear and nonlinear calibrations are available. Uses `EnumDescriptionTypeConverter` and `[Description]` attributes.
#### `InitialOffsetTypes`
- **Members**: `None = 0`, `EU = 1`, `EUAtMV = 2`, `LHS = 3`, `RHS = 4`, `FRONTAL = 5`
- **Purpose**: Indicates the format and meaning of the initial offset value. Uses `EnumDescriptionTypeConverter` and `[Description]` attributes.
#### `FilterClassType`
- **Members**: `None = 0`, `AdHoc = -1`, `Unfiltered = -2`, `CFC10 = 17`, `CFC60 = 100`, `CFC180 = 300`, `CFC600 = 1000`, `CFC1000 = 1650`
- **Purpose**: Represents SAE filter class definitions (e.g., CFC 100 = 100 Hz cutoff). Uses `EnumDescriptionResource` attributes for localization.
#### `ZeroMethodType`
- **Members**: `AverageOverTime = 0`, `UsePreEventDiagnosticsZero = 1`, `None = 2`
- **Purpose**: Specifies the method used to compute the software zero reference. Legacy ordering is preserved for CSV import compatibility. Uses `EnumDescriptionTypeConverter`.
#### `OriginalZeroMethodType`
- **Members**: `AverageOverTime`, `UsePreCalZero`, `None`
- **Purpose**: Original version of zero method types; likely retained for backward compatibility or migration.
#### `SensorConstants.SensorType`
- **Members**: `Analog`, `DigitalIn`, `DigitalOut`, `Squib`, `Clock`, `UART`, `StreamOut`, `StreamIn`
- **Purpose**: High-level classification of sensor/channel types.
#### `SensorConstants.BridgeType`
- **Members**: `IEPE`, `QuarterBridge`, `HalfBridge`, `FullBridge`, `DigitalInput`, `SQUIB`, `TOMDigital`, `HalfBridge_SigPlus`, `RTC`, `UART`, `StreamOut`, `StreamIn`
- **Purpose**: Bitmask-style enumeration representing bridge configuration and channel type. Includes helper methods `ConvertIntToBridgeType` and `ConvertBridgeToInt`.
#### `SensorConstants.SensUnits`
- **Members**: `NONE`, `mV`, `mVperV`, `mVperVperEU`, `mVperEU`
- **Purpose**: Sensitivity unit types. Includes `SensUnitStringConverter.ConvertFromString` for parsing.
#### `SensorConstants.SensorCalPolicy`
- **Members**: `AllowAlways`, `DONT_ALLOW`
- **Purpose**: Policy for handling out-of-calibration sensors.
#### `SensorConstants.CouplingModes`
- **Members**: `AC = 0`, `DC`
- **Purpose**: IEPE/analog coupling mode.
#### `SensorConstants.AvailableRangesLowG`
- **Members**: `LowG64D`, `LowG32D`, `LowG16D`, `LowG8D`
- **Purpose**: Valid low-g ranges for TSR AIR sensors.
#### `SensorConstants.AvailableRangesARS`
- **Members**: `ARS2000D`, `ARS250D`
- **Purpose**: Valid angular rate sensor (ARS) ranges.
### Constants & Static Properties (in `SensorConstants`)
#### Unit Strings
- `VOLTAGE_INSERTION_UNIT = "mV"`
- `TSRAIR_ACCEL_UNIT = "g"`
- `TSRAIR_ARS_UNIT = "deg/sec"`
- `TSRAIR_TEMPERATURE_UNIT = "C"`
- `TSRAIR_HUMIDITY_UNIT = "%"`
- `TSRAIR_PRESSURE_UNIT = "PSI"`
- `DEGREES = "deg"`
- `DEGREE_ANGLE = "deg-ang"`
- `LinearValuesSeparator = "||"`
#### Bridge Resistance Limits
- `MIN_BRIDGE_RESISTANCE_OHMS = 1`
- `MAX_BRIDGE_RESISTANCE_OHMS = 32000`
#### Calibration Defaults
- `SENSOR_FIRST_USE_DEFAULT = false`
- `UseSensorFirstUseDate = false` *(cached, mutable)*
- `UseISOCodeFilterMapping = true` *(cached, mutable)*
- `DefaultZeroMethodType = ZeroMethodType.AverageOverTime` *(cached, mutable)*
- `DefaultZeroMethodStart = -0.05D`
- `DefaultZeroMethodEnd = -0.02D`
- `CAL_SENSOR_POLICY_DEFAULT = DONT_ALLOW`
- `CAL_SENSOR_POLICY_WARNING_DAYS_DEFAULT = 14`
- `SensorCalOutOfDateWarningPeriodDays = 14` *(mutable)*
- `SensorCalPolicyCurrent = DONT_ALLOW` *(mutable)*
#### TSR AIR Default Ranges
- `DefaultRangeHiG = 400D`
- `DefaultRangeLowG = 64D`
- `DefaultRangeLowGDisplay = 50D`
- `DefaultRangeARS = 2000D`
- `DefaultRangeTemperature = 85D`
- `DefaultRangeHumidity = 100D`
- `DefaultRangePressure = 16D`
#### Squib & Digital Output Defaults (for "Restore Defaults")
- `SQUIB_DELAY_CONSTANT = 0D`
- `SQUIB_LIMIT_DURATION_CONSTANT = true`
- `SQUIB_DURATION_CONSTANT = 10D`
- `SQUIB_LOW_TOLERANCE_CONSTANT = 1D`
- `SQUIB_HIGH_TOLERANCE_CONSTANT = 10D`
- `SQUIB_CURRENT_CONSTANT = 1.5D`
- `DIGITALOUT_DELAY_CONSTANT = 0D`
- `DIGITALOUT_LIMITDURATION_CONSTANT = true`
- `DIGITALOUT_DURATION_CONSTANT = 10D`
#### UART Defaults
- `UART_BAUDRATE_CONSTANT = 57600`
- `UART_DATABITS_CONSTANT = 8`
- `UART_STOPBITS_CONSTANT = StopBits.One`
- `UART_PARITY_CONSTANT = Parity.None`
- `UART_FLOWCONTROL_CONSTANT = Handshake.None`
- `UART_DATAFORMAT_CONSTANT = UartDataFormat.Binary`
#### Stream I/O Defaults
- `STREAMIN_ADDRESS_CONSTANT = "UDP://239.1.2.10:8400"`
- `STREAMOUT_PROFILE_CONSTANT = UDPStreamProfile.CH10_PCM_128BIT_2HDR`
- `STREAMOUT_ADDRESS_CONSTANT = "UDP://239.1.2.10:8400"`
- `STREAMOUT_TIME_CHID_CONSTANT = 1`
- `STREAMOUT_DATA_CHID_CONSTANT = 3`
- `STREAMOUT_TMNS_CONFIG_CONSTANT = "(1,6,60,0,0,0,0,0)"`
- `STREAMOUT_IRIG_TDP_INTERVAL_CONSTANT = 500`
#### Test-Specific Serial Number Prefixes
- `TEST_SPECIFIC_DOUT = "TSD_"`
- `TEST_SPECIFIC_SQUIB = "TSQ_"`
- `TEST_SPECIFIC_DIN = "TSI_"`
- `TEST_SPECIFIC_EMB = "TSA_"`
- `TEST_SPECIFIC_EMB_CLK = "TSC_"`
- `TEST_SPECIFIC_UART = "TSU_"`
- `TEST_SPECIFIC_STREAM_OUT = "TSS_"`
- `TEST_SPECIFIC_STREAM_IN = "TSN_"`
#### Helper Methods
- `IsTestSpecificDigitalOut(string sn)`
- `IsTestSpecificSquib(string sn)`
- `IsTestSpecificDigitalIn(string sn)`
- `IsTestSpecificEmbedded(string sn)`
- `IsTestSpecificEmbeddedClock(string sn)`
- `IsTestSpecificStreamOut(string sn)`
- `IsTestSpecificStreamIn(string sn)`
- `IsTestSpecificUart(string sn)`
- `IsTSRAirHighGChannel(string moduleSerialNumber)`
- `IsTSRAirLowGChannel(string moduleSerialNumber)`
- `IsTSRAirARSChannel(string moduleSerialNumber)`
- `IsTSRAirAtmChannel(string moduleSerialNumber)`
- `IsTSRAirHumidityChannel(string moduleSerialNumber, int channelNumber)`
### `CSVImportTags` (abstract class)
#### Constants
- `MIN_VALID_VERSION = 0`
- `MAX_VALID_VERSION = 6`
- `IsSensorTag(int version)``bool` (returns `true` for versions `{0, 2, 3, 4}`)
#### Static Methods
- `GetVersionTags(int version)``Tags[]`
- `GetStringForTag(Tags tag)``string`
- `GetTagForString(string s)``Tags` (returns `Tags.Unknown` if not found)
- `GetVersionForTag(Tags t)``int` (returns `int.MaxValue` if not found)
#### `CSVImportTags.Tags` Enum (partial list)
- **Version 0**: `DatabaseReferenceNumber`, `SensorSN`, `ChannelName`, `Location`, `SensorType`, `EU`, `FullScale`, `Exc`, `OutputAtEXCFSmV`, `Sensitivity`, `FilterClass`, `SoftwareZeroReference`, `SoftwareZeroEquivalentEU`, `OffsetToleranceLow`, `OffsetToleranceHigh`, `BridgeResistance`, `ShuntResistorValue`, `CalInterval`, `ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `InitialOffset`, `NonLinear`, `NonLinearCalibration`, `DisplayUnits`, `UserCode`, `UserChannelName`, `ISOChannelName`, `UserChannelName`, `AdditionalLinearSensitivity`, `AdditionalLinearZeroMethod`, `AdditionalInitialOffsets`, `GroupName`, `GroupType`, `DASSerialNumber`, `DASChannelIndex`, `StreamProfile`, `UDPAddress`, `TimeChannelId`, `DataChannelId`, `TmNSConfig`, `IRIGTimeDataPacketIntervalMS`, `TMATSIntervalMS`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `DataFormat`, `TestUserCode`, `TestUserChannelName`, `TestIsoCode`, `TestIsoChannelName`, `ClockMasterInputType`, `ClockMasterOutputType`, `ManageClocksOutsideDPMaster`, `ManageClocksOutsideDPSlave`, `ClockSlaveInputType`, `ClockSlaveOutputType`, `DASSerial`, `DASSampleRate`, `PTPDomainId`, `ClockMaster`, `Version`, `TestSetupName`, `TestSetupDescription`, `RecordingMode`, `SampleRate`, `PreTriggerSec`, `PostTriggerSec`, `Tags`, `TwoVoltExcSensitivity`, `FiveVoltExcSensitivity`, `TenVoltExcSensitivity`, `RangeLow`, `RangeMedium`, `RangeHigh`, `SupportedExcitation`, `BridgeType`, `Unipolar`, `AxisNumber`, `NumberOfAxes`, `Polarity`, `PhysicalDimension`, `Direction`, `CheckOffset`, `Broken`, `DoNotUse`, `AtCapacity`, `CapacityOutputIsBasedOn`, `SensitivityUnits`, `CouplingMode`, `DelayMS`, `DigitalOutputDelayMS`, `DurationMS`, `DigitalOutputDurationMS`, `DigitalOutputMode`, `LimitDuration`, `SquibFireMode`, `SquibMeasurementType`, `SquibOutputCurrent`, `DigitalScaleMultiplier`, `DigitalInputMode`, `ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `BridgeLegMode`, `Created`, `TimesUsed`, `IRTRACCExponent`, `Unknown`
- **Version 1**: Adds `Version`, `TestSetupName`, `TestSetupDescription`, `RecordingMode`, `SampleRate`, `PreTriggerSec`, `PostTriggerSec`, `Tags`
- **Version 2**: Adds many fields (e.g., `TwoVoltExcSensitivity`, `ZeroMethod`, `InitialOffset`, `NonLinear`, `DigitalOutputMode`, `SquibFireMode`, `CouplingMode`, `DelayMS`, `DigitalOutputDelayMS`, `DurationMS`, `DigitalOutputDurationMS`, `DigitalOutputMode`, `LimitDuration`, `SquibFireMode`, `SquibMeasurementType`, `SquibOutputCurrent`, `DigitalScaleMultiplier`, `DigitalInputMode`, `NonLinearCalibration`, `DisplayUnits`, `AtCapacity`, `CapacityOutputIsBasedOn`, `SensitivityUnits`, `CheckOffset`, `Broken`, `DoNotUse`, `ISOChannelName`, `UserCode`, `UserChannelName`, `AdditionalLinearSensitivity`, `AdditionalLinearZeroMethod`, `AdditionalInitialOffsets`, `GroupName`, `GroupType`, `DASSerialNumber`, `DASChannelIndex`, `StreamProfile`, `UDPAddress`, `TimeChannelId`, `DataChannelId`, `TmNSConfig`, `IRIGTimeDataPacketIntervalMS`, `TMATSIntervalMS`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `DataFormat`, `TestUserCode`, `TestUserChannelName`, `TestIsoCode`, `TestIsoChannelName`, `ClockMasterInputType`, `ClockMasterOutputType`, `ManageClocksOutsideDPMaster`, `ManageClocksOutsideDPSlave`, `ClockSlaveInputType`, `ClockSlaveOutputType`, `DASSerial`, `DASSampleRate`, `PTPDomainId`, `ClockMaster`)
- **Version 3**: Adds `GroupName`, `GroupType`
- **Version 4**: Adds `DASSerialNumber`, `DASChannelIndex`, `StreamProfile`, `UDPAddress`, `TimeChannelId`, `DataChannelId`, `TmNSConfig`, `IRIGTimeDataPacketIntervalMS`, `TMATSIntervalMS`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `DataFormat`, `TestUserCode`, `TestUserChannelName`, `TestIsoCode`, `TestIsoChannelName`
- **Version 5**: Adds `ClockMasterInputType`, `ClockMasterOutputType`, `ManageClocksOutsideDPMaster`, `ManageClocksOutsideDPSlave`, `ClockSlaveInputType`, `ClockSlaveOutputType`
- **Version 6**: Adds `DASSerial`, `DASSampleRate`, `PTPDomainId`, `ClockMaster`
> Note: `Tags.Unknown` is returned for unrecognized strings in `GetTagForString`.
## 3. Invariants
- **CSV Import Versions**: Valid import versions are `0`, `2`, `3`, `4` (per `_SensorTagsVersions`). Versions `1`, `5`, and `6` are *not* included in `IsSensorTag`, but are still valid for general import (as `GetVersionTags` supports them).
- **Zero Method Ordering**: `ZeroMethodType` enum values are ordered to preserve legacy compatibility (e.g., `AverageOverTime = 0`, `UsePreEventDiagnosticsZero = 1`, `None = 2`). Changing order may break CSV import/export.
- **Bridge Type Conversion**: `ConvertBridgeToInt` and `ConvertIntToBridgeType` use non-bitmask integer mappings (e.g., `FullBridge → 3`, `QuarterBridge → 1`). Do not assume bitmask semantics for storage.
- **Sensitivity Unit Parsing**: `SensUnitStringConverter.ConvertFromString` is case-insensitive and accepts multiple aliases (e.g., `"mvperv"``mVperV`). Throws `InvalidCastException` for unrecognized strings.
- **TSR AIR Channel Detection**: Channel type detection is based on serial number suffixes (`"-High g"`, `"-Low g"`, `"-ARS"`, `"-Atm"`). Case-sensitive.
- **Test-Specific Serial Number Prefixes**: Prefixes are exact string matches (e.g., `"TSQ_"`). No wildcard or partial matching.
- **Calibration Policy Defaults**: `CAL_SENSOR_POLICY_DEFAULT = DONT_ALLOW`, `CAL_SENSOR_POLICY_WARNING_DAYS_DEFAULT = 14`. Mutable statics (`SensorCalPolicyCurrent`, `SensorCalOutOfDateWarningPeriodDays`) may be updated at runtime.
## 4. Dependencies
### Internal Dependencies
- `DTS.Common.Converters.EnumDescriptionTypeConverter`
- `DTS.Common.Attributes.VersionAttribute`, `System.ComponentModel.DataAnnotations.DisplayAttribute`
- `System.IO.Ports` (for `StopBits`, `Parity`, `Handshake`)
- `System.IO` (for `InvalidCastException` in `SensUnitStringConverter`)
### External Dependencies
- `System` (core types: `string`, `int`, `double`, `bool`, `Enum`, `Dictionary`, `HashSet`, `Exception`)
- `System.ComponentModel.DataAnnotations` (for `DisplayAttribute`)
- `System.IO.Ports` (for `StopBits`, `Parity`, `Handshake`)
### Usage
- This module is referenced by modules handling sensor configuration, CSV import/export, channel filtering, diagnostics, and calibration enforcement.
## 5. Gotchas
- **`ZeroMethodType` vs `OriginalZeroMethodType`**:

View File

@@ -0,0 +1,80 @@
---
source_files:
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/DigitalInputFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/DigitalOutFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/SensorListTabs.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/UartSettingFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/SquibFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/StreamInSettingFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/StreamOutSettingFields.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/CACOption.cs
- Common/DTS.CommonCore/Enums/Sensors/SensorsList/AnalogSensorFields.cs
generated_at: "2026-04-16T02:45:01.449243+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ee886777e1e8fa53"
---
# SensorsList
## Documentation: Sensor Field Enumerations
---
### 1. Purpose
This module defines a set of strongly-typed enumerations that specify the *editable or displayable fields* for various sensor configuration types within the system (e.g., analog sensors, digital inputs/outputs, squibs, UART, stream in/out). Each enum lists the valid field identifiers that can be used for operations such as UI binding, data serialization/deserialization, or field-level validation—ensuring consistency across components that interact with sensor metadata. These enums do not contain logic or behavior themselves; they serve as *metadata contracts* for structured sensor data.
---
### 2. Public Interface
All types are `public enum`s under the namespace `DTS.Common.Enums.Sensors.SensorsList`. No classes, methods, or properties are exposed.
| Enum Name | Fields (in order declared) | Notes |
|-----------|----------------------------|-------|
| `DigitalInputFields` | `Included`, `SerialNumber`, `Description`, `Mode`, `ModifiedBy`, `LastModified` | Represents fields for digital input sensors. |
| `DigitalOutFields` | `Included`, `SerialNumber`, `Description`, `Delay`, `Duration`, `ModifiedBy`, `LastModified` | Represents fields for digital output sensors. |
| `SensorListTabs` | `ANALOG = 0`, `SQUIB = 1`, `DIGITAL_IN = 2`, `DIGITAL_OUT = 3`, `UART = 4`, `STREAM_IN = 5`, `STREAM_OUT = 6` | Defines tab identifiers for UI navigation; values are explicit integers. |
| `UartSettingFields` | `Included`, `SerialNumber`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, `DataFormat`, `LastModifiedBy`, `LastModified` | Represents UART configuration fields. |
| `SquibFields` | `Included`, `SerialNumber`, `Description`, `ResistanceLow`, `ResistanceHigh`, `Id`, `Mode`, `Delay`, `Current`, `Duration`, `ModifiedBy`, `LastModified` | Represents squib (explosive device) sensor fields. |
| `StreamInSettingFields` | `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPAddress` | Represents stream input (e.g., UDP) configuration fields. |
| `StreamOutSettingFields` | `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPProfile`, `UDPAddress`, `UDPTimeChannelId`, `UDPDataChannelId`, `UDPTmNSConfig`, `IRIGTimeDataPacketIntervalMs`, `TMATSIntervalMs` | Represents stream output configuration fields. |
| `AnalogSensorFields` | `Included`, `SerialNumber`, `Description`, `Manufacturer`, `Model`, `Capacity`, `CalInterval`, `Sensitivity`, `LinearSensitivity`, `Resistance`, `Excitation`, `Units`, `Id`, `CalDate`, `CalDueDate`, `ModifiedBy`, `LastModified`, `IEPE`, `OutOfDate`, `InWarningPeriod`, `NonLinearCalucationType`, `ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `FirstUseDate`, `UserValue1`, `UserValue2`, `UserValue3` | Represents comprehensive analog sensor fields. **Note**: `NonLinearCalucationType` appears to be a typo for *CalculationType* (see *Gotchas*). |
| `CACOption` | `Manual`, `Capacity`, `RangeHigh`, `RangeMedium`, `RangeLow` | Represents calibration/characterization options. Each value is decorated with `[DescriptionResourceAttribute]` referencing external resource keys (e.g., `"CAC_Manual"`). |
---
### 3. Invariants
- **Field naming consistency**: All enums (except `CACOption` and `SensorListTabs`) begin with `Included`, `SerialNumber`, and `Description`. This suggests a common baseline for sensor metadata.
- **Audit fields**: All sensor-related enums (except `SensorListTabs` and `CACOption`) include `ModifiedBy` and `LastModified` (or `LastModifiedBy` in some cases). `StreamInSettingFields` and `StreamOutSettingFields` use `LastModifiedBy`, while others use `ModifiedBy`—this is inconsistent but intentional per source.
- **`SensorListTabs` is exhaustive**: The enum values cover all known sensor tab types (`ANALOG`, `SQUIB`, `DIGITAL_IN`, `DIGITAL_OUT`, `UART`, `STREAM_IN`, `STREAM_OUT`), with no gaps or extras.
- **`CACOption` values are fixed**: Only five options exist, each annotated with `[DescriptionResourceAttribute]`. The enum itself does not define behavior—only labels.
- **No overlap between enums**: Each enum represents a distinct sensor *type* or *category*; no field name appears in multiple enums with conflicting semantics (e.g., `Delay` exists in `DigitalOutFields` and `SquibFields`, but contextually appropriate).
---
### 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Base.Classes` (for `DescriptionResourceAttribute` used in `CACOption.cs`).
- `System.*` namespaces (`System`, `System.Collections.Generic`, etc.) are imported in `StreamInSettingFields.cs` but unused—likely legacy or auto-generated.
- **Consumers (inferred)**:
- UI layers (e.g., tab management via `SensorListTabs`, field binding via other enums).
- Data persistence or serialization modules (e.g., mapping JSON/XML fields to enum values).
- Validation or configuration editors that operate on sensor metadata.
- **No external (non-.NET) dependencies** are evident.
---
### 5. Gotchas
- **Typo in `AnalogSensorFields`**: The field `NonLinearCalucationType` is misspelled (`Calucation` instead of `Calculation`). This is likely a historical bug that must be preserved for backward compatibility.
- **Inconsistent audit field naming**: Most enums use `ModifiedBy` and `LastModified`, but `UartSettingFields`, `StreamInSettingFields`, and `StreamOutSettingFields` use `LastModifiedBy` instead of `ModifiedBy`. This may cause mismatches in generic processing logic if field names are assumed uniform.
- **`CACOption` requires resource resolution**: The enum values have no intrinsic string representation—`DescriptionResourceAttribute` implies runtime lookup via a resource manager (e.g., `ResourceManager`). Consumers must handle localization or fallback.
- **`StreamInSettingFields` has unused imports**: The file imports `System.*` namespaces but does not use them. May indicate incomplete cleanup or future expansion.
- **No `Included` semantics defined**: While all sensor enums include `Included`, its meaning (e.g., `true`/`false`, `0`/`1`, or presence/absence flag) is not specified here—it is context-dependent and must be inferred from usage.
- **`FirstUseDate` comment**: The comment `//13065 Sensor "First Use" Date` suggests a legacy ticket/issue ID; its relevance or validation rules are not documented here.
None identified beyond the above.

View File

@@ -0,0 +1,50 @@
---
source_files:
- Common/DTS.CommonCore/Enums/SettingsExport/TopLevelFields.cs
generated_at: "2026-04-16T02:43:04.993021+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "d94295ae09d6b074"
---
# SettingsExport
### **1. Purpose**
This module defines a strongly-typed enumeration (`TopLevelFields`) representing the allowed top-level XML element names used in settings export/serialization contexts within the DTS system. It serves as a canonical source of truth for the root tags that may appear in XML configuration files, ensuring consistency across serialization, deserialization, and validation logic throughout the codebase.
---
### **2. Public Interface**
The module exposes only one public type:
- **`TopLevelFields`** (`enum`)
Represents the set of valid top-level XML element names.
Members:
- `GlobalSettings`
- `TestSetupDefaultSettings`
- `SensorSettings`
- `TestHistorySettings`
Each member corresponds to a specific configuration section in exported XML. No methods, properties, or constructors are defined on the enum.
---
### **3. Invariants**
- The set of enum values is **fixed** and exhaustive for top-level XML tags used in settings export.
- No additional values may be added without updating all consumers that rely on this enum for validation or routing logic.
- The underlying type is the default `int` (not explicitly specified, but standard for C# enums without a base type).
- Enum values are **case-sensitive** and must match the exact string names used in XML (e.g., `<GlobalSettings>` not `<globalsettings>`), though case handling in XML parsing is typically managed elsewhere.
---
### **4. Dependencies**
- **Depends on**: None (self-contained enum in `DTS.Common.Enums.SettingsExport` namespace).
- **Used by**: Implicitly, any module responsible for XML settings export/import (e.g., serializers, configuration loaders, validators). While not visible in this source file, typical consumers would include classes handling XML serialization (e.g., `XmlSerializer`-based exporters) or schema validation logic that routes based on the root element.
---
### **5. Gotchas**
- **No documentation on XML schema mapping**: The enum names are used as-is in XML, but the source provides no indication of whether XML element names are case-sensitive, whether aliases exist, or how namespace prefixes are handled.
- **No extensibility mechanism**: Adding a new top-level field requires recompilation and careful coordination across all consumers, as there is no fallback or dynamic registration pattern evident here.
- **No versioning guidance**: The enum does not indicate whether older XML formats with different root tags are supported or deprecated.
- **None identified from source alone** — further context from serialization/deserialization logic would be needed to confirm behavior (e.g., how unknown root tags are handled).

View File

@@ -0,0 +1,63 @@
---
source_files:
- Common/DTS.CommonCore/Enums/SliceSimpleArm/SSACommands.cs
generated_at: "2026-04-16T02:43:56.731605+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "50cc5ab91bad7384"
---
# SliceSimpleArm
### 1. Purpose
This module defines the command and response enumerations used for communication with a SliceSimpleArm (SSA) subsystem—likely a hardware control or embedded device interface. `SSACommand` enumerates the set of high-level operations that can be issued to the device (e.g., arming, starting recording, diagnostics), while `SSAResponse` enumerates the possible structured responses the system may return, including success/failure states and specific error conditions (e.g., `NoSensorsFound`, `DiagnosticsFailedOffsetTolerance`). These enums serve as the contract for commandresponse semantics between the host software and the SSA hardware or its simulator.
### 2. Public Interface
The module exposes two public enums:
- **`SSACommand`**
*Type:* `enum`
*Values:*
- `ConfigureDevice` Likely used to initialize or reconfigure device parameters.
- `Diagnostics` Triggers a self-test or health check.
- `Arm` Arms the device for operation (e.g., enables data acquisition or triggering).
- `StartRecord` Begins data recording.
- `CheckForArmed` Polls the device to verify if it is armed.
- `Disarm` Disarms the device, halting active operations.
- `Download` Requests data or logs from the device.
- `SetLowPowerMode` Puts the device into a low-power state.
- `Trigger` Sends an external trigger command (e.g., manual or timed trigger).
- **`SSAResponse`**
*Type:* `enum`
*Values:*
- `Unknown` Default/unrecognized response.
- `Status` Generic status update (possibly informational).
- `Pass` Operation completed successfully.
- `Fail` Operation failed for unspecified reason.
- `SystemNotArmed` Requested operation requires the system to be armed first.
- `NoSensorsFound` No sensors detected during diagnostics or configuration.
- `NoEIDsFound` No EIDs (Event Identifiers?) found—likely during configuration or diagnostics.
- `UnknownEIDFound` An unexpected or invalid EID was encountered.
- `NoDASConnected` Data Acquisition System (DAS) is not connected or detected.
- `ExceptionThrown` An exception occurred during command processing.
- `DiagnosticsFailedOffsetTolerance` Diagnostics failed due to sensor offset exceeding tolerance.
- `DiagnosticsFailedShuntCheck` Diagnostics failed during shunt verification (e.g., electrical integrity test).
### 3. Invariants
- The `SSACommand` and `SSAResponse` enums are strictly *declarative*—they define symbolic names only; no validation, serialization, or parsing logic resides in this file.
- Each `SSACommand` value corresponds to a well-defined operation in the SSA protocol; similarly, each `SSAResponse` value represents a distinct outcome or error condition.
- No ordering guarantees are implied by the enum values (i.e., they are not ordered by priority, frequency, or sequence).
- The `Unknown` value in both enums likely serves as a sentinel for uninitialized or unhandled cases.
### 4. Dependencies
- **Internal dependencies:** This module resides in `DTS.Common.Enums.SliceSimpleArm`, suggesting it is part of a shared/common library (`DTS.CommonCore`). It has no external dependencies beyond the base .NET runtime (no `using` directives beyond `namespace`).
- **Consumers:** Other modules in the codebase (e.g., communication layers, device drivers, UI logic) likely reference this enum to construct commands and interpret responses. The presence of `DTS.Common` in the namespace implies this is a cross-cutting contract used by higher-level components (e.g., `DTS.CommonCore`, `DTS.SliceSimpleArm`, or test harnesses).
- **No external libraries or hardware-specific dependencies** are declared in this file.
### 5. Gotchas
- **Ambiguity in EID/DAS terminology:** The meaning of “EID” (Event Identifier?) and “DAS” (Data Acquisition System?) is not defined in this file. Their usage in `NoEIDsFound`, `UnknownEIDFound`, and `NoDASConnected` suggests domain-specific concepts that require external documentation.
- **No explicit mapping to command/response payloads:** This file defines *what* commands/responses exist, but not *how* they are serialized, transmitted, or deserialized (e.g., via serial, TCP, or binary protocol). That logic resides elsewhere.
- **`Status` vs. `Pass`:** The distinction between `Status` (generic update) and `Pass` (explicit success) is unclear—`Status` may be used for intermediate or polling responses, but this is not specified.
- **No versioning or extensibility guidance:** Adding new commands/responses may break backward compatibility if consumers switch on all values; no attributes or patterns (e.g., `[Flags]`) suggest safe extension strategies.
- **None identified from source alone.**

View File

@@ -0,0 +1,43 @@
---
source_files:
- Common/DTS.CommonCore/Enums/TSRAIRGo/NavigationButtonId.cs
generated_at: "2026-04-16T02:42:58.260456+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1fad088aa5051ccc"
---
# TSRAIRGo
### 1. Purpose
This module defines a strongly-typed enumeration of navigation button identifiers used within the TSRAIRGo application context. It serves as a centralized, type-safe contract for referencing specific UI navigation actions—such as arming/disarming a system, triggering events, downloading data, or accessing help—across the codebase, ensuring consistency between UI components, routing logic, and business logic layers.
### 2. Public Interface
The module exposes a single public type:
- **`NavigationButtonId`** (`enum`)
A set of named constants representing distinct navigation button roles in the TSRAIRGo UI. Each member corresponds to a specific user-facing action:
- `TestId`: Reserved for internal testing purposes.
- `ArmDisarm`: Toggles system arming/disarming state.
- `Trigger`: Initiates an immediate action or event (e.g., manual trigger).
- `Download`: Initiates data download functionality.
- `ViewData`: Opens a view for inspecting current or historical data.
- `ExportData`: Exports data to an external format (e.g., CSV, JSON).
- `Help`: Opens help documentation or support resources.
- `Dashboard`: Navigates to the main dashboard view.
### 3. Invariants
- All values are compile-time constants; no runtime mutation is possible.
- The enum is strictly additive: new members may be added, but existing members must not be renamed or removed without coordinated updates across consumers.
- No implicit ordering or numeric semantics are assumed by the enum definition itself (though underlying `int` values default to 0, 1, 2, … in declaration order).
- `TestId` is intended solely for testing; its use in production code is discouraged but not enforced by the type system.
### 4. Dependencies
- **Depends on**: None (standalone `enum` with no external references).
- **Depended on by**: Likely consumed by UI frameworks (e.g., Blazor, WPF, or MAUI), navigation routers, command handlers, or analytics modules that map button clicks to actions. Specific consumers cannot be inferred from this file alone.
### 5. Gotchas
- The enum does not define any validation logic or metadata (e.g., labels, icons, or permissions); such data must be maintained separately (e.g., via attributes, switch statements, or configuration).
- `TestId` has no documented runtime behavior—its purpose is ambiguous without context from other modules.
- No `Flags` attribute is applied, so bitwise combinations are not semantically supported (though technically possible in C#).
- None identified from source alone.

View File

@@ -0,0 +1,94 @@
---
source_files:
- Common/DTS.CommonCore/Enums/TTS/TTSEnums.cs
generated_at: "2026-04-16T02:43:11.533810+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "f097505e03f0c09d"
---
# TTS
## Documentation: `DTS.Common.Enums.TTS.TTSEnums`
### 1. Purpose
This module defines enumerations and supporting attributes used to manage field-level metadata for TTS (likely *Test & Test System* or *Transducer Test System*) import configurations, specifically addressing legacy column mapping issues (e.g., issue #18396). It provides a structured way to classify fields by their current relevance (`RequiredParameter`, `RemainedButNotUsed`, `RemovedParameter`) and supports parsing and validation of TTS import data through the `FieldSupportAttribute`. The enums `ToyotaFieldOrder`, `ToyotaBridgeType`, and `ToyotaZeroMethods` model domain-specific configuration options for sensor/channel setup.
---
### 2. Public Interface
#### `FieldSupportLevel` enum
- **Values**:
- `RequiredParameter`: Field is actively used and required.
- `RemainedButNotUsed`: Field exists in legacy data but is ignored in processing.
- `RemovedParameter`: Field is obsolete and no longer present in current data formats.
#### `FieldSupportAttribute` class
- **Inherits**: `Attribute`
- **Usage**: Applied to enum fields to declare their support status.
- **Properties**:
- `SupportLevel`: Gets or sets the `FieldSupportLevel` value assigned to the attributed enum member.
- **Methods**:
- `FieldSupportAttribute(FieldSupportLevel value)`: Constructor setting `SupportLevel`.
- `static FieldSupportLevel GetSupportLevel(Enum genericEnum)`:
- Returns the `FieldSupportLevel` associated with the given enum value via its `FieldSupportAttribute`.
- If no attribute is present, returns `FieldSupportLevel.RemovedParameter` as default.
#### `ToyotaFieldOrder` enum
- **Purpose**: Represents ordered column indices for TTS import (e.g., CSV/Excel), with each member annotated with `FieldSupportAttribute`.
- **Key Members**:
- `ChannelNumber`, `ChannelCode`, `JCodeOrDescription`, `ChannelRange`, `ChannelFilterHz`, `SensorSerialNumber`, `SensorExcitationVolts`, `SensorPolarity`: Marked `RequiredParameter`.
- `SensorID`, `SensorSensitivity`, `SensorCapacity`, `SensorEU`, `ChannelType`, `Description`, `ProportionalToExcitation`, `BridgeResistance`, `InitialOffsetVoltage`, `RemoveOffset`, `ZeroMethod`: Marked `RemainedButNotUsed`.
- `InitialOffsetVoltageTolerance`, `CableCompensationMultiplier`, `InitialEUInMV`, `InitialEUInEU`, `IRTRACCExponent`, `PolynomialConstant`, `PolynomialCoefficentC/B/A/Alpha`, `ISOCode`, `ISODescription`, `ISOPolarity`, `KyowaSpecificField_1`: Marked `RemovedParameter`.
#### `ToyotaBridgeType` enum
- **Purpose**: Defines supported bridge configurations for sensors.
- **Values**:
- `FullBridge`, `HalfBridge`, `Voltage`, `PotentionmeterFullBridge`, `PotentionmeterHalfBridge`, `IRTRACC`, `LinearChestPot`.
- **Notes**: Each value has a `[Description]` attribute (from `System.ComponentModel`), but no custom attribute or behavior is defined for it in this file.
#### `ToyotaZeroMethods` enum
- **Purpose**: Specifies zeroing methods for sensor calibration.
- **Values**:
- `None = 0` (Description: `"0"`),
- `AverageOverTime = 1` (Description: `"1"`),
- `UsePreEventDiagnosticsZero = 2` (Description: `"2"`).
- **Notes**: Only `[Description]` attributes are present; no custom support-level metadata.
---
### 3. Invariants
- **`FieldSupportAttribute.GetSupportLevel` behavior**:
- For any `Enum` value, if the field lacks a `FieldSupportAttribute`, the method **always returns `FieldSupportLevel.RemovedParameter`**.
- The method relies on reflection (`GetMember`, `GetCustomAttributes`) and is not optimized; performance may degrade with frequent use.
- **`ToyotaFieldOrder` ordering**:
- Values are explicitly assigned sequential integer indices starting at `0`, implying strict positional semantics (e.g., column order in an import file).
- The `FieldSupportLevel` annotations are *static metadata* and do not affect runtime behavior unless explicitly consumed elsewhere.
- **No validation logic is defined in this module**: The enums and attribute serve as *declarative metadata*; enforcement of support levels occurs in dependent code.
---
### 4. Dependencies
- **Dependencies on other modules**:
- `System` (core runtime types), `System.ComponentModel` (for `DescriptionAttribute`), `System.Linq` (for `Any()`, `ElementAt()` in `GetSupportLevel`).
- **Used by**:
- *Not specified in this file*, but `FieldSupportAttribute.GetSupportLevel` is clearly designed for use in TTS import/parsing logic (e.g., to filter columns during data loading).
- `ToyotaFieldOrder` is likely referenced by import handlers to map columns to properties.
- `ToyotaBridgeType` and `ToyotaZeroMethods` are likely used in sensor configuration classes or UI components.
---
### 5. Gotchas
- **`GetSupportLevel` default behavior**:
- Missing `FieldSupportAttribute` on an enum field silently defaults to `RemovedParameter`, which may mask omissions during refactoring.
- **Typos in `ToyotaBridgeType`**:
- `PotentionmeterFullBridge` and `PotentionmeterHalfBridge` are misspelled (should be *Potentiometer*). This is preserved in the source.
- **`ToyotaZeroMethods` descriptions are numeric strings**:
- Descriptions (`"0"`, `"1"`, `"2"`) match the underlying values but provide no semantic clarity. This may cause confusion if used in UI or logs.
- **No runtime enforcement of `FieldSupportLevel`**:
- The enum and attribute are *metadata-only*; consumers must explicitly check `GetSupportLevel` to act on support status.
- **Historical context**:
- The `KyowaSpecificField_1` comment references an internal Fogbugz link (`http://fogbugz/fogbugz/default.asp?5433`), suggesting legacy vendor-specific handling that may be obsolete or poorly documented.
- **Reflection overhead**:
- `GetSupportLevel` uses reflection on every call; caching is not implemented. Repeated use in hot paths may impact performance.

View File

@@ -0,0 +1,40 @@
---
source_files:
- Common/DTS.CommonCore/Enums/TestSetups/RealtimeGraphsEnum.cs
generated_at: "2026-04-16T02:44:28.591642+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5da219cbdf4b218e"
---
# TestSetups
## 1. Purpose
This module defines a strongly-typed enumeration `RealtimeGraphsEnum` used to represent configurable numbers of real-time graphs in the system—specifically, one, three, or six graphs. It is part of the `DTS.Common.Enums.TestSetups` namespace and is intended for use in test setup configurations where the UI or backend logic must select or validate the number of concurrent real-time data visualizations. The enum is annotated with `[Description]` attributes and leverages a custom `EnumDescriptionTypeConverter` to support localization or display-name resolution (e.g., for UI binding or serialization).
## 2. Public Interface
- **`RealtimeGraphsEnum`**
- `One = 1` — Represents a configuration with **one** real-time graph.
- `Three = 3` — Represents a configuration with **three** real-time graphs.
- `Six = 6` — Represents a configuration with **six** real-time graphs.
All members are explicitly assigned integer values (1, 3, 6), and each has a `[Description]` attribute containing a string key (e.g., `"RealtimeGraphs_One"`) rather than a human-readable label—suggesting the actual display text is resolved externally (e.g., via resource files using the description string as a key).
## 3. Invariants
- Only the values `1`, `3`, and `6` are valid for this enum; no other numeric values are defined.
- The enum is **not** marked as `[Flags]`, so bitwise combinations are not intended or supported.
- The `[Description]` attribute values are *keys*, not display strings—consumers must resolve them via the `EnumDescriptionTypeConverter` or external localization mechanism.
- The enum relies on `DTS.Common.Converters.EnumDescriptionTypeConverter`; invalid usage without this converter may result in raw numeric values or unlocalized strings.
## 4. Dependencies
- **Depends on**:
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverter`)
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter for resolving descriptions)
- **Used by**:
- Likely consumed by UI layers (e.g., dropdowns, configuration editors) and test setup logic in `DTS.CommonCore` or downstream modules (e.g., `DTS.TestRunner`, `DTS.UI`).
- Not directly inferable from this file, but any code that serializes/deserializes or binds to `RealtimeGraphsEnum` will depend on this type.
## 5. Gotchas
- **Non-sequential values**: The enum uses `1`, `3`, `6`—not contiguous integers. Code assuming sequential or incremental values (e.g., `for (int i = 1; i <= 6; i++)`) may fail or misbehave.
- **Description strings are keys, not labels**: The `[Description]` values (e.g., `"RealtimeGraphs_One"`) are *not* user-facing text; they are resource keys. Relying on `ToString()` or direct `DescriptionAttribute` access without the converter will yield these keys—not localized text.
- **TypeConverter dependency**: If `EnumDescriptionTypeConverter` is missing or misconfigured (e.g., in serialization contexts like JSON.NET without custom converters), deserialization or display may fall back to numeric values or fail.
- **No `Default` or `None` member**: There is no `0` or `Unspecified` value; uninitialized or invalid enum values will default to `0`, which is *not* a defined member—this may cause `InvalidCastException` or unexpected behavior if cast from an arbitrary `int`.

View File

@@ -0,0 +1,52 @@
---
source_files:
- Common/DTS.CommonCore/Enums/TestSetups/TestSetupsList/TestSetupFields.cs
generated_at: "2026-04-16T02:45:32.341303+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "d4958540c1aaf26d"
---
# TestSetupsList
### 1. **Purpose**
This module defines a strongly-typed enumeration (`TestSetupFields`) that specifies the set of fields available for representing or querying test setup metadata in the DTS (Data Test System) platform. It serves as a canonical list of field identifiers used throughout the system—likely in data access layers, UI binding contexts, or query builders—to ensure consistent referencing of test setup attributes (e.g., for filtering, sorting, or displaying test setup records in a list or grid).
### 2. **Public Interface**
The module exposes a single public type:
- **`TestSetupFields`** (`enum`)
- **Members**:
- `Name` (`string`-like identifier for the test setup)
- `Description` (`string`-like human-readable description)
- `RecordingMode` (`string` or enum value indicating how data is captured, e.g., continuous vs. event-triggered)
- `PreTriggerSeconds` (`double` or `int`—duration of data to capture *before* a trigger event)
- `PostTriggerSeconds` (`double` or `int`—duration of data to capture *after* a trigger event)
- `LastModified` (`DateTime`—timestamp of last modification)
- `LastModifiedBy` (`string`—identifier of the user/system that last modified the setup)
- `IsComplete` (`bool`—flag indicating whether the test setup is fully configured and ready for use)
*Note:* The enum values themselves are strongly typed symbols; their semantic usage (e.g., mapping to database columns, UI labels, or DTO properties) is determined by consumers of this enum.
### 3. **Invariants**
- The set of fields is **fixed and exhaustive** for the current version of the system: no fields are omitted or optional in the definition.
- Each enum member corresponds to a *single, well-defined* logical attribute of a test setup; no member represents multiple concepts.
- The enum is **not extensible at runtime**—new fields require source code modification and recompilation.
- The ordering of members in the enum is *not* semantically significant (i.e., `Name` is not “primary” over `Description`); however, their declaration order may be used for UI rendering or serialization in downstream code.
### 4. **Dependencies**
- **Internal dependencies**:
- `DTS.Common.Enums.TestSetups.TestSetupList` namespace (same assembly/module).
- Likely consumed by other modules in `DTS.CommonCore` (e.g., data models, query builders, UI components) that operate on test setup metadata.
- **External dependencies**: None inferred—this is a pure enum definition with no external references.
- **Consumers**: Not explicitly stated in this file, but based on naming conventions, this enum is likely used by:
- Data access layers (e.g., for column selection in SQL queries or ORM mappings)
- UI components (e.g., grid column definitions, filter/sort controls)
- API contracts (e.g., DTOs for test setup listing endpoints)
### 5. **Gotchas**
- **No validation or semantics encoded**: The enum itself does not enforce data types, nullability, or business rules (e.g., `PreTriggerSeconds` must be non-negative). Such constraints are expected to be handled elsewhere.
- **String-based usage risk**: If consumers convert enum values to strings (e.g., for dynamic queries), mismatches may occur if field names change (e.g., `LastModified` vs. `LastModifiedAt`).
- **No versioning mechanism**: Adding/removing fields requires manual coordination across all consumers; no migration or deprecation strategy is evident from this file.
- **Ambiguous types**: The enum does not specify the underlying data types for each field (e.g., `RecordingMode` could be a string, enum, or numeric code), so consumers must infer or reference external contracts.
- **None identified from source alone.** *(Note: While the above points are reasonable engineering concerns, they are not directly observable in this file.)*

View File

@@ -0,0 +1,156 @@
---
source_files:
- Common/DTS.CommonCore/Events/LoginUserEvent.cs
- Common/DTS.CommonCore/Events/TextPastedEvent.cs
- Common/DTS.CommonCore/Events/BusyIndicatorChangeNotification.cs
- Common/DTS.CommonCore/Events/ComActiveEvent.cs
- Common/DTS.CommonCore/Events/CloseApplicationRequested.cs
- Common/DTS.CommonCore/Events/TabControlSelectionChanged.cs
- Common/DTS.CommonCore/Events/RaiseNotification.cs
- Common/DTS.CommonCore/Events/PageSetActiveEvent.cs
- Common/DTS.CommonCore/Events/GroupTemplateChangeNotification.cs
- Common/DTS.CommonCore/Events/DatabaseVersionChangedEvent.cs
- Common/DTS.CommonCore/Events/SetSaveButton.cs
- Common/DTS.CommonCore/Events/DBConnectionEvent.cs
- Common/DTS.CommonCore/Events/AutomaticModeStatusEvent.cs
- Common/DTS.CommonCore/Events/SetPageVisibilityEvent.cs
- Common/DTS.CommonCore/Events/LogoutUserEvent.cs
- Common/DTS.CommonCore/Events/PageNameEvent.cs
- Common/DTS.CommonCore/Events/TestEvent.cs
- Common/DTS.CommonCore/Events/PageSelectionChanged.cs
- Common/DTS.CommonCore/Events/UserEvent.cs
- Common/DTS.CommonCore/Events/ListViewStatusEvent.cs
- Common/DTS.CommonCore/Events/HelpTextEvent.cs
- Common/DTS.CommonCore/Events/PageModifiedEvent.cs
- Common/DTS.CommonCore/Events/FeedbackEvent.cs
- Common/DTS.CommonCore/Events/AssemblyListNotification.cs
- Common/DTS.CommonCore/Events/CancelProcess.cs
- Common/DTS.CommonCore/Events/TabControlSelectionEventArgs.cs
- Common/DTS.CommonCore/Events/SLICE6MulticastPropertyEvent.cs
- Common/DTS.CommonCore/Events/AppStatusEvent.cs
- Common/DTS.CommonCore/Events/PageErrorEvent.cs
- Common/DTS.CommonCore/Events/PageNavigationRequestEvent.cs
- Common/DTS.CommonCore/Events/ProgressBarEvent.cs
- Common/DTS.CommonCore/Events/NotificationContentEventArgs.cs
- Common/DTS.CommonCore/Events/ShowStatus.cs
generated_at: "2026-04-16T02:17:22.225930+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9cee3f5e2ea58fa5"
---
# DTS.Common.Events Module Documentation
## 1. Purpose
This module defines a centralized set of Prism-based events for inter-module communication within the DTS application. It serves as the canonical event catalog for cross-cutting concerns such as user authentication, UI state management (busy indicators, page visibility, tab selection), database connectivity, application lifecycle, and domain-specific notifications (e.g., COM status, test execution, feedback). Events are implemented as `CompositePresentationEvent<T>` subclasses, enabling decoupled pub/sub communication between view models, services, and UI components across the application.
## 2. Public Interface
All event types are defined in the `DTS.Common.Events` namespace and inherit from `CompositePresentationEvent<T>`.
### Event Classes and Payload Types
| Event Class | Payload Type | Description |
|-------------|--------------|-------------|
| `LoginUserEvent` | `LoginUserArg` | Notifies of a user login attempt. Payload contains `UserName`. |
| `LogoutUserEvent` | `LogoutUserArg` | Notifies of a user logout. Payload contains `Reason` (currently only `DatabaseSwitch`). |
| `BusyIndicatorChangeNotification` | `bool` | Indicates whether the application/busy indicator should be active (`true`) or inactive (`false`). |
| `CommActiveEvent` | `ComStatusArg` | Notifies of COM communication state changes. Payload is `CommandStart` or `ResponseStart`. |
| `CloseApplicationRequested` | `object` | Signals that the application should close. Payload is unused (`object`). |
| `TabControlSelectionChanged` | `TabControlSelectionEventArgs` | Signals tab selection change. Payload includes `Operation` (`TabControlOperation`) and `Item`. |
| `RaiseNotification` | `NotificationContentEventArgs` | Triggers a UI notification (modal dialog). Payload includes `Message`, `MessageDetails`, `Image`, and `Title`. |
| `PageSetActiveEvent` | `PageSetActiveEventArg` | Notifies that a page has been set active. Payload contains `Page` implementing `IDataPROPage`. |
| `GroupTemplateChangeNotification` | `IBaseModel` | Signals that the selected group template has changed. Payload is the new template model. |
| `DatabaseVersionChangedEvent` | `DatabaseVersionChangedEventArgs` | Notifies of database version change. Payload contains `Version` string. |
| `SetSaveButton` | `SaveButtonUsability` | Enables/disables the Save button. Payload contains `IsUsable` boolean. |
| `DBConnectionEvent` | `DBConnectionArg` | Notifies of database connection status change. Payload includes `Connected`, `DBName`, and `Server`. |
| `AutomaticModeStatusEvent` | `AutomaticModeStatusEventArgs` | Notifies of automatic mode status change. Payload includes `TextSet` (bool) and `Text` (string). |
| `SetPageHeaderVisibilityEvent` | `SetPageHeaderVisibilityEventArgs` | Sets visibility of the page header. Payload includes `SetVisiblity` (bool) and `Visibility` (`System.Windows.Visibility`). |
| `PageNameEvent` | `PageNameEventArg` | Notifies that a pages display name has changed. Payload includes `Name` (string) and `Page` (object). |
| `TestEvent` | `TestEventArg` | Notifies of test execution status. Payload includes `Status` (`TestStarted` or `TestEnded`). |
| `PageSelectionChanged` | `PageSelectionChangedArg` | Notifies of page selection change. Payload includes `Page` (object) and `Count` (int). |
| `UserEvent` | `UserEventArg` | Generic user-related event. Payload includes `EventType` (`ViewingUserChanged`) and `Argument` (object). |
| `ListViewStatusEvent` | `ListViewStatusArg` | Notifies of ListView status change. Payload includes `Status` (`Unloaded` or `ScrollToBottom`) and `Id` (string). |
| `HelpTextEvent` | `HelpTextEventArg` | Triggers help text display (e.g., tooltip). Payload includes `Sender` and `E` (`ToolTipEventArgs`). |
| `PageModifiedEvent` | `PageModifiedArg` | Notifies of page modification state change. Payload includes `PageStatus` (`Clear`, `Modified`, `Saved`), `Page`, and `Handled` (bool). |
| `FeedbackEvent` | `FeedbackArg` | Sends feedback (e.g., logging, status) to feedback page. Payload includes `Severity` (`Information`, `Warning`, `Error`, `ResponseStarting`, `CommandStarting`) and `Message`. |
| `AssemblyListNotification` / `AssemblyListNotificationViewer` | `AssemblyListInfo` | Notifies of assembly list changes. Payload contains `AssemblyList` (`List<Assembly>`). |
| `CancelProcessEvent` | `CancelProcess` | Requests cancellation of a process. Payload includes `IsBusy` and `ProcessId`. |
| `SLICE6MulticastPropertyEventChanged` | `SLICE6MulticastPropertyEventArgs` | Notifies of SLICE6 multicast property changes. Payload includes `SLICE6Property`, `SLICE6MulticastAddress`, `SLICE6MulticastCommandPort`, and `SLICE6MulticastResponsePort`. |
| `AppStatusEvent` | `AppStatusArg` | Notifies of high-level application status. Payload is `Busy`, `Available`, `Shutdown`, `Close`, or `UserLogout`. |
| `AppStatusExEvent` | `AppStatusExArg` | Extended app status event. Payload includes `Status` (`AppStatusArg`) and `Name` (string, process name). |
| `PageErrorEvent` | `PageErrorArg` | Surfaces errors to the application. Payload includes `Errors` (string array), `Page`, and `Handled` (bool). Includes static helper `SurfaceApplicationError(string)`. |
| `PageNavigationRequestEvent` | `PageNavigationRequest` | Requests navigation to a page. Payload includes `Destination` (`Sensor`, `TestSetups`), `DestinationArg`, and `Caller`. |
| `ProgressBarEvent` | `ProgressBarEventArg` | Controls progress bar state. Payload includes `ProgressBarName`, `ProgressBarColor`, `SetPercentage`/`ProgressBarPercentage`, `SetText`/`ProgressBarText`, `SetVisibility`/`ProgressBarVisibility`. |
| `ShowStatus` | `StatusInfo` | Notifies of process status. Payload includes `CurrentState` (`Idle`, `Busy`, `DoneNoError`, `DoneFailed`), `IsOk`, `Percentage`, `Text`, and `ProcessId`. |
### Supporting Types
| Type | Description |
|------|-------------|
| `LoginUserArg` | Payload for `LoginUserEvent`. Contains `UserName` (string). |
| `DBConnectionArg` | Payload for `DBConnectionEvent`. Contains `Connected` (bool), `DBName`, `Server` (strings). |
| `AutomaticModeStatusEventArgs` | Payload for `AutomaticModeStatusEvent`. Contains `TextSet` (bool), `Text` (string). |
| `SaveButtonUsability` | Payload for `SetSaveButton`. Contains `IsUsable` (bool). |
| `PageSetActiveEventArg` | Payload for `PageSetActiveEvent`. Contains `Page` (`IDataPROPage`). |
| `DatabaseVersionChangedEventArgs` | Payload for `DatabaseVersionChangedEvent`. Contains `Version` (string). |
| `PageNameEventArg` | Payload for `PageNameEvent`. Contains `Name` (string, read-only), `Page` (object, read-only). Constructor sets both. |
| `PageSelectionChangedArg` | Payload for `PageSelectionChanged`. Contains `Page` (object, read-only), `Count` (int, read-only). Constructor sets both. |
| `UserEventArg` | Payload for `UserEvent`. Contains `EventType` (`Events.ViewingUserChanged`, read-only), `Argument` (object, read-only). Constructor sets both. |
| `ListViewStatusArg` | Payload for `ListViewStatusEvent`. Contains `Status` (`ListViewStatus` enum, read-only), `Id` (string, read-only). Constructor sets both. |
| `HelpTextEventArg` | Payload for `HelpTextEvent`. Contains `Sender` (object), `E` (`ToolTipEventArgs`). |
| `PageModifiedArg` | Payload for `PageModifiedEvent`. Contains `PageStatus` (`Status` enum, read-only), `Page` (object, read-only), `Handled` (bool, writable). Constructor sets first two. |
| `FeedbackArg` | Payload for `FeedbackEvent`. Contains `Severity` (`Severity` enum, read-only), `Message` (string, read-only). Constructor sets both. |
| `AssemblyListInfo` | Payload for `AssemblyListNotification`/`AssemblyListNotificationViewer`. Contains `AssemblyList` (`List<Assembly>`). |
| `CancelProcess` | Payload for `CancelProcessEvent`. Contains `IsBusy` (bool), `ProcessId` (int). |
| `SLICE6MulticastPropertyEventArgs` | Payload for `SLICE6MulticastPropertyEventChanged`. Contains `SLICE6Property`, `SLICE6MulticastAddress`, `SLICE6MulticastCommandPort`, `SLICE6MulticastResponsePort`. |
| `AppStatusExArg` | Payload for `AppStatusExEvent`. Contains `Status` (`AppStatusArg`, read-only), `Name` (string, read-only). Constructor sets both. |
| `PageErrorArg` | Payload for `PageErrorEvent`. Contains `Errors` (string[], read-only), `Page` (object, read-only), `Handled` (bool, writable). Constructor sets first two. |
| `PageNavigationRequest` | Payload for `PageNavigationRequestEvent`. Contains `Destination` (`Destinations` enum, read-only), `DestinationArg` (object, read-only), `Caller` (object, read-only). Constructor sets all. |
| `ProgressBarEventArg` | Payload for `ProgressBarEvent`. Contains `ProgressBarName`, `ProgressBarColor`, `SetPercentage`, `ProgressBarPercentage`, `SetText`, `ProgressBarText`, `SetVisibility`, `ProgressBarVisibility`. |
| `StatusInfo` | Payload for `ShowStatus`. Contains `CurrentState` (`StatusState` enum), `IsOk`, `Percentage`, `Text`, `ProcessId`. Includes `IsBusy` property and `Unsubscribe()` method. |
| `TabControlSelectionEventArgs` | Payload for `TabControlSelectionChanged`. Contains `Operation` (`TabControlOperation`), `Item`. Constructor sets both. |
| `NotificationContentEventArgs` | Payload for `RaiseNotification`. Contains `Message`, `MessageDetails`, `Image` (`PopupWindowImage`), `Title`. |
| `NotificationContentEventArgsWithoutTitle` | Simplified payload for notifications without title. Contains `Message`, `MessageDetails`, `Image`. |
## 3. Invariants
- **Event Naming**: All event types follow the `XxxEvent` naming convention (e.g., `CloseApplicationRequested`, `ProgressBarEvent`).
- **Payload Immutability**: Payload classes generally expose properties as `get;` (read-only) after construction, with values set via constructor parameters. Exceptions include `Handled` (writable flag in `PageModifiedArg`, `PageErrorArg`), `IsUsable` (`SaveButtonUsability`), and `Set*` properties (`ProgressBarEventArg`).
- **Prism Dependency**: All events inherit from `CompositePresentationEvent<T>`, requiring Prisms `Microsoft.Practices.Prism.Events` library.
- **Namespace Consistency**: All types reside in the `DTS.Common.Events` namespace.
- **Enum Values**: Enums (`ComStatusArg`, `TestEventStatus`, `Severity`, `AppStatusArg`, `StatusInfo.StatusState`, `UserEventArg.Events`, `ListViewStatusArg.ListViewStatus`, `PageNavigationRequest.Destinations`) define discrete, named states. No implicit ordering or numeric assumptions should be made.
- **Null Safety**: Payload properties are not guaranteed non-null unless specified (e.g., `ProgressBarEventArg.ProgressBarName` defaults to `"Footer"`). Consumers should validate nulls.
## 4. Dependencies
### Dependencies *of* this module:
- **Prism Library**: `Microsoft.Practices.Prism.Events` (for `CompositePresentationEvent<T>` and `EventBase`).
- **WPF**: `System.Windows`, `System.Windows.Media`, `System.Windows.Controls`, `System.Windows.Threading` (via `Visibility`, `Color`, `ToolTipEventArgs`).
- **.NET Reflection**: `System.Reflection` (for `Assembly` in `AssemblyListInfo`).
- **DTS Common Infrastructure**:
- `DTS.Common.Base` (`IBaseModel`, `IDataPROPage`)
- `DTS.Common.Enums` (`TabControlOperation`, `PopupWindowImage`, `SLICE6Properties`)
- `DTS.Common.Utilities.Logging` (`APILogger`)
- `Microsoft.Practices.ServiceLocation` (`IEventAggregator`, `ServiceLocator`)
- `DTS.Common.Strings` (for `Strings.Strings.ResourceManager` in `StatusInfo` constructor)
### Dependencies *on* this module:
- **View Models & Services**: All modules that need to signal state changes (e.g., login/logout, database status, page navigation, progress updates) publish events defined here.
- **UI Components**: Views subscribe to events to update UI (e.g., progress bars, busy indicators, notifications, page headers).
- **Event Aggregator Consumers**: Any module using Prisms `IEventAggregator` to subscribe/publish these events.
## 5. Gotchas
- **Inconsistent Naming**: `SetSaveButton` event is defined in `SetSaveButton.cs`, but its payload class is `SaveButtonUsability`. Similarly, `ShowStatus` event uses `StatusInfo` payload. Ensure correct pairing.
- **Typos in Properties**: `SetPageHeaderVisibilityEventArgs.SetVisiblity` has a typo (`Visiblity` instead of `Visibility`). This is preserved from source.
- **Redundant Events**: Several events (`BusyIndicatorChangeNotification`, `AppStatusEvent`, `AppStatusExEvent`, `DBConnectionEvent`) overlap in purpose (busy/available state). Consumers must determine which to use based on context or legacy constraints.
- **Unused/Incomplete Events**: `TestEvent`, `UserEvent`, `ListViewStatusEvent`, `HelpTextEvent`, `AssemblyListNotificationViewer`, `SLICE6MulticastPropertyEventChanged` have minimal documentation and unclear usage. Verify with domain experts.
- **Static Helper Side Effects**: `PageErrorEvent.SurfaceApplicationError()` uses `ServiceLocator` internally. This may fail if `ServiceLocator` is not initialized or configured.
- **Enum Values Not Exhaustive**: `ComStatusArg` and `TestEventStatus` only define two values each; future extensions may require new enum members.
- **Payload Mutability**: While most payload properties are read-only, `Handled` (in `PageModifiedArg`, `PageErrorArg`) is writable and may be set by subscribers. Ensure publishers check `Handled` if needed.
- **Null `Text` in `StatusInfo`**: If `text` is `null` in `StatusInfo` constructor, it defaults to a resource string or enum name. Ensure `Strings.Strings` is initialized.
- **`NotificationContentEventArgsWithoutTitle`**: A separate class (not used by any event) exists but is not tied to any event. Likely leftover from refactoring.
- **`AssemblyListNotification` vs `AssemblyListNotificationViewer`**: Two identical events exist. Clarify intent or consolidate if redundant.
- **`ProgressBarEventArg` Defaults**: Default constructor sets `ProgressBarName = "Footer"`. Other properties default to `false`, `double.NaN`, or `null`. Ensure consumers set required fields explicitly.

View File

@@ -0,0 +1,68 @@
---
source_files:
- Common/DTS.CommonCore/Events/ChannelCodes/ChannelCodesViewChangedEvent.cs
- Common/DTS.CommonCore/Events/ChannelCodes/ChannelCodeCommittedEvent.cs
generated_at: "2026-04-16T02:48:23.376026+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ada2b2e64b345605"
---
# ChannelCodes
## Documentation: Channel Codes Event Definitions
### 1. Purpose
This module defines Prism-based event types used for inter-module communication related to channel code management in the DTS system. Specifically, `ChannelCodesViewChangedEvent` signals when the user switches between different view modes (e.g., list, grid) for channel codes UI, while `ChannelCodeCommittedEvent` broadcasts when one or more channel codes have been successfully saved or submitted by a user, including metadata about the operation (e.g., code value, name, type, and user privileges). These events decouple UI components (e.g., views, view models) from business logic or persistence layers involved in channel code handling.
### 2. Public Interface
#### `ChannelCodesViewChangedEvent`
- **Type**: `class` (inherits from `CompositePresentationEvent<DTS.Common.Enums.IsoViewMode>`)
- **Payload**: `DTS.Common.Enums.IsoViewMode`
- **Behavior**: A Prism event used to notify subscribers when the current view mode for the channel codes UI has changed. Subscribers receive the new `IsoViewMode` value (e.g., `List`, `Grid`, etc., per the enum definition).
#### `ChannelCodeCommittedEvent`
- **Type**: `class` (inherits from `CompositePresentationEvent<ChannelCodeCommittedEventArgs[]>`)
- **Payload**: `ChannelCodeCommittedEventArgs[]` (array of committed channel code entries)
- **Behavior**: A Prism event published after one or more channel codes are committed (e.g., saved to a backend or cache). Subscribers receive an array of `ChannelCodeCommittedEventArgs`, each describing a single committed code.
#### `ChannelCodeCommittedEventArgs`
- **Type**: `class`
- **Properties**:
- `ChannelCodeType`: `ChannelEnumsAndConstants.ChannelCodeType` — immutable; indicates the category or domain of the channel code (e.g., `Network`, `Device`, `Service`).
- `Code`: `string` — immutable; the actual code string (e.g., `"NET_001"`).
- `Name`: `string` — immutable; the human-readable name/description of the code (e.g., `"Primary Network"`).
- `CanUserCommitChannelCodes`: `bool` — immutable; `true` if the user submitting the event has write permissions for channel codes; `false` otherwise.
- **Constructor**:
```csharp
public ChannelCodeCommittedEventArgs(
ChannelEnumsAndConstants.ChannelCodeType channelCodeType,
string code,
string name,
bool canUserCommitChannelCodes)
```
Initializes a new instance with the specified values. All properties are set at construction and remain read-only thereafter.
### 3. Invariants
- `ChannelCodeCommittedEventArgs` instances are **immutable** after construction: all properties have `private set` accessors and are assigned only in the constructor.
- `ChannelCodeCommittedEvent` always carries an array of `ChannelCodeCommittedEventArgs`, even if empty (i.e., no null payload is implied by the source, but callers may choose to publish with zero-length arrays).
- The `CanUserCommitChannelCodes` flag reflects the *submitting users* privilege at the time of commit, not necessarily the current users privilege (e.g., in multi-user or background scenarios).
- `IsoViewMode` values are constrained to the members defined in `DTS.Common.Enums.IsoViewMode` (not shown in source; assumed to be an enum defined elsewhere).
### 4. Dependencies
- **Dependencies on other modules/types**:
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation)
- `DTS.Common.Enums` (for `IsoViewMode`)
- `DTS.Common.Enums.Channels` (for `ChannelEnumsAndConstants.ChannelCodeType`)
- **Depended on by**:
- UI components (e.g., views/view models) that need to react to view mode changes or channel code commits (e.g., refreshing displays, updating audit logs, enforcing permissions).
- Likely consumed by modules handling channel code persistence, audit logging, or UI state synchronization.
### 5. Gotchas
- **Namespace inconsistency**: `ChannelCodesViewChangedEvent` resides in `DTS.Common.Events`, while `ChannelCodeCommittedEvent` and its args are in `DTS.Common.Events.ChannelCodes`. This may cause confusion during subscription (e.g., `eventAggregator.GetEvent<ChannelCodesViewChangedEvent>().Subscribe(...)`)—ensure correct namespace resolution.
- **No validation guarantees**: The source provides no indication that `Code` or `Name` are non-null/non-empty; callers must validate inputs before publishing `ChannelCodeCommittedEvent`.
- **Privilege flag semantics**: `CanUserCommitChannelCodes` is set at event publication time and may become stale if user permissions change between commit and event handling. Handlers should not assume this flag reflects the *current* user state.
- **Array payload**: `ChannelCodeCommittedEvent` uses an array, implying batch commits are supported. Handlers must iterate the array and not assume a single item.
- **No error handling**: The event is named `CommittedEvent`, suggesting success only. There is no corresponding failure/error event defined here; error handling must be separate.
- **Missing documentation for `IsoViewMode`**: The actual values/states of `IsoViewMode` are not visible in the source, so behavior tied to specific modes (e.g., `List` vs `Grid`) cannot be fully specified.

View File

@@ -0,0 +1,38 @@
---
source_files:
- Common/DTS.CommonCore/Events/DASFactory/DASConfigurationEvent.cs
generated_at: "2026-04-16T02:48:38.970688+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "923244ee6528d02e"
---
# DASFactory
### 1. **Purpose**
This module defines the `DASConfigurationEvent` class, a Prism-based event used to propagate DAS (Device Abstraction Service) configuration-related notifications within the application. Specifically, it signals when configuration data is blank or missing—such as during an emergency download scenario where DAS must fall back to on-disk XML configuration files (per issue #17872). It serves as a decoupled communication mechanism for components that need to react to configuration state changes, particularly in fallback or error-handling workflows.
### 2. **Public Interface**
- **`DASConfigurationEvent`**
- **Type**: `class` (inherits from `CompositePresentationEvent<IDASConfigurationArg>`)
- **Behavior**: A Prism event token used for publishing and subscribing to configuration notifications. The payload is of type `IDASConfigurationArg`, which (based on the interface import) is expected to carry configuration state details (e.g., file paths, validation status, or error context). No additional methods or properties are defined in this file.
### 3. **Invariants**
- The event *always* carries a payload of type `IDASConfigurationArg` (as enforced by its base class `CompositePresentationEvent<T>`).
- Subscribers must handle `null` payloads if `IDASConfigurationArg` allows it (source does not specify nullability constraints for the argument).
- The event is intended *only* for configuration-related notifications (per the summary), and its usage should be limited to scenarios involving blank/missing configurations (e.g., emergency downloads).
- No ordering guarantees or delivery semantics are specified beyond Prisms default `CompositePresentationEvent` behavior (thread-safe, background dispatch, etc.).
### 4. **Dependencies**
- **Imports/References**:
- `DTS.Common.Interface.DASFactory.IDASConfigurationArg` (interface defining the configuration argument contract)
- `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>` (Prism event infrastructure)
- **Depended upon by**:
- Any module/component that needs to respond to DAS configuration anomalies (e.g., emergency download logic, configuration validators, UI status indicators).
- *Not inferred*: Concrete implementations of `IDASConfigurationArg` or publishers of this event are not visible in this file.
### 5. **Gotchas**
- The event name `DASConfigurationEvent` is generic, but its documented purpose is narrow (blank/missing configs only). Misuse for *general* configuration changes could break assumptions in subscribers.
- The `IDASConfigurationArg` interface is imported but not defined here; its contract (e.g., properties like `IsBlank`, `FilePath`, `ErrorCode`) must be verified in `DTS.Common.Interface.DASFactory` to avoid misinterpretation of payload semantics.
- No explicit error-handling guidance is provided for subscribers (e.g., whether to log, retry, or abort).
- The comment references issue #17872; historical context for this events creation may be critical for correct usage but is not embedded in the source.

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/Reports/SaveReportToCSVRequestedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/Reports/SaveReportToPDFRequestedEvent.cs
generated_at: "2026-04-16T02:50:24.002572+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "32eb4ff533778e72"
---
# Reports
## Documentation: Report Export Request Events
### 1. Purpose
This module defines Prism-based event types used to signal user requests to export report data to external file formats—specifically CSV and PDF. These events serve as decoupled communication mechanisms within the applications event-driven architecture, allowing view models or UI components to request export operations without direct coupling to the export implementation logic (e.g., a report service or controller). They are part of the `DTS.Common.Events` namespace and are intended for use in Prism-based WPF or similar XAML-based UI frameworks.
### 2. Public Interface
- **`SaveReportToCSVRequestedEvent`**
*Type:* `class` (inherits from `CompositePresentationEvent<SaveReportToCSVRequestedEventArgs>`)
*Behavior:* A Prism event token used to publish and subscribe to requests to save a report to CSV format. Subscribers handle the actual export logic.
- **`SaveReportToCSVRequestedEventArgs`**
*Type:* `class`
*Properties:*
- `Directory` (`string`): The target directory path where the CSV file should be saved.
- `ParentVM` (`IBaseViewModel`): A reference to the view model initiating the request, typically used for context (e.g., to access report data or UI state).
- **`SaveReportToPDFRequestedEvent`**
*Type:* `class` (inherits from `CompositePresentationEvent<SaveReportToPDFRequestedEventArgs>`)
*Behavior:* A Prism event token used to publish and subscribe to requests to save a report to PDF format. Subscribers handle the actual export logic.
- **`SaveReportToPDFRequestedEventArgs`**
*Type:* `class`
*Properties:*
- `Directory` (`string`): The target directory path where the PDF file should be saved.
- `ParentVM` (`IBaseViewModel`): A reference to the view model initiating the request, typically used for context (e.g., to access report data or UI state).
### 3. Invariants
- Both event argument classes (`SaveReportToCSVRequestedEventArgs`, `SaveReportToPDFRequestedEventArgs`) require that `Directory` and `ParentVM` be non-null at the time the event is published, though the source does not enforce this explicitly.
- The `Directory` property is expected to represent a valid, writable file system path (conventionally validated by the subscriber).
- `ParentVM` must implement `IBaseViewModel` (from `DTS.Common.Base`), implying the event publisher has access to a view model instance conforming to that interface.
- No ordering or timing guarantees are specified—events are published asynchronously via Prisms `CompositePresentationEvent` mechanism.
### 4. Dependencies
- **Dependencies *of* this module:**
- `DTS.Common.Base` (provides `IBaseViewModel`)
- `Microsoft.Practices.Prism.Events` (provides `CompositePresentationEvent<T>`)
- **Dependencies *on* this module:**
- Any component (e.g., view models, services) that needs to trigger a report export must subscribe to or publish these events.
- Export handlers (e.g., services in other modules) must subscribe to these events to perform the actual file generation.
- No other modules in the provided source reference these events, so their consumers are external to this file set.
### 5. Gotchas
- **Ambiguity in `Directory` semantics:** The property name is `Directory`, but export operations typically require a *full file path* (e.g., `C:\Reports\export.csv`). It is unclear whether subscribers are expected to append a filename, or if the filename is derived from `ParentVM` or other context.
- **No cancellation or error propagation mechanism:** The events carry no way to signal success/failure or allow cancellation (e.g., via `CancellationToken` or result object), which may complicate error handling in subscribers.
- **No metadata about the report:** Neither event argument includes information about *which* report to export (e.g., report ID, data source, or filter criteria). This data must be inferred from `ParentVM`, increasing coupling and risk of inconsistency.
- **No thread-safety guarantees:** As Prisms `CompositePresentationEvent` uses the UI thread by default for subscriptions (unless `ThreadOption.Background` is specified), subscribers may need to marshal work off the UI thread, but this is not documented or enforced here.
- **Historical duplication:** The near-identical structure of `SaveReportToCSVRequestedEvent` and `SaveReportToPDFRequestedEvent` suggests potential for refactoring into a generic `SaveReportRequestedEvent<T>` (if Prism and project constraints allow), but no such generic exists in the source.

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportGRMSValuesUpdatedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportSettingsChangedEvent.cs
generated_at: "2026-04-16T02:50:24.419139+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "8cae978d3c87299f"
---
# PowerSpectralDensity
## Documentation: PSD Report Events
### 1. Purpose
This module defines Prism-based event types used to communicate changes in Power Spectral Density (PSD) report state within the DTS Viewer application. Specifically, it provides events for notifying subscribers when GRMS (Root Mean Square acceleration) summary values have been updated (`PSDReportGRMSValuesUpdatedEvent`) and when PSD report configuration settings have changed (`PSDReportSettingsChangedEvent`). These events facilitate decoupled UI updates and state synchronization across view models and services in a Prism-based MVVM architecture.
### 2. Public Interface
#### `PSDReportGRMSValuesUpdatedEvent`
- **Type**: `CompositePresentationEvent<PSDReportGRMSValuesUpdatedEventArg>`
- **Behavior**: A Prism event used to publish notifications when GRMS summary values for a PSD report have been recalculated or updated. Subscribers receive an `PSDReportGRMSValuesUpdatedEventArg` instance containing the updated values and the originating view model.
#### `PSDReportGRMSValuesUpdatedEventArg`
- **Type**: `class`
- **Properties**:
- `IChannelGRMSSummary[] Values`: Array of GRMS summary data per channel.
- `IBaseViewModel ParentVM`: Reference to the view model that triggered the event (e.g., the report view model).
#### `PSDReportSettingsChangedEvent`
- **Type**: `CompositePresentationEvent<PSDReportSettingsChangedEventArg>`
- **Behavior**: A Prism event used to publish notifications when PSD report settings (e.g., frequency range, window type, overlap) have been modified. Subscribers receive an `PSDReportSettingsChangedEventArg` instance containing the updated settings model and the originating view model.
#### `PSDReportSettingsChangedEventArg`
- **Type**: `class`
- **Properties**:
- `IPSDReportSettingsModel Model`: The updated PSD report settings model.
- `IBaseViewModel ParentVM`: Reference to the view model that triggered the event.
### 3. Invariants
- `Values` in `PSDReportGRMSValuesUpdatedEventArg` must be non-null when the event is published (though the array may be empty).
- `Model` in `PSDReportSettingsChangedEventArg` must be non-null when the event is published.
- `ParentVM` in both argument types is expected to be non-null and represent the view model instance associated with the report that triggered the event.
- Events are published via Prisms `EventAggregator`; subscribers must subscribe on the appropriate thread context (e.g., UI thread) if UI updates are required.
### 4. Dependencies
- **Dependencies on other modules**:
- `DTS.Common.Base` (provides `IBaseViewModel`)
- `DTS.Common.Interface` (provides `IChannelGRMSSummary`, `IPSDReportSettingsModel`)
- `Microsoft.Practices.Prism.Events` (provides `CompositePresentationEvent<T>`)
- **Depended on by**:
- View models and services that consume or produce PSD report data (e.g., report generation logic, UI components like `PSDReportViewModel`).
- Likely consumed by modules handling report display, export, or analysis (not specified in source).
### 5. Gotchas
- **No validation or immutability guarantees**: The argument classes expose public setters for all properties. Subscribers must assume values may be mutated after event publication unless explicitly copied.
- **No event payload versioning**: Changes to `IChannelGRMSSummary` or `IPSDReportSettingsModel` interfaces may break subscribers without warning.
- **Ambiguity in `ParentVM` semantics**: While `ParentVM` is included, its exact role (e.g., originator, owner, or context) is not documented in this file; callers must infer usage from surrounding code.
- **No documentation of event subscription/unsubscription patterns**: It is unclear whether events are intended for one-time use, persistent subscriptions, or scoped lifetime (e.g., per-view).
- **None identified from source alone.**

View File

@@ -0,0 +1,73 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/RefreshTestRequestEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/ShowT0CursorEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/TestModificationChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/SetUseZeroForUnfilteredEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/TestModificationEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/TestModification/ShiftT0Event.cs
generated_at: "2026-04-16T02:49:56.440589+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "42735a65c478074f"
---
# TestModification
## Documentation: Test Modification Event Definitions
### 1. Purpose
This module defines a set of Prism-based event types used for communication within the DTS Viewer component related to test modification operations. These events facilitate decoupled UI and data layer interactions—such as refreshing test data, toggling or shifting the T0 cursor, updating filter behavior, and signaling when a test has been modified—enabling reactive updates across modules without tight coupling. All events inherit from `CompositePresentationEvent<T>` (Prisms pub/sub mechanism), indicating they are intended for cross-view or cross-module communication in a WPF/Prism-based application.
### 2. Public Interface
| Event / Type | Signature | Behavior |
|--------------|-----------|----------|
| `RefreshTestRequestEvent` | `public class RefreshTestRequestEvent : CompositePresentationEvent<string> { }` | Payload is a `string` representing the **Test ID**. Subscribers use this to refresh the UI/data for the specified test. |
| `ShowT0CursorEvent` | `public class ShowT0CursorEvent : CompositePresentationEvent<bool> { }` | Payload is a `bool`. `true` to show the T0 cursor, `false` to hide it. |
| `TestModificationChangedEvent` | `public class TestModificationChangedEvent : CompositePresentationEvent<ITestModificationModel> { }` | Payload is an `ITestModificationModel`. Signals that the current test modification state (e.g., metadata, parameters) has changed. |
| `SetUseZeroForUnfilteredEvent` | `public class SetUseZeroForUnfilteredEvent : CompositePresentationEvent<bool> { }` | Payload is a `bool`. Controls whether `0` (true) or `P` (false) is displayed in the isocode filter field when modifying an isocode from a filter. |
| `TestModificationEvent` | `public class TestModificationEvent : CompositePresentationEvent<TestModificationArgs> { }` | Payload is a `TestModificationArgs`. Raised whenever a test is modified by the viewer (e.g., user edits metadata or parameters). Triggers downstream regeneration of ROIs (e.g., by DataPro). |
| `TestModificationArgs` | `public class TestModificationArgs { public string DataSetDirectory { get; } public string TestId { get; } public TestModificationArgs(string dtsFilePath, string testId) { ... } }` | Encapsulates context for a test modification: `dtsFilePath``DataSetDirectory`, and `testId`. |
| `ShiftT0Event` | `public class ShiftT0Event : CompositePresentationEvent<ShiftT0EventArguments> { }` | Payload is a `ShiftT0EventArguments`. Requests shifting the T0 time (cursor) either by absolute time offset or by sample/step count. |
| `ShiftT0EventArguments` | `public class ShiftT0EventArguments { public double T0Time { get; } public bool IsInitialization { get; } public int T0Steps { get; } public bool IsKeyPress { get; }` | Contains shift parameters: <br>• `T0Time`: Absolute time value (used in one constructor). <br>• `T0Steps`: Number of steps/samples to shift (used in the other constructor). <br>• `IsInitialization`: Whether this shift is part of initial setup. <br>• `IsKeyPress`: Whether the shift was triggered by a keyboard event (left/right arrow). |
> **Note**: Two distinct constructors for `ShiftT0EventArguments` exist:
> - One accepting `(double t0, bool isInitialization)` → sets `T0Time`, `IsInitialization`; `T0Steps = 0`, `IsKeyPress = false`.
> - One accepting `(int steps, bool isInitialization, bool isKeyPress)` → sets `T0Steps`, `IsInitialization`, `IsKeyPress`; `T0Time = 0D`.
### 3. Invariants
- All events are **non-interactive** (i.e., they carry data only; no return values or side effects in the event class itself).
- Payload types are strictly typed:
- `RefreshTestRequestEvent``string` (Test ID)
- `ShowT0CursorEvent``bool`
- `TestModificationChangedEvent``ITestModificationModel` (interface, not concrete type)
- `SetUseZeroForUnfilteredEvent``bool`
- `TestModificationEvent``TestModificationArgs`
- `ShiftT0Event``ShiftT0EventArguments`
- `TestModificationArgs.TestId` and `TestModificationArgs.DataSetDirectory` are **immutable** (`private set;`).
- In `ShiftT0EventArguments`, `T0Time` and `T0Steps` are mutually exclusive: only one is non-zero/non-default per instance.
- `IsInitialization` and `IsKeyPress` are independent flags; both may be `false` (e.g., programmatic shifts not triggered by user input or initialization).
### 4. Dependencies
- **External Dependency**:
- `Microsoft.Practices.Prism.Events` (Prism library) — required for `CompositePresentationEvent<T>`.
- **Internal Dependency**:
- `DTS.Common.Interface.ITestModificationModel` — referenced in `TestModificationChangedEvent`. This interface must be defined elsewhere in the codebase (not included here).
- **Inferred Usage**:
- Events are likely published by the DTS Viewer (e.g., test editing UI) and consumed by modules like DataPro (for ROI regeneration), cursor rendering components, or filter UI logic.
- No direct consumers are listed in the source; usage must be inferred from comments (e.g., `TestModificationEvent` is used by DataPro to regenerate ROI).
### 5. Gotchas
- **Ambiguous payload semantics**:
- `DataSetDirectory` in `TestModificationArgs` is initialized from `dtsFilePath`, but its name suggests a *directory* while the parameter is named `dtsFilePath` (which may be a full file path). Clarify whether this expects a directory or file path.
- `ShiftT0EventArguments` has two constructors with overlapping parameters (`isInitialization`) but different semantics. Callers must ensure correct constructor is used—mixing them may lead to `T0Time = 0` when a time shift was intended.
- **Missing validation**:
- No validation is present in `ShiftT0EventArguments` constructors (e.g., `steps` could be negative; `T0Time` could be negative). Behavior for invalid values is undefined.
- **Namespace quirk**:
- `// ReSharper disable CheckNamespace` is present in multiple files, suggesting intentional deviation from folder-based namespace conventions. Ensure build/linting rules accommodate this.
- **No documentation on event subscription/unsubscription patterns**:
- Since these are Prism events, subscribers must manage thread affinity (e.g., `ThreadOption.PublisherThread` vs `UIThread`) explicitly—this is not documented here.
- **No deprecation notices**:
- The comment for `TestModificationEvent` ("this event is called currently whenever...") suggests it may be legacy or in flux. No indication of planned replacement or migration path.
- **None identified from source alone.**

View File

@@ -0,0 +1,85 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ResetZoomChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorShowChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorsClearChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorShowMinMaxChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorsAlailableChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/SaveToPDFRequestedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ChartAxisChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ChartOptionsChangedEvent.cs
generated_at: "2026-04-16T02:50:11.916711+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "16f84af1488883a8"
---
# ViewerChartOptions
## Documentation: Viewer Chart Options Events Module
### 1. Purpose
This module defines a set of Prism-based pub/sub events used to communicate state changes and user requests related to chart viewer options in the DTS system. These events enable decoupled communication between chart UI components (e.g., view models, views, controllers) and backend logic—specifically for toggling cursor/zoom behavior, axis adjustments, chart configuration changes, and export actions. The events are part of the `DTS.Common.Events` namespace and rely on the `CompositePresentationEvent<T>` base class from Prism for cross-thread subscription and publication.
---
### 2. Public Interface
All event classes are *payload-only*—they carry no methods or properties beyond their inherited event infrastructure. Each inherits from `CompositePresentationEvent<TPayload>` and defines a strongly-typed payload.
| Event Class | Payload Type | Description |
|-------------|--------------|-------------|
| `ResetZoomChangedEvent` | `bool` | Indicates that the reset-zoom state has changed (e.g., whether reset-zoom is enabled or active). |
| `CursorShowChangedEvent` | `bool` | Indicates that the visibility state of the primary cursor has changed. |
| `CursorsClearChangedEvent` | `bool` | Indicates that the state of the “clear cursors” action has changed (e.g., whether clearing is allowed or requested). |
| `CursorShowMinMaxChangedEvent` | `bool` | Indicates that the state of displaying min/max values alongside cursors has changed. |
| `CursorsAlailableChangedEvent` | `bool` | *Note: Typo in class name—intended `CursorsAvailableChangedEvent`.* Indicates that the availability state of cursors has changed (e.g., whether cursors are enabled for interaction). |
| `SaveToPDFRequestedEvent` | `string` | Signals a request to save the current chart to PDF. The payload is a string—likely a suggested filename or export path. |
| `ChartAxisChangedEvent` | `ChartAxisChangedEventArg` | Signals that one chart axis (X or Y) has been adjusted. Payload contains updated axis bounds and the parent view model. |
| `ChartOptionsChangedEvent` | `ChartOptionsChangedEventArg` | Signals that high-level chart options (e.g., type, model settings) have changed. Payload includes the updated model, chart type, and parent view model. |
#### Payload Types
| Type | Fields | Description |
|------|--------|-------------|
| `ChartAxisChangedEventArg` | `IBaseViewModel ParentVM`, `string Axis`, `double MinValue`, `double MaxValue` | Encapsulates axis change details. `Axis` is likely `"X"` or `"Y"`. |
| `ChartOptionsChangedEventArg` | `IBaseViewModel ParentVM`, `IChartOptionsModel Model`, `string ChartType` | Encapsulates chart configuration change. `Model` holds serializable chart settings; `ChartType` identifies the visualization mode (e.g., `"Line"`, `"Bar"`). |
---
### 3. Invariants
- **Event naming convention**: All event classes end with `ChangedEvent` (for state changes) or `RequestedEvent` (for user-initiated actions).
- **Payload semantics**:
- Boolean events (`ResetZoomChangedEvent`, `CursorShowChangedEvent`, etc.) use `true`/`false` to represent *on/off* or *enabled/disabled* states—**not** toggling actions.
- `SaveToPDFRequestedEvent` payload is a `string`—interpreted as a *request* (not a confirmation), so the payload likely represents a *target* (e.g., filename or path), not a result.
- **ParentVM usage**: In `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg`, `ParentVM` is non-null and identifies the originating view model—enabling subscribers to scope responses to specific chart instances.
- **No validation in event classes**: Payload objects contain no validation logic; subscribers must enforce constraints (e.g., `MinValue ≤ MaxValue`).
---
### 4. Dependencies
#### Dependencies *of* this module:
- `Microsoft.Practices.Prism.Events` → Provides `CompositePresentationEvent<T>`.
- `DTS.Common.Base` → Provides `IBaseViewModel` interface.
- `DTS.Common.Interface` → Provides `IChartOptionsModel` interface.
#### Dependencies *on* this module:
- Any module/view model/view that needs to react to chart viewer option changes (e.g., chart rendering logic, cursor management, export handlers).
- Specifically:
- Subscribers to `ChartAxisChangedEvent` likely update axis scales in chart controls.
- Subscribers to `SaveToPDFRequestedEvent` likely trigger PDF export workflows.
- UI components (e.g., toolbar buttons) may publish `ResetZoomChangedEvent`/`CursorShowChangedEvent` to reflect toggle states.
---
### 5. Gotchas
- **Typo in class name**: `CursorsAlailableChangedEvent` is misspelled (`Alailable` instead of `Available`). This is preserved in the source and must be respected in code.
- **Misleading XML comments**: All events (except `SaveToPDFRequestedEvent`) have a comment `/// <summary>The Data Folder changed event.</summary>`, which is incorrect and likely copy-paste error. This does not affect runtime behavior but may confuse developers.
- **Ambiguous boolean semantics**: The meaning of `true`/`false` in boolean events is not standardized in the source. For example, `CursorShowChangedEvent` with `true` could mean *“show cursors”* or *“cursor visibility changed to visible”*—subscribers must infer intent from context or external documentation.
- **No event grouping**: Related events (e.g., cursor toggles) are defined separately, requiring subscribers to subscribe to each individually. No composite event or enum-based alternative is provided.
- **No deprecation markers**: Despite the typo, no `[Obsolete]` attribute or migration path is indicated.
None identified beyond the above.

View File

@@ -0,0 +1,56 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerFilter/FilterParameterChangedEvent.cs
generated_at: "2026-04-16T02:49:40.608427+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b412d168caf7b62d"
---
# ViewerFilter
### 1. **Purpose**
This module defines a Prism-based event (`FilterParameterChangedEvent`) used to broadcast changes to filter parameters within the DTS Viewer component. It enables decoupled communication between view models (implementing `IBaseViewModel`) and other subscribers (e.g., filter controllers, data aggregators) when a filter parameter is modified—typically in response to user interaction in the UI. The event carries metadata about *who* triggered the change (`Requester`) and *which* parameter changed (`Param`), supporting dynamic, reactive filtering logic without tight coupling.
---
### 2. **Public Interface**
- **`FilterParameterArgs`**
A data carrier class for the event payload.
- `IBaseViewModel Requester { get; set; }` — The view model instance that initiated the filter parameter change.
- `string Param { get; set; }` — The name or identifier of the filter parameter that changed.
- **`FilterParameterChangedEvent`**
A Prism `CompositePresentationEvent<FilterParameterArgs>` subclass used to publish and subscribe to filter parameter change notifications.
- Inherits standard Prism event methods: `Subscribe(...)`, `Publish(...)`, `Unsubscribe(...)`, etc.
- Payload type is `FilterParameterArgs`.
---
### 3. **Invariants**
- `Requester` **must not be null** when publishing the event (implied by the XML comment “Filter requester” and typical Prism usage patterns), though the source does not enforce this at runtime.
- `Param` **must be non-null and non-empty** for meaningful filtering, though again, no explicit validation is present in the source.
- The event is *asynchronous* by default (as `CompositePresentationEvent` supports thread marshaling), but no specific threading guarantees are documented.
- No ordering guarantees are provided for subscribers—multiple subscribers may receive the event in arbitrary order.
---
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Base.IBaseViewModel` — Defines the contract for the `Requester`.
- `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>` — Prisms event aggregation infrastructure.
- **Used by**:
- Any component in the DTS Viewer module (e.g., filter controls, view models, data services) that needs to notify others of filter parameter changes.
- Likely consumed by filter logic handlers (e.g., in a `FilterService` or `ViewerViewModel`) to re-query or re-render data.
---
### 5. **Gotchas**
- **No null-safety**: The class does not validate or guard against `null` values for `Requester` or `Param`. Subscribers must handle potential `NullReferenceException`s if these are not validated before publishing.
- **String-based parameter identification**: Using `string Param` instead of an enum or typed identifier increases risk of typos/mismatches (e.g., `"Status"` vs `"status"`).
- **No versioning or metadata**: The event carries no timestamp, correlation ID, or version info—making debugging or deduplication difficult in complex flows.
- **Namespace quirk**: The `// ReSharper disable CheckNamespace` comment suggests namespace alignment may be manually enforced, but the `DTS.Common.Events` namespace is used despite the file path `.../DTS.Viewer/...`. Developers should verify namespace consistency across the codebase.
- **No documentation on event lifecycle**: It is unclear whether this event is intended for one-time use, repeated updates, or if subscribers must clean up to avoid memory leaks (standard Prism practice applies: always `Unsubscribe` when appropriate).
*None identified from source alone.*

View File

@@ -0,0 +1,61 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerSettings/CalibrationBehaviorSettableInViewerChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerSettings/ViewerSettingsVisibilityChangedEvent.cs
generated_at: "2026-04-16T02:49:52.617936+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7819516e9af4aa9e"
---
# ViewerSettings
### 1. **Purpose**
This module defines two Prism-based event types used for broadcasting changes to viewer settings within the DTS application. Specifically, `CalibrationBehaviorSettableInViewerChangedEvent` signals when the availability (enabled/disabled state) of calibration behavior configuration in the viewer has changed, while `ViewerSettingsVisibilityChangedEvent` signals when the visibility state of the viewer settings panel has changed. These events facilitate loose coupling between components that manage or respond to viewer configuration state, enabling reactive UI updates or logic adjustments without direct dependencies.
---
### 2. **Public Interface**
- **`CalibrationBehaviorSettableInViewerChangedEvent`**
- **Inherits from**: `CompositePresentationEvent<bool>`
- **Behavior**: A Prism event used to publish and subscribe to changes in whether calibration behavior settings are settable (i.e., enabled) in the viewer. The payload is a `bool`: `true` indicates calibration behavior *is* settable; `false` indicates it is not.
- **Usage**: Published when the underlying logic determines that the user should or should not be allowed to modify calibration behavior via the viewer UI (e.g., due to permissions, mode constraints, or data state).
- **`ViewerSettingsVisibilityChangedEvent`**
- **Inherits from**: `CompositePresentationEvent<Visibility>`
- **Behavior**: A Prism event used to publish and subscribe to changes in the visibility of the viewer settings panel. The payload is a `System.Windows.Visibility` value (`Visible`, `Collapsed`, or `Hidden`).
- **Usage**: Published when the viewer settings panel is shown, hidden, or collapsed—e.g., in response to user actions (toggling a settings button) or application state changes (e.g., entering full-screen mode).
---
### 3. **Invariants**
- Both events are *purely informational*—they carry no side effects beyond notification; subscribers are responsible for any state changes or UI updates.
- The payload for `CalibrationBehaviorSettableInViewerChangedEvent` is strictly a `bool`, with no defined semantics beyond “settable” (`true`) vs. “not settable” (`false`). No intermediate or invalid states are implied.
- The payload for `ViewerSettingsVisibilityChangedEvent` must be one of the three `Visibility` enum values defined in `System.Windows`, and no other values are expected.
- Events are published *asynchronously* (via Prisms `CompositePresentationEvent` semantics), so subscribers may not receive events in the same call stack as the publisher.
- No ordering guarantees are provided between these two events—e.g., a visibility change may occur before or after a settable-state change, and subscribers must handle arbitrary sequences.
---
### 4. **Dependencies**
- **External Dependencies**:
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation).
- `System.Windows` (for `Visibility` type used in `ViewerSettingsVisibilityChangedEvent`).
- **Namespace**:
- Defined in `DTS.Common.Events`, indicating it is part of a shared/common core library (`DTS.CommonCore`).
- **Inferred Usage**:
- Likely consumed by viewer-related UI components (e.g., a settings panel view model or control) and possibly by core logic modules that manage calibration or viewer state.
- No direct reverse dependencies are visible in the source—these are leaf event definitions.
---
### 5. **Gotchas**
- **No default value semantics**: The source does not specify what the *initial* value of `CalibrationBehaviorSettableInViewerChangedEvent` or `ViewerSettingsVisibilityChangedEvent` should be (e.g., whether `false` or `Visibility.Collapsed` is the default). Subscribers must not assume an initial state unless documented elsewhere.
- **`Visibility` ambiguity**: `Visibility` has three states (`Visible`, `Collapsed`, `Hidden`), but the source does not clarify whether all three are intentionally used or whether only `Visible`/`Collapsed` are expected. Misuse (e.g., publishing `Hidden` when only `Collapsed` is handled) could cause subtle UI inconsistencies.
- **No deprecation or versioning markers**: The events lack attributes or comments indicating planned obsolescence, migration paths, or versioning—though this may be handled at a higher architectural layer.
- **Namespace consistency**: The `// ReSharper disable CheckNamespace` directive suggests the namespace is intentionally `DTS.Common.Events` (not nested under `DTS.CommonCore.Events`), which may conflict with folder structure expectations. Developers should verify expected namespace usage.
- **None identified from source alone.**

View File

@@ -0,0 +1,136 @@
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/ChannelSelectionCountNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/ChannelsModificationNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/ChannelSelectionChangeNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphChannelReadCalcProgressChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphChannelsReadCompletedNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/DataFileSelectedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphLoadedCountNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/TestLoadedCountNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/TestSummaryCountNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphClearNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedChannelCountNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedChannelsNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/ChannelsModificationLineFitNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/TestSummaryChangeNotification.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerTestSummary/DataFolderChangedEvent.cs
generated_at: "2026-04-16T02:50:13.872680+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cf000c210789fe90"
---
# Documentation: DTS.Viewer Test Summary Events Module
## 1. Purpose
This module defines a set of Prism-based event types used for decoupled communication within the DTS Viewer component, specifically for tracking and propagating changes related to test data selection, channel state, graph loading, and progress updates. It serves as a central event bus for UI and view model layers to react to state changes in the Test Summary view (e.g., when channels are selected, graphs are loaded, or data files/folders change), enabling modular and testable architecture without tight coupling between components.
## 2. Public Interface
All event classes inherit from `CompositePresentationEvent<TPayload>` (Prism event type), and payloads are strongly typed. Public types are:
### Event Classes (Payload Types in parentheses):
- **`ChannelSelectionCountNotification`** (`int`)
Published when the count of selected test channels changes.
- **`ChannelsModificationNotification`** (`List<ITestChannel>`)
Published when the set of selected test channels is modified (e.g., added/removed). Payload is the *current* list of selected channels.
- **`ChannelSelectionChangeNotification`** (`List<ITestChannel>`)
Published when the selected test channel list changes. Payload is the *new* list of selected channels.
*Note: Semantically similar to `ChannelsModificationNotification`; distinction unclear from source.*
- **`GraphChannelReadCalcProgressChangedEvent`** (`GraphChannelReadCalcProgressChangedEventArgs`)
Published to report progress during graph channel read/calculation. Payload contains:
- `ProgressMessage`: string description of current operation.
- `ProgressPercent`: double (0100) indicating completion percentage.
- `GraphVM`: `IBaseViewModel` instance associated with the graph.
- **`GraphChannelsReadCompletedNotification`** (`GraphChannelsReadCompletedNotificationArgs`)
Published when reading channels for a graph completes. Payload contains:
- `IsReadCompleted`: bool indicating success/failure status.
- `GraphVM`: `IBaseViewModel` instance associated with the graph.
- **`DataFileSelectedEvent`** (`DataFileSelectionArg`)
Published when a specific data file is selected (distinct from folder-level changes). Payload contains:
- `File`: string path to the selected file.
- `ParentVM`: `IBaseViewModel` referencing the owner view model (for multi-view reuse).
- **`GraphLoadedCountNotification`** (`GraphLoadedCountNotificationArg`)
Published when the count of loaded graphs changes. Payload contains:
- `LoadedCount`: int number of loaded graphs.
- `ParentVM`: `IBaseViewModel` instance (for multi-view reuse).
- **`TestLoadedCountNotification`** (`TestLoadedCountNotificationArg`)
Published when the count of loaded tests changes. Payload contains:
- `LoadedCount`: int number of loaded tests.
- `ParentVM`: `IBaseViewModel` instance.
- **`TestSummaryCountNotification`** (`TestSummaryCountNotificationArg`)
Published when the count of items in the test summary list changes. Payload contains:
- `SummaryCount`: int number of summary items.
- `ParentVM`: `IBaseViewModel` instance.
- **`GraphClearNotification`** (`GraphClearNotificationArg`)
Published when a graph is cleared. Payload contains:
- `GraphClear`: bool (always `true` per usage; likely legacy naming).
- `ParentVM`: `IBaseViewModel` instance.
- **`GraphSelectedChannelCountNotification`** (`GraphSelectedChannelCountNotificationArg`)
Published when the count of selected channels *for a specific graph* changes. Payload contains:
- `SelectedChannelCount`: int number of selected channels.
- `ParentVM`: `IBaseViewModel` instance.
- **`GraphSelectedChannelsNotification`** (`GraphSelectedChannelsNotificationArg`)
Published when the set of selected channels *for a specific graph* changes. Payload contains:
- `SelectedChannels`: `List<ITestChannel>` (current selection).
- `ParentVM`: `IBaseViewModel` instance.
- **`ChannelsModificationLineFitNotification`** (`LineFitArgs`)
Published to request or notify about line-fit calculations on a channel. Payload contains:
- `Channel`: `ITestChannel` to process.
- `StartIndex`: `ulong` start index for fit range.
- `EndIndex`: `ulong` end index for fit range.
- **`TestSummaryChangeNotification`** (`TestSummaryChangeNotificationArg`)
Published when the test summary list changes. Payload contains:
- `SummaryList`: `List<ITestSummary>` (new summary items).
- `ParentVM`: `IBaseViewModel` instance.
- **`DataFolderChangedEvent`** (`DataFolderSelectionArg`)
Published when the data folder path changes. Payload contains:
- `Path`: string folder path.
- `File`: string file path (may be null or empty).
- `SetSelected`: bool flag indicating whether to select the file in UI/viewer (default `false`).
- `ParentVM`: `IBaseViewModel` instance.
## 3. Invariants
- All events derive from `CompositePresentationEvent<T>`, implying they are published/subscribed via Prisms `EventAggregator`.
- Payloads are *always* passed by reference (no defensive copies implied by source).
- `ParentVM` is consistently present in all events related to multi-view reuse (commented as part of issue #24417), and must be non-null when used in contexts requiring view model scoping.
- `DataFileSelectedEvent` is explicitly intended *not* to trigger `DataFolderChangedEvent` subscribers (per inline comment), indicating a semantic distinction between file-level and folder-level selection.
- `GraphClearNotificationArg.GraphClear` is always `true` in practice (despite being a `bool` property), suggesting legacy naming or incomplete refactoring.
## 4. Dependencies
### Dependencies *of* this module:
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation).
- `DTS.Common.Base` (provides `IBaseViewModel`).
- `DTS.Common.Interface` (provides `ITestChannel`, `ITestSummary`).
- `DTS.Common.Interface.TestDefinition` (provides `ITestSummary` via `TestSummaryChangeNotification`).
### Dependencies *on* this module:
- Any component in the Viewer/Test Summary UI or view models that needs to react to selection, loading, or progress changes (e.g., `IBaseViewModel` implementations, UI controls).
- Likely consumed by modules handling graph rendering, channel selection, and data file/folder navigation.
## 5. Gotchas
- **Ambiguous event semantics**: `ChannelsModificationNotification` and `ChannelSelectionChangeNotification` both carry `List<ITestChannel>` and have near-identical documentation ("selected Test Summary list changed" vs "selected Graphs changed"). Without runtime usage context, it is unclear if they serve distinct purposes or are redundant.
- **`GraphClear` property naming**: `GraphClearNotificationArg.GraphClear` is always `true` (per usage pattern), suggesting it should be a constant or removed. Its presence may mislead consumers into expecting variable state.
- **`DataFileSelectedEvent` vs `DataFolderChangedEvent`**: Though both involve file/folder paths, `DataFileSelectedEvent` is explicitly designed *not* to trigger `DataFolderChangedEvent` subscriptions. Consumers must avoid conflating the two.
- **`LineFitArgs` immutability**: `LineFitArgs` has read-only properties (`Channel`, `StartIndex`, `EndIndex`) initialized via constructor, but `ChannelsModificationLineFitNotification` is a *notification* (not a request), implying consumers should not mutate the payload.
- **`ParentVM` usage**: All events with `ParentVM` are tied to multi-view reuse (issue #24417). Omitting or misassigning `ParentVM` may cause incorrect view scoping in PSD report or other derived viewers.
- **No validation rules**: Payloads (e.g., `List<ITestChannel>`, `IBaseViewModel`) are not validated in the event definitions. Consumers must handle nulls, empty lists, or invalid states.

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Events/Database/DbStatusEvent.cs
generated_at: "2026-04-16T02:47:59.031594+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e7feae6606912806"
---
# Database
## 1. Purpose
This module defines event infrastructure for communicating database operation status changes within the application, specifically to notify subscribers when database-related operations (such as connection, backup, copy, or restore) succeed or fail. It leverages the Prism event aggregation pattern (`CompositePresentationEvent`) to decouple event producers (e.g., database service logic) from consumers (e.g., UI components or logging modules), enabling asynchronous, loosely coupled status reporting.
## 2. Public Interface
- **`DbStatusEvent`**
*Type:* `class` inheriting from `CompositePresentationEvent<DbStatusArg>`
*Behavior:* A Prism event class used to publish and subscribe to database status updates. Subscribers receive a `DbStatusArg` payload describing the outcome of a database operation.
- **`DbStatusArg`**
*Type:* `class`
*Properties:*
- `EventTypes Status { get; }` — The type of database event that occurred (e.g., `Complete`, `FailedToConnectToRemote`).
- `Exception Exception { get; }` — The exception associated with the event (may be `null` for non-error events like `Complete`).
*Constructor:*
- `DbStatusArg(EventTypes error, Exception exception)` — Initializes a new instance with the specified status and exception. Both parameters are stored immutably.
- **`DbStatusArg.EventTypes`**
*Type:* `enum`
*Values:*
- `FailedToConnectToRemote`
- `FailedToBackupLocal`
- `FailedToCopy`
- `FailedToRestoreLocal`
- `FailedToBackupLocalFileNotFound`
- `Complete`
- `LegacyStatus`
## 3. Invariants
- `Status` and `Exception` are **immutable** after construction (no setters beyond initialization).
- `Exception` may be `null`, but only for non-error statuses (e.g., `Complete`). For error statuses, an exception *should* be provided, though the class does not enforce this at runtime.
- The `EventTypes` enum values are exhaustive for known database operation outcomes; no validation ensures that only these values are used.
- The event is published via Prisms event aggregation system, implying thread-safety and subscription lifecycle management (e.g., unsubscription required to avoid memory leaks), though the source file itself does not enforce subscription rules.
## 4. Dependencies
- **Depends on:**
- `System` (for `Exception`)
- `Microsoft.Practices.Prism.Events` (for `CompositePresentationEvent<T>`)
- `DTS.Common.Events.Database` namespace (internal module scope)
- **Depended on by (inferred):**
- Any module or component that needs to react to database status changes (e.g., UI layers subscribing to `DbStatusEvent` to update status indicators, or logging services publishing to an external system).
- *Note:* The source file does not specify concrete consumers; dependencies are implied by the events purpose and Prism usage.
## 5. Gotchas
- `LegacyStatus` is included in `EventTypes` but its meaning is undocumented; its purpose is unclear from the source alone.
- The `Exception` property is nullable, but the constructor does not validate that non-`Complete` statuses include a non-null exception. Consumers must defensively handle `null` exceptions for error statuses.
- The class uses Prisms `CompositePresentationEvent<T>`, which implies **thread marshaling may be required** for UI updates (e.g., via `Subscribe` with `ThreadOption.UIThread`). This is not enforced by the event class itself.
- No versioning or deprecation mechanism is evident for `EventTypes`; adding/removing values may break consumers.
- None identified from source alone.

View File

@@ -0,0 +1,48 @@
---
source_files:
- Common/DTS.CommonCore/Events/Diagnostics/CheckDataToDownloadEvent.cs
generated_at: "2026-04-16T02:48:40.389549+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3e255fee03a6af6b"
---
# Diagnostics
### 1. Purpose
This module defines a Prism-based event (`CheckDataToDownloadEvent`) used to signal and coordinate a check for data that needs to be downloaded in the DTS system. It enables decoupled communication between components: a producer (e.g., a service or UI module) raises the event to request validation or assessment of download requirements, optionally bypassing the check (e.g., for forced updates or initialization scenarios). The event carries context via `CheckDataToDownloadEventArgs`, including whether the check should be skipped and a reference to the originating component.
### 2. Public Interface
- **`CheckDataToDownloadEvent`**
*Type:* `class` inheriting from `CompositePresentationEvent<CheckDataToDownloadEventArgs>`
*Behavior:* A Prism event used for publishing and subscribing to download-check requests across modules. As a `CompositePresentationEvent`, it supports thread marshaling (via `ThreadOption`) and event subscription management (e.g., weak references, multiple subscribers).
- **`CheckDataToDownloadEventArgs`**
*Type:* `class`
*Properties:*
- `bool BypassCheck { get; }` — Indicates whether the download check logic should be skipped. `true` means the check is bypassed (e.g., proceed directly to download or skip validation).
- `object Producer { get; }` — A reference to the component that raised the event (e.g., a view model, service, or controller). Used for tracing or context-aware handling.
*Constructor:*
- `CheckDataToDownloadEventArgs(bool bypassCheck, object o)` — Initializes the args with the bypass flag and producer reference. Both parameters are required and immutable after construction.
### 3. Invariants
- `BypassCheck` is set at construction and **never modified** (read-only via `private set`).
- `Producer` is set at construction and **never modified** (read-only via `private set`).
- `Producer` may be `null` (no validation is enforced in the constructor), but callers are expected to provide a meaningful reference when possible.
- The event is intended for **one-time publication per request**; repeated publications require new event instances.
- No ordering guarantees exist for subscribers (Prisms `CompositePresentationEvent` delivers events to all subscribers concurrently or in undefined order depending on configuration).
### 4. Dependencies
- **Depends on:**
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation).
- `DTS.Common.Events.Diagnostics` namespace (module-scoped grouping; no external cross-module dependencies implied by the file alone).
- **Used by:**
- Any module/component needing to trigger or respond to download-check requests (e.g., a data synchronization service, update manager, or UI component).
- Subscribers would typically be in modules that handle data download logic (e.g., `DTS.DownloadService`), though not explicitly stated in this file.
### 5. Gotchas
- `Producer` is typed as `object`, not a specific interface or base type (e.g., `IProducer`), which may lead to runtime type-casting assumptions in subscribers.
- No validation on `bypassCheck` values (e.g., `true`/`false` are both accepted without constraint).
- The event name `CheckDataToDownloadEvent` implies a *request* for a check, but subscribers may misinterpret it as a *notification* of completed checks—clear documentation of intent is critical.
- `CompositePresentationEvent` implies thread-safety via event aggregation, but subscribers must still handle cross-thread access if `Producer` is UI-bound (e.g., marshaling to the UI thread).
- None identified from source alone.

View File

@@ -0,0 +1,59 @@
---
source_files:
- Common/DTS.CommonCore/Events/GroupTemplates/CustomChannels/CustomChannelExportFileSetEvent.cs
- Common/DTS.CommonCore/Events/GroupTemplates/CustomChannels/CustomChannelImportEvent.cs
generated_at: "2026-04-16T02:49:05.802703+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "46fed4b1ba64a18a"
---
# CustomChannels
## Documentation: Custom Channel Events Module
### 1. Purpose
This module defines Prism-based events used to coordinate custom channel import and export operations within the applications Group Templates feature. Specifically, it provides a mechanism to signal when a custom channel export file set is ready (triggering UI busy state) and to report the completion status of a custom channel import operation. These events facilitate decoupled communication between components involved in custom channel lifecycle management.
### 2. Public Interface
- **`CustomChannelExportFileSetEvent`**
- *Type*: `class`
- *Inherits*: `CompositePresentationEvent<string>`
- *Behavior*: A Prism event used to notify subscribers that a custom channel export file set has been generated. The payload is a `string`, which (based on naming and typical usage) is expected to represent the file path or identifier of the exported file set. Subscribers should interpret this string as the location or reference to the exported data.
- **`CustomChannelImportEvent`**
- *Type*: `class`
- *Inherits*: `CompositePresentationEvent<CustomChannelImportEventArgs>`
- *Behavior*: A Prism event used to signal the completion status of a custom channel import operation.
- **`CustomChannelImportEventArgs`**
- *Type*: `class`
- *Properties*:
- `ImportStatus`: `Status` — read-only; indicates the outcome of the import operation.
- *Constructors*:
- `CustomChannelImportEventArgs(Status status)` — initializes the event args with the given import status.
- *Nested Type*:
- `Status``enum` with a single member:
- `Done` — indicates the import operation has completed.
### 3. Invariants
- `CustomChannelExportFileSetEvent` payloads are non-null `string` values representing an exported file set reference (e.g., a file path). Null payloads are not explicitly guarded against in the event definition, but their presence would likely cause downstream failures.
- `CustomChannelImportEventArgs` instances must be constructed with a valid `Status` value; currently, only `Status.Done` is defined, implying that *only successful import completions are reported*. No error or cancellation states are modeled in the current implementation.
- Events are published via Prisms `EventAggregator`, so subscribers must be registered and unregistered appropriately to avoid memory leaks or missed notifications.
### 4. Dependencies
- **Depends on**:
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation)
- `DTS.CommonCore` (namespace context for shared core types)
- **Used by**:
- Components responsible for custom channel export (publishing `CustomChannelExportFileSetEvent`)
- Components responsible for custom channel import (publishing `CustomChannelImportEvent`)
- UI or service layers that react to these events (e.g., to toggle busy states or update import history)
### 5. Gotchas
- The `CustomChannelExportFileSetEvent` inherits `CompositePresentationEvent<string>`, but the documentation comment does not clarify the *meaning* of the `string` payload (e.g., is it a file path, a GUID, or serialized metadata?). This ambiguity may lead to inconsistent interpretation by subscribers.
- `CustomChannelImportEventArgs.Status` currently only supports `Done`. If import failures or partial successes occur, they are *not* reported via this event, potentially masking errors or leaving subscribers unaware of non-success outcomes.
- The `CustomChannelImportEvent` and `CustomChannelExportFileSetEvent` share the same namespace (`DTS.Common.Events.GroupTemplates.CustomChannels`), suggesting they are part of a related workflow, but no explicit ordering or dependency between them is enforced (e.g., export must precede import).
- No validation is performed on the `string` payload of `CustomChannelExportFileSetEvent`; subscribers must assume responsibility for path existence, format, or permissions.
- None identified from source alone.

View File

@@ -0,0 +1,45 @@
---
source_files:
- Common/DTS.CommonCore/Events/GroupTemplates/GroupTemplateList/GroupTemplateListGroupDoubleClickEvent.cs
- Common/DTS.CommonCore/Events/GroupTemplates/GroupTemplateList/GroupTemplateListGroupTemplateSelectedEvent.cs
generated_at: "2026-04-16T02:49:23.076829+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "20dafea03a43d30f"
---
# GroupTemplateList
## 1. Purpose
This module defines two Prism-based events used for inter-module communication in the DTS application related to group template management in the UI. Specifically, `GroupTemplateListGroupDoubleClickEvent` signals when a user double-clicks on a group template (carrying the templates identifier as a `string`), while `GroupTemplateListGroupTemplateSelectedEvent` signals when one or more group templates are selected (carrying an array of template identifiers as `string[]`). These events decouple UI components (e.g., a list view and a detail panel or command handler) by enabling event-driven responses to user interactions.
## 2. Public Interface
- **`GroupTemplateListGroupDoubleClickEvent`**
- *Signature*: `public class GroupTemplateListGroupDoubleClickEvent : CompositePresentationEvent<string>`
- *Behavior*: A Prism `CompositePresentationEvent` that publishes a single `string` payload—the identifier of the group template that was double-clicked. Intended for use when a double-click action should trigger an immediate operation (e.g., opening the template for editing or preview).
- **`GroupTemplateListGroupTemplateSelectedEvent`**
- *Signature*: `public class GroupTemplateListGroupTemplateSelectedEvent : CompositePresentationEvent<string[]>`
- *Behavior*: A Prism `CompositePresentationEvent` that publishes a `string[]` payload—identifiers of the group templates currently selected in the UI (e.g., via checkbox or multi-select). Intended for scenarios where selection state changes (e.g., enabling/disabling toolbar buttons or updating a summary view).
## 3. Invariants
- The payload for `GroupTemplateListGroupDoubleClickEvent` is always a non-null `string` representing exactly one template ID (since double-click implies a single item).
- The payload for `GroupTemplateListGroupTemplateSelectedEvent` is always a non-null `string[]`, though the array may be empty (indicating no selection).
- Event payloads contain *only* template identifiers (no metadata or full objects); consumers must resolve IDs to template instances via other means (e.g., a service or cache).
- No ordering guarantee is specified for the `string[]` in `GroupTemplateListGroupTemplateSelectedEvent`; consumers must not assume the order reflects UI selection order unless documented elsewhere.
## 4. Dependencies
- **Dependencies *of* this module**:
- `Microsoft.Practices.Prism.Events` (Prism library, specifically `CompositePresentationEvent<T>`).
- Implicitly depends on `DTS.Common.Events.GroupTemplates.GroupTemplateList` namespace structure (other event types may exist in this hierarchy, but none are referenced here).
- **Dependencies *on* this module**:
- UI components (e.g., a `GroupTemplateList` view) that publish these events.
- Command handlers or view models (e.g., `GroupTemplateListViewModel`) that subscribe to these events to react to user actions.
- No direct dependencies on other *events* in the source—though logically, these events likely coordinate with other group-template-related events (e.g., load/save events), but those are not evident from the provided files.
## 5. Gotchas
- **Naming inconsistency**: The class `GroupTemplateListGroupDoubleClickEvent` is documented as `The GroupTemplateListGroupTemplateSelectedEvent event` in its XML comment—this appears to be a copy-paste error in the comment (the class name itself is correct).
- **Ambiguous semantics**: The distinction between *selection* and *double-click* is not clarified in the source. Double-click may or may not trigger a selection event first; consumers should not assume ordering or mutual exclusivity without external documentation.
- **No validation on IDs**: Neither event validates or enforces ID format (e.g., GUID vs. numeric). Consumers must handle invalid or missing IDs gracefully.
- **Array mutability risk**: Since `string[]` is passed directly, subscribers could inadvertently modify the array. Prism does not clone payloads; consider defensive copying if mutation is a concern (not enforced here).
- **No cancellation support**: These are `CompositePresentationEvent<T>` (not `PubSubEvent<T>`), meaning all subscribers are invoked synchronously and cannot cancel the event. This may cause side effects if one subscriber fails.

View File

@@ -0,0 +1,66 @@
---
source_files:
- Common/DTS.CommonCore/Events/GroupTemplates/TemplateChannelList/TemplateChannelListOrderChangedEvent.cs
- Common/DTS.CommonCore/Events/GroupTemplates/TemplateChannelList/TemplateChannelListSelectionChangedEvent.cs
- Common/DTS.CommonCore/Events/GroupTemplates/TemplateChannelList/TemplateChannelListRequiredChangedEvent.cs
generated_at: "2026-04-16T02:49:20.561270+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "2352802106c3fc56"
---
# TemplateChannelList
## Documentation: TemplateChannelList Events Module
### 1. Purpose
This module defines Prism-based event types used to communicate changes in the state of a *template channel list*—a UI or logical construct representing ordered, selectable channels associated with a group template. Specifically, it publishes events when the *order* of channels changes, when the *selection* among channels changes, or when the *required status* of the channel list changes (e.g., whether at least one channel must be selected). These events decouple UI components or services that manage or react to channel list state, enabling modular and testable event-driven behavior within the application.
### 2. Public Interface
- **`TemplateChannelListOrderChangedEvent`**
- **Type**: `class` inheriting from `CompositePresentationEvent<IGroupTemplateChannel>`
- **Behavior**: Published when the *order* of channels in the template channel list has been modified (e.g., via drag-and-drop reordering). The payload is the `IGroupTemplateChannel` instance that was moved (or the channel whose position changed most significantly—implementation detail not specified in source).
- **`TemplateChannelListSelectionChangedEvent`**
- **Type**: `class` inheriting from `CompositePresentationEvent<IGroupTemplateChannel>`
- **Behavior**: Published when the *selection state* of a channel in the list changes (e.g., a channel is selected or deselected). The payload is the `IGroupTemplateChannel` instance whose selection status changed.
- **`TemplateChannelListRequiredChangedEvent`**
- **Type**: `class` inheriting from `CompositePresentationEvent<TemplateChannelListRequiredChangeEventArgs>`
- **Behavior**: Published when the *required status* of the channel list changes (e.g., the list transitions from optional to mandatory, or vice versa). The payload is a `TemplateChannelListRequiredChangeEventArgs` object containing:
- `Consumer`: The object (e.g., UI control, service) triggering or affected by the change.
- `Channels`: An array of `IGroupTemplateChannel` instances currently in the list.
- **`TemplateChannelListRequiredChangeEventArgs`**
- **Type**: `class`
- **Properties**:
- `public object Consumer { get; }` — The entity responsible for the change.
- `public IGroupTemplateChannel[] Channels { get; }` — The current set of channels in the list at the time of the event.
- **Constructor**: `TemplateChannelListRequiredChangeEventArgs(object o, IGroupTemplateChannel[] channels)` — Initializes the args with the consumer and channel array.
### 3. Invariants
- All events derive from `CompositePresentationEvent<T>`, meaning they are published/subscribed via Prisms event aggregation mechanism and are *thread-safe* for cross-thread publishing (subject to Prisms default behavior).
- The payload for `TemplateChannelListOrderChangedEvent` and `TemplateChannelListSelectionChangedEvent` is a *single* `IGroupTemplateChannel` instance, implying events are likely published per-channel changes (not batched).
- For `TemplateChannelListRequiredChangedEvent`, the `Channels` array is non-null (as it is assigned directly from constructor parameter), but its *contents* may be empty if no channels exist.
- The `Consumer` property in `TemplateChannelListRequiredChangeEventArgs` is typed as `object`, indicating no specific contract is enforced—consumers must cast or inspect as needed.
### 4. Dependencies
- **Depends on**:
- `DTS.Common.Interface.GroupTemplate` (specifically `IGroupTemplateChannel` interface)
- `Microsoft.Practices.Prism.Events` (`CompositePresentationEvent<T>`)
- **Depended on by**:
- Any module or component that manages or reacts to template channel list state (e.g., UI views, view models, or services handling group templates).
- *Inferred*: Components that implement or consume `IGroupTemplateChannel` (e.g., channel list controls, template editors) will likely subscribe to these events.
### 5. Gotchas
- **Misleading XML documentation**: All three event classes share the same summary comment: *“The GroupTemplateListGroupTemplateSelectedEvent event.”* and remarks: *“called when a template is selected.”* This is **inaccurate** for `TemplateChannelListOrderChangedEvent` and `TemplateChannelListRequiredChangedEvent`, and partially misleading for `TemplateChannelListSelectionChangedEvent` (which concerns *channel* selection, not *template* selection). This may cause confusion during maintenance.
- **Ambiguous semantics**: The source does not clarify whether `TemplateChannelListOrderChangedEvent` publishes the *moved* channel, the *source* channel, or the *entire list*—only that it carries a single `IGroupTemplateChannel`. Similarly, it is unclear whether `TemplateChannelListSelectionChangedEvent` fires on *any* selection change or only on *user-initiated* selection changes.
- **No batch support**: Events are single-channel focused; reordering or bulk selection changes may require multiple event publications, potentially impacting performance or consistency if not handled atomically by subscribers.
- **`Consumer` type safety**: `TemplateChannelListRequiredChangeEventArgs.Consumer` is `object`, requiring runtime type checks or casting—no compile-time safety.
- **No event filtering or cancellation**: As Prism `CompositePresentationEvent<T>` instances, these events do not support payload filtering or cancellation by default (unlike `PubSubEvent<T>` with `ThreadOption.PublisherThread` or custom `SubscriptionToken` handling).
None identified beyond the above.

View File

@@ -0,0 +1,95 @@
---
source_files:
- Common/DTS.CommonCore/Events/Groups/GroupChannelList/GroupChannelDeleteRequestEvent.cs
- Common/DTS.CommonCore/Events/Groups/GroupChannelList/GroupChannelsChangedEvent.cs
- Common/DTS.CommonCore/Events/Groups/GroupChannelList/GroupUpdatedEvent.cs
generated_at: "2026-04-16T02:49:37.172100+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1f00e06c87e755ec"
---
# GroupChannelList
## Documentation: GroupChannelList Events Module
### 1. Purpose
This module defines Prism-based event types used for communication related to group channel list management within the DTS system. It enables decoupled notification of changes to group channel structures—such as channel deletions, overall channel count updates, and logical group updates (e.g., channel insertion or assignment changes)—across UI layers and business logic components. These events follow the Prism `CompositePresentationEvent<T>` pattern, supporting subscription on multiple threads and view-model-level decoupling.
---
### 2. Public Interface
#### `GroupChannelDeleteRequestEvent`
- **Type**: `class` (inherits `CompositePresentationEvent<GroupChannelDeleteRequestEventArgs>`)
- **Behavior**: Publishes a request to delete a specific channel from a group. Subscribers are expected to handle the deletion logic.
#### `GroupChannelDeleteRequestEventArgs`
- **Type**: `class`
- **Properties**:
- `object Page` — The UI page or context where the deletion was initiated.
- `IGroupChannel Channel` — The channel object requested for deletion.
- **Constructor**: `GroupChannelDeleteRequestEventArgs(object page, IGroupChannel channel)`
#### `GroupChannelsChangedEvent`
- **Type**: `class` (inherits `CompositePresentationEvent<GroupChannelsChangedEventArgs>`)
- **Behavior**: Published when the number of channels in a group has changed (e.g., after bulk add/remove operations).
- **Note**: The XML comment incorrectly labels this as “The GroupUpdated event” and states it is “called when a template is selected,” which appears inconsistent with its name and payload. Actual semantics are inferred from the type name and data.
#### `GroupChannelsChangedEventArgs`
- **Type**: `class`
- **Properties**:
- `object Group` — The group whose channel count has changed.
- `int ChannelCount` — The new total number of channels in the group.
- **Constructor**: `GroupChannelsChangedEventArgs(object group, int channelCount)`
#### `GroupUpdatedEvent`
- **Type**: `class` (inherits `CompositePresentationEvent<GroupUpdatedEventArgs>`)
- **Behavior**: Published when a logical update occurs within a groups channel list, such as insertion of new channels or assignment of channels to users/groups.
#### `GroupUpdatedEventArgs`
- **Type**: `class`
- **Properties**:
- `object Page` — The UI page or context where the update occurred.
- `Status UpdateStatus` — Indicates the type of update performed (see enum below).
- **Enum `Status`**:
- `ChannelsInserted` — New channels were inserted into the group.
- `AssignmentsMade` — Channel assignments (e.g., user/group permissions) were modified.
- **Constructor**: `GroupUpdatedEventArgs(object page, Status status)`
---
### 3. Invariants
- All event args classes are **immutable** after construction (no setters beyond the constructor).
- `Channel` in `GroupChannelDeleteRequestEventArgs` is guaranteed non-null at construction time (enforced by constructor), but nullability of `Page` and `Group` is not explicitly constrained—callers may pass `null`.
- `ChannelCount` in `GroupChannelsChangedEventArgs` must reflect the **current total** number of channels in the group after the change.
- `UpdateStatus` in `GroupUpdatedEventArgs` must be one of the two defined enum values (`ChannelsInserted` or `AssignmentsMade`).
- Events are published using Prisms `CompositePresentationEvent<T>`, implying they support **thread-safe subscription** and **background thread publishing**, though the source does not specify default threading behavior (e.g., `ThreadOption`).
---
### 4. Dependencies
#### Dependencies *of* this module:
- `Microsoft.Practices.Prism.Events` — Provides `CompositePresentationEvent<T>`.
- `DTS.Common.Interface.Channels.IGroupChannel` — Interface defining the contract for group channels (imported from `DTS.Common.Interface.Channels`).
#### Dependencies *on* this module:
- Any module handling group channel UI or state (e.g., view models, services) likely subscribes to these events.
- The presence of `IGroupChannel` implies this module is part of a larger channel abstraction layer; consumers must implement or reference `DTS.Common.Interface.Channels`.
---
### 5. Gotchas
- **Misleading XML comments**:
- `GroupChannelsChangedEvent` is documented as “The GroupUpdated event” and described as “called when a template is selected,” which contradicts its name and payload. This may cause confusion during maintenance.
- `GroupUpdatedEvent` is documented identically, despite having a distinct purpose and payload.
- **Ambiguous `Page`/`Group` semantics**:
- The `object` type for `Page` and `Group` provides flexibility but lacks compile-time safety. Consumers must agree on expected types (e.g., `Page` likely represents a `FrameworkElement` or view model, but this is not specified).
- **No explicit validation**:
- No validation is enforced on `ChannelCount` (e.g., non-negative), though negative values would be semantically invalid.
- **No event payload versioning**:
- Adding new fields to event args (e.g., `ChannelCount``ChannelCount`, `ChannelIds`) would break backward compatibility for existing subscribers.
- **None identified from source alone** for behavioral quirks beyond the above.

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Events/Groups/GroupsList/GroupListEditGroupEvent.cs
- Common/DTS.CommonCore/Events/Groups/GroupsList/GroupListGroupSelectedEvent.cs
generated_at: "2026-04-16T02:49:31.134710+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "d421bd098cb2332c"
---
# GroupsList
## Documentation Page: Group List Events
### 1. Purpose
This module defines two Prism-based events used for inter-module communication in the DTS application related to group list UI interactions. Specifically, `GroupListEditGroupEvent` signals when a user selects a single group for editing, and `GroupListGroupSelectedEvent` signals when one or more groups are selected (e.g., for batch operations). These events decouple UI components (e.g., group list views) from handlers (e.g., view models or controllers) by leveraging the Prism event aggregation pattern.
---
### 2. Public Interface
#### `GroupListEditGroupEvent`
- **Namespace**: `DTS.Common.Events.Groups.GroupList`
- **Inherits**: `CompositePresentationEvent<int>`
- **Behavior**: Published when a *single* group is selected for editing. The payload is the `int` ID of the selected group.
#### `GroupListGroupSelectedEvent`
- **Namespace**: `DTS.Common.Events.Groups.GroupList`
- **Inherits**: `CompositePresentationEvent<int[]>`
- **Behavior**: Published when *one or more* groups are selected (e.g., via multi-select). The payload is an `int[]` array of group IDs in the current selection.
> **Note**: Despite the XML documentation comments referencing `"GroupTemplateListGroupTemplateSelectedEvent"` and `"called when a template is selected"`, the actual class names and payload types (`int` vs `int[]`) and the namespace context (`GroupList`) strongly indicate these events pertain to *groups*, not templates. This appears to be a copy-paste error in the comments.
---
### 3. Invariants
- `GroupListEditGroupEvent` **always** carries exactly one group ID (`int`), implying the event is intended for single-selection contexts.
- `GroupListGroupSelectedEvent` **always** carries an array of group IDs (`int[]`), which may be empty, contain one element, or multiple elements.
- Both events derive from `CompositePresentationEvent<T>`, meaning they are thread-safe for publishing/subscribing across UI threads (Prisms default behavior for `CompositePresentationEvent`).
- No validation rules or constraints are enforced on the group IDs (e.g., negative IDs or non-existent IDs are not prevented by the event definition itself).
---
### 4. Dependencies
- **Dependencies *on***:
- `Microsoft.Practices.Prism.Events` (Prism library, specifically `CompositePresentationEvent<T>`).
- **Dependencies *of***:
- UI components (e.g., group list controls) that publish these events when selection changes.
- Subscribers (e.g., view models, services) that react to group selection changes (e.g., to load group details, enable edit commands, or trigger batch operations).
- **No other internal module dependencies** are visible in the provided source files.
---
### 5. Gotchas
- **Misleading XML comments**: Both event classes include documentation referencing `"GroupTemplateListGroupTemplateSelectedEvent"` and "template selection", which contradicts the class names, namespaces, and payload semantics (group IDs, not template IDs). This is likely stale documentation and could mislead developers.
- **Ambiguity in selection semantics**: `GroupListGroupSelectedEvent` uses `int[]`, but the arrays ordering (e.g., sorted, user-selection order) and whether duplicates are possible are not specified. Subscribers must not assume ordering or uniqueness without external guarantees.
- **No null safety**: Since `int` and `int[]` are value types (with `int[]` being a reference type but non-nullable in C# without `?`), the event payload is never `null`, but an empty array (`new int[0]`) is valid for `GroupListGroupSelectedEvent`. Subscribers must handle the empty-array case explicitly if needed.
- **No versioning or deprecation markers**: The events lack attributes or comments indicating planned changes or obsolescence, but given the namespace (`DTS.CommonCore`), they are likely part of a stable shared layer—caution is warranted when modifying them.
None identified beyond the above.

View File

@@ -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 Prisms `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 hardwares 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 its *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.

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Events/ISO/ExtraPropertiesChangedEvent.cs
generated_at: "2026-04-16T02:48:09.465052+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e516fa28d2ce4f6a"
---
# ISO
### 1. **Purpose**
This module defines event infrastructure for propagating changes to a collection of extra properties within the ISO domain layer. Specifically, it provides a Prism-based event (`ExtraPropertiesChangedEvent`) and its argument container (`ExtraPropertiesChangedEventArgs`) to decouple producers of property updates (e.g., data sources, UI components, or business logic modules) from consumers (e.g., view models or services) in a loosely coupled, publish-subscribe pattern. It enables reactive updates to extended metadata associated with ISO-compliant entities, beyond standard properties.
---
### 2. **Public Interface**
#### `ExtraPropertiesChangedEvent`
- **Signature**: `public class ExtraPropertiesChangedEvent : CompositePresentationEvent<ExtraPropertiesChangedEventArgs>`
- **Behavior**: A Prism `CompositePresentationEvent` typed to `ExtraPropertiesChangedEventArgs`. Used to publish and subscribe to notifications when the set of extra properties has changed. Subscribers receive the updated list of properties, along with context about the producer and consumer involved.
#### `ExtraPropertiesChangedEventArgs`
- **Signature**: `public class ExtraPropertiesChangedEventArgs`
- **Properties**:
- `IList<IExtraProperty> ExtraProperties { get; }`
The new or updated list of extra properties. *Not null* (per constructor requirement), though the list itself may be empty.
- `object Producer { get; }`
The object instance that initiated or caused the change (e.g., a data adapter, service, or UI element).
- `object Consumer { get; }`
The object instance that is the target or recipient of the change (e.g., a view model or state manager).
- **Constructor**:
`ExtraPropertiesChangedEventArgs(IList<IExtraProperty> extraProperties, object producer, object consumer)`
Initializes a new instance with the specified property list, producer, and consumer. All parameters are required and stored immutably.
---
### 3. **Invariants**
- `ExtraProperties` is never `null`; the constructor enforces this by accepting `IList<IExtraProperty>` directly (though the caller must ensure non-null input).
- `Producer` and `Consumer` may be `null` (no validation is applied in the constructor), but are semantically expected to be non-null in practice (contextual usage).
- The event is *publish-only* on change; it does not support partial updates or delta semantics—subscribers receive the *entire* current list of extra properties.
- The `IList<IExtraProperty>` reference is stored directly (no defensive copy), so callers must avoid mutating the list after construction if immutability is desired.
---
### 4. **Dependencies**
- **Depends on**:
- `Microsoft.Practices.Prism.Events` (for `CompositePresentationEvent<T>` base class).
- `DTS.Common.Interface.ISO.ExtraProperties` (for `IExtraProperty` interface).
- **Depended on by**:
- Any module or layer that needs to publish or subscribe to extra property changes (e.g., ISO data adapters, UI components using Prism event aggregation).
- Not directly consumed by other *modules* in this file, but its usage is implied by the namespace (`DTS.Common.Events.ISO`) and naming conventions.
---
### 5. **Gotchas**
- **No immutability guarantee**: The `ExtraProperties` list is not defensively copied; external mutation of the passed list after construction will affect the event args. Callers should pass an immutable or defensive copy if needed.
- **`Producer`/`Consumer` semantics are application-defined**: The interface does not enforce or document what constitutes a valid `producer` or `consumer`. Misuse (e.g., passing `null` or unrelated objects) may lead to ambiguous event tracing.
- **No versioning or change metadata**: The event carries only the *current* state of properties, not what changed (e.g., additions/removals). Consumers must diff against prior state if granular change tracking is required.
- **No validation on `IExtraProperty` contents**: The list may contain duplicate, invalid, or inconsistent `IExtraProperty` instances—validation (if any) occurs elsewhere.

View File

@@ -0,0 +1,39 @@
---
source_files:
- Common/DTS.CommonCore/Events/Realtime/RealtimeChannelSelectedEvent.cs
generated_at: "2026-04-16T02:48:30.854477+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b5b90e6c3d17fb4a"
---
# Realtime
### 1. **Purpose**
This module defines the `RealtimeChannelSelectedEvent`, a Prism-based event used to propagate notifications across the application when a realtime communication channel is selected. It serves as a decoupling mechanism in the event-driven architecture, enabling subscribers (e.g., UI components, services, or modules) to react to channel selection changes—such as updating UI state, initializing connections, or switching data streams—without tight coupling to the publisher.
### 2. **Public Interface**
- **`RealtimeChannelSelectedEvent`**
- **Type**: `class` (inherits from `CompositePresentationEvent<IRealtimeChannel>`)
- **Behavior**: A Prism event token used for publishing and subscribing to channel selection events. When published, it carries an `IRealtimeChannel` instance representing the newly selected channel. Subscribers receive this instance via their event handler.
- **Note**: No additional public methods or properties are defined beyond those inherited from `CompositePresentationEvent<TPayload>` (e.g., `Subscribe`, `Publish`, `GetSubscriptionToken`).
### 3. **Invariants**
- The payload passed via `Publish` must be a non-null instance of `IRealtimeChannel` (enforced by convention, though not explicitly validated in this class).
- The event is intended for *thread-safe* use within Prisms event system (i.e., subscriptions/publishing may occur on any thread, with Prism handling dispatch to the UI thread if configured to do so).
- The event payload type is strictly `IRealtimeChannel`; no other types are supported.
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Interface.Realtime.IRealtimeChannel` (interface defining the realtime channel contract)
- `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>` (Prism event infrastructure)
- **Used by**:
- Components that publish channel selection changes (e.g., a channel manager or UI view model).
- Subscribers (e.g., data handlers, logging modules, or UI elements) that need to respond to channel changes.
*(Exact consumers are not visible in this file but are implied by the events purpose.)*
### 5. **Gotchas**
- **No explicit validation**: The class does not validate the `IRealtimeChannel` payload; subscribers must handle null or invalid channel states defensively.
- **Lifetime management**: Subscribers must manually unsubscribe (e.g., via `SubscriptionToken`) to avoid memory leaks—especially critical for long-lived subscribers (e.g., views) in Prisms event system.
- **Thread-safety assumptions**: While Prisms `CompositePresentationEvent` handles thread dispatch, the behavior depends on the applications Prism configuration (e.g., `ThreadOption.PublisherThread` vs. `UIThread`).
- **Naming ambiguity**: The class name `RealtimeChannelSelectedEvent` implies selection *triggered by user action*, but the source does not clarify whether it is also used for programmatic channel changes.

View File

@@ -0,0 +1,37 @@
---
source_files:
- Common/DTS.CommonCore/Events/RegionOfInterest/RegionOfInterestChangedEvent.cs
generated_at: "2026-04-16T02:47:49.374454+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "a47f2325776df1cf"
---
# RegionOfInterest
1. **Purpose**
This module defines a Prism `CompositePresentationEvent`-based event (`RegionOfInterestChangedEvent`) used to publish and subscribe to notifications when a region of interest (ROI) changes within the system. It serves as the messaging mechanism in the event-driven architecture to decouple components that generate or consume ROI updates—enabling loose coupling between ROI management logic and UI or processing modules that react to ROI changes.
2. **Public Interface**
- **`RegionOfInterestChangedEvent`**
- *Type*: `class` (inherits from `CompositePresentationEvent<IRegionOfInterest>`)
- *Behavior*: A Prism event type used for publishing and subscribing to ROI change notifications. When published, the event carries an `IRegionOfInterest` instance representing the new or updated region of interest. Subscribers receive the payload via their event handler.
3. **Invariants**
- The event payload is guaranteed to be of type `IRegionOfInterest` (as per the generic parameter of the base class).
- The event must be published only with a non-null `IRegionOfInterest` instance (though the source does not enforce this at compile time; runtime enforcement would depend on publisher code).
- As a `CompositePresentationEvent`, it supports multiple subscribers and thread-safe publication/subscription (per Prisms implementation), but ordering of subscriber invocation is not guaranteed.
4. **Dependencies**
- **External Dependencies**:
- `Microsoft.Practices.Prism.Events` — provides the `CompositePresentationEvent<T>` base class.
- `DTS.Common.Interface.RegionOfInterest` — defines the `IRegionOfInterest` interface used as the event payload.
- **Depended upon by**:
- Any module or component that needs to react to ROI changes (e.g., UI views, analysis pipelines) will subscribe to this event.
- ROI management components (e.g., ROI editors, trackers) are expected to publish this event when an ROI is modified.
5. **Gotchas**
- The class is a *pure event definition*—it contains no logic, validation, or helper methods. All behavior (e.g., payload construction, null checks) resides in the publisher/consumer code.
- No explicit documentation is present about whether the event is intended for *synchronous* or *asynchronous* use; Prisms `CompositePresentationEvent` defaults to synchronous dispatch on the calling thread unless configured otherwise (e.g., via `ThreadOption.Background` in subscription), but this is not specified here.
- The event name `RegionOfInterestChangedEvent` suggests a *change* occurred, but the payload is the *current* ROI state—not a diff or delta. Consumers must infer what changed by comparing with prior state if needed.
- None identified from source alone.

View File

@@ -0,0 +1,56 @@
---
source_files:
- Common/DTS.CommonCore/Events/RegionOfInterest/RegionOfInterestChannels/RegionOfInterestChannelsSelectedEvent.cs
generated_at: "2026-04-16T02:48:50.089661+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ab9ac5458ba58e80"
---
# RegionOfInterestChannels
### 1. Purpose
This module defines event types used for broadcasting and subscribing to selections of channels within a specific Region of Interest (ROI) in a Prism-based application. Specifically, it enables decoupled communication where a consumer (e.g., a view model or service) signals that a set of channels has been selected for a given ROI, identified by a suffix. The event is published using Prisms `CompositePresentationEvent`, supporting both synchronous and asynchronous subscription patterns across modules or layers.
### 2. Public Interface
- **`RegionOfInterestChannelsSelectedEvent`**
*Type:* `class` (inherits from `CompositePresentationEvent<RegionOfInterestChannelsSelectedEventArgs>`)
*Behavior:* A Prism event used to publish and subscribe to ROI channel selection changes. Subscribers receive an instance of `RegionOfInterestChannelsSelectedEventArgs` containing the selected channels and metadata.
- **`RegionOfInterestChannelsSelectedEventArgs`**
*Type:* `class`
*Behavior:* Encapsulates the data payload for the `RegionOfInterestChannelsSelectedEvent`.
- **Constructor:**
```csharp
RegionOfInterestChannelsSelectedEventArgs(string roiSuffix, string[] selectedChannelNames, object o)
```
Initializes the event args with:
- `roiSuffix`: A string identifying the ROI (e.g., `"Brain"`, `"Lesion"`), used to scope the channel selection.
- `selectedChannelNames`: An array of channel names (e.g., `["Red", "Green"]`) selected for the ROI.
- `o`: The consumer object triggering the event (e.g., a view model instance).
- **Properties:**
- `RegionOfInterestSuffix`: `string` — read-only; identifies the ROI context.
- `ChannelNames`: `string[]` — read-only; the list of selected channel names.
- `Consumer`: `object` — read-only; the object responsible for raising the event.
### 3. Invariants
- `RegionOfInterestSuffix` and `ChannelNames` are non-null (enforced by constructor; no null checks are present in the source, implying callers must supply valid values).
- `ChannelNames` is expected to be a non-empty array in typical usage (though not enforced by this class—consumers must validate).
- The `Consumer` property is non-null in practice (as it is passed directly from the constructor argument `o`), but the class does not enforce this.
- The event is *publish-only*—no built-in mechanism for acknowledgment or cancellation.
### 4. Dependencies
- **Depends on:**
- `Microsoft.Practices.Prism.Events` (for `CompositePresentationEvent`)
- `Microsoft.Practices.Prism.Regions` (imported but *not used* in this file—likely a legacy or placeholder import)
- `System` (implicitly via `string`, `object`, `string[]`)
- **Used by:**
- Other modules in the `DTS.Common.Events.RegionOfInterest.RegionOfInterestChannels` namespace (inferred from namespace structure).
- Any Prism module that needs to publish or subscribe to ROI channel selection events (e.g., UI components, analysis services).
### 5. Gotchas
- **No validation in constructor:** The class does not validate `roiSuffix`, `selectedChannelNames`, or `o` for null or emptiness, risking `NullReferenceException` or invalid state at runtime if callers are not disciplined.
- **`Prism.Regions` import is unused:** The `using Microsoft.Practices.Prism.Regions;` statement is present but irrelevant—suggests possible copy-paste artifact or incomplete refactoring.
- **`Consumer` is untyped:** Using `object` for `Consumer` makes it unclear what contract the consumer is expected to adhere to (e.g., interface requirements), increasing coupling risk.
- **No immutability guarantee for `ChannelNames`:** While the property is read-only, the underlying array reference is mutable—subscribers could observe side effects if the caller retains and mutates the array after construction.
- **No documentation on ROI suffix semantics:** The meaning of `RegionOfInterestSuffix` (e.g., allowed values, naming conventions) is not defined here—consumers must infer from context or external documentation.

View File

@@ -0,0 +1,67 @@
---
source_files:
- Common/DTS.CommonCore/Events/Sensors/CalibrationBehaviorSettingChangedEvent.cs
- Common/DTS.CommonCore/Events/Sensors/SensorFilterTypeChangedEvent.cs
generated_at: "2026-04-16T02:47:19.043189+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "6c4242c9e13326a0"
---
# Sensors
## Documentation: Sensor Event Definitions
### 1. Purpose
This module defines Prism-based pub/sub events used to propagate changes in sensor configuration and filtering behavior across the application. Specifically, it enables decoupled components to react to changes in calibration behavior settings (`CalibrationBehaviorSettingChangedEvent`) and sensor filter type selections (`SensorFilterTypeChangedEvent`), which may involve ISO code mappings or filter class assignments. These events support dynamic UI updates and state synchronization in sensor data processing pipelines.
### 2. Public Interface
#### `CalibrationBehaviorSettingChangedEvent`
- **Type**: `class` (inherits from `CompositePresentationEvent<CalibrationBehaviors>`)
- **Generic Payload**: `DTS.Common.Enums.Sensors.CalibrationBehaviors`
- **Behavior**: Publishes when the global or context-specific calibration behavior setting changes. Subscribers receive the new `CalibrationBehaviors` enum value.
#### `SensorFilterTypeChangedEvent`
- **Type**: `class` (inherits from `CompositePresentationEvent<SensorFilterTypeChangedEventArgs>`)
- **Payload**: `SensorFilterTypeChangedEventArgs`
- **Behavior**: Publishes when the sensor filter type (either ISO code character or filter class) is modified. Triggers updates to ISO code lists or filter logic.
##### `SensorFilterTypeChangedEventArgs`
- **Properties**:
- `char ISOCodeChar`: Set only when `EventType == EventTypes.ISOCodeChar`. Represents the selected ISO code character (e.g., `'A'`, `'B'`).
- `enum EventTypes { ISOCodeChar, FilterClass }`: Indicates which constructor was used to initialize the instance.
- `FilterClassType FilterClass`: Set only when `EventType == EventTypes.FilterClass`. Represents the selected filter class.
- `ISensorCalibration Calibration`: The calibration object associated with the sensor at the time of change.
- `ISensorData Sensor`: The sensor instance whose filter type is changing.
- `bool UseISOCodeFilterMapping`: Flag indicating whether ISO codebased filtering is enabled.
- `bool UseZeroForUnfiltered`: Flag indicating whether unfiltered readings should be represented as `0`.
- **Constructors**:
- `SensorFilterTypeChangedEventArgs(char code, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
Initializes for ISO code changes (`EventType = ISOCodeChar`).
- `SensorFilterTypeChangedEventArgs(FilterClassType filterClassType, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
Initializes for filter class changes (`EventType = FilterClass`).
### 3. Invariants
- `SensorFilterTypeChangedEventArgs` must be constructed using **exactly one** of its two constructors—never both parameters sets.
- `EventType` is set at construction time and **never changes**; it determines which of `ISOCodeChar` or `FilterClass` is valid.
- `ISOCodeChar` is only meaningful when `EventType == EventTypes.ISOCodeChar`; otherwise, its value is undefined (but not null-checked, as `char` is non-nullable).
- `FilterClass` is only meaningful when `EventType == EventTypes.FilterClass`.
- `Calibration`, `Sensor`, `UseISOCodeFilterMapping`, and `UseZeroForUnfiltered` are always set in both constructors and must be non-null (except `Calibration`/`Sensor` could be `null` if passed as such—no explicit validation is present in the source).
### 4. Dependencies
- **Depends on**:
- `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>` (for event infrastructure).
- `DTS.Common.Enums.Sensors` (for `CalibrationBehaviors` and `SensorFilterTypeChangedEventArgs.EventTypes`).
- `DTS.Common.Interface.Sensors` (for `ISensorCalibration` and `ISensorData` interfaces).
- **Used by**:
- Components that subscribe to `CalibrationBehaviorSettingChangedEvent` to adjust calibration logic.
- Components that subscribe to `SensorFilterTypeChangedEvent` to recompute ISO code mappings, filter tables, or UI filter controls.
- Likely consumed by sensor UI modules, data processing pipelines, or configuration managers (inferred from event semantics).
### 5. Gotchas
- `SensorFilterTypeChangedEventArgs` does not validate that `ISOCodeChar` is a valid ISO code character (e.g., range or allowed set). Consumers must enforce this.
- The `FilterClass` property is of type `FilterClassType`, but its definition is not included in the provided source—its valid values and semantics are unknown here.
- `Calibration` and `Sensor` are passed as interfaces but may be `null` if passed as such in the constructor; no null-checking is evident in this class.
- The namespace `DTS.Common.Events.Sensors` is used for `SensorFilterTypeChangedEvent`, while `CalibrationBehaviorSettingChangedEvent` resides in the parent `DTS.Common.Events` namespace—this may cause discoverability issues.
- The `bUseZeroForUnfiltered` parameter name uses Hungarian notation (`b` prefix), inconsistent with C# naming conventions (though preserved in the source).

View File

@@ -0,0 +1,72 @@
---
source_files:
- Common/DTS.CommonCore/Events/Sensors/SensorsList/SensorsListSensorSelectedEvent.cs
- Common/DTS.CommonCore/Events/Sensors/SensorsList/SensorChangedEvent.cs
generated_at: "2026-04-16T02:48:55.256595+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3ae767ae71f8e4ec"
---
# SensorsList
## Documentation: Sensors List Events Module
### 1. Purpose
This module defines Prism-based event types used for inter-module communication within the DTS application related to sensor management in the Sensors List UI. It enables decoupled notification of sensor selection, changes to sensor properties (e.g., sensitivity, excitation, nonlinearity), and sensor lifecycle events (addition/update). These events facilitate synchronization across UI components and business logic layers without tight coupling—specifically supporting scenarios such as saving sensor configurations, updating filter selections, and responding to user edits in sensor settings.
### 2. Public Interface
- **`SensorsListSensorSelectedEvent`**
*Inherits from:* `CompositePresentationEvent<string[]>`
*Behavior:* Published when a sensor (or sensors) is selected in the Sensors List UI. The payload is an array of strings—interpreted as serial numbers of the selected sensors (based on naming and usage context, though not explicitly documented in source).
- **`SensorSavedEvent`**
*Inherits from:* `CompositePresentationEvent<double>`
*Behavior:* Published after a new sensor is added via the settings menu (per comment referencing FB 13120). The payload is a `double`, likely representing the database ID or timestamp of the newly saved sensor (exact meaning not documented in source).
- **`SensorUpdatedEvent`**
*Inherits from:* `CompositePresentationEvent<bool>`
*Behavior:* Published when a sensor is added or deleted, to notify consumers (e.g., filter list UI) to re-evaluate or update the default filter selection. The `bool` payload likely indicates success or some state flag, but its precise semantics are not documented.
- **`SensorChangedEvent`**
*Inherits from:* `CompositePresentationEvent<SensorChangedArgs>`
*Behavior:* Published when a user modifies a sensor property in the UI (e.g., sensitivity, excitation, nonlinearity). Triggers dependent UI updates (e.g., sensitivity controls). Payload is a `SensorChangedArgs` object describing which properties changed.
- **`SensorChangedArgs`**
*Fields:*
- `SerialNumber` (`string`): Serial number of the changed sensor (currently unused, reserved for future use).
- `DatabaseId` (`int`): Database ID of the changed sensor (currently unused, reserved for future use).
- `CurrentModelLoading` (`bool`): `true` if the current model is being loaded.
- `NonLinearChanged` (`bool`): `true` if the nonlinear calibration setting changed.
- `SensitivityChanged` (`bool`): `true` if the sensitivity value changed.
- `IsProportionalChanged` (`bool`): `true` if the proportionality setting changed.
- `ExcitationChanged` (`bool`): `true` if the excitation setting changed.
*Constructor:* `SensorChangedArgs(string serialNumber, int databaseId, bool currentModelLoading, bool nonLinearChanged, bool sensitivityChanged, bool isProportionalChanged, bool excitationChanged)`
### 3. Invariants
- All events derive from `CompositePresentationEvent<T>` (Prism), implying they support subscription on any thread and marshaling to the UI thread via `ThreadOption.UIThread` (default behavior), though the source does not specify subscription options.
- The `SensorChangedArgs` payload is immutable: all properties have `private set` (implicitly via auto-property with only `get`), and the constructor enforces initialization of all fields.
- The `SerialNumber` and `DatabaseId` fields are *not currently used* (per comments), so consumers must not rely on them for active logic.
- The `bool` payloads in `SensorSavedEvent` and `SensorUpdatedEvent` lack explicit semantic documentation; their meaning is inferred from usage context and may be ambiguous.
### 4. Dependencies
- **Dependencies *of* this module:**
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation).
- Namespace `DTS.Common.Events.Sensors.SensorsList` (self-contained; no external module dependencies beyond Prism).
- **Dependencies *on* this module:**
- UI components handling sensor list selection (subscribe to `SensorsListSensorSelectedEvent`).
- Sensor configuration/save logic (publishes `SensorSavedEvent`).
- Filter list UI or related components (subscribe to `SensorUpdatedEvent`).
- Sensitivity/excitation control panels or validation logic (subscribe to `SensorChangedEvent`).
### 5. Gotchas
- **Misleading documentation:** The XML comment for `SensorsListSensorSelectedEvent` incorrectly states it is the `TTSImportSummaryImportEvent` and describes an "Import button" scenario—this is clearly a copy-paste error and does not match the class name or usage context.
- **Ambiguous payloads:**
- `SensorSavedEvent` uses `double` for its payload without documentation—this could be a database ID, timestamp, or other numeric identifier.
- `SensorUpdatedEvent` uses `bool` without specifying what `true`/`false` signifies (e.g., success/failure, add/delete).
- **Unused fields:** `SerialNumber` and `DatabaseId` in `SensorChangedArgs` are explicitly marked as unused; consumers should ignore them until future use is documented.
- **No validation guarantees:** The source provides no indication of validation on `SensorChangedArgs` constructor inputs (e.g., whether `SerialNumber` can be `null`, or `DatabaseId` negative). Consumers should assume inputs are accepted as-is.
- **No ordering guarantees:** As Prism events, subscribers receive notifications in the order they subscribed, but no cross-event ordering (e.g., between `SensorChangedEvent` and `SensorUpdatedEvent`) is implied or documented.
None identified beyond the above.

View File

@@ -0,0 +1,54 @@
---
source_files:
- Common/DTS.CommonCore/Events/TSRAIRGo/NavigateToDashboard.cs
- Common/DTS.CommonCore/Events/TSRAIRGo/NavigateFromTSRAIRGoToDataPRO.cs
- Common/DTS.CommonCore/Events/TSRAIRGo/GlobalStatus.cs
- Common/DTS.CommonCore/Events/TSRAIRGo/Trigger.cs
- Common/DTS.CommonCore/Events/TSRAIRGo/Arm.cs
generated_at: "2026-04-16T02:48:11.814347+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1820aad4390a7494"
---
# TSRAIRGo
## Documentation: TSRAIRGo Event Definitions
### 1. Purpose
This module defines a set of Prism-based pub/sub events used for inter-module communication within the TSRAIRGo application domain. These events facilitate decoupled navigation, system state signaling (e.g., arm/disarm), and status updates across loosely coupled UI and service components. The events follow the `CompositePresentationEvent<T>` pattern from the Prism Library, enabling thread-safe subscription and publication across UI and background threads.
### 2. Public Interface
| Type | Signature | Behavior |
|------|-----------|----------|
| `NavigateToDashboardEvent` | `public class NavigateToDashboardEvent : CompositePresentationEvent<NavigateToDashboardArg>` | Event published to request navigation to the Dashboard view. Payload type `NavigateToDashboardArg` is currently empty. |
| `NavigateFromTSRAIRGoToDataPROEvent` | `public class NavigateFromTSRAIRGoToDataPROEvent : CompositePresentationEvent<NavigateFromTSRAIRGoToDataPROArg>` | Event published to request navigation from the TSRAIRGo module to the DataPRO module. Payload type `NavigateFromTSRAIRGoToDataPROArg` is currently empty. |
| `GlobalStatusEvent` | `public class GlobalStatusEvent : CompositePresentationEvent<GlobalStatusArg>` | Event published to broadcast a global status message (e.g., system health, progress, or error state). Payload type `GlobalStatusArg` contains a `Message` string property. |
| `TriggerEvent` | `public class TriggerEvent : CompositePresentationEvent<TriggerArg>` | Event published to signal a generic trigger action. Payload type `TriggerArg` is currently empty. |
| `ArmEvent` | `public class ArmEvent : CompositePresentationEvent<ArmArg>` | Event published to arm or disarm a system component (e.g., data acquisition, safety interlocks). Payload type `ArmArg` contains a single `bool Arm` property indicating the desired state (`true` = arm, `false` = disarm). |
### 3. Invariants
- All event types inherit from `CompositePresentationEvent<T>`, meaning they support cross-thread publication and subscription (thread-safe for UI and background threads).
- Payload argument classes (`*Arg`) must be instantiated before publishing; null payloads are not explicitly guarded against in this module, so subscribers must handle null or validate payload contents.
- For `GlobalStatusArg`, the `Message` property is nullable (`string`); no validation or formatting guarantees are enforced by this module.
- For `ArmArg`, the `Arm` property is a `bool`; no semantic validation (e.g., range checks) is performed—consumers must interpret `true`/`false` consistently.
- No ordering guarantees are provided for event subscribers; multiple subscribers may receive events in arbitrary order.
### 4. Dependencies
- **Dependencies (imports):**
- `Microsoft.Practices.Prism.Events` (Prism Library v6 or earlier; note use of `Microsoft.Practices.Prism` namespace, indicating legacy Prism version)
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`, `System.Windows` (only in `Trigger.cs`, likely unused—possibly leftover from template or tooling)
- **Namespace usage:**
- Events reside in `DTS.Common.Events` (for `NavigateToDashboardEvent`, `NavigateFromTSRAIRGoToDataPROEvent`) and `DTS.Common.Events.TSRAIRGo` (for `GlobalStatusEvent`, `TriggerEvent`, `ArmEvent`).
- **Depended upon by:**
- Unknown from source alone—consumers would subscribe to these events via the Prism `EventAggregator`. Likely used by UI modules (e.g., view models, shells) and background services in the TSRAIRGo and DataPRO subsystems.
### 5. Gotchas
- **Empty payload types**: `NavigateToDashboardArg`, `NavigateFromTSRAIRGoToDataPROArg`, and `TriggerArg` contain no properties. If future requirements demand passing data (e.g., destination ID, trigger parameters), modifying these types may break backward compatibility if consumers rely on default instantiation.
- **Namespace inconsistency**: `NavigateToDashboardEvent` and `NavigateFromTSRAIRGoToDataPROEvent` are in `DTS.Common.Events`, while others are in `DTS.Common.Events.TSRAIRGo`. This suggests possible refactoring in progress or legacy grouping; developers should verify intended scoping.
- **Unused `System.Windows` reference**: `Trigger.cs` imports `System.Windows` but does not use it—may indicate dead code or accidental inclusion.
- **No documentation on event semantics**: The source provides no guidance on when each event should be published (e.g., pre- vs. post-condition), leading to potential misuse (e.g., publishing `ArmEvent` with `Arm=false` when system is already disarmed).
- **No versioning or deprecation markers**: No indication of whether these events are stable, experimental, or deprecated.
None identified from source alone beyond the above.

View File

@@ -0,0 +1,81 @@
---
source_files:
- Common/DTS.CommonCore/Events/TTSImport/TTSImportSavedChangesStatusEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/StatusAndProgressBarEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportSummaryRunTestEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportTestSetupChangedEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/AssignedChannelsChangedEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportHardwareScanRunEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportSummaryImportEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportReadFileFinishedEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportArmedRunTestEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportHardwareScanFinishedEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/EIDMappingEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportReadFileStatusEvent.cs
- Common/DTS.CommonCore/Events/TTSImport/TTSImportReadXMLFileEvent.cs
generated_at: "2026-04-16T02:48:30.472302+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "429a14fc6889c232"
---
# TTS Import Events Module Documentation
## 1. Purpose
This module defines a set of Prism-based events used for inter-component communication within the TTS (Time-to-Sync) import workflow. These events coordinate state transitions and data flow across UI steps (e.g., Read File, Hardware Scan, Summary) and background operations (e.g., file parsing, hardware pinging), enabling loose coupling between view models and services in the applications import pipeline. The events are published and subscribed to using the `CompositePresentationEvent<T>` base class from Prism, supporting cross-thread delivery and subscription lifetime management.
## 2. Public Interface
### Event Classes
All events inherit from `CompositePresentationEvent<T>` and are defined in the `DTS.Common.Events` or `DTS.Common.Events.TTSImport` namespaces.
| Event Name | Payload Type | Behavior |
|------------|--------------|----------|
| `TTSImportSavedChangesStatusEvent` | `bool` | Indicates whether changes have been saved (`true`) or not (`false`). |
| `StatusAndProgressBarEvent` | `StatusAndProgressBarEventArgs` | Updates status text and/or progress bar UI elements. *(Note: `StatusAndProgressBarEventArgs` is defined in `DTS.Common.Classes` but not included in source; behavior inferred from remarks.)* |
| `TTSImportSummaryRunTestEvent` | `ITTSSetup` | Triggered by the Summary step to instruct the page to execute the test. |
| `TTSImportTestSetupChangedEvent` | `ITTSSetup` | Published whenever the current `ITTSSetup` instance is modified. |
| `AssignedChannelsChangedEvent` | `ITTSSetup` | Published whenever the set of channels assigned to the test setup changes. |
| `TTSImportHardwareScanRunEvent` | `ITTSSetup` | Triggered by the Hardware Scan step to initiate hardware pinging. |
| `TTSImportSummaryImportEvent` | `ITTSSetup` | Published by the Summary step when the Import button is clicked. |
| `TTSImportReadFileFinishedEvent` | `ITTSSetup` | Published by the Read File step upon completion of file reading. |
| `TTSImportHardwareScanFinishedEvent` | `List<IDASHardware>` | Published by the page to notify the Hardware Scan view model to refresh the list of DAS (Data Acquisition System) hardware. |
| `EIDMappingEvent` | `IDictionary<string, string>` | Published when a mapping from sensor IDs to hardware channel IDs is determined. Keys = sensor IDs, values = hardware channel IDs. |
| `TTSImportReadFileStatusEvent` | `ReadFileStatusArg` | Reports success/failure of file read: `Status` indicates outcome; `TTSSetup` contains parsed setup if successful; `ErrorMessage` contains failure reason if `Status` is `false`. |
| `TTSImportReadXMLFileRequestEvent` | `TTSImportReadXMLFileRequestArg` | Requests XML file parsing: `FilePath` and `TestSetup` (preliminary) are provided. |
| `TTSImportReadXMLFileResponseEvent` | `TTSImportReadXMLFileResponseEventArg` | Response to XML read request: includes updated `ITestSetup`, `TTSSetup`, `Errors[]`, and `LevelTriggers[]`. |
### Argument Classes
| Class | Fields | Purpose |
|-------|--------|---------|
| `ReadFileStatusArg` | `bool Status`, `ITTSSetup TTSSetup`, `string ErrorMessage` | Encapsulates result of file read operation. |
| `TTSImportReadXMLFileRequestArg` | `string FilePath`, `ITTSSetup TestSetup` | Request payload for XML file read. |
| `TTSImportReadXMLLevelTrigger` | `double Threshold`, `string SensorSerialNumber` | Represents a level trigger configuration parsed from XML. |
| `TTSImportReadXMLFileResponseEventArg` | `ITestSetup TestSetup`, `string[] Errors`, `ITTSSetup TTSSetup`, `TTSImportReadXMLLevelTrigger[] LevelTriggers` | Response payload after XML parsing. |
## 3. Invariants
- All events are published using Prisms event aggregation mechanism (`CompositePresentationEvent<T>`), implying they support thread marshaling and subscription lifetime management via `EventSubscription` tokens.
- Payload types (`ITTSSetup`, `ITestSetup`, `IDASHardware`) are interfaces defined in external modules (`DTS.Common.Interface.*`).
- `ReadFileStatusArg.Status == true` implies `TTSSetup != null` and `ErrorMessage == null` (or empty); `Status == false` implies `ErrorMessage != null`. *(Inferred from remarks; no explicit validation in source.)*
- `TTSImportReadXMLFileRequestArg` and `TTSImportReadXMLFileResponseEventArg` are immutable (all properties have `private set` or are `readonly`-equivalent via constructor initialization).
- `EIDMappingEvent` payload is a mapping from sensor ID → hardware channel ID (both `string`). Order is not guaranteed (uses `IDictionary`).
## 4. Dependencies
### Dependencies *of* this module:
- `Microsoft.Practices.Prism.Events` (Prism library for event aggregation)
- `DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile` (provides `ITTSSetup`, `ITTSSetup` interfaces)
- `DTS.Common.Interface.TestSetups.TestSetupsList` (provides `ITestSetup` interface)
- `DTS.Common.Interface.DataRecorders` (provides `IDASHardware` interface)
- `DTS.Common.Classes` (provides `StatusAndProgressBarEventArgs` for `StatusAndProgressBarEvent`)
### Dependencies *on* this module:
- View models and services involved in the TTS import workflow (e.g., `ReadFileViewModel`, `HardwareScanViewModel`, `SummaryViewModel`) are expected to subscribe to these events.
- No other modules *define* these events; this module is the sole source.
## 5. Gotchas
- **Namespace inconsistency**: Most events reside in `DTS.Common.Events`, but `TTSImportTestSetupChangedEvent` and `AssignedChannelsChangedEvent` are in `DTS.Common.Events.TTSImport`. This may cause subscription failures if subscribers use incorrect namespace resolution.
- **Ambiguous `StatusAndProgressBarEventArgs`**: The type `StatusAndProgressBarEventArgs` is referenced but not defined in the provided source; its structure and behavior cannot be determined.
- **Redundant naming**: `TTSImportReadXMLFileRequestEvent` vs. `TTSImportReadXMLFileEvent` (not present) — the naming pattern (`*RequestEvent`/`*ResponseEvent`) is inconsistent with other events (e.g., `TTSImportReadFileStatusEvent` instead of `TTSImportReadFileRequestEvent`).
- **No cancellation support**: Events like `TTSImportHardwareScanRunEvent` lack a cancellation token or request ID, making it difficult to handle overlapping or aborted operations.
- **`ReadFileStatusArg` error handling**: `ErrorMessage` is only populated on failure, but its type (`string`) allows empty strings — consumers must check `Status` first to avoid misinterpreting empty messages.
- **`ITTSSetup` vs `ITestSetup`**: Both interfaces appear in responses (e.g., `TTSImportReadXMLFileResponseEventArg`), but their relationship (inheritance, composition) is not specified in the source.

View File

@@ -0,0 +1,80 @@
---
source_files:
- Common/DTS.CommonCore/Events/TestSetups/TestSetupsList/CurrentTestIdChangedEvent.cs
- Common/DTS.CommonCore/Events/TestSetups/TestSetupsList/CurrentTestChangedEvent.cs
- Common/DTS.CommonCore/Events/TestSetups/TestSetupsList/TestSetupsListEditTestSetupEvent.cs
- Common/DTS.CommonCore/Events/TestSetups/TestSetupsList/TestSetupsListTestSetupSelectedEvent.cs
generated_at: "2026-04-16T02:50:37.794496+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0a7d14a1bfb658a4"
---
# TestSetupsList
## Documentation: TestSetupsList Events Module
### 1. Purpose
This module defines a set of Prism-based events used to coordinate state and user actions within the *Test Setups List* feature of the system. Specifically, it enables decoupled communication between UI components (e.g., a test list view and detail editors) regarding changes to the currently selected or edited test setup, as well as user-initiated actions like selecting or editing a test setup. All events are strongly typed subclasses of `CompositePresentationEvent<TPayload>` and carry string or string array payloads to identify test setups.
---
### 2. Public Interface
| Event Class | Payload Type | Behavior |
|-------------|--------------|----------|
| `CurrentTestIdChangedEvent` | `string` | Signals that the *ID* of the current test setup has changed. Payload is the new test setup ID (or `null` if none). |
| `CurrentTestChangedEvent` | `string` | Signals that the *entire current test setup* (not just its ID) has changed. Payload is the test setup ID of the new current test setup (or `null` if none). |
| `TestSetupsListEditTestSetupEvent` | `string` | Fires when the user requests to edit a specific test setup. Payload is the ID of the test setup to be edited. |
| `TestSetupsListTestSetupSelectedEvent` | `string[]` | Fires when one or more test setups are selected (e.g., via UI). Payload is an array of test setup IDs representing the selected items. |
> **Note**: All events inherit from `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>`, meaning they support subscription from multiple views/modules and are published on the UI thread by default (Prism behavior).
---
### 3. Invariants
- **Payload semantics**:
- For events with `string` payload (`CurrentTestIdChangedEvent`, `CurrentTestChangedEvent`, `TestSetupsListEditTestSetupEvent`), the payload is expected to be a valid test setup ID (non-empty string) when indicating a real selection/edit. A `null` or empty string may indicate "no current test" or "clear selection", though this is not explicitly documented and must be inferred from usage.
- For `TestSetupsListTestSetupSelectedEvent`, the payload is a non-null array of test setup IDs (though the array may be empty to indicate deselection).
- **Event ordering**:
- No guaranteed ordering between event publication and handling. Subscribers must be prepared to handle events asynchronously.
- `CurrentTestChangedEvent` *may* imply `CurrentTestIdChangedEvent` in typical usage, but this is **not enforced** by the event definitions themselves.
- **No validation**:
- The events themselves perform no validation on payload contents (e.g., no check for existence or format of test setup IDs). Validation is the responsibility of subscribers.
---
### 4. Dependencies
- **Dependencies *of* this module**:
- `Microsoft.Practices.Prism.Events` (Prism library, version not specified).
- Namespace `DTS.Common.Events.TestSetups.TestSetupsList` (internal to the codebase).
- **Dependencies *on* this module**:
- Any module/view responsible for managing the test setups list UI (e.g., a list view, editor dialog, or summary step) likely subscribes to or publishes these events.
- Specifically, the *Summary step* is documented to publish `TestSetupsListTestSetupSelectedEvent` (see comment in `TestSetupsListTestSetupSelectedEvent.cs`).
- Other modules (e.g., test setup detail view, edit dialog) likely subscribe to `TestSetupsListEditTestSetupEvent` or `CurrentTestChangedEvent`.
---
### 5. Gotchas
- **Naming inconsistency**:
- The class `TestSetupsListTestSetupSelectedEvent` has a misleading summary comment: it incorrectly refers to `TTSImportSummaryImportEvent` in its `<summary>` tag. This appears to be a copy-paste error and may cause confusion during documentation review.
- **Ambiguous semantics of `CurrentTestIdChangedEvent` vs `CurrentTestChangedEvent`**:
- The distinction between "ID changed" and "test changed" is not clarified in the source. In practice, if only the ID changes (e.g., due to renaming), does `CurrentTestChangedEvent` fire? The source does not specify. Subscribers should assume both events may fire independently and handle accordingly.
- **No payload validation or error signaling**:
- Events carry no error or status metadata. If a subscriber cannot act on a payload (e.g., invalid ID), it must handle failure silently or via separate mechanisms (e.g., logging, exceptions, or additional events).
- **String-based IDs are fragile**:
- Using `string` (and `string[]`) as the payload type offers no compile-time safety. Typos or ID mismatches (e.g., mixing internal vs. external IDs) could lead to runtime errors.
- **No deprecation or lifecycle guidance**:
- No indication of whether these events are stable, deprecated, or subject to change. Subscribers should assume they are part of the stable public API unless otherwise documented elsewhere.
None identified beyond the above.

View File

@@ -0,0 +1,37 @@
---
source_files:
- Common/DTS.CommonCore/Exceptions/OutOfDataException.cs
generated_at: "2026-04-16T02:13:54.656604+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "fdc72f1eddeb3763"
---
# Exceptions
### 1. Purpose
The `OutOfDataException` class provides a specialized exception type for scenarios where an operation attempting to read or consume data from a sequential data source (e.g., a stream, buffer, or parser) has exceeded the available data. It extends `System.Exception` to include contextual information—the `Index` at which the shortage occurred—enabling callers to pinpoint the location of the failure and implement recovery or error-reporting logic accordingly.
### 2. Public Interface
- **`OutOfDataException(string message, long index)`**
Constructor. Initializes a new instance of the `OutOfDataException` class with a specified error message and the zero-based index in the data source where the shortage occurred. The `index` parameter is stored in the `Index` property and is immutable after construction.
- **`long Index { get; }`**
Read-only property exposing the zero-based index (e.g., byte offset, element position, or token index) in the underlying data source where the exception was thrown. This value is set at construction and cannot be modified.
### 3. Invariants
- `Index` is non-negative and represents a position *beyond* the last valid data element (i.e., `Index >= DataLength`).
- `Index` is set exactly once during construction and remains constant for the lifetime of the exception instance.
- The exception message (`Message` inherited from `Exception`) must clearly describe the nature of the data shortage (e.g., “Unexpected end of input at index 42”).
### 4. Dependencies
- **Depends on**: `System.Exception` (via `System` namespace).
- **Used by**: Likely consumed by data-parsing, deserialization, or streaming components within the `DTS.Common` namespace (e.g., `DTS.Common.Core`, `DTS.Common.IO`)—though no direct usages are visible in this file, the exceptions design implies integration with data-reading logic.
- **No external dependencies** beyond the base .NET runtime.
### 5. Gotchas
- The `Index` property uses a zero-based convention, but callers must verify whether the underlying data source uses byte offsets, character positions, or element indices (e.g., in a token stream) to avoid misinterpretation.
- The exception does *not* include the total data length; callers must track capacity separately if needed for context.
- The `Index` is `long`, suggesting support for large data sources (e.g., >2GB), but callers should ensure consistency with the data sources indexing scheme (e.g., `int`-based APIs may require casting).
- No additional context (e.g., source name, buffer snapshot) is stored—only the index and message—limiting diagnostic depth without external correlation.
- None identified from source alone.

View File

@@ -0,0 +1,195 @@
---
source_files:
- Common/DTS.CommonCore/Interface/ITabView.cs
- Common/DTS.CommonCore/Interface/IMainView.cs
- Common/DTS.CommonCore/Interface/IMenuView.cs
- Common/DTS.CommonCore/Interface/IShellView.cs
- Common/DTS.CommonCore/Interface/INavigationView.cs
- Common/DTS.CommonCore/Interface/IViewerShellView.cs
- Common/DTS.CommonCore/Interface/ITabViewModel.cs
- Common/DTS.CommonCore/Interface/IMenuViewModel.cs
- Common/DTS.CommonCore/Interface/INavigationViewModel.cs
- Common/DTS.CommonCore/Interface/IPluginComponent.cs
- Common/DTS.CommonCore/Interface/IShellViewModel.cs
- Common/DTS.CommonCore/Interface/IViewerShellViewModel.cs
- Common/DTS.CommonCore/Interface/IMainViewModel.cs
- Common/DTS.CommonCore/Interface/IAssemblyInfo.cs
- Common/DTS.CommonCore/Interface/IDataPROPage.cs
generated_at: "2026-04-16T02:12:22.294556+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c067eaab6be3056e"
---
# DTS.Common.Interface Module Documentation
## 1. Purpose
This module defines a set of core interfaces that establish the contract for the applications view and view model layer within the DTS (Data Test System) architecture. It enforces a structured separation of concerns using a view/view model pattern, where each view interface (`ITabView`, `IMainView`, `IMenuView`, `INavigationView`, `IShellView`, `IViewerShellView`) corresponds to a specific UI region or shell, and each view model interface (`ITabViewModel`, `IMainViewModel`, etc.) exposes its associated view and manages region-specific context (e.g., `ContextMainRegion`, `ContextNavigationRegion`). Additionally, it provides infrastructure for plugin discovery (`IPluginComponent`) and assembly-level metadata (`IAssemblyInfo`), as well as a detailed contract for data entry pages (`IDataPROPage`). The module serves as the foundational abstraction layer for UI composition and plugin extensibility.
## 2. Public Interface
### Interfaces (No implementation classes provided; only contracts)
#### View Interfaces
- **`ITabView : IBaseView`**
Represents a tab-specific view. No additional members beyond inheritance.
- **`IMainView : IBaseView`**
Represents the main application view. No additional members beyond inheritance.
- **`IMenuView : IBaseView`**
Represents a menu-specific view. No additional members beyond inheritance.
- **`INavigationView : IBaseView`**
Represents a navigation-specific view. No additional members beyond inheritance.
- **`IShellView : IBaseWindow`**
Represents the top-level shell window view (e.g., main application window). Inherits from `IBaseWindow`, not `IBaseView`.
- **`IViewerShellView : IBaseView`**
Represents a dedicated viewer shell view (e.g., for inspection or preview). Inherits from `IBaseView`.
#### View Model Interfaces
- **`ITabViewModel : IBaseViewModel`**
- `ITabView View { get; }` — Returns the associated tab view instance.
- **`IMenuViewModel : IBaseViewModel`**
- `IMenuView View { get; }` — Returns the associated menu view instance.
- **`INavigationViewModel : IBaseViewModel`**
- `INavigationView NavigationView { get; }` — Returns the associated navigation view instance.
- **`IShellViewModel : IBaseWindowModel`**
- `IShellView View { get; }` — Returns the associated shell view instance.
- `List<FrameworkElement> GetRegions()` — Returns a list of named UI regions (e.g., for region injection).
- `object ContextMainRegion { get; set; }` — Gets/sets the data context for the main region.
- **`IViewerShellViewModel : IBaseViewModel`**
- `IViewerShellView View { get; }` — Returns the associated viewer shell view instance.
- `List<FrameworkElement> GetRegions()` — Returns a list of named UI regions.
- `object ContextMainRegion { get; set; }` — Gets/sets the data context for the main region.
- **`IMainViewModel : IBaseViewModel`**
- `IBaseView View { get; }` — Returns the associated main view instance.
- `object ContextNavigationRegion { get; set; }` — Context for the navigation region.
- `object ContextGraphRegion { get; set; }` — Context for the graph region.
- `object ContextTestsRegion { get; set; }` — Context for the tests region.
- `object ContextGraphsRegion { get; set; }` — Context for the graphs region.
- `object ContextLegendRegion { get; set; }` — Context for the legend region.
- `object ContextDiagRegion { get; set; }` — Context for the diagnostics region.
- `object ContextStatsRegion { get; set; }` — Context for the statistics region.
- `object ContextCursorRegion { get; set; }` — Context for the cursor region.
- `object ContextPropertyRegion { get; set; }` — Context for the property region.
- `List<FrameworkElement> GetRegions()` — Returns a list of named UI regions.
#### Plugin & Metadata Interfaces
- **`IPluginComponent`**
- `string ProgId { get; }` — Programmatic identifier used to instantiate the plugin component.
- **`IAssemblyImageAttribute : Attribute`** *(abstract base class)*
- `string AssemblyName { get; }`
- `string AssemblyGroup { get; }`
- `eAssemblyRegion AssemblyRegion { get; }`
- `BitmapImage AssemblyImage { get; }`
- `BitmapImage GetAssemblyImage()`
- `string GetAssemblyName()`
- `string GetAssemblyGroup()`
- `eAssemblyRegion GetAssemblyRegion()`
- `Type GetAttributeType()`
*Applied via `[assembly: ImageAttribute(...)]` at assembly level.*
- **`IAssemblyNameAttribute : Attribute`** *(abstract base class)*
- `string AssemblyName { get; }`
- `string GetAssemblyName()`
*Applied via `[assembly: TextAttribute(...)]` at assembly level.*
#### Data Entry Page Interface
- **`IDataPROPage : INotifyPropertyChanged`**
- `Visibility TestSetupChangeButtonVisible { get; set; }`
- `Visibility AutomaticModeStatusVisible { get; set; }`
- `string PageName { get; set; }`
- `ImageSource PageImage { get; set; }`
- `bool IsAdd { get; set; }`
- `bool UsesModifyEnhancements { get; set; }`
- `string EditIDString { get; set; }`
- `string AddIDString { get; set; }`
- `string ModifiedObjectName { get; set; }`
- `bool AutomaticProgression { get; set; }`
- `bool RecoveryDownloadMode { get; set; }`
- `string UniqueId { get; }`
- `string GetName()`
- `long GetID()`
- `void SetID(long id)`
- `Color TileColor { get; }`
- `void SetTileColor(Color c)`
- `void SavePage(object obj)`
- `string CurrentSearchTerm { get; set; }`
- `void ClearSearchTerm()`
- `void SetEnabled(bool bEnable)`
- `bool UsesNAVControl { get; set; }`
- `bool UsesSearchControl { get; set; }`
- `bool UsesSelectControl { get; set; }`
- `void VerifyProgress(object o)`
- `void SaveAndExit()`
- `void RefreshButtonPressed()`
- `void SetDoneButtonIsEnabled(bool bEnabled)`
- `void SetBackButtonIsEnabled(bool bEnabled)`
- `void DoneButtonPress()`
- `bool HasBackButton { get; set; }`
- `bool HasRefreshButton { get; set; }`
- `bool HasCancelButton { get; set; }`
- `bool HasSaveButton { get; set; }`
- `void SetCancelEnabled(bool bEnabled)`
- `bool HasNextButton { get; set; }`
- `Color ContentBackgroundColor { get; set; }`
- `object MainContent { get; set; }`
- `ContentControl GetMainContentControl()`
- `void SetReturning()`
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)`
- `bool OKToProceed()`
- `void FormClosing(Action OnComplete = null)`
- `bool ControlInOnSetActive { get; set; }`
- `void OnSetActive()`
- `void UnSet()`
- `void SetCurrentItem(object o)`
- `void SetupPageAvailable()`
- **`DataProPageProperties`** *(enum)*
Lists all properties on `IDataPROPage` that are considered stateful and observable (e.g., for binding or change tracking). Includes:
`UsesModifyEnhancements`, `TestSetupChangeButtonVisible`, `AutomaticModeStatusVisible`, `PageName`, `PageImage`, `IsAdd`, `EditIDString`, `AddIDString`, `ModifiedObjectName`, `AutomaticProgression`, `RecoveryDownloadMode`, `UsesNAVControl`, `UsesSearchControl`, `UsesSelectControl`, `HasBackButton`, `HasRefreshButton`, `HasCancelButton`, `HasSaveButton`, `HasNextButton`, `ContentBackgroundColor`, `MainContent`, `GenerateReportsVisible`.
## 3. Invariants
- **View-ViewModel Pairing**: Each view model interface (`*ViewModel`) exposes a strongly-typed `View` property (or `NavigationView` in `INavigationViewModel`) that must return the corresponding view interface instance.
- **Region Context Management**: `IShellViewModel` and `IViewerShellViewModel` expose `ContextMainRegion`; `IMainViewModel` exposes multiple named region contexts (`ContextNavigationRegion`, `ContextGraphRegion`, etc.). These must be set to valid data contexts before region binding occurs.
- **Region List Consistency**: `GetRegions()` methods across `IShellViewModel`, `IViewerShellViewModel`, and `IMainViewModel` must return a list of `FrameworkElement` instances representing named regions (e.g., for Prism-style region injection).
- **Unique Page Identity**: `IDataPROPage.UniqueId` must be non-null and stable for the lifetime of the page instance.
- **Page State Validation**: `Validate()` must populate `errors` and `warnings` lists and return `false` if validation fails; `OKToProceed()` must reflect whether the page is in a state to proceed (e.g., after validation).
- **Assembly Attributes**: `ImageAttribute` and `TextAttribute` are assembly-level attributes (`AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)`), meaning each assembly may define at most one of each.
- **Inheritance Hierarchy**: All view interfaces inherit from `IBaseView` (or `IBaseWindow` for `IShellView`), and all view model interfaces inherit from `IBaseViewModel` (or `IBaseWindowModel` for `IShellViewModel`). This implies a strict hierarchy enforced by the base layer (`DTS.Common.Base`).
## 4. Dependencies
### Dependencies *of* this module:
- `DTS.Common.Base` — Provides base interfaces (`IBaseView`, `IBaseViewModel`, `IBaseWindow`, `IBaseWindowModel`) and likely core types like `eAssemblyRegion`.
- `System.Windows` — Required for `FrameworkElement`, `BitmapImage`, `Color`, `ContentControl`, and `Visibility`.
- `System.Collections.Generic`, `System.ComponentModel`, `System.Windows.Media` — Used in `IDataPROPage` and `IAssemblyInfo`.
### Dependencies *on* this module:
- UI composition modules (e.g., shell, navigation, plugin loaders) — These depend on the view/view model interfaces to wire up regions and bind contexts.
- Plugin infrastructure — Uses `IPluginComponent.ProgId` for dynamic instantiation.
- Assembly metadata consumers — Use `IAssemblyImageAttribute`/`IAssemblyNameAttribute` (via reflection) to discover plugin metadata.
- Data entry page host frameworks — Rely on `IDataPROPage` to manage page lifecycle, validation, and UI state.
## 5. Gotchas
- **`INavigationViewModel.NavigationView` is misnamed**: Despite the interface name, `INavigationViewModel` exposes `INavigationView NavigationView { get; }`, not `INavigationView View { get; }`. This breaks the naming consistency of other view models (e.g., `ITabViewModel.View`).
- **`IShellView` inherits from `IBaseWindow`, not `IBaseView`**: This is inconsistent with all other view interfaces and may indicate a design distinction for top-level windows vs. nested views.
- **`IAssemblyImageAttribute` vs. `ImageAttribute`**: `IAssemblyImageAttribute` is an interface, while `ImageAttribute` is its abstract base class. Implementers must inherit from `ImageAttribute`, not implement `IAssemblyImageAttribute` directly.
- **`GenerateReportsVisible` in `DataProPageProperties` enum but not declared in `IDataPROPage`**: The enum includes `GenerateReportsVisible`, but no corresponding property or method exists in `IDataPROPage`. This is likely an oversight or incomplete refactoring.
- **Missing `IBaseView`/`IBaseWindow` definitions**: Since the base interfaces are in `DTS.Common.Base`, their contract (e.g., whether `IBaseView` has a `DataContext` property) is unknown and critical to understanding the full interface semantics.
- **No documentation for `eAssemblyRegion`**: The enum `eAssemblyRegion` is referenced in `IAssemblyImageAttribute` but not defined in this module; its values and semantics are unknown.
- **`IAssemblyImageAttribute.GetType()` and `GetAttributeType()`**: Both methods exist in `IAssemblyImageAttribute` and `ImageAttribute`. Their purpose is unclear — `GetType()` is standard `object.GetType()`, but `GetAttributeType()` likely returns the concrete attribute type (e.g., `typeof(MyImageAttribute)`). This duplication may cause confusion.
- **`IDataPROPage` has many mutable properties**: The interface exposes numerous `set` properties (e.g., `PageName`, `PageImage`, `HasBackButton`), implying runtime mutability. This may conflict with MVVM best practices if not carefully managed by view model synchronization.
None identified from source alone beyond the above.

View File

@@ -0,0 +1,182 @@
---
source_files:
- Common/DTS.CommonCore/Interface/BuildTestSetup/IBuildTestSetup.cs
generated_at: "2026-04-16T02:22:58.506403+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5d29553a439a7fc1"
---
# BuildTestSetup
### **Purpose**
This module defines the `IBuildTestSetup` interface, which serves as the contract for build/test configuration data in the DTS (Data Acquisition and Test System) framework. It encapsulates a comprehensive set of user-configurable parameters governing test execution behavior—such as device identification, acquisition settings, diagnostic checks, export formats, and upload/download behavior—enabling serialization, UI binding, and runtime configuration of test setups. As it extends `INotifyPropertyChanged`, it is designed for data-binding scenarios (e.g., UI forms) where real-time updates to configuration changes are required.
---
### **Public Interface**
All members are properties; no methods are declared in this interface.
#### **Core Metadata Properties**
- `string DASSerialNumber { get; set; }`
Serial number of the DAS (Data Acquisition System) unit under test.
- `string SetupName { get; set; }`
Human-readable name for the test setup instance.
- `string SetupDescription { get; set; }`
Optional descriptive text for the setup.
- `string LastModified { get; set; }`
Timestamp (as string) of the last modification to the setup.
- `string LastModifiedBy { get; set; }`
Identifier (e.g., username) of the last modifier.
#### **Test Execution Control Properties**
- `string AutomaticMode { get; set; }`
Enables/disables automatic test mode.
- `string AutomaticModeDelay { get; set; }`
Delay (as string) before automatic mode starts.
- `string AutoArm { get; set; }`
Enables/disables automatic arming of the test.
- `string QuitTestWithoutWarning { get; set; }`
If true, permits exiting the test without user confirmation.
- `string Streaming { get; set; }`
Enables/disables streaming mode (continuous data acquisition).
- `string UploadData { get; set; }`
Enables/disables post-test data upload.
- `string UploadDataFolder { get; set; }`
Target folder path for uploaded data.
- `string DownloadFolder { get; set; }`
Folder path for downloading test data.
#### **Diagnostic & Safety Checks**
- `string WarnOnBatteryFail { get; set; }`
Triggers warning if battery check fails.
- `string StrictDiagnostics { get; set; }`
Enforces strict diagnostic compliance (e.g., abort on minor failures).
- `string RequireConfirmationOnErrors { get; set; }`
Requires user confirmation before proceeding after an error.
- `string PerformArmChecklist { get; set; }`
Enables/disables the pre-arm checklist.
- `string RequireAllUnitsPassArmCheckList { get; set; }`
If true, *all* units must pass the checklist before arming.
- `string CheckInputVoltage { get; set; }`
Enables input voltage check during diagnostics.
- `string CheckBatteryVoltage { get; set; }`
Enables battery voltage check.
- `string CheckSquibResistance { get; set; }`
Enables squib (pyro) resistance check.
- `string MeasureSquibResistances { get; set; }`
Explicitly enables squib resistance *measurement* (distinct from check).
- `string CheckSensorIds { get; set; }`
Enables sensor ID validation.
- `string CheckStartEventLines { get; set; }`
Validates start event line states.
- `string CheckTiltSensor { get; set; }`
Enables tilt sensor diagnostics.
- `string CheckTemperature { get; set; }`
Enables temperature sensor diagnostics.
- `string TriggerCheckStep { get; set; }`
Enables/disables a dedicated trigger verification step.
- `string PostTestDiagnostics { get; set; }`
Enables diagnostics run after test completion.
#### **Data Acquisition Configuration**
- `string ViewRealtime { get; set; }`
Enables/disables real-time data visualization.
- `string RecordingMode { get; set; }`
Specifies recording mode (e.g., continuous, event-triggered).
- `string SamplesPerSecond { get; set; }`
Sampling rate (as string).
- `string PreTriggerSeconds { get; set; }`
Duration of pre-trigger buffer (seconds).
- `string PostTriggerSeconds { get; set; }`
Duration of post-trigger buffer (seconds).
- `string NumberOfEvents { get; set; }`
Maximum number of events to record.
- `string WakeUpMotionTimeout { get; set; }`
Timeout (seconds) for motion-based wake-up detection.
- `string AllowSensorIdToBlankChannel { get; set; }`
If true, permits mapping sensor IDs to blank/unconfigured channels.
- `string ExcitationWarmupTimeMS { get; set; }`
Warm-up delay (ms) for sensor excitation before acquisition.
- `string UseTestEngineerDetails { get; set; }`
If true, embeds test engineer identity in output data.
#### **ROI (Region of Interest) & Download Settings**
- `string ROIDownload { get; set; }`
Enables ROI-based data download.
- `string ViewROIDownload { get; set; }`
Enables ROI download visualization.
- `string ROIStart { get; set; }`
Start time (as string, likely seconds) for ROI.
- `string ROIEnd { get; set; }`
End time (as string) for ROI.
#### **Export Configuration**
- `string Export { get; set; }`
Enables/disables data export.
- `string ExportFolder { get; set; }`
Output directory for exported files.
- `string UseLabDetails { get; set; }`
If true, includes lab-specific metadata in exports.
- `string UseCustomerDetails { get; set; }`
If true, includes customer-specific metadata in exports.
- `string UserTags { get; set; }`
Custom tags to embed in exported data.
- `string CalibrationBehavior { get; set; }`
Controls calibration application during export (e.g., raw, calibrated).
- `string SuppressMissingSensorsWarning { get; set; }`
Suppresses warnings for missing sensors during export.
- `string NotAllChannelsRealTime { get; set; }`
Indicates not all channels are available in real-time (affects UI/logic).
- `string NotAllChannelsViewer { get; set; }`
Indicates not all channels are available in post-processing viewer.
- `string AllowMissingSensors { get; set; }`
Permits test completion despite missing sensors.
##### **Export Format Flags**
*Each `Export*Desired` property is a string flag indicating whether a specific export format is requested.*
- `ExportCh10FilteredEUDesired`, `ExportChryslerDDASDesired`, `ExportCSVADCDesired`, `ExportCSVFilteredDesired`, `ExportCSVMVDesired`, `ExportCSVUnfilteredDesired`, `ExportDiademADCDesired`, `ExportHDFADCDesired`, `ExportHDFMVDesired`, `ExportHDFUnfilteredDesired`, `ExportISOFilteredDesired`, `ExportISOUnfilteredDesired`, `ExportRDFADCDesired`, `ExportTDASADCDesired`, `ExportTDMSADCDesired`, `ExportToyotaUnfilteredDesired`, `ExportTSVFilteredDesired`, `ExportTSVUnfilteredDesired`, `ExportXLSXFilteredDesired`, `ExportXLSXUnfilteredDesired`, `ExportASCDesired`
Boolean-like string values (e.g., `"True"`/`"False"`) indicating inclusion of the respective export format.
*Note: Several commented-out properties (e.g., `ExportCh10UnfilteredEUDesired`, `ExportHDFFilteredDesired`) suggest historical or deprecated formats.*
#### **Grouping & UI**
- `List<GroupXMLClass> Groups { get; set; }`
Collection of `GroupXMLClass` objects defining logical groupings of channels or tests.
- `string CommonStatusLine { get; set; }`
Shared status message displayed across UI components.
---
### **Invariants**
- **All properties are `string`-typed**, even those logically representing booleans (e.g., `"True"`/`"False"`) or numbers (e.g., `"1000"` for `SamplesPerSecond`). Parsing is deferred to consumers.
- **`Groups` must be non-null** when accessed; implementations must initialize it (e.g., in constructor) to avoid `NullReferenceException`.
- **`INotifyPropertyChanged` compliance**: Any change to a property must raise `PropertyChanged` with the correct property name.
- **No validation is enforced by the interface itself**; validation rules (e.g., numeric range checks) are implemented externally.
- **Commented-out properties are not part of the interface** and must not be assumed to exist.
---
### **Dependencies**
- **Direct Dependencies**:
- `System.ComponentModel` (for `INotifyPropertyChanged`).
- `System.Collections.Generic` (for `List<T>`).
- `DTS.Common.XMLUtils` (specifically `GroupXMLClass`, used in the `Groups` property).
- **Inferred Consumers**:
- UI layers (e.g., WPF/WinForms) binding to this interface for configuration forms.
- Serialization/deserialization modules (e.g., XML/JSON converters) that persist/load `IBuildTestSetup` instances.
- Test execution engine that reads properties to configure acquisition, diagnostics, and export pipelines.
- **Inferred Dependents**:
- Implementations (e.g., `BuildTestSetup` class) in the same or related modules.
- XML serialization utilities (via `GroupXMLClass` dependency) for saving/loading setups.
---
### **Gotchas**
- **String-based booleans/numbers**: Consumers must parse values (e.g., `bool.Parse(Export)`) and handle format exceptions—no built-in type safety.
- **Deprecated export formats**: Commented-out properties (e.g., `ExportSomatFilteredDesired`) indicate legacy formats no longer supported; avoid referencing them.
- **Ambiguous semantics**: Properties like `AutomaticMode` and `RecordingMode` lack documentation on valid values (e.g., `"On"`, `"Auto"`, `"Manual"`); these must be inferred from implementation or external docs.
- **No validation guarantees**: The interface does not enforce constraints (e.g., `SamplesPerSecond` must be numeric), leading to potential runtime errors if consumers assume validity.
- **`CommonStatusLine` purpose unclear**: Its role as a shared status string suggests UI coordination, but its lifecycle (e.g., who sets/updates it) is not defined here.
- **Missing `ExportFormat` property**: The commented-out `ExportFormat` suggests a previous unified format selector, now replaced by per-format flags—potential source of confusion during migration.
*None identified beyond the above.*

View File

@@ -0,0 +1,342 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Channels/IChannelSettingRecord.cs
- Common/DTS.CommonCore/Interface/Channels/IGroupChannelSettingRecord.cs
- Common/DTS.CommonCore/Interface/Channels/IChannelCode.cs
- Common/DTS.CommonCore/Interface/Channels/IChannelSetting.cs
- Common/DTS.CommonCore/Interface/Channels/IChannelDbRecord.cs
- Common/DTS.CommonCore/Interface/Channels/IGroupChannel.cs
generated_at: "2026-04-16T02:30:03.492567+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cbc4fb29d29bc466"
---
# Channels
### **Purpose**
This module defines a set of interfaces that model channel-related data and behavior within the DTS (Data Acquisition and Test System) platform. It establishes contracts for representing physical and logical channels—both as database records (`IChannelDbRecord`) and as runtime objects (`IGroupChannel`)—alongside associated settings (`IChannelSetting`, `IChannelSettingRecord`, `IGroupChannelSettingRecord`) and channel identification codes (`IChannelCode`). These interfaces collectively support configuration, data acquisition, UI binding, and persistence of measurement channels, including support for analog, digital, squib, clock, UART, and stream modules, as well as sensor/hardware assignment, calibration, and filtering.
---
### **Public Interface**
#### **`IChannelSettingRecord`**
- **`int Id { get; set; }`**
Unique identifier for the setting definition.
- **`string SettingName { get; set; }`**
Human-readable name of the setting (e.g., `"Range"`, `"Polarity"`).
- **`string DefaultValue { get; set; }`**
Default value (as a string) for this setting type.
#### **`IGroupChannelSettingRecord`**
- **`long ChannelId { get; set; }`**
Foreign key referencing the channel (`IChannelDbRecord.Id`).
- **`int SettingId { get; set; }`**
Reference to the setting definition (`IChannelSettingRecord.Id`).
- **`string SettingValue { get; set; }`**
Actual value assigned to this setting on the channel.
#### **`IChannelCode`**
- **`int Id { get; }`**
Unique identifier for the channel code.
- **`string Code { get; }`**
Machine-readable code (e.g., ISO code fragment).
- **`string Name { get; }`**
Human-readable description of the code.
- **`ChannelEnumsAndConstants.ChannelCodeType CodeType { get; }`**
Enumerated type of the code (e.g., `Range`, `Filter`, `Polarity`).
#### **`IChannelSetting`**
- **`long ChannelId { get; set; }`**
ID of the channel this setting belongs to.
- **`int SettingTypeId { get; }`**
ID of the setting type (corresponds to `IChannelSettingRecord.Id`).
- **`string SettingName { get; }`**
Name of the setting (e.g., `"Range"`).
- **`string DefaultValue { get; }`**
Default value for this setting type.
- **`string Value { get; set; }`**
Current value stored as a string.
- **`int IntValue { get; set; }`**
Typed value (int) for numeric settings.
- **`double DoubleValue { get; set; }`**
Typed value (double) for floating-point settings.
- **`bool BoolValue { get; set; }`**
Typed value (bool) for boolean settings.
- **`IChannelSetting Clone()`**
Creates a deep copy of the setting.
#### **`IChannelDbRecord`**
- **`long Id { get; set; }`**
Primary key in the database.
- **`int GroupId { get; set; }`**
Foreign key to the group (`IGroup.Id`).
- **`string IsoCode { get; set; }`**
ISO-standard code for the channel (e.g., `"A1.1"`).
- **`string IsoChannelName { get; set; }`**
ISO-standard name of the channel.
- **`string UserCode { get; set; }`**
User-defined code.
- **`string UserChannelName { get; set; }`**
User-defined name of the channel.
- **`int DASId { get; set; }`**
ID of the data acquisition system (DAS) device.
- **`int DASChannelIndex { get; set; }`**
Physical channel index on the DAS device.
- **`int GroupChannelOrder { get; set; }`**
Order of the channel within its group.
- **`int TestSetupOrder { get; set; }`**
Order of the channel in the test setup.
- **`int SensorId { get; set; }`**
ID of the assigned sensor.
- **`bool Disabled { get; set; }`**
Whether the channel is disabled.
- **`DateTime LastModified { get; set; }`**
Timestamp of last modification.
- **`string LastModifiedBy { get; set; }`**
User who last modified the record.
#### **`IGroupChannel`** *(Extends `IChannelDbRecord`)*
All members of `IChannelDbRecord` are inherited. Additional members:
- **`SensorConstants.AvailableRangesLowG RangeLowG { get; set; }`**
Low-G sensor range setting.
- **`bool VoltageInsertionSensor { get; }`**
Indicates presence of a calibration-less voltage measurement channel.
- **`bool RangeModifiableSensorLowG { get; }`**
Indicates embedded low-G sensor with modifiable range.
- **`bool RangeModifiableSensorARS { get; }`**
Indicates embedded ARS sensor with modifiable range.
- **`InitialOffset[] AvailableInitialOffsets { get; set; }`**
Available initial offset options (depends on assigned sensor calibration).
- **`string IEPESupport { get; }`**
IEPE support status (e.g., `"Supported"`, `"N/A"`).
- **`IGroup Group { get; set; }`**
Parent group object.
- **`string GroupName { get; set; }`**
Display name of the parent group.
- **`bool GroupNameValid { get; set; }`**
Whether `GroupName` is set (not validated for correctness).
- **`bool IsoCodeValid { get; set; }`**
Whether `IsoCode` is set (not validated for correctness).
- **`bool IsoChannelNameValid { get; set; }`**
Whether `IsoChannelName` is set.
- **`bool UserCodeValid { get; set; }`**
Whether `UserCode` is set.
- **`bool UserChannelNameValid { get; set; }`**
Whether `UserChannelName` is set.
- **`bool HardwareValid { get; }`**
Whether hardware has been assigned.
- **`string HardwareId { get; set; }`**
Legacy hardware identifier (format: `"[das serial]:[channel index]"`).
- **`double TestSampleRate { get; set; }`**
Sample rate of the associated DAS.
- **`bool SensorValid { get; }`**
Whether a sensor has been assigned.
- **`bool IsDisabled { get; set; }`**
Whether the channel is disabled for data collection.
- **`void SetHardwareChannel(IHardwareChannel hardwareChannel)`**
Assigns a hardware channel object.
- **`void SetSensor(IDragAndDropItem sensor, IChannelSetting[] channelDefaults, bool applySensorDataToBlankChannels)`**
Assigns a sensor and optionally applies its default settings.
- **`bool CompareValue(string property)`**
Compares current value of a property to its original (e.g., for change tracking).
- **`bool SetDifferent(string property)`**
Marks a property as having been changed from its original value.
- **`void SetNotDifferent()`**
Clears all "different" flags.
- **`void SetRange(CACOption option)`**
Sets range based on a CAC option.
- **`bool CanMoveUp { get; set; }`**
Whether the channel can be moved up in the list.
- **`bool CanMoveDown { get; set; }`**
Whether the channel can be moved down in the list.
- **`bool DeleteShouldBeEnabled { get; set; }`**
Whether delete action should be enabled in UI.
- **`System.Windows.Visibility RemoveSensorVisibility { get; set; }`**
UI visibility for sensor removal control.
- **`bool IsBlank()`**
Returns `true` if the channel is new and unedited.
- **`void Clear()`**
Clears hardware and sensor assignments.
- **`bool Filter(string term)`**
Returns `true` if the channel matches the given search term.
- **`ICommand PasteCommand { get; set; }`**
Command executed on paste operation.
- **`IChannelSetting[] ChannelSettings { get; set; }`**
Array of channel-specific settings.
- **`string GetChannelName(IsoViewMode isoViewMode)`**
Returns channel name based on ISO view mode.
- **`string GetChannelCode(IsoViewMode isoViewMode)`**
Returns channel code based on ISO view mode.
- **`void Copy(IGroupChannel groupChannel)`**
Copies state from another channel.
- **`string Hardware { get; set; }`**
UI display string for hardware.
- **`string Sensor { get; }`**
UI display string for sensor.
- **`ISensorData SensorData { get; }`**
Sensor metadata and configuration.
- **`IHardwareChannel HardwareChannel { get; }`**
Hardware channel object.
- **`IDragAndDropItem DragAndDropItem { get; }`**
Drag-and-drop representation of the channel.
- **`ISensorCalibration SensorCalibration { get; }`**
Sensor calibration data.
- **`void SetSensorCalibration(ISensorCalibration calibration)`**
Assigns sensor calibration.
- **`void SetSensorData(ISensorData sensorData, IDragAndDropItem dragAndDropItem, bool decideSettings = false)`**
Assigns sensor data and optionally updates settings.
- **`bool HasEID { get; }`**
Whether the channel has an EID (Embedded ID).
- **`bool IsAnalog { get; }`**
Whether channel has an analog sensor assigned (or is non-blank).
- **`bool IsSquib { get; }`**
Whether channel has a squib sensor assigned (or is non-blank).
- **`bool IsDigitalIn { get; }`**
Whether channel has a digital input sensor assigned (or is non-blank).
- **`bool IsDigitalOut { get; }`**
Whether channel has a digital output sensor assigned (or is non-blank).
- **`bool IsClock { get; }`**
Whether channel is from an RTC module.
- **`bool IsUart { get; }`**
Whether channel is from a UART module.
- **`bool IsStreamIn { get; }`**
Whether channel is from a stream-in module.
- **`bool IsStreamOut { get; }`**
Whether channel is from a stream-out module.
- **`double Range { get; set; }`**
Current range setting.
- **`double Capacity { get; }`**
Sensor capacity.
- **`IFilterClass FilterClass { get; set; }`**
Filter class setting.
- **`string Polarity { get; set; }`**
Polarity setting.
- **`string Units { get; }`**
Units of measurement.
- **`ZeroMethodType ZeroMethod { get; set; }`**
Zeroing method.
- **`double ZeroMethodStart { get; set; }`**
Start time for zeroing.
- **`double ZeroMethodEnd { get; set; }`**
End time for zeroing.
- **`string Sensitivity { get; }`**
Sensor sensitivity.
- **`InitialOffset InitialOffset { get; set; }`**
Initial offset value.
- **`bool SquibLimitDuration { get; set; }`**
Whether squib duration is limited.
- **`double SquibDuration { get; set; }`**
Squib duration.
- **`double? SquibDelay { get; set; }`**
Nullable squib delay (nullable for UI purposes).
- **`double SquibCurrent { get; set; }`**
Squib current.
- **`bool DigitalOutLimitDuration { get; set; }`**
Whether digital output duration is limited.
- **`double DigitalOutDuration { get; set; }`**
Digital output duration.
- **`double DigitalOutDurationMax { get; set; }`**
Maximum allowed digital output duration (FB 28107).
- **`double DigitalOutDelay { get; set; }`**
Digital output delay.
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Digital output mode.
- **`SquibFireMode SquibFireMode { get; set; }`**
Squib fire mode.
- **`DigitalInputModes DigitalInputMode { get; set; }`**
Digital input mode.
- **`string ActiveValue { get; set; }`**
Active value for digital inputs/outputs.
- **`string DefaultValue { get; set; }`**
Default value for digital inputs/outputs.
- **`uint UartBaudRate { get; set; }`**
UART baud rate.
- **`uint UartDataBits { get; set; }`**
UART data bits.
- **`StopBits UartStopBits { get; set; }`**
UART stop bits.
- **`Parity UartParity { get; set; }`**
UART parity.
- **`Handshake UartFlowControl { get; }`**
UART flow control (always `NONE`; FB 30486).
- **`UartDataFormat UartDataFormat { get; set; }`**
UART data format.
- **`string StreamInUDPAddress { get; set; }`**
UDP address for stream-in.
- **`UDPStreamProfile StreamOutUDPProfile { get; set; }`**
UDP profile for stream-out.
- **`string StreamOutUDPAddress { get; set; }`**
UDP address for stream-out.
- **`ushort StreamOutUDPTimeChannelId { get; set; }`**
Time channel ID for stream-out UDP.
- **`ushort StreamOutUDPDataChannelId { get; set; }`**
Data channel ID for stream-out UDP.
- **`string StreamOutUDPTmNSConfig { get; set; }`**
TMATS configuration for stream-out.
- **`ushort StreamOutIRIGTimeDataPacketIntervalMs { get; set; }`**
IRIG packet interval (ms).
- **`ushort StreamOutTMATSIntervalMs { get; set; }`**
TMATS interval (ms; per FB 29987).
- **`IFilterClass GetFilterClassFromISOCode(ISoftwareFilter[] filters, string isoCode)`**
Retrieves filter class based on ISO code.
- **`CoerceISOCodeDelegate CoerceISOCodeFunc { get; }`**
Function to coerce/normalize ISO codes.
- **`UIItemStatus ChannelStatus { get; }`**
Combined status of channel (e.g., incomplete, error).
- **`void SetSettingsFromSensor(ISensorData sd)`**
Applies sensor settings to channel.
- **`string GetChangeList(ISensorData sensor)`**
Returns list of differences between sensor and channel settings.
- **`bool IsRangeDifferent { get; set; }`**
Whether range differs from original.
- **`bool IsFilterClassDifferent { get; set; }`**
Whether filter class differs from original.
- **`bool IsPolarityDifferent { get; set; }`**
Whether polarity differs from original.
- **`bool IsZeroMethodDifferent { get; set; }`**
Whether zero method differs from original.
- **`bool IsZeroMethodStartDifferent { get; set; }`**
Whether zero start time differs.
- **`bool IsZeroMethodEndDifferent { get; set; }`**
Whether zero end time differs.
- **`bool IsInitialOffsetDifferent { get; set; }`**
Whether initial offset differs.
- **`bool IsSquibFireModeDifferent { get; set; }`**
Whether squib fire mode differs.
- **`bool IsSquibDelayDifferent { get; set; }`**
Whether squib delay differs.
- **`bool IsSquibLimitDurationDifferent { get; set; }`**
Whether squib duration limit differs.
- **`bool IsSquibDurationDifferent { get; set; }`**
Whether squib duration differs.
- **`bool IsSquibCurrentDifferent { get; set; }`**
Whether squib current differs.
- **`bool IsDigitalOutputModeDifferent { get; set; }`**
Whether digital output mode differs.
- **`bool IsDigitalOutDelayDifferent { get; set; }`**
Whether digital output delay differs.
- **`bool IsDigitalOutLimitDurationDifferent { get; set; }`**
Whether digital output duration limit differs.
- **`bool IsDigitalOutDurationDifferent { get; set; }`**
Whether digital output duration differs.
- **`bool IsDigitalInputModeDifferent { get; set; }`**
Whether digital input mode differs.
- **`bool IsDefaultValueDifferent { get; set; }`**
Whether default value differs.
- **`bool IsActiveValueDifferent { get; set; }`**
Whether active value differs.
- **`bool BorderShouldShowOutOfDate { get; set; }`**
Whether UI border should indicate stale data.
---
### **Invariants**
- `IChannelDbRecord.Id` must be unique per record and non-negative.
- `IChannelDbRecord.GroupId` must reference a valid group.
- `IChannelDbRecord.DASChannelIndex` must be ≥ 0 and consistent with the DAS devices channel count.
- `IChannelDbRecord.SensorId` must be ≥ 0 if a sensor is assigned; otherwise, may be 0 or -1 depending on implementation.
- `IGroupChannel.IsBlank()` returns `true` only if the channel has never been edited (i.e., no hardware/sensor assigned and all fields at defaults).
- `IGroupChannel.SensorValid` and

View File

@@ -0,0 +1,88 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Channels/ChannelCodes/IChannelCodesListView.cs
- Common/DTS.CommonCore/Interface/Channels/ChannelCodes/IChannelCodesListViewModel.cs
- Common/DTS.CommonCore/Interface/Channels/ChannelCodes/IChannelCode.cs
generated_at: "2026-04-16T02:38:26.071478+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0d6003b6ee26589a"
---
# ChannelCodes
### **Purpose**
This module defines the core interfaces for a channel codes management UI component within the DTS system. It establishes a standardized contract between the view, view model, and individual channel code entities, enabling consistent handling of both ISO-standard and user-defined channel codes. The module supports operations such as loading, editing, filtering, sorting, saving, and validating channel codes, while abstracting UI-specific concerns (e.g., paste handling, status indication) through well-defined interfaces.
---
### **Public Interface**
#### **`IChannelCodesListView`**
- **Inherits**: `IBaseView`
- **Description**: A marker interface representing the view layer for the channel codes list UI. No additional members beyond base view functionality.
#### **`IChannelCodesListViewModel`**
- **Inherits**: `IBaseViewModel`
- **Properties**:
- `IChannelCodesListView View { get; set; }` — Reference to the associated view instance.
- `ObservableCollection<IChannelCode> ISOChannelCodes { get; set; }` — Collection of ISO-standard channel codes.
- `ObservableCollection<IChannelCode> UserChannelCodes { get; set; }` — Collection of user-defined channel codes.
- `Func<IList<IChannelCode>> ChannelCodesFunc { get; }` — A delegate returning the full list of channel codes (likely used for persistence or validation).
- `bool ShowISOStringBuilder { get; set; }` — Controls visibility of the ISO channel code builder UI.
- `bool UniqueISOCodesRequired { get; set; }` — Enforces uniqueness constraint on ISO codes.
- `bool ShowChannelCodeLookupHelper { get; set; }` — Toggles visibility of a lookup helper UI.
- `bool IsReadOnly { get; set; }` — If `true`, disables editing operations.
- `IChannelCode[] SelectedCodes { get; }` — Returns the currently selected channel codes.
- **Methods**:
- `void Unset()` — Cleans up view model state, likely detaching from the view.
- `void SetPage(object page)` — Associates the view model with a specific UI page (e.g., for navigation context).
- `void OnSetActive()` — Invoked when the view becomes active (e.g., on navigation to the page).
- `bool Save()` — Persists changes to the channel codes; returns `true` on success.
- `bool Validate(bool bDisplayWindow)` — Validates the channel codes; if `bDisplayWindow` is `true`, shows validation errors in a dialog.
- `void CopySelected()` — Copies selected channel codes to the clipboard.
- `void DeleteSelected()` — Deletes the selected channel codes.
- `void Filter(object columnTag, string searchTerm)` — Filters the displayed codes by `searchTerm` on the column identified by `columnTag`.
- `void Sort(object columnTag, bool bColumnClick)` — Sorts the displayed codes by the column identified by `columnTag`; `bColumnClick` indicates if triggered by user column click.
#### **`IChannelCode`**
- **Properties**:
- `int Id { get; }` — Database identifier of the channel code.
- `string Code { get; set; }` — The code value (ISO or user-defined).
- `string Name { get; set; }` — Human-readable name for the channel code.
- `ChannelEnumsAndConstants.ChannelCodeType CodeType { get; }` — Indicates whether the code is `ISO` or `USER` (from `DTS.Common.Enums.Channels`).
- `ICommand PasteCommand { get; set; }` — Command invoked when pasting multi-row data (e.g., CSV) into a field.
- `UIItemStatus ItemStatus { get; set; }` — UI status (e.g., success, error) for the item.
---
### **Invariants**
- `ISOChannelCodes` and `UserChannelCodes` are mutually exclusive collections (per `CodeType`).
- If `UniqueISOCodesRequired` is `true`, duplicate `Code` values in `ISOChannelCodes` must be rejected during validation or save.
- `IsReadOnly` mode must prevent modification of `Code`, `Name`, and deletion/copy operations (though `CopySelected` may still be allowed depending on implementation).
- `SelectedCodes` must reflect the current selection state in the view at all times.
- `ChannelCodesFunc` must return a consistent, up-to-date list of all channel codes (both ISO and user) when invoked.
---
### **Dependencies**
- **Internal Dependencies**:
- `DTS.Common.Base` (provides `IBaseView`, `IBaseViewModel`).
- `DTS.Common.Enums` (provides `UIItemStatus`, `ChannelEnumsAndConstants.ChannelCodeType`).
- **External Dependencies**:
- WPF (`System.Windows.Input.ICommand`, `ObservableCollection<T>`).
- **Depended Upon By**:
- UI layers implementing `IChannelCodesListView` (e.g., XAML views).
- View model implementations for channel codes management (e.g., `ChannelCodesListViewModel`).
- Persistence or domain services that consume `ChannelCodesFunc` to serialize or validate codes.
---
### **Gotchas**
- **`PasteCommand` behavior is UI-specific**: While the interface exposes `PasteCommand`, the actual parsing logic for multi-row pastes (e.g., CSV) is not defined here and must be implemented by concrete types.
- **`ChannelCodesFunc` is a delegate, not a property**: Its value may be lazily evaluated or change over time; callers should not cache its result.
- **`ShowISOStringBuilder`, `ShowChannelCodeLookupHelper`, and `IsReadOnly` are mutable properties**: Their values may change at runtime, and implementations must react appropriately (e.g., re-enabling/disabling UI controls).
- **`Validate` behavior depends on `bDisplayWindow`**: When `false`, validation may only return a boolean without user feedback—callers must handle error reporting if needed.
- **No explicit thread-safety guarantees**: `ObservableCollection<T>` is not thread-safe; modifications to `ISOChannelCodes`/`UserChannelCodes` must occur on the UI thread.
- **`SelectedCodes` is an array, not a collection**: Its contents may be stale if selection changes between calls; callers should use it immediately after selection operations.
- **None identified from source alone.**

View File

@@ -0,0 +1,60 @@
---
source_files:
- Common/DTS.CommonCore/Interface/CheckChannels/ICheckChannelsView.cs
- Common/DTS.CommonCore/Interface/CheckChannels/ICheckChannelsViewModel.cs
- Common/DTS.CommonCore/Interface/CheckChannels/ICheckChannelsMenuView.cs
- Common/DTS.CommonCore/Interface/CheckChannels/ICheckChannelsMenuViewModel.cs
generated_at: "2026-04-16T02:20:12.180878+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3a5d65945568970d"
---
# CheckChannels
## Documentation: CheckChannels Module Interfaces
### 1. Purpose
This module defines the core interface contracts for the *CheckChannels* feature within the applications UI architecture. It establishes a separation of concerns between view and view model layers for both the main content area and its associated ribbon menu, following the MVVM pattern. The interfaces `ICheckChannelsView`, `ICheckChannelsViewModel`, `ICheckChannelsMenuView`, and `ICheckChannelsMenuViewModel` collectively enable modular UI composition—allowing implementations to be swapped or extended while adhering to a consistent contract for integration with the broader system.
### 2. Public Interface
All interfaces are *marker interfaces* with no additional members declared. Their purpose is purely to categorize and type-check components within the UI framework.
- **`ICheckChannelsView`**
*Signature:* `public interface ICheckChannelsView : IBaseView`
*Behavior:* Serves as the contract for the view component responsible for displaying the primary CheckChannels UI content. Inherits from `IBaseView`, implying it participates in a base view lifecycle or infrastructure (e.g., initialization, data binding setup).
- **`ICheckChannelsViewModel`**
*Signature:* `public interface ICheckChannelsViewModel : IBaseViewModel`
*Behavior:* Serves as the contract for the view model backing `ICheckChannelsView`. Inherits from `IBaseViewModel`, indicating it likely exposes properties, commands, and state management for the main CheckChannels content.
- **`ICheckChannelsMenuView`**
*Signature:* `public interface ICheckChannelsMenuView : IRibbonView`
*Behavior:* Serves as the contract for the ribbon menu view associated with CheckChannels. Inherits from `IRibbonView`, implying integration with a ribbon-based UI control system (e.g., a tabbed toolbar with groups and buttons).
- **`ICheckChannelsMenuViewModel`**
*Signature:* `public interface ICheckChannelsMenuViewModel : IRibbonViewModel`
*Behavior:* Serves as the view model for `ICheckChannelsMenuView`. Inherits from `IRibbonViewModel`, indicating it manages ribbon-specific state (e.g., button visibility, command execution for ribbon items).
### 3. Invariants
- All four interfaces are *purely marker interfaces*—they carry no additional properties, methods, or events beyond their base interface contracts.
- `ICheckChannelsView` and `ICheckChannelsViewModel` must be used in conjunction (e.g., via dependency injection or view-model-first patterns) to form a valid view/view-model pair for the main content area.
- Similarly, `ICheckChannelsMenuView` and `ICheckChannelsMenuViewModel` must be paired for the ribbon menu component.
- Since they inherit from `IBaseView`, `IBaseViewModel`, `IRibbonView`, and `IRibbonViewModel` respectively, they inherit all invariants and contracts defined in those base interfaces (e.g., lifecycle events, binding requirements), though those are not detailed in this modules source.
### 4. Dependencies
- **Depends on:**
- `DTS.Common.Base` namespace (for `IBaseView`, `IBaseViewModel`)
- `DTS.Common.RibbonControl` namespace (for `IRibbonView`, `IRibbonViewModel`)
- **Depended on by:**
- UI framework components that resolve or validate view/view-model types by interface (e.g., a DI container, view factory, or navigation service).
- Concrete implementations (not present in this source) for `ICheckChannelsView`, `ICheckChannelsViewModel`, `ICheckChannelsMenuView`, and `ICheckChannelsMenuViewModel`.
- Likely consumed by modules responsible for UI composition (e.g., shell layout, ribbon registration, or module initialization logic in a modular application architecture).
### 5. Gotchas
- **No behavior defined:** These interfaces convey *no operational semantics*—all functionality resides in their implementations. Developers must inspect concrete classes to understand actual behavior.
- **Ambiguous scope:** The term “CheckChannels” is not defined here; its functional meaning (e.g., channel validation, configuration, monitoring) is external to this module.
- **Inheritance chain opacity:** Since `IBaseView`, `IBaseViewModel`, `IRibbonView`, and `IRibbonViewModel` are defined elsewhere, their contracts (e.g., required properties like `DataContext`, event handlers, or initialization methods) must be referenced separately to fully understand the obligations of these interfaces.
- **No versioning or deprecation markers:** No attributes (e.g., `[Obsolete]`) or versioning hints are present, suggesting these are stable but potentially low-level abstractions.
None identified from source alone beyond the above.

View File

@@ -0,0 +1,49 @@
---
source_files:
- Common/DTS.CommonCore/Interface/CheckTrigger/ICheckTriggerView.cs
- Common/DTS.CommonCore/Interface/CheckTrigger/ICheckTriggerViewModel.cs
generated_at: "2026-04-16T02:17:32.566868+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b59a55831fe5a086"
---
# CheckTrigger
## 1. Purpose
This module defines the core interfaces for the *Check Trigger* feature within the DTS (likely *Data Tracking System*) architecture. It establishes the contract between the view and view model layers for components responsible for triggering and managing check operations—likely periodic or event-driven validation/sync tasks—within a MVVM (Model-View-ViewModel) pattern. The interfaces `ICheckTriggerView` and `ICheckTriggerViewModel` serve as base abstractions that concrete implementations must fulfill, enabling decoupled UI and business logic for check-triggering functionality.
## 2. Public Interface
No public *functions*, *methods*, or *properties* are defined directly in these interfaces. Both interfaces are marker interfaces inheriting from base interfaces in the `DTS.Common.Base` namespace:
- **`ICheckTriggerView`**
- *Signature*: `public interface ICheckTriggerView : IBaseView`
- *Behavior*: Represents the view layer contract for a check-trigger UI component. It inherits from `IBaseView`, implying it adheres to a common view contract (e.g., lifecycle, binding context, or UI state management), but no additional API surface is exposed here.
- **`ICheckTriggerViewModel`**
- *Signature*: `public interface ICheckTriggerViewModel : IBaseViewModel`
- *Behavior*: Represents the view model layer contract for managing check-trigger state and logic. It inherits from `IBaseViewModel`, implying standard view model capabilities (e.g., property change notification, command handling), but no additional API surface is exposed here.
> **Note**: All meaningful behavior (e.g., commands, properties like `IsTriggerEnabled`, `LastCheckTime`) must be defined in concrete implementations or in `IBaseView`/`IBaseViewModel`. This file only declares the *type roles*.
## 3. Invariants
- `ICheckTriggerView` must be implemented by a UI component (e.g., XAML view, control, or page) that participates in the check-trigger workflow.
- `ICheckTriggerViewModel` must be implemented by a view model that coordinates check-trigger logic and binds to an `ICheckTriggerView`.
- The pair (`ICheckTriggerView`, `ICheckTriggerViewModel`) must be used in a standard MVVM binding relationship (e.g., view sets its `BindingContext` to an instance of `ICheckTriggerViewModel`).
- Both interfaces are *marker interfaces*—they carry no behavioral contract beyond their type identity and base inheritance.
## 4. Dependencies
- **Depends on**:
- `DTS.Common.Base` (specifically `IBaseView` and `IBaseViewModel`).
- **Depended on by**:
- Concrete view classes (e.g., `CheckTriggerPage : Page, ICheckTriggerView`) and view model classes (e.g., `CheckTriggerViewModel : ICheckTriggerViewModel`) in the UI layer.
- Dependency injection or composition containers likely register types against these interfaces.
- Other modules (e.g., `DTS.Common.Core.CheckTrigger`) likely consume these interfaces to bind or wire up check-trigger components.
## 5. Gotchas
- **No behavior defined here**: Developers may mistakenly expect methods/properties in these interfaces; all logic resides in implementations or base interfaces.
- **Ambiguity in `IBaseView`/`IBaseViewModel`**: Behavior of `ICheckTriggerView` and `ICheckTriggerViewModel` is entirely contingent on the contracts of `IBaseView` and `IBaseViewModel`, which are not provided here. Their semantics (e.g., required lifecycle methods, binding patterns) must be consulted separately.
- **No versioning or extensibility signals**: The interfaces are empty—adding future functionality may require breaking changes or new derived interfaces (e.g., `ICheckTriggerView2`).
- **Namespace reuse**: Both interfaces reside in `DTS.Common.Interface`, but no other types in this namespace are shown; ensure no naming conflicts exist with other `*Trigger` interfaces (e.g., `IScheduleTriggerView`).
None identified beyond the above.

View File

@@ -0,0 +1,103 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Communication/ICommunicationReport.cs
- Common/DTS.CommonCore/Interface/Communication/IDASConnectedDevice.cs
- Common/DTS.CommonCore/Interface/Communication/ICommunication_DASInfo.cs
generated_at: "2026-04-16T02:23:54.710439+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c40d100ec97fea56"
---
# Communication
### **Purpose**
This module defines core interfaces for representing communication results, connected devices in a DAS (Data Acquisition System) network, and DAS-specific metadata. It serves as the foundational abstraction layer for device discovery, status monitoring, and communication state reporting—specifically supporting the auto-discovery and monitoring of DAS-connected hardware (e.g., SLICE6 devices connected to an SLICE6DB base station). These interfaces decouple communication logic from implementation details, enabling consistent handling of device properties, communication outcomes, and DAS-level state across the system.
---
### **Public Interface**
#### **`ICommunicationReport`**
- **`object UserState { get; set; }`**
A user-defined object for associating custom state with a communication operation (e.g., tracking request context or correlation ID).
- **`CommunicationConstantsAndEnums.CommunicationResult Result { get; set; }`**
The outcome of a communication operation (e.g., success, timeout, error). *Note: `CommunicationResult` is defined in an external enum namespace (`DTS.Common.Enums.Communication`), not included here.*
- **`byte[] Data { get; set; }`**
Raw payload data received or transmitted during the communication. May be `null` or empty depending on the operation type and result.
#### **`IDASConnectedDevice`**
- **`HardwareTypes DeviceType { get; }`**
The hardware type of the connected device (e.g., sensor, actuator), per the `HardwareTypes` enum (defined externally in `DTS.Common.Enums.Hardware`).
- **`int Port { get; }`**
Zero-based port index on the DAS to which the device is physically connected.
- **`int SpotOnPort { get; }`**
Zero-based position of the device on its ports daisy chain (e.g., `0` = first device on the port).
- **`PhysicalAddress PhysicalAddress { get; }`**
The devices MAC address (from `System.Net.NetworkInformation`).
- **`string IPAddress { get; }`**
The IPv4/IPv6 address assigned to the device (as a string).
- **`string SerialNumber { get; }`**
Unique hardware serial number of the device.
- **`string Location { get; }`**
Human-readable location descriptor (e.g., "Lab A, Rack 2").
- **`string Version { get; }`**
Firmware version string of the device.
#### **`ICommunication_DASInfo`**
- **`IDASConnectedDevice[] ConnectedDevices { get; }`**
Immutable array of devices currently connected to this DAS (read-only). *Currently only populated for SLICE6DB.*
- **`void SetConnectedDevices(IDASConnectedDevice[] devices)`**
Updates the `ConnectedDevices` array. Intended for internal use by DAS implementations during discovery.
- **`string[] SerialNumbers { get; set; }`**
Parallel array of serial numbers for connected devices (order matches `ConnectedDevices`).
- **`string[] FirmwareVersions { get; set; }`**
Parallel array of firmware versions for connected devices (order matches `ConnectedDevices`).
- **`string StackSerialNumber(int devid)`**
Returns the serial number of the device at index `devid` in the `ConnectedDevices` array. *Behavior for invalid `devid` is unspecified.*
- **`DateTime? FirstUseDate { get; set; }`**
Date of the devices first operational use. `null` indicates the hardware has never been used since calibration. Only valid when `IsFirstUseDateSupported` is `true`.
- **`bool IsFirstUseDateSupported { get; set; }`**
Indicates whether the DAS hardware supports tracking first-use date (requires firmware/user-attribute storage and calibration support per ticket 15524).
- **`bool IsStreamingSupported { get; set; }`**
Indicates whether the DAS supports streaming data (e.g., via ticket 30429, controllable via the `DISABLE_STREAMING_FEATURE` system attribute).
---
### **Invariants**
- **`ICommunicationReport`**:
- `Data` may be `null` or non-empty only if `Result` indicates success or partial success (implementation-dependent).
- `UserState` is not interpreted by the interface; its lifecycle is managed by the caller.
- **`IDASConnectedDevice`**:
- `Port` and `SpotOnPort` are zero-based indices.
- `PhysicalAddress` is guaranteed non-null (as `PhysicalAddress` is a struct in .NET, but the interface implies it is initialized).
- `SerialNumber`, `Location`, and `Version` are non-null strings (no explicit nullability annotation, but context implies required fields).
- **`ICommunication_DASInfo`**:
- `ConnectedDevices`, `SerialNumbers`, and `FirmwareVersions` must have identical lengths when populated.
- `FirstUseDate` is only meaningful when `IsFirstUseDateSupported` is `true`; otherwise, it should be ignored.
- `StackSerialNumber(devid)` assumes `devid` is a valid index into `ConnectedDevices`; out-of-bounds behavior is undefined.
---
### **Dependencies**
- **External Dependencies**:
- `DTS.Common.Enums.Communication.CommunicationResult` (for `ICommunicationReport.Result`)
- `DTS.Common.Enums.Hardware.HardwareTypes` (for `IDASConnectedDevice.DeviceType`)
- `System.Net.NetworkInformation.PhysicalAddress` (for `IDASConnectedDevice.PhysicalAddress`)
- **Internal Dependencies**:
- `ICommunication_DASInfo` is used by DAS implementations (e.g., SLICE6DB) to expose device metadata.
- `IDASConnectedDevice` is consumed by higher-level discovery/monitoring logic (e.g., auto-discovery services).
- **Consumers**:
- Likely used by DAS-specific communication layers (e.g., `DASCommunicationManager`) and device monitoring services.
- `ICommunicationReport` is probably returned by asynchronous communication operations (e.g., `SendAsync`, `ReceiveAsync`).
---
### **Gotchas**
- **`StackSerialNumber(int devid)`**: No validation or exception behavior is specified for invalid `devid` (e.g., negative or ≥ `ConnectedDevices.Length`). Implementations may throw `ArgumentOutOfRangeException` or return `null`—behavior is implementation-defined.
- **`ConnectedDevices` mutability**: While `ConnectedDevices` is read-only (`get` only), `SetConnectedDevices()` allows external mutation. Callers must ensure thread-safety if used concurrently.
- **`FirstUseDate` semantics**: A `null` value does *not* imply "never calibrated"—it means "never used since calibration." A calibrated but unused device may still have `FirstUseDate == null`.
- **`IsStreamingSupported`**: Support is hardware/firmware-dependent and may be toggled via system attributes (e.g., `DISABLE_STREAMING_FEATURE`). The interface does not enforce consistency with actual runtime streaming capability.
- **No error details**: `ICommunicationReport` lacks error codes, messages, or stack traces—only a high-level `Result` enum. Debugging requires correlating with logs or `UserState`.
- **Missing nullability annotations**: Properties like `Data`, `SerialNumber`, and `IPAddress` lack `?` for nullability despite potential `null` values in practice. This may cause confusion in nullable-enabled contexts.
- **No versioning guarantees**: Arrays (`SerialNumbers`, `FirmwareVersions`) are parallel to `ConnectedDevices` but have no explicit synchronization mechanism—out-of-sync arrays could occur if `SetConnectedDevices` is called without updating these arrays.

View File

@@ -0,0 +1,109 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Components/IAssemblyView.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyListView.cs
- Common/DTS.CommonCore/Interface/Components/ITileView.cs
- Common/DTS.CommonCore/Interface/Components/IGroupView.cs
- Common/DTS.CommonCore/Interface/Components/ITileListView.cs
- Common/DTS.CommonCore/Interface/Components/IGroupListView.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyListViewModel.cs
- Common/DTS.CommonCore/Interface/Components/ITileViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IGroupViewModel.cs
- Common/DTS.CommonCore/Interface/Components/ITileListViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IGroupListViewModel.cs
generated_at: "2026-04-16T02:22:29.046640+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9dfaf004748c958d"
---
# Documentation: View and ViewModel Interfaces for Assembly/Tile/Group Hierarchies
---
## 1. Purpose
This module defines a set of interfaces that establish a consistent MVVM (Model-View-ViewModel) pattern for hierarchical UI components representing assemblies, tiles, and groups. It provides abstract contracts for *view* interfaces (`I*View`) and *view model* interfaces (`I*ViewModel`) across two distinct namespace hierarchies (`DTS.Common.Interface` and `DataPro.Common.Interface`), likely supporting different UI frameworks or product lines. The interfaces enable decoupling of UI rendering logic (views) from data presentation logic (view models), with view models exposing strongly-typed references to their associated views and managing collections of child items (e.g., `AssemblyList`, `GroupList`). The structure supports nested groupings—e.g., a list of groups, each group containing assemblies or tiles.
---
## 2. Public Interface
### View Interfaces (All inherit `IBaseView`)
| Interface | Namespace | Description |
|---------|-----------|-------------|
| `IAssemblyView` | `DTS.Common.Interface` | Marker interface for views displaying a single assembly. |
| `IAssemblyListView` | `DTS.Common.Interface` | Marker interface for views displaying a list of assembly groups. |
| `ITileView` | `DataPro.Common.Interface` | Marker interface for views displaying a single tile. |
| `IGroupView` | `DataPro.Common.Interface` | Marker interface for views displaying a single group. |
| `ITileListView` | `DataPro.Common.Interface` | Marker interface for views displaying a list of tile groups. |
| `IGroupListView` | `DataPro.Common.Interface` | Marker interface for views displaying a list of groups. |
> **Note**: All view interfaces are *empty* (no members beyond inheritance). They serve as type-safe markers to associate view models with concrete view implementations.
### ViewModel Interfaces (All inherit `IBaseViewModel`)
| Interface | Namespace | Key Members | Description |
|---------|-----------|-------------|-------------|
| `IAssemblyViewModel` | `DTS.Common.Interface` | `IAssemblyView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single assembly groups data and behavior. Contains a list of `AssemblyNameImage` items. |
| `IAssemblyListViewModel` | `DTS.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`IAssemblyListView View { get; set; }`<br>`List<IAssemblyView> GroupList { get; set; }` | Represents a list of assembly groups. Holds references to child `IAssemblyView`s (not view models). |
| `ITileViewModel` | `DataPro.Common.Interface` | `ITileView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single tile groups data. Structurally identical to `IAssemblyViewModel`. |
| `IGroupViewModel` | `DataPro.Common.Interface` | `IGroupView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single groups data. Structurally identical to `IAssemblyViewModel`. |
| `ITileListViewModel` | `DataPro.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`ITileListView View { get; set; }`<br>`List<ITileView> GroupList { get; set; }` | Represents a list of tile groups. Holds references to child `ITileView`s. |
| `IGroupListViewModel` | `DataPro.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`IGroupListView View { get; set; }`<br>`List<IGroupView> GroupList { get; set; }` | Represents a list of groups. Holds references to child `IGroupView`s. |
> **Note**:
> - `AssemblyNameImage` is used in multiple view models but is not defined in this source set; its definition must be found elsewhere.
> - `IMainViewModel` is referenced as a parent but not defined here.
> - `List<T>` is used for collections (not `ObservableCollection<T>`), despite `System.Collections.ObjectModel` being imported in some files.
---
## 3. Invariants
- **View-ViewModel Pairing**: Each `I*ViewModel` interface declares a `View` property typed to its corresponding `I*View` interface (e.g., `IAssemblyViewModel``IAssemblyView`). This implies a strict 1:1 pairing between view and view model.
- **Hierarchical Consistency**:
- `IAssemblyListViewModel.GroupList` holds `IAssemblyView` instances (not `IAssemblyViewModel`), suggesting the list is view-centric.
- Conversely, `IAssemblyViewModel.AssemblyList` holds `AssemblyNameImage` objects, indicating data content.
- The same pattern holds for `Tile` and `Group` variants.
- **Namespace Separation**: Two disjoint sets of interfaces exist:
- `DTS.*` namespace for *Assembly*-centric components.
- `DataPro.*` namespace for *Tile/Group*-centric components.
This suggests parallel UI architectures for different subsystems or product lines.
- **No Validation Rules**: No explicit validation or constraint logic is present in the interfaces themselves.
---
## 4. Dependencies
### Internal Dependencies (from imports)
- `DTS.Common.Base` → Defines `IBaseView` and `IBaseViewModel` (not included here).
- `DataPro.Common.Base` → Defines `IBaseView` and `IBaseViewModel` (not included here).
- `System.Collections.Generic`, `System.Collections.ObjectModel`, `System.Reflection` → Standard .NET collections and reflection APIs.
### External Dependencies (inferred)
- **Consumers**: Any UI layer (e.g., WPF, WinForms, or custom framework) implementing MVVM must implement these interfaces to bind views and view models.
- **Dependents**: Concrete implementations of these interfaces (e.g., `AssemblyViewModel : IAssemblyViewModel`) will depend on:
- `AssemblyNameImage` type (for `AssemblyList`)
- `IMainViewModel` (for `Parent` reference)
- Concrete view classes implementing `I*View` interfaces.
---
## 5. Gotchas
- **Namespace Splitting**: The duplication of nearly identical interfaces across `DTS.Common.Interface` and `DataPro.Common.Interface` (e.g., `IAssemblyViewModel` vs. `ITileViewModel`) suggests legacy or parallel development paths. Developers must ensure correct namespace usage to avoid type conflicts or accidental mixing of subsystems.
- **View vs. ViewModel Collections**:
- `IAssemblyListViewModel.GroupList` stores `IAssemblyView` (not `IAssemblyViewModel`).
- This implies the *view layer* is responsible for managing child view instances, which is unconventional in MVVM (typically, view models manage child view models). This may indicate a design where views are composed manually or via a custom framework.
- **Missing Collection Type Consistency**:
- `ITileViewModel` and `IGroupViewModel` import `System.Collections.ObjectModel` but use `List<T>` for `AssemblyList`. If observable notifications are needed, `ObservableCollection<T>` would be expected—this mismatch may cause issues if data binding relies on change notifications.
- **No Method Signatures**: All interfaces are property-only. Behavior (e.g., initialization, command binding) must be defined in base interfaces (`IBaseViewModel`, `IBaseView`) or concrete implementations.
- **Ambiguous `GroupName` Semantics**: The `GroupName` property appears in `IAssemblyViewModel`, `ITileViewModel`, and `IGroupViewModel`, but its meaning is unclear:
- Is it the *name of the group containing the assemblies/tiles*?
- Or the *name of the assembly/tile itself*?
Context from `AssemblyList` suggests the former, but this is not explicit.
> **None identified from source alone** for other areas (e.g., thread safety, lifecycle, nullability), as these are not specified in the interfaces.

View File

@@ -0,0 +1,121 @@
---
source_files:
- Common/DTS.CommonCore/Interface/Connection/IConnection.cs
generated_at: "2026-04-16T02:19:32.551940+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "a6aead5143a016b8"
---
# Connection
## Documentation: `IConnection` Interface
### 1. Purpose
The `IConnection` interface defines a standardized abstraction for network connection management within the DTS system, supporting both synchronous and asynchronous send/receive operations, connection lifecycle control (including soft disconnect/reconnect semantics), and socket-level configuration. It serves as the foundational contract for all connection implementations (e.g., TCP, UDP, custom transports), enabling decoupled communication logic across the system while preserving consistent behavior for connection state, data transfer, and error handling.
### 2. Public Interface
- **`Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)`**
Asynchronously sends data from `sendBuffer`, starting at `bufferStartOffset`, for `bufferSizeToSend` bytes. Returns the number of bytes sent.
- **`bool IsSoftDisconnected { get; }`**
Indicates whether the connection is in a *soft disconnected* state—i.e., previously connected, then voluntarily disconnected with the expectation of reconnection.
- **`void SoftDisconnect()`**
Voluntarily disconnects the connection *without* fully closing underlying resources, preserving state for later reconnection.
- **`void SoftConnect()`**
Re-establishes a connection previously soft-disconnected, restoring communication capability.
- **`System.Net.Sockets.SocketFlags Flags { get; set; }`**
Gets or sets the socket flags used for send/receive operations (e.g., `DontRoute`, `OutOfBand`).
- **`event EventHandler OnDisconnected`**
Raised when the connection is fully disconnected (not soft-disconnected).
- **`void KeepAliveErrorReceived()`**
Explicitly signals that a keep-alive timeout/error occurred (e.g., no timely response received). Implementation likely triggers disconnection or retry logic.
- **`string ConnectString { get; }`**
Returns the connection string used to establish the connection (e.g., `"tcp://192.168.1.10:5000"`).
- **`bool Connected { get; }`**
Indicates whether the connection is currently active (i.e., not disconnected or soft-disconnected).
- **`void Create(string connectString)`**
Initializes the connection using the provided `connectString`.
- **`void Create(string connectString, string hostIPAddress)`**
Initializes the connection using `connectString` and an explicit `hostIPAddress` (likely for override or validation).
- **`string GetConnectionData()`**
Returns diagnostic or metadata information about the current connection state (e.g., remote endpoint, protocol details).
- **`IAsyncResult BeginConnect(AsyncCallback callback, object callbackObject)`**
Initiates an asynchronous connection attempt.
- **`void EndConnect(IAsyncResult ar)`**
Completes an asynchronous connection attempt.
- **`IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback callback, object state)`**
Initiates an asynchronous disconnection. If `reuseSocket` is `true`, the underlying socket may be reused.
- **`void EndDisconnect(IAsyncResult asyncResult)`**
Completes an asynchronous disconnection.
- **`IAsyncResult BeginAccept(AsyncCallback callback, object state)`**
Initiates an asynchronous accept operation (for server-side connections).
- **`IConnection EndAccept(IAsyncResult asyncResult)`**
Completes an asynchronous accept operation and returns a new `IConnection` representing the accepted client connection.
- **`void Bind(int port)`**
Binds the connection to a local port (typically used for server-side listening).
- **`void Listen(int backlog)`**
Begins listening for incoming connections with the specified `backlog` queue size.
- **`IAsyncResult BeginSend(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend, AsyncCallback callback, object callbackObject)`**
Initiates an asynchronous send operation.
- **`int EndSend(IAsyncResult ar)`**
Completes an asynchronous send operation and returns the number of bytes sent.
- **`IAsyncResult BeginReceive(byte[] receiveBuffer, int bufferStartOffset, int maxSizeToReceive, AsyncCallback callback, object state)`**
Initiates an asynchronous receive operation.
- **`int EndReceive(IAsyncResult ar)`**
Completes an asynchronous receive operation and returns the number of bytes received.
> **Note**: Two methods—`GetCurrentUploadRate()` and `GetCurrentDownloadRate()`—are commented out and not part of the active interface.
### 3. Invariants
- `Connected` must be `true` only when the underlying socket is actively connected (excluding soft-disconnected state).
- `IsSoftDisconnected` must be `true` only after `SoftDisconnect()` is called and before `SoftConnect()` is called.
- `OnDisconnected` must be raised only when the connection transitions to a *non-recoverable* (hard) disconnect state, not during soft disconnects.
- `SendAsync`, `BeginSend`, `EndSend`, `BeginReceive`, `EndReceive` must only be invoked when `Connected` is `true` (behavior on violation is undefined per interface—implementation-dependent).
- `SoftConnect()` must succeed only if `IsSoftDisconnected` is `true`.
- `Flags` must be applied consistently to all socket operations (send/receive/connect/accept).
- `KeepAliveErrorReceived()` must be called only when a keep-alive failure is detected (e.g., timeout without response).
### 4. Dependencies
- **Depends on**:
- `System` (core types: `Task`, `EventHandler`, `IAsyncResult`, `AsyncCallback`, `object`)
- `System.Threading.Tasks` (for `Task<int>`)
- `System.Net.Sockets` (for `SocketFlags`)
- **Implemented by**: Concrete connection classes (e.g., `TcpConnection`, `UdpConnection`)—not visible in this file but implied by usage.
- **Used by**: Higher-level components requiring network communication (e.g., protocol handlers, device managers, session controllers).
- **No direct dependency on other DTS modules** is visible in this interface, though `ConnectString` format and `GetConnectionData()` output likely conform to internal conventions.
### 5. Gotchas
- **Soft vs. Hard Disconnect**: `SoftDisconnect()` does *not* raise `OnDisconnected`; only full disconnections do. Confusing these can lead to incorrect state management.
- **`Connected` vs. `IsSoftDisconnected`**: `Connected` is `false` when `IsSoftDisconnected` is `true`. Code must check both states explicitly if distinguishing soft-disconnect is required.
- **`BeginAccept`/`EndAccept`**: Returns a *new* `IConnection` instance—consumers must manage its lifecycle (including disposal).
- **`reuseSocket` in `BeginDisconnect`**: If `true`, the socket may be reused; if `false`, it may be closed. Behavior depends on implementation.
- **No rate-limiting API**: The commented-out `GetCurrentUploadRate()`/`GetCurrentDownloadRate()` suggest rate monitoring was considered but not implemented—do not assume rate data is available.
- **`Create` overloads**: The two `Create` methods differ only by `hostIPAddress`; the purpose of the second parameter is unclear without implementation—likely for override or validation.
- **No timeout parameters**: All async operations lack explicit timeout configuration—timeouts are likely handled internally or via `KeepAliveErrorReceived()`.
- **No exception contract**: The interface does not specify exceptions (e.g., `ObjectDisposedException` after `SoftDisconnect`/`SoftConnect`), leaving error handling implementation-defined.
None identified beyond those above.

View File

@@ -0,0 +1,86 @@
---
source_files:
- Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsView.cs
- Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsExportView.cs
- Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsImportView.cs
- Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelModel.cs
- Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsViewModel.cs
generated_at: "2026-04-16T02:18:35.414312+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "d441dada7c96f903"
---
# CustomChannels
## Documentation: Custom Channels Module
### 1. Purpose
This module defines the core interfaces for a *Custom Channels* feature, enabling users to manage user-defined channel configurations through import/export workflows. It provides a separation of concerns between view layers (`ICustomChannelsView`, `ICustomChannelsImportView`, `ICustomChannelsExportView`), data models (`ICustomChannelModel`), and view-model logic (`ICustomChannelsViewModel`). The module serves as the contract layer for a UI-driven workflow where users can select, import from files, export to files, and toggle inclusion status of custom channels—likely in a data acquisition, signal processing, or configuration context.
### 2. Public Interface
#### Interfaces
- **`ICustomChannelsView`**
*Namespace:* `DTS.Common.Interface`
*Inherits:* `IBaseView`
*Description:* Marker interface for the main custom channels view. No additional members beyond base view contract.
- **`ICustomChannelsExportView`**
*Namespace:* `DTS.Common.Interface.CustomChannels`
*Inherits:* `IBaseView`
*Description:* Marker interface for the export-specific view component.
- **`ICustomChannelsImportView`**
*Namespace:* `DTS.Common.Interface.CustomChannels`
*Inherits:* `IBaseView`
*Description:* Marker interface for the import-specific view component.
- **`ICustomChannelModel`**
*Namespace:* `DTS.Common.Interface.CustomChannels`
*Properties:*
- `string Name { get; }` — Immutable identifier/name of the custom channel.
- `bool Included { get; set; }` — Read-write flag indicating whether the channel is included in current operations (e.g., import/export).
- **`ICustomChannelsViewModel`**
*Namespace:* `DTS.Common.Interface.CustomChannels`
*Inherits:* `IBaseViewModel`
*Properties:*
- `ICustomChannelsImportView ImportView { get; set; }` — Reference to the import view instance.
- `ICustomChannelsExportView ExportView { get; set; }` — Reference to the export view instance.
- `string ExportFileName { get; set; }` — Path/filename for export operations.
- `string ImportFileName { get; set; }` — Path/filename for import operations.
- `ObservableCollection<ICustomChannelModel> AllCustomChannels { get; }` — Collection of all available custom channel models; bound to UI for selection.
*Methods:*
- `void Unset()` — Likely clears references or resets state (e.g., view bindings).
- `void OnSetActive(bool bImport)` — Activates the view for either import (`bImport == true`) or export (`bImport == false`) mode.
- `void ReadImportFile()` — Reads and parses the file specified in `ImportFileName`, populating `AllCustomChannels`.
- `void SelectAll()` — Sets `Included = true` for all items in `AllCustomChannels`.
- `void ClearSelection()` — Sets `Included = false` for all items in `AllCustomChannels`.
- `void Export()` — Executes export of selected (included) channels to `ExportFileName`.
- `void Import()` — Executes import of selected (included) channels from `ImportFileName`.
### 3. Invariants
- `AllCustomChannels` is an `ObservableCollection<ICustomChannelModel>`—UI must be notified of changes via collection change events.
- `Included` property on each `ICustomChannelModel` is mutable and controls inclusion state for import/export operations.
- `ImportFileName` and `ExportFileName` must be set *before* calling `ReadImportFile()`, `Import()`, or `Export()`; otherwise, behavior is undefined.
- `OnSetActive(bool)` must be called to switch between import/export modes before invoking import/export operations.
- `Unset()` is expected to be called during view lifecycle teardown (e.g., view disposal), though exact semantics are not specified beyond resetting state.
### 4. Dependencies
- **Depends on:**
- `DTS.Common.Base` (specifically `IBaseView`, `IBaseViewModel`)
- `System.Collections.ObjectModel` (for `ObservableCollection<T>`)
- **Depended on by (inferred):**
- UI layers (e.g., WPF/WinForms views) implementing `ICustomChannelsView`, `ICustomChannelsImportView`, `ICustomChannelsExportView`.
- View-model implementations (e.g., concrete `ICustomChannelsViewModel` classes) that consume file I/O, channel parsing, and export logic.
- Likely used by a higher-level controller or shell module that orchestrates custom channel workflows.
### 5. Gotchas
- **No file format specification**: The interfaces do not define the expected format for import/export files—implementation details (e.g., CSV, XML, JSON) are not visible here.
- **Ambiguous `ReadImportFile()` semantics**: Does it *replace* `AllCustomChannels`, *append*, or *merge*? The interface does not clarify.
- **No error handling in interface**: Methods like `Import()`, `Export()`, and `ReadImportFile()` have no declared exception behavior—consumers must infer or document error paths separately.
- **`Unset()` is underspecified**: Its purpose (e.g., nulling view references, clearing collections) is not defined.
- **No validation on `Name` or `Included`**: No constraints on `Name` (e.g., null/empty rules) or `Included` default value are specified.
- **No thread-safety guarantees**: `ObservableCollection<T>` is not thread-safe; concurrent access (e.g., async import) may require synchronization.
- **None identified from source alone** for file I/O behavior, error handling, and lifecycle management—these require implementation context.

View File

@@ -0,0 +1,47 @@
---
source_files:
- Common/DTS.CommonCore/Interface/CustomerDetails/ICustomerDetailsView.cs
- Common/DTS.CommonCore/Interface/CustomerDetails/ICustomerDetailsViewModel.cs
generated_at: "2026-04-16T02:25:10.730477+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b07af412c78e07b1"
---
# CustomerDetails
## 1. Purpose
This module defines the foundational interfaces for the customer details view layer within the DTS Common Core library. Specifically, it establishes `ICustomerDetailsView` and `ICustomerDetailsViewModel` as contract interfaces that enable separation of concerns between UI presentation (view) and business logic/data binding (view model) in a MVVM (Model-View-ViewModel) architecture. These interfaces extend base abstractions (`IBaseView` and `IBaseViewModel`) to provide type-safe, extensible hooks for customer-specific UI components without prescribing implementation details—allowing platform-specific or feature-specific consumers to implement or consume them consistently.
## 2. Public Interface
- **`ICustomerDetailsView`**
```csharp
public interface ICustomerDetailsView : IBaseView
```
Represents the view layer for customer details UI. It inherits from `IBaseView`, implying it adheres to a common base contract for all views (e.g., lifecycle events, navigation participation, or platform-specific view behaviors), though the exact members of `IBaseView` are not visible in this source. No additional members are declared here.
- **`ICustomerDetailsViewModel`**
```csharp
public interface ICustomerDetailsViewModel : IBaseViewModel
```
Represents the view model layer for customer details. It inherits from `IBaseViewModel`, implying it conforms to a shared base contract for view models (e.g., property change notification, command handling, or state management), though the concrete members of `IBaseViewModel` are not visible here. No additional members are declared here.
## 3. Invariants
- Both interfaces are *marker interfaces*—they carry no explicit members and serve only to categorize types within the type hierarchy.
- `ICustomerDetailsView` must be implemented by types that serve as the *view* for customer details functionality.
- `ICustomerDetailsViewModel` must be implemented by types that serve as the *view model* for customer details functionality.
- Neither interface defines runtime guarantees beyond those inherited from `IBaseView`/`IBaseViewModel`. Any invariants (e.g., thread-safety, initialization order, data validity) are assumed to be defined in the base interfaces or by consumers of these interfaces.
## 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Base` namespace (specifically `IBaseView` and `IBaseViewModel`), implying a shared base layer for UI abstractions.
- **Consumers (inferred)**:
- Any UI module or platform-specific project (e.g., WPF, MAUI, or Blazor) implementing or consuming customer details UI components.
- Dependency injection containers or navigation frameworks that rely on these interfaces to resolve or bind view/view model pairs.
- **No external dependencies** (e.g., no third-party libraries, database, or service references) are declared in this source.
## 5. Gotchas
- **Ambiguity in base contracts**: Since `IBaseView` and `IBaseViewModel` are not defined in this source, their exact contract (methods, events, properties) is unknown. This may lead to confusion if consumers assume behaviors not present in the base interfaces.
- **No explicit data contract**: Neither interface exposes properties (e.g., `Customer`, `IsLoading`) or commands (e.g., `SaveCommand`), so consumers must rely on implementation details or additional interfaces to define customer-specific data. This could indicate incomplete design or intentional minimalism for extensibility.
- **Namespace co-location**: Both interfaces reside in `DTS.Common.Interface`, but the lack of a dedicated `CustomerDetails` sub-namespace for implementations (e.g., `DTS.Common.Interface.CustomerDetails`) may cause naming collisions or unclear ownership if more view/view model pairs are added later.
- **None identified from source alone** regarding behavioral quirks, deprecations, or anti-patterns—only structural observations.

View File

@@ -0,0 +1,294 @@
---
source_files:
- Common/DTS.CommonCore/Interface/DASFactory/IAutoArmed.cs
- Common/DTS.CommonCore/Interface/DASFactory/ITiltSensorCalAware.cs
- Common/DTS.CommonCore/Interface/DASFactory/IRangeBandwidthLimited.cs
- Common/DTS.CommonCore/Interface/DASFactory/IAutoArmStatus.cs
- Common/DTS.CommonCore/Interface/DASFactory/ITimeSynchronization.cs
- Common/DTS.CommonCore/Interface/DASFactory/IConnectedEthernetDevice.cs
- Common/DTS.CommonCore/Interface/DASFactory/IDASConfigurationArg.cs
- Common/DTS.CommonCore/Interface/DASFactory/IRealtime.cs
- Common/DTS.CommonCore/Interface/DASFactory/IUDPQATSEntry.cs
- Common/DTS.CommonCore/Interface/DASFactory/IDASFactory.cs
- Common/DTS.CommonCore/Interface/DASFactory/ICommunication.cs
- Common/DTS.CommonCore/Interface/DASFactory/IDiscoveredDevice.cs
- Common/DTS.CommonCore/Interface/DASFactory/IAnalogInputDASChannel.cs
- Common/DTS.CommonCore/Interface/DASFactory/IDASCommunication.cs
generated_at: "2026-04-16T02:25:03.434505+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5d1420792c49604c"
---
# DASFactory Interface Documentation
## 1. Purpose
This module defines a set of C# interfaces that collectively represent the contract for interacting with Data Acquisition Systems (DAS) in the DASFactory subsystem. These interfaces abstract hardware-specific behaviors—such as configuration, diagnostics, real-time data streaming, arming, time synchronization, and communication transport—into a unified API layer. They enable decoupling of core business logic from hardware implementation details, supporting multiple DAS device types (e.g., SLICE, TDAS, g5, S6) and facilitating operations like device discovery, configuration, diagnostics, and data acquisition. The interfaces are designed to be consumed by higher-level services (e.g., `ConfigurationService`, `DiagnosticsService`, `DownloadService`) and are central to the factory pattern used for device management.
## 2. Public Interface
### Interfaces (No implementation classes provided; only interface definitions)
#### `IAutoArmed`
- **Property**: `bool AutoArmed { get; set; }`
Indicates whether the DAS unit is currently in an auto-armed state.
#### `ITiltSensorCalAware`
- **Property**: `double[] TiltSensorCals { get; }`
Provides calibration coefficients for tilt sensors (e.g., for converting raw ADC values to degrees).
#### `IRangeBandwidthLimited`
- **Property**: `bool RangeBandwidthLimited { get; }`
Indicates whether the DAS units analog input range is constrained by bandwidth limitations.
#### `IAutoArmStatus`
- **Property**: `DFConstantsAndEnums.CommandStatus AutoArmStatus { get; set; }`
Represents the current status of the auto-arm command (e.g., pending, success, failure).
#### `ITimeSynchronization`
- **Property**: `bool SupportsTimeSynchronization { get; }`
Indicates whether the device supports time synchronization.
- **Property**: `DateTime SystemBaseTime { get; }`
Returns the base system time used for time-synchronized acquisition.
#### `IConnectedEthernetDevice`
- **Property**: `string MACAddress { get; }`
MAC address of the connected Ethernet device.
- **Property**: `int Port { get; }`
Port number on the parent device (e.g., SLICE6DB) to which this device is connected.
- **Property**: `string SerialNumber { get; set; }`
Serial number of the connected Ethernet device.
#### `IDASConfigurationArg`
- **Property**: `IDASCommunication DAS { get; }`
Reference to the DAS unit being configured.
- **Property**: `bool BlankConfigurationRead { get; }`
Indicates whether the configuration was read from a blank (uninitialized) configuration storage.
- **Property**: `bool ConfigurationFailedValidation { get; }`
Indicates whether the configuration failed validation during a configuration event.
#### `IRealTime`
- **Property**: `List<int> RealtimeDASChannels { get; set; }`
List of channel indices from which real-time data is streamed.
- **Property**: `List<double> TiltAxisData { get; set; }`
Tilt sensor axis data (X, Y, Z) in degrees for Slice6.
- **Property**: `string UDPStreamAddress { get; }`
UDP stream address for Slice6/Slice6A real-time data.
#### `IUDPQATSEntry`
- **Properties**:
- `string ResponseHostMac`, `ResponseClientMacAddress`, `SerialNumber`
- `byte ArmState`, `ArmMode`, `Started`, `Triggered`, `FaultFlags`, `LegacyFaultFlags`
- `uint SampleRate`, `ulong TotalSamples`, `CurrentSample`, `EventNumber`, `FaultSampleNumber`
- `ulong EventTriggerSample`, `EstimateMaxSamples`
- `short TiltSensorCh1`, `TiltSensorCh2`, `TiltSensorCh3`
- `float InputVoltage`, `BackupVoltage`, `BatterySOC`, `SysTempC`
- `byte SyncClockEnable`, `ADCExtClockSyncEnable`, `SyncClockStatus`, `ADCExtClockSyncStatus`
- `float[] ChannelOffsetMV`, `ShuntDeviationPercent`
- `DateTime Timestamp`
Encapsulates a single UDP packets worth of QATS (Quick Arm/Trigger Status) telemetry data from a DAS unit.
#### `IDASFactory`
- **Properties**:
- `bool AllowSDBCommandPort { get; set; }`
- `double S6ConnectNewTimeout { get; set; }`
- `string[] SliceDBHostNames { get; set; }`
- `string[] TDASHostNames { get; set; }`
- `string[] TDASSerialPortNames { get; set; }`
- `string TDASSerialRackSerialNumber { get; set; }`
- `int MultiCastAutoDiscoveryDefaultTimeoutMS { get; set; }`
- `string Language { get; set; }`
- **Methods**:
- `bool PingAll()`
- `void TakeOwnership()`
- `string[] GetConnectedDevices()`
- `List<IDASCommunication> GetDASList()`
- `List<IDASCommunication> GetSortedDASList()`
- `List<ICommunication> GetDevList()`
- `void DetachAllDevices(bool detachUSB = false)`
- `void Refresh(ActionCompleteDelegate action)`
- `SortableBindingList<IDiscoveredDevice> AutoDiscoverMulticast(bool discoverParents = true)`
#### `ICommunication`
- **Properties**:
- `IConnection Transport { get; set; }`
- `int ReceiveBufferSize { get; set; }`
- `string SerialNumber { get; set; }`
- `string FirmwareVersion { get; set; }`
- `byte ProtocolVersion { get; set; }`
- `ICommunication_DASInfo DASInfo { get; set; }`
- `Dictionary<DFConstantsAndEnums.ProtocolLimitedCommands, byte> MinimumProtocols { get; set; }`
- `bool ExecuteIsBusy { get; set; }`
- `string ConnectString { get; }`
- `bool Connected { get; }`
- **Methods**:
- `void SetupReader()`
- `void InitMinProto()`
- `bool IsCommandSupported(ProtocolLimitedCommands command)`
- `byte GetMinProto(ProtocolLimitedCommands command)`
- `void Connect(string ConnectString, CommunicationCallback Callback, object CallbackObject, int CallbackTimeout, string ipAddress)`
- `void Disconnect(bool reuseSocket, CommunicationCallback Callback, object CallbackObject, int CallbackTimeout)`
- `void Close(int Timeout)`
- `void Flush(int Timeout)`
- `void Execute(byte[] byteData, CommunicationCallback Callback, object CallbackObject, int CallbackTimeout)`
- `void PseudoExecute(byte[] byteData, CommunicationCallback Callback, object CallbackObject, int CallbackTimeout)`
- `byte[] SyncExecute(byte[] byteData, int Timeout)`
- `void Cancel()`, `ForceCancel()`, `IsCanceled()`, `ClearCancel()`
- `ManualResetEvent CancelEvent { get; }`
- **Events**:
- `event EventHandler OnDisconnected`
#### `IDiscoveredDevice`
- **Properties**:
- `string Serial { get; set; }`
- `MultiCastDeviceClasses DevClass { get; set; }`
- `string Mac { get; set; }`
- `IDiscoveredDevice Parent { get; set; }`
- `bool IsModule { get; set; }`
- `int Port { get; set; }`
- `int PositionOnDistributor { get; set; }`
- `int PositionOnChain { get; set; }`
- `bool Dhcp { get; set; }`
- `string Ip`, `Subnet`, `Gateway`, `Dns`
- `bool Connected { get; set; }`
- `string ConnectedIp`, `ConnectedHost`
- `ushort SystemId`, `string Location`
- `string FirmwareVersion`, `BuildId`
- `IConnectedEthernetDevice[] Connections { get; set; }`
- **Methods**:
- `bool IsParent(IDiscoveredDevice possibleChild)`
- `int GetPort(IDiscoveredDevice device)`
- `int GetSlot(IDiscoveredDevice child, Dictionary<string, IDiscoveredDevice> lookup)`
- `int GetSlotOnPort(IDiscoveredDevice child, Dictionary<string, IDiscoveredDevice> lookup)`
#### `IAnalogInputDASChannel`
- **Properties**:
- `SensorConstants.BridgeType TypeOfBridge { get; set; }`
- `SensorConstants.BridgeType[] SupportedBridges { get; set; }`
- `DigitalInputModes[] SupportedDigitalInputModes { get; set; }`
- `SensorConstants.CouplingModes CouplingMode { get; set; }`
- `double BridgeResistanceOhms { get; set; }`
- `double ZeroPoint { get; set; }`
- `double SensorCapacityEU`, `SensorCapacity { get; set; }`
- `string SensorPolarity { get; set; }`
- `double DesiredRangeWithHeadroomEU { get; set; }`
- `double SensitivityMilliVoltsPerEU { get; set; }`
- `double SensitivityMilliVoltsPerEUNormalized { get; }`
- `bool IsProportionalToExcitation { get; set; }`
- `bool IsSupported(ExcitationVoltageOptions.ExcitationVoltageOption o)`
- `bool IsInverted { get; set; }`
- `string OriginalChannelName`, `ChannelName2 { get; set; }`
- `string ChannelId`, `ChannelGroupName { get; set; }`
- `string HardwareChannelName { get; set; }`
- `string DIUnits { get; set; }`
- `DigitalInputModes DigitalMode { get; set; }`
- `LinearizationFormula LinearizationFormula { get; set; }`
- `ExcitationVoltageOptions.ExcitationVoltageOption Excitation { get; set; }`
- `ExcitationVoltageOptions.ExcitationVoltageOption[] SupportedExcitation { get; set; }`
- `string EngineeringUnits { get; set; }`
- `string SerialNumber`, `Manufacturer`, `Model`, `Description { get; set; }`
- `ZeroMethodType ZeroMethod { get; set; }`
- `double ZeroAverageStartSeconds`, `ZeroAverageStopSeconds { get; set; }`
- `double InitialEU { get; set; }`
- `string InitialOffset { get; set; }`
- `bool Unipolar { get; set; }`
- `bool ShuntIsEnabled { get; set; }`
- `short ZeromVInADC { get; set; }`
- `bool VoltageInsertionCheckEnabled { get; set; }`
- `bool IEPEChannel`, `DigitalInputChannel`, `CalSignalIsEnabled { get; set; }`
- `bool RemoveOffset`, `VerifyOffset { get; set; }`
- `double OffsetToleranceLowMilliVolts`, `OffsetToleranceHighMilliVolts { get; set; }`
- `DateTime LastCalibrationDate`, `CalDueDate { get; set; }`
- `string ISOCode { get; set; }`
- `bool BypassAAFilter { get; set; }`
- `string SensorID { get; set; }`
- `IDiagnosticResult Diagnostics { get; }`
- `bool UpdateChannelFromDatabase { get; set; }`
- `double? TriggerBelowThresholdEu`, `TriggerAboveThresholdEu { get; set; }`
- `bool AlreadyLevelTriggered { get; set; }`
- `double MeasuredEULevelTriggerCheck { get; set; }`
- `double SoftwareFilterFrequency { get; set; }`
- `IFilterClass SoftwareFilterClass { get; set; }`
- `IDiagnosticResult DiagnosticInformation { get; }`
- `double? MeasuredExcitationVolts`, `FactoryExcitationVolts { get; }`
- `double ScalefactorMilliVoltsPerADC`, `ScalefactorEngineeringUnitsPerADC { get; set; }`
- `double NoiseAsPercentOfFullScale { get; set; }`
- `double UnsupersampledSampleRate { get; set; }`
- `bool IsConfigured()`
- **Methods**:
- `void WriteElementEnd(XmlWriter writer)`
- `void WriteXml(XmlWriter writer)`
- `string GetSupportedExcitationSerialized()`
- `string GetSupportedDigitalInputModesSerialized()`
- `string GetSupportedBridgesSerialized()`
- `void WriteXmlCRC32(XmlWriter writer)`
#### `IDASCommunication`
- **Inherits from**: `IConfiguration`, `IDiagnos`, `ITriggerCheck`, `IRealTime`, `IArmStatus`, `IDownload`, `IInformation`, `IAutoArmStatus`, `IAutoArmed`, `IRangeBandwidthLimited`, `ITimeSynchronization`
- **Properties**:
- `ExcitationStatus ExcitationStatus { get; set; }`
- `DateTime? FirstUseDate { get; set; }`
- `bool IsFirstUseDateSupported { get; set; }`
- `bool IsStreamingSupported { get; set; }`
- `bool DiagnosticsHasBeenRun { get; set; }`
- `bool ConfigureHasBeenRun { get; set; }`
- `int RecordId { get; set; }`
- `float InputLowVoltage`, `InputMediumVoltage`, `InputHighVoltage`
- `float BatteryLowVoltage`, `BatteryMediumVoltage`, `BatteryHighVoltage`
- `double MinimumValidInputVoltage`, `MaximumValidInputVoltage`
- `double MinimumValidBatteryVoltage`, `MaximumValidBatteryVoltage`
- `string SerialNumber { get; set; }`
- `string FirmwareVersion { get; }`
- `int MaxModules { get; set; }`
- `bool InvertTrigger { set; }`
- `bool InvertStart { get; set; }`
- `bool IgnoreShortedStart`, `IgnoreShortedTrigger { get; set; }`
- `string MACAddress { get; set; }`
- `string[] DownstreamMACAddresses { get; set; }`
- `bool SupportsIndividualChannelRealtimeStreaming { get; }`
- **Methods**:
- `void ReadFirstUseDate()`
- `void SetIsStreamingSupported(bool supported = false)`
- `bool ConnectionCheck()`
- `HardwareTypes GetHardwareType()`
- `double[] GetNominalRanges(SensorConstants.BridgeType bridge)`
- `int NumberOfConfiguredChannels()`
- `int NumberOfChannels()`
- `long MaxMemory()`
- `uint MinSampleRate()`
- `uint MaxSampleRate(int numberOfConfiguredChannels)`
- `uint MaxAAFilterRate()`
- `bool SupportsAutoArm()`
- `bool SupportsLevelTrigger()`
- `bool SupportsRealtime()`
- `bool SupportsMultipleEvents()`
- `bool SupportsTriggerInversion()`
- `bool SupportsStartInversion()`
- `bool SupportsHardwareInputCheck()`
- `bool SupportsMultipleSampleRealtime()`
- `bool ControlsDAQ()`
- `bool CheckAAF(float rate)`
- `bool RequireDiagnosticRateMatchSampleRate()`
- `ulong GetPhaseShiftSamples(uint ModuleIndex, double ActualSampleRate, uint HardwareAAF, ulong originalT0)`
- `bool IsEthernetDistributor()`
- `bool GetCanCheckArmStatus()`
- `bool IsSlice6Distributor()`
- `bool IsBattery()`
- `bool IsTSRAIR()`
- `bool IsSlice6Air()`
## 3. Invariants
- **`IDASCommunication`** must implement all inherited interfaces (`IConfiguration`, `IDiagnos`, `ITriggerCheck`, `IRealTime`, `IArmStatus`, `IDownload`, `IInformation`, `IAutoArmStatus`, `IAutoArmed`, `IRangeBandwidthLimited`, `ITimeSynchronization`).
- **`ICommunication`** must support `ConnectString`-based connection establishment and `Execute`/`SyncExecute` for command dispatch.
- **`ICommunication.CancelEvent`** is a `ManualResetEvent` that signals cancellation state; `Cancel()` and `ForceCancel()` must set this event.
- **`IDiscoveredDevice`** must accurately reflect physical topology (e.g., `Port`, `PositionOnChain`, `PositionOnDistributor`) for hierarchical devices like SLICE6DB.
- **`IAnalogInputDASChannel`** must ensure `IsConfigured()` returns `true` only if `SerialNumber` is non-null/non-empty.
- **`IDASCommunication`** must expose `FirmwareVersion` as read-only, while `SerialNumber` is read-write.
- **`ITimeSynchronization.SystemBaseTime`** must be valid only if `SupportsTimeSynchronization` is `true`.
- **`IUDPQATSEntry.Timestamp`** must represent the time the UDP packet was received or generated (implementation-dependent but must be non-null).
- **`IDASFactory.Refresh(...)`** must update `GetDASList()` to reflect current hardware state before invoking the `action` callback.
## 4. Dependencies
- **External Dependencies**:
- `DTS.Common.Enums.*` (e.g., `DFConstantsAndEnums`, `CommunicationConstantsAndEnums`, `HardwareTypes`, `SensorConstants`, `DigitalInputModes`, `ZeroMethodType`, `ExcitationVoltageOptions`)
- `DTS.Common.Interface.*` (e.g., `IConnection`, `ICommunication_DASInfo`, `IDiagnosticResult`, `IFilter

View File

@@ -0,0 +1,105 @@
---
source_files:
- Common/DTS.CommonCore/Interface/DASFactory/ARM/IArmStatus.cs
- Common/DTS.CommonCore/Interface/DASFactory/ARM/IArmStatusData.cs
generated_at: "2026-04-16T02:36:19.293285+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cab749a0c8a2b813"
---
# ARM
## Documentation: `IArmStatus` and `IArmStatusData` Interfaces
---
### 1. **Purpose**
This module defines the contract for tracking and managing the operational state of a DAS (Data Acquisition System) unit within the DASFactory ARM (Armed) subsystem. It provides a state abstraction layer—*not* a direct hardware interface—by exposing flags and metadata about the units current mode (e.g., Arm, Realtime, Streaming), trigger status, fault conditions, and recording progress. The interfaces enable consistent state reporting and propagation (including optional persistence to a database) across higher-level components (e.g., test sequencers, UI, diagnostics), decoupling state logic from hardware-specific implementations.
---
### 2. **Public Interface**
#### `IArmStatus` Interface
| Member | Signature | Behavior |
|--------|-----------|----------|
| `SetInArm` | `void SetInArm(bool WriteToDb)` | Marks the unit as being in *Arm* mode. If `WriteToDb` is `true`, persists the state change to the database. |
| `SetInRealtime` | `void SetInRealtime(bool WriteToDb, bool ExitRealtimeIfPossible)` | Marks the unit as being in *Realtime* mode. If `WriteToDb` is `true`, persists the state change. If `ExitRealtimeIfPossible` is `true`, may transition out of Realtime if conditions allow (e.g., post-test). |
| `GetIsInArm` | `bool GetIsInArm()` | Returns `true` if the units *Arm* flag is set (based on internal state, *not* hardware query). |
| `GetIsInRealtime` | `bool GetIsInRealtime()` | Returns `true` if the units *Realtime* flag is set (based on internal state, *not* hardware query). |
| `GetIsStreaming` | `bool GetIsStreaming()` | Returns `true` if the unit is known to be *streaming* (based on internal state, *not* hardware query). |
| `DASArmStatus` | `IArmStatusData DASArmStatus { get; set; }` | Gets or sets the current `IArmStatusData` instance holding detailed status fields. |
| `SetDASArmStatus` (overload 1) | `void SetDASArmStatus(IArmStatusData status, bool bSetInDb)` | Replaces the current `DASArmStatus` with `status`. If `bSetInDb` is `true`, persists the new status to the database. |
| `SetDASArmStatus` (overload 2) | `void SetDASArmStatus()` | Persists the *current* `DASArmStatus` to the database (if connected). Does *not* modify the in-memory status object. |
#### `IArmStatusData` Interface
| Member | Type | Description |
|--------|------|-------------|
| `ReceivedInvalidModeDuringSetup` | `bool` | `true` if the unit received an `InvalidMode` error during initial setup (used as a heuristic to infer streaming state in some code paths). |
| `ClearTriggerCheckStatus()` | `void` | Clears flags related to trigger checks (e.g., `IsTriggerShorted`, `IsStartShorted`). |
| `IsArmed` | `bool` | Whether the DAS is currently armed. |
| `IsTriggered` | `bool` | Whether the DAS has sensed a trigger (set in many contexts, not limited to trigger checks). |
| `IsTriggerShorted` | `bool` | Whether the trigger was shorted *during a trigger check*. Distinct from `IsTriggered`. |
| `IsStartShorted` | `bool` | Whether the start signal was shorted *during a trigger check*. Only set during trigger checks. |
| `IsRecording` | `bool` | Whether the DAS is currently recording sample data. |
| `IsFaulted` | `bool` | Whether the DAS has faulted. |
| `IsInRealtime` | `bool` | Whether the DAS is in real-time mode. |
| `IsInFlashWrite` | `bool` | Whether the DAS is in flash write mode (G5). |
| `IsUndefined` | `bool` | Used when `TDAS ARM STAT READ` returns no data (fallback state). |
| `IsInPostTestDiagnostics` | `bool` | Whether the DAS is in post-test diagnostics. |
| `TimeRemainingSeconds` | `double` | Estimated seconds remaining in recording. |
| `PercentComplete` | `double` | Percentage complete for flash write operations. |
| `TotalSamples` | `ulong` | Total number of samples to be recorded in the current test. |
| `CurrentSample` | `ulong` | Current sample index being recorded. |
| `SampleRate` | `uint` | Current sample rate (samples/sec). |
| `InputMilliVolts` | `double?` | Current input voltage (mV), or `null` if unavailable. |
| `BatteryMilliVolts` | `double?` | Current battery voltage (mV), or `null` if no battery present. |
| `EventNumber` | `int?` | Current event number being recorded, or `null` if none. |
| `MaxEventsPossible` | `ushort?` | Maximum number of events supported by the device (per issue FB 26817). |
| `RecordingMode` | `int` | Numeric recording mode identifier (semantic meaning not documented in interface). |
| `FaultMessage` | `string` | Optional human-readable fault description (e.g., for software-detected faults). |
| `IsRearming` | `bool` | Whether the DAS is currently rearming. |
| `HasBeenRecording` | `bool` | Whether the DAS has ever recorded in the current session. |
| `TimeLeftInArm` | `double?` | Estimated time remaining in the *Arm* state (seconds), or `null`. |
---
### 3. **Invariants**
- **State Flags Are Software-Only**: Methods like `GetIsInArm()`, `GetIsInRealtime()`, and `GetIsStreaming()` return *software-tracked flags* only. They do *not* query hardware directly.
- **`DASArmStatus` Is Mutable and Optional to Persist**: The `DASArmStatus` property can be replaced or updated, and persistence to the database is *explicitly opt-in* via `WriteToDb`/`bSetInDb` parameters.
- **Trigger Check Flags Are Scoped**: `IsTriggerShorted` and `IsStartShorted` are *only* set during trigger checks and must be cleared via `ClearTriggerCheckStatus()` to avoid stale state.
- **`ReceivedInvalidModeDuringSetup` Is a Heuristic**: This flag is used as a proxy for streaming state in some legacy code paths (see *Gotchas*), but is not a definitive indicator.
- **Nullable Fields May Be Uninitialized**: All `double?`, `int?`, and `ushort?` properties may be `null` if the corresponding data is unavailable or not yet computed.
---
### 4. **Dependencies**
- **Depends On**:
- `DTS.Common.Interface.DASFactory.ARM` namespace (inferred from `namespace` declaration).
- Likely depends on database connectivity (via `WriteToDb`/`bSetInDb` parameters implying a persistence layer).
- Likely depends on hardware communication layers (e.g., `TDAS ARM STAT READ` mentioned in `IsUndefined` comment), though not directly visible here.
- **Depended On By**:
- Any component managing DAS state transitions (e.g., test sequencers, ARM state machines).
- UI components displaying DAS status.
- Diagnostics or logging modules that consume `IArmStatusData` for telemetry.
- Hardware abstraction layers (implementations of `IArmStatus`).
---
### 5. **Gotchas**
- **`IsTriggered` vs. `IsTriggerShorted`**: `IsTriggered` is set broadly (e.g., after any trigger event), while `IsTriggerShorted` is *exclusively* set during trigger checks. Confusing these may lead to incorrect logic (e.g., assuming a physical trigger occurred when only a short was simulated).
- **`ReceivedInvalidModeDuringSetup` as Streaming Proxy**: This flag is explicitly used *in some places* to infer streaming state when direct indicators (e.g., `IsRecording`) are unavailable. Relying on this heuristic outside its intended scope may cause incorrect behavior.
- **`IsUndefined` Is a Fallback State**: When `TDAS ARM STAT READ` returns no data, `IsUndefined` should be set—but implementations may not consistently handle this case.
- **`SetDASArmStatus()` Overload Ambiguity**: The parameterless `SetDASArmStatus()` persists the *current* in-memory status but does *not* update it. This may cause stale data to be persisted if the in-memory object was modified after the last explicit `SetDASArmStatus(status, ...)` call.
- **`TimeLeftInArm` Semantics Unclear**: The meaning of `TimeLeftInArm` (e.g., time until disarm, time until test end) is not documented. Its relationship to `TimeRemainingSeconds` is ambiguous.
- **`RecordingMode` Is Undocumented**: The integer value of `RecordingMode` has no documented mapping (e.g., enum or constants), making interpretation difficult without external context.
*None identified from source alone.*

View File

@@ -0,0 +1,190 @@
---
source_files:
- Common/DTS.CommonCore/Interface/DASFactory/Config/IEID.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IVoltageInsertionEnabled.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IInformation.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IConfigurationData.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IConfiguration.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IInfoResultModule.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IDASChannel.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IInfoResult.cs
- Common/DTS.CommonCore/Interface/DASFactory/Config/IDASModule.cs
generated_at: "2026-04-16T02:35:36.435465+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "126041a8d3394f8b"
---
# DAS Factory Configuration Interfaces Documentation
## 1. Purpose
This module defines a set of core interfaces that establish the contract for configuration, metadata, and state management within the DAS (Data Acquisition System) factory framework. It provides abstractions for representing hardware configuration (`IConfiguration`, `IConfigurationData`), module/channel metadata (`IDASModule`, `IDASChannel`, `IInfoResult`, `IInfoResultModule`), identification (`IEID`), voltage insertion status (`IVoltageInsertionEnabled`), and serialization support. These interfaces decouple configuration logic from concrete implementations, enabling flexible hardware interaction, test setup management, and UI display ordering—particularly critical for multi-DAS, multi-channel systems where precise channel/module mapping and ordering are required.
## 2. Public Interface
### `IEID`
- `string ID { get; set; }` Identifier string for the EID (e.g., serial, UUID).
- `byte[] Blob { get; set; }` Binary payload associated with the EID.
- `bool IsValid()` Returns `true` if the EID data is considered valid.
### `IVoltageInsertionEnabled`
- `bool VoltageInsertionEnabled { get; }` Indicates whether voltage insertion was detected as enabled on the hardware (see internal case 34284).
### `IInformation`
- `IInfoResult DASInfo { get; set; }` Gets or sets the hardware-derived information object.
- `void SetDASInfo(IInfoResult dasInfo, bool bSetInDb = true)` Sets `DASInfo`, optionally persisting to a database.
- `void SetDASInfo()` Overload that sets `DASInfo` with default persistence (`bSetInDb = true`).
### `IConfigurationData`
- `IDASModule[] Modules { get; set; }` Array of modules in the DAS.
- `IEID[] IDs { get; set; }` Array of EIDs for the entire DAS.
- `string TestID { get; set; }` Current test/event identifier.
- `string TestSetupUniqueId { get; set; }` Unique identifier for the test setup.
- `string Description { get; set; }` Human-readable description of the test/event.
- `bool ClearSetup { get; set; }` Flag indicating whether to clear existing setup.
- `int NumberOfConfiguredChannels()` Returns count of channels where `IsConfigured()` is `true`.
- `int NumberOfChannels()` Returns total number of channels (configured or not).
- `int NumberOfDownloadChannels()` Returns count of downloadable channels (excludes UART/StreamOut).
- `int[] DisplayOrder { get; set; }` Channel display order array.
- `int DasDisplayOrder { get; set; }` DAS-level display order.
- `int GetDisplayOrder(uint channelIdx)` Returns display order for a given channel index.
- `string UDPReceiveAddress { get; set; }` UDP address for OBR-DDR control.
- `void WriteXml(XmlWriter writer)` Serializes configuration to XML.
- `void ReadXml(XmlReader reader)` Deserializes configuration from XML.
- `XmlSchema GetSchema()` Returns XML schema for validation.
### `IConfiguration`
- `string TestDirectory { get; set; }` Path on PC where test data is stored.
- `bool SupportsAutoDetect { get; }` Indicates support for auto-detecting channel type (bridge/IEPE).
- `void QueryConnectedDevices()` Queries hardware for connected devices.
- `IConfigurationData ConfigData { get; set; }` Pre-test configuration data (updated by `ConfigurationService.Configure(...)`).
- `ClockSyncProfile DASClockSyncProfile { get; set; }` Clock synchronization profile (updated on configure, applied only to compatible units).
- `int GetDASDisplayOrder()` Returns DAS display order (default `-1`).
- `int[] GetChannelDisplayOrder()` Returns channel display order array.
- `void SetDASDisplayOrder(int order)` Sets DAS display order (intended for use by FWTU only).
- `void SetChannelDisplayOrder(int[] order)` Sets channel display order (intended for use by FWTU only).
### `IInfoResultModule`
- `string SerialNumber { get; set; }` Module serial number.
- `string FirmwareVersion { get; set; }` Firmware version string.
- `int ModuleArrayIndex { get; set; }` Index in the module array.
- `uint NumberOfChannels { get; set; }` Number of channels on this module.
- `uint[] SupportedSampleRates { get; set; }` Supported sample rates (Hz).
- `Dictionary<uint, float> SampleRate2AAFrequency { get; set; }` Mapping of sample rate to anti-aliasing filter frequency.
- `ulong? MaxEventStorageSpaceInBytes { get; set; }` Max storage per module (null if DAS-level).
- `uint? NumberOfBytesPerSampleClock { get; set; }` Bytes per sample per module (null if DAS-level).
- `double MaxRecordingSamples { get; set; }` Max samples this module can record.
- `DateTime? CalibrationDate { get; set; }` Last calibration date (null if invalid/NA).
- `bool RackIsUnreadable { get; set; }` `true` if TDAS rack is armed and unresponsive.
- `DFConstantsAndEnums.ModuleType TypeOfModule { get; set; }` Module type.
- `DFConstantsAndEnums.RecordingMode[] SupportedModes { get; set; }` Supported recording modes.
- `bool IsProgrammable { get; set; }` Indicates if module is programmable.
### `IDASChannel`
- `DFConstantsAndEnums.ConfigMode ConfigurationMode { get; set; }` Configuration mode.
- `bool DiagnosticsMode { get; set; }` Whether channel is in diagnostics mode.
- `int ModuleChannelNumber { get; set; }` Channel index within its module.
- `int AbsoluteDisplayOrder { get; set; }` Global display order.
- `double UnitConverision { get; set; }` Unit conversion factor (note: typo in property name).
- `bool AtCapacity { get; set; }` Whether channel is at capacity.
- `double CapacityOutputIsBasedOn { get; set; }` Output value capacity is based on.
- `SensorConstants.SensUnits SensitivityUnits { get; set; }` Sensitivity units.
- `byte Number { get; }` DAS-wide channel number (0-based).
- `IEID[] IDs { get; set; }` EIDs associated with this channel.
- `DateTime EventStartTime { get; set; }` Timestamp of event start.
- `bool LevelTriggerSeen { get; set; }` Whether level trigger was detected.
- `string IsoChannelName { get; set; }`, `string ChannelGroupName { get; set; }`, `string UserCode { get; set; }`, `string UserChannelName { get; set; }`, `string LinearSensorCalibration { get; set; }` User-configurable metadata fields.
- `int QualificationSamples { get; set; }` Number of samples for trigger qualification.
- `int? LevelTriggerT0AdjustmentSamples { get; set; }` Sample shift for time alignment (null if not directly triggered).
- `bool IsConfigured()` Returns `true` if channel is configured (sensor connected + config present).
- `void WriteXml(XmlWriter writer)`, `void ReadXml(XmlReader reader)`, `XmlSchema GetSchema()` XML serialization.
- `int IdType { get; set; }`, `string UserValue1 { get; set; }`, `string UserValue2 { get; set; }`, `string UserValue3 { get; set; }` Extensibility fields.
### `IInfoResult`
- `string MACAddress { get; set; }` MAC address of the DAS.
- `IInfoResultModule[] Modules { get; set; }` Array of modules in the DAS.
- `List<Common.Classes.Hardware.ExternalTilt> ActiveExternalTilts { get; set; }` List of active external tilt sensors.
- `uint MaxNumberOfModules { get; set; }` Max modules supported.
- `ulong? MaxEventStorageSpaceInBytes { get; set; }` DAS-level max storage (null if per-module).
- `uint? NumberOfBytesPerSampleClock { get; set; }` DAS-level bytes per sample (null if per-module).
- `bool? DeviceStreamingOnly { get; set; }` Hardware streaming-only flag (null if unsupported).
- `int NumberOfBridgeChannels { get; set; }` Count of bridge channels (temporary constant).
- `IEID BatteryID { get; set; }` Battery EID.
- `bool HasBattery { get; }` Whether hardware has a battery.
- `byte MapDASChannelNumber2RealtimeChannelNumber(int channelNumber)` Maps DAS channel to real-time channel number.
- `byte MapDASChannelNumber2ModuleArrayIndex(int channelNumber)` Maps DAS channel to module array index.
- `byte MapDASChannelNumber2ModuleDeviceID(int channelNumber)` Maps DAS channel to module device ID (1-based).
- `byte MapDASChannelNumber2ModuleChannelNumber(int channelNumber)` Maps DAS channel to module channel number (0-based).
- `byte MapModuleArrayIndexAndChannelNum2DASChannel(int moduleArrayIdx, int channelNumber)` Inverse mapping.
- `DateTime? CalibrationDate { get; set; }` DAS calibration date (returns `1970-01-01` if invalid/NA).
### `IDASModule`
- `IDASChannel[] Channels { get; set; }` Array of channels, indexed by `ModuleChannelNumber`.
- `IEID[] IDs { get; set; }` Module-level EIDs.
- `int ModuleArrayIndex { get; set; }` Index in module array.
- `double RequestedPreTriggerSeconds { get; set; }`, `double RequestedPostTriggerSeconds { get; set; }` Requested trigger timing.
- `double PreTriggerSeconds { get; set; }`, `double PostTriggerSeconds { get; set; }` Actual trigger timing.
- `int NumberOfEvents { get; set; }` Events to collect before disarming.
- `int WakeUpMotionTimeout { get; set; }` Inactivity timeout before sleep.
- `string FirmwareVersion { get; set; }` Module firmware version.
- `string Description { get; set; }` Module description.
- `ulong? MaxEventStorageSpaceInBytes { get; set; }` Module storage capacity.
- `ulong NumberOfSamples { get; set; }` Samples captured in last run.
- `ulong[] TriggerSampleNumbers { get; set; }` Array of trigger sample numbers.
- `int GetLevelTriggerT0AdjustmentSamplesAutoApplied()` Returns auto-applied T0 adjustment.
- `ulong StartRecordSampleNumber { get; set; }` Sample number where recording started.
- `uint StartRecordTimestampSec`, `uint TriggerTimestampSec`, `uint StartRecordTimestampNanoSec`, `uint TriggerTimestampNanoSec` Timestamps for start/trigger.
- `bool PTPMasterSync { get; set; }` Precision Time Protocol master sync status.
- `double TiltSensorAxisX/Y/ZDegreesPre/Post { get; set; }` Tilt angles before/after event.
- `float TemperatureLocation1/2/3/4Pre/Post { get; set; }` Temperatures before/after event.
- `uint SampleRateHz { get; set; }`, `uint ActualSampleRateHz { get; set; }` Nominal and actual sample rates.
- `float AAFilterRateHz { get; set; }` Anti-aliasing filter rate.
- `DFConstantsAndEnums.RecordingMode RecordingMode { get; set; }` Recording mode.
- `DateTime ScheduledStartTime { get; set; }`, `int RecordingInterval { get; set; }` Scheduling info.
- `UDPStreamProfile StreamProfile { get; set; }` UDP streaming profile.
- `DFConstantsAndEnums.TiltAxes TiltAxes { get; set; }`, `double TargetAxisOne/Two { get; set; }`, `float TargetAngleAxisX/Y/Z { get; set; }`, `double MountOffsetAxisOne/Two { get; set; }`, `string SystemLocation { get; set; }`, `string SystemID { get; set; }`, `int AxisIgnored { get; set; }`, `double LevelTolerance { get; set; }`, `bool UseForTiltCalculation { get; set; }`, `double InputVoltage { get; set; }`, `double BatteryVoltage { get; set; }`, `byte TiltID { get; set; }`, `string TiltSerialNumber { get; set; }` Slice 6 tilt feature fields.
- `int NumberOfConfiguredChannels()`, `int NumberOfConfiguredTOMChannels()` Channel counts.
- `bool IsDummyArmed()` Whether module is dummy-armed.
- `int NumberOfChannels()` Total channel count.
- `string SerialNumber()`, `DFConstantsAndEnums.ModuleType ModuleType()` Metadata getters.
- `bool IsStreamIn()`, `bool IsStreamOut()`, `bool IsUart()`, `bool IsClock()`, `bool IsEmbedded()` Module type checks.
- `void WriteXml(XmlWriter writer)`, `void ReadXml(XmlReader reader)`, `XmlSchema GetSchema()`, `void WriteXmlCRC32(XmlWriter writer)`, `ushort GetCRC32()` Serialization and checksum.
## 3. Invariants
- **Channel numbering**: `IDASChannel.Number` is a DAS-wide 0-based index (0..29). `IDASModule.ModuleArrayIndex` is 0-based (0..9). `IDASChannel.ModuleChannelNumber` is 0-based within a module (0..2). Mapping functions (`Map*`) enforce consistent conversion between these spaces.
- **Configuration state**: A channel is considered *configured* only if `IsConfigured()` returns `true`, which requires both a sensor connection and configuration data populated via `ConfigurationService.Configure(...)`.
- **Display ordering**: `DisplayOrder` (array) and `DasDisplayOrder` (scalar) in `IConfigurationData` control UI rendering order. Default `DasDisplayOrder` is `-1`. Channel display order is managed via `GetChannelDisplayOrder()`/`SetChannelDisplayOrder()`.
- **Storage hierarchy**: Storage capacity (`MaxEventStorageSpaceInBytes`, `NumberOfBytesPerSampleClock`) may be defined at either the DAS or module level (indicated by `null` values).
- **Calibration date**: `IInfoResult.CalibrationDate` and `IInfoResultModule.CalibrationDate` return `DateTime?`. An invalid/NA date is represented as `1970-01-01` (Unix epoch).
- **EID validity**: `IEID.IsValid()` must be called to validate EID data before use; no automatic validation is implied by property access.
## 4. Dependencies
### Dependencies *of* this module (interfaces):
- **`DTS.Common.Enums.DASFactory`**: Used via `DFConstantsAndEnums.ModuleType`, `RecordingMode`, `ConfigMode`, `TiltAxes`.
- **`DTS.Common.Enums.Sensors`**: Used via `SensorConstants.SensUnits`.
- **`System.Xml`**: Required for `XmlWriter`, `XmlReader`, `XmlSchema`.
- **`System.Collections.Generic`**: Required for `Dictionary<uint, float>`, `List<ExternalTilt>`.
- **`System`**: Required for `DateTime`, `byte`, `string`, `double`, `float`, `uint`, `ulong`, `int`, `bool`.
### Dependencies *on* this module:
- **`ConfigurationService`**: Updates `IConfiguration.ConfigData` and `IConfiguration.DASClockSyncProfile` via `Configure(...)` (referenced in `IConfiguration` XML docs).
- **`ClockSyncProfile`**: Used as a property type in `IConfiguration`; assumed to be defined elsewhere.
- **`UDPStreamProfile`**: Used as a property type in `IDASModule`; assumed to be defined elsewhere.
- **`Common.Classes.Hardware.ExternalTilt`**: Used in `IInfoResult.ActiveExternalTilts`; assumed to be defined elsewhere.
- **`DTS.Common.Interface.DASFactory.Config` namespace**: All interfaces co-reside in this namespace and reference each other.
## 5. Gotchas
- **Typo in property name**: `IDASChannel.UnitConverision` is misspelled (should be `UnitConversion`). This is preserved as-is per source.
- **`SetDASInfo` overloads**: `IInformation.SetDASInfo()` has two overloads; the parameterless version defaults `bSetInDb = true`. Ensure callers understand persistence behavior.
- **`NumberOfDownloadChannels` semantics**: Excludes UART and StreamOut modules; does *not* imply channels are active—only that they are of a downloadable type.
- **`IsDummyArmed()`**: Specific to `IDASModule`; behavior and implications are not documented in source—assumed to relate to a test/diagnostic mode.
- **`LevelTriggerT0AdjustmentSamples`**: A nullable `int?` in `IDASChannel`; `null` indicates no direct trigger. In `IInfoResult`, `MapDASChannelNumber2ModuleChannelNumber` assumes valid channel numbers (0..29); out-of-range inputs may cause undefined behavior (not validated in interface).
- **`DeviceStreamingOnly`**: Nullable `bool?`; `null` means the device doesnt support a streaming-only configuration, not that streaming is disabled.
- **`ActualSampleRateHz`**: Comment notes it is currently used only for TSR AIR type hardware (FB 25558); behavior on other hardware is undefined.
- **Display order mutability**: `SetDASDisplayOrder` and `SetChannelDisplayOrder` are documented as “should only be called really from FWTU”—suggesting external tools manage UI ordering, not core logic.
- **`CalibrationDate` invalid representation**: `1970-01-01` is used as a sentinel for invalid dates in `IInfoResult.CalibrationDate`, but `IInfoResultModule.CalibrationDate` is `DateTime?` (nullable), so `null` is the canonical invalid value there. Inconsistent handling.
- **`IDASChannel.Number` is read-only**: Unlike `Module

Some files were not shown because too many files have changed in this diff Show More