init
This commit is contained in:
72
enriched-qwen3-coder-next/Common/DTS.Common/Attributes.md
Normal file
72
enriched-qwen3-coder-next/Common/DTS.Common/Attributes.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Attributes/VersionAttribute.cs
|
||||
- Common/DTS.Common/Attributes/DisplayAttributeEx.cs
|
||||
- Common/DTS.Common/Attributes/DescriptionAttributeEx.cs
|
||||
- Common/DTS.Common/Attributes/ProgrammableTriggerAttributes.cs
|
||||
generated_at: "2026-04-16T02:54:29.459111+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a6c138fea6a5740b"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Attributes Module
|
||||
|
||||
## 1. Purpose
|
||||
This module provides custom .NET attributes for enriching metadata on types and members (especially enums and properties) with versioning, localized display names, localized descriptions, and programmable trigger configuration. It enables consistent internationalization of UI-facing labels and descriptions via string resources, and supports declarative specification of trigger behavior (pre/post) for enum values—primarily used to annotate programmable trigger types in the system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `VersionAttribute`
|
||||
- **Constructor**: `VersionAttribute(int version)`
|
||||
Initializes the attribute with a specified integer version.
|
||||
- **Property**: `int Version { get; }`
|
||||
Returns the version value passed to the constructor.
|
||||
|
||||
### `DisplayAttributeEx`
|
||||
- **Constructor**: `DisplayAttributeEx(string propertyId)`
|
||||
Stores `propertyId` for later lookup in string resources.
|
||||
- **Override**: `override string DisplayName { get; }`
|
||||
Returns the localized display name by looking up `propertyId + "_DisplayName"` in `StringResources.ResourceManager`. If not found, returns `"##DisplayNameNotFound##" + propertyId`.
|
||||
|
||||
### `DescriptionAttributeEx`
|
||||
- **Constructor**: `DescriptionAttributeEx(string propertyId)`
|
||||
Stores `propertyId` for later lookup in string resources.
|
||||
- **Override**: `override string Description { get; }`
|
||||
Returns the localized description by looking up `propertyId + "_Description"` in `StringResources.ResourceManager`. If not found, returns `"##DescriptionNotFound##" + propertyId`.
|
||||
|
||||
### `ProgrammableTriggersAttribute`
|
||||
- **Constructor**: `ProgrammableTriggersAttribute(bool preTrigger, bool postTrigger)`
|
||||
Initializes the attribute with flags indicating whether pre- and post-triggers are programmable.
|
||||
- **Properties**:
|
||||
- `bool PreTrigger { get; set; }`
|
||||
- `bool PostTrigger { get; set; }`
|
||||
- **Static Methods**:
|
||||
- `static bool IsPreTriggerProgrammable(Enum value)`
|
||||
Returns `true` if the `PreTrigger` flag is `true` on the attribute applied to the enum *field* corresponding to `value`; otherwise returns `true` by default (i.e., if no attribute is present).
|
||||
- `static bool IsPostTriggerProgrammable(Enum value)`
|
||||
Returns `true` if the `PostTrigger` flag is `true` on the attribute applied to the enum *field* corresponding to `value`; otherwise returns `true` by default.
|
||||
|
||||
## 3. Invariants
|
||||
- `DisplayAttributeEx` and `DescriptionAttributeEx` require that string resources exist with keys formed as `{propertyId}_DisplayName` and `{propertyId}_Description`, respectively. If missing, fallback strings are returned (not thrown exceptions).
|
||||
- `ProgrammableTriggersAttribute` is only applied to enum *fields* (not enum types themselves) in practice, as its static methods use `value.GetType().GetField(value.ToString())` to retrieve the attribute.
|
||||
- `ProgrammableTriggersAttribute.IsPreTriggerProgrammable` and `IsPostTriggerProgrammable` default to `true` if no attribute is present on the enum field.
|
||||
- All attributes are intended for use on `Class`, `Enum`, `Interface`, `Delegate`, and `Property` targets (per `[AttributeUsage(...)]`).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Internal Dependencies**:
|
||||
- `DTS.Common.SharedResource.Strings.StringResources` (used by `DisplayAttributeEx` and `DescriptionAttributeEx` for localization).
|
||||
- **External Dependencies**:
|
||||
- `System`, `System.ComponentModel`, `System.Linq` (standard .NET libraries).
|
||||
- **Consumers**:
|
||||
- Presumably used throughout the codebase to annotate enums (e.g., trigger types) and properties for localization and metadata.
|
||||
- `ProgrammableTriggersAttribute` is likely used on enum fields to control trigger behavior logic elsewhere (e.g., in trigger configuration or execution modules).
|
||||
|
||||
## 5. Gotchas
|
||||
- **Default behavior in `ProgrammableTriggersAttribute`**: If the attribute is not applied to an enum field, both `IsPreTriggerProgrammable` and `IsPostTriggerProgrammable` return `true`. This may be counterintuitive if the expectation is that absence implies `false`.
|
||||
- **String resource key construction**: Keys are formed by appending `"_DisplayName"` or `"_Description"` to the `propertyId` passed to the constructor. Mismatched naming (e.g., missing underscore or suffix) will cause lookup failure.
|
||||
- **Case sensitivity**: String resource lookup via `ResourceManager.GetString(...)` is case-sensitive; inconsistent casing in `propertyId` will cause fallback strings.
|
||||
- **Typo in justification**: The `SuppressMessage` attributes for `S3376` contain a typo ("extebded" instead of "extended"), but this is cosmetic and does not affect behavior.
|
||||
- **No validation in constructors**: `DisplayAttributeEx` and `DescriptionAttributeEx` accept any `string propertyId` without validation; invalid or malformed IDs will simply fail to resolve at runtime.
|
||||
- **Thread-safety**: Not addressed in source; assumes `StringResources.ResourceManager` is thread-safe (standard for .NET `ResourceManager`).
|
||||
- **Enum field lookup limitation**: `ProgrammableTriggersAttribute.Is*Programmable` methods rely on `value.ToString()` to get the field name, which may fail or misbehave if the enum has `[Flags]` and `value` is a composite (bitwise OR) of multiple enum values.
|
||||
174
enriched-qwen3-coder-next/Common/DTS.Common/Base/Classes.md
Normal file
174
enriched-qwen3-coder-next/Common/DTS.Common/Base/Classes.md
Normal file
@@ -0,0 +1,174 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Base/Classes/BaseUserControl.cs
|
||||
- Common/DTS.Common/Base/Classes/BasePropertyChanged.cs
|
||||
- Common/DTS.Common/Base/Classes/DisplayResourceAttribute.cs
|
||||
- Common/DTS.Common/Base/Classes/DescriptionResourceAttribute.cs
|
||||
- Common/DTS.Common/Base/Classes/DynamicTypeDescriptor.cs
|
||||
generated_at: "2026-04-16T03:27:54.091271+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7d5e0417dd645280"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
### **Purpose**
|
||||
This module provides foundational infrastructure for WPF-based UI components and data binding within the DTS system, specifically enabling property change notification, dynamic property metadata customization, and localized display names/descriptions for properties and enums. It supports two primary patterns: `BaseUserControl` for WPF user controls that require `INotifyPropertyChanged` integration, and `BasePropertyChanged` for non-UI classes needing the same notification capability. Additionally, it offers attribute-based localization via `DisplayResourceAttribute` and `DescriptionResourceAttribute`, which resolve display strings from a centralized resource file (`Strings.Strings`). Finally, `DynamicTypeDescriptor` enables runtime modification of property metadata (e.g., `DisplayName`, `Category`, `ReadOnly`, `Browsable`) for use with `PropertyGrid` controls, particularly to override or extend metadata from sources like Entity Framework where attributes cannot be applied directly.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
|
||||
#### **`BaseUserControl`**
|
||||
- **Namespace**: `DTS.Common.Base.Classes`
|
||||
- **Inherits**: `UserControl`
|
||||
- **Abstract**: Yes
|
||||
- **Constructors**: None (abstract base class)
|
||||
- **Events**:
|
||||
- `event PropertyChangedEventHandler PropertyChanged`
|
||||
- **Methods**:
|
||||
- `protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)`
|
||||
- Sets `storage` to `value` if not equal, raises `PropertyChanged`, and returns `true`; otherwise returns `false`. Used to implement property setters with change notification.
|
||||
- `protected void OnPropertyChanged(string propertyName = null)`
|
||||
- Raises the `PropertyChanged` event with the given property name (or `null` for all properties).
|
||||
|
||||
#### **`BasePropertyChanged`**
|
||||
- **Namespace**: `DTS.Common.Base`
|
||||
- **Implements**: `IBasePropertyChanged` (not shown in source, but referenced)
|
||||
- **Abstract**: Yes
|
||||
- **Constructors**: None (abstract base class)
|
||||
- **Events**:
|
||||
- `public virtual event PropertyChangedEventHandler PropertyChanged`
|
||||
- **Methods**:
|
||||
- `public bool SetProperty<T>(ref T storage, T value, string propertyName = null)`
|
||||
- Same semantics as `BaseUserControl.SetProperty`.
|
||||
- `public virtual void OnPropertyChanged(string propertyName = null)`
|
||||
- Same semantics as `BaseUserControl.OnPropertyChanged`.
|
||||
|
||||
#### **`DisplayResourceAttribute`**
|
||||
- **Namespace**: `DTS.Common.Base.Classes`
|
||||
- **Inherits**: `DisplayNameAttribute`
|
||||
- **Constructors**:
|
||||
- `public DisplayResourceAttribute(string resourceId)`
|
||||
- Stores `resourceId` for later lookup.
|
||||
- **Properties**:
|
||||
- `public override string DisplayName`
|
||||
- Returns the localized string from `Strings.Strings.ResourceManager.GetString(resourceId)`; if not found, returns `"##ResourceNotFound##" + resourceId`.
|
||||
|
||||
#### **`DescriptionResourceAttribute`**
|
||||
- **Namespace**: `DTS.Common.Base.Classes`
|
||||
- **Inherits**: `DescriptionAttribute`
|
||||
- **Constructors**:
|
||||
- `public DescriptionResourceAttribute(string resourceId)`
|
||||
- Stores `resourceId` for later lookup.
|
||||
- **Properties**:
|
||||
- `public override string Description`
|
||||
- Returns the localized string from `Strings.Strings.ResourceManager.GetString(resourceId)`; if not found, returns `"##DescriptionNotFound##" + resourceId`.
|
||||
|
||||
#### **`DynamicTypeDescriptor`**
|
||||
- **Namespace**: `DTS.Common.Base.Classes`
|
||||
- **Implements**: `ICustomTypeDescriptor`, `INotifyPropertyChanged`
|
||||
- **Sealed**: Yes
|
||||
- **Constructors**:
|
||||
- `public DynamicTypeDescriptor(Type type)`
|
||||
- Initializes from a base `type`, preserving original properties, attributes, converters, and editors. Only includes browsable properties.
|
||||
- **Events**:
|
||||
- `public event PropertyChangedEventHandler PropertyChanged`
|
||||
- **Properties**:
|
||||
- `public PropertyDescriptorCollection OriginalProperties { get; }`
|
||||
- `public PropertyDescriptorCollection Properties { get; }`
|
||||
- `public object Component { get; private set; }`
|
||||
- `public string ClassName { get; set; }`
|
||||
- `public string ComponentName { get; set; }`
|
||||
- **Methods**:
|
||||
- `public T GetPropertyValue<T>(string name, T defaultValue)`
|
||||
- Gets the value of property `name` from the `Component`, returning `defaultValue` on failure.
|
||||
- `public void SetPropertyValue(string name, object value)`
|
||||
- Sets the value of property `name` on the `Component`.
|
||||
- `public PropertyDescriptor AddProperty(...)`
|
||||
- Overloads to add a new dynamic property with specified metadata (`displayName`, `description`, `category`, `readOnly`, `hasDefaultValue`, `defaultValue`, `uiTypeEditor`).
|
||||
- `public void RemoveProperty(string name)`
|
||||
- Removes a property by name from `Properties`.
|
||||
- `public void AddProperty(PropertyDescriptor property)`
|
||||
- Adds a pre-constructed `PropertyDescriptor` to `Properties`.
|
||||
- `public DynamicTypeDescriptor FromComponent(object component)`
|
||||
- Creates a new `DynamicTypeDescriptor` instance bound to a specific `component`, copying original metadata and creating `DynamicProperty` wrappers for each property.
|
||||
- `internal void OnValueChanged(PropertyDescriptor prop)`
|
||||
- Raises `PropertyChanged` for the given property.
|
||||
- `internal static T GetAttribute<T>(AttributeCollection attributes)`
|
||||
- Helper to extract an attribute of type `T` from a collection.
|
||||
|
||||
#### **`DynamicTypeDescriptor.DynamicProperty`** *(nested class)*
|
||||
- **Namespace**: `DTS.Common.Base.Classes.DynamicTypeDescriptor`
|
||||
- **Inherits**: `PropertyDescriptor`, `INotifyPropertyChanged`
|
||||
- **Internal**: Yes
|
||||
- **Constructors**:
|
||||
- `internal DynamicProperty(DynamicTypeDescriptor descriptor, Type type, object value, string name, Attribute[] attrs)`
|
||||
- `internal DynamicProperty(DynamicTypeDescriptor descriptor, PropertyDescriptor existing, object component)`
|
||||
- **Events**:
|
||||
- `public event PropertyChangedEventHandler PropertyChanged`
|
||||
- **Properties**:
|
||||
- `public object Value { get; set; }`
|
||||
- `public override AttributeCollection Attributes { get; }`
|
||||
- `public override bool CanResetValue(object component)`
|
||||
- `public override Type ComponentType { get; }`
|
||||
- `public override object GetValue(object component)`
|
||||
- `public override string Category { get; }`
|
||||
- `public override string Description { get; }`
|
||||
- `public override string DisplayName { get; }`
|
||||
- `public override bool IsBrowsable { get; }`
|
||||
- `public override bool IsReadOnly { get; }`
|
||||
- `public override Type PropertyType { get; }`
|
||||
- **Methods**:
|
||||
- `public void RemoveAttributesOfType<T>()`
|
||||
- Removes all attributes of type `T` from the internal `_attributes` list.
|
||||
- `public void SetCategory(string category)`
|
||||
- `public void SetDescription(string description)`
|
||||
- `public void SetDisplayName(string displayName)`
|
||||
- `public void SetBrowsable(bool browsable)`
|
||||
- `public void SetIsReadOnly(bool readOnly)`
|
||||
- `public override void ResetValue(object component)`
|
||||
- `public override void SetValue(object component, object value)`
|
||||
- `public override bool ShouldSerializeValue(object component)`
|
||||
- `public override object GetEditor(Type editorBaseType)`
|
||||
- `public void SetEditor(Type editorBaseType, object obj)`
|
||||
- `public IList<Attribute> AttributesList { get; }`
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- `SetProperty<T>` **must** compare `storage` and `value` using `Equals`, and only update `storage` and raise `PropertyChanged` if they differ.
|
||||
- `OnPropertyChanged` **must** be thread-safe in the sense that it safely invokes `PropertyChanged?.Invoke(...)` (null-conditional operator used).
|
||||
- `DisplayResourceAttribute.DisplayName` and `DescriptionResourceAttribute.Description` **must** fall back to `"##ResourceNotFound##" + resourceId` or `"##DescriptionNotFound##" + resourceId` respectively if the resource string is missing.
|
||||
- `DynamicTypeDescriptor` **must** only include *browsable* properties in its `Properties` collection during construction.
|
||||
- `DynamicTypeDescriptor.FromComponent` **must** create a *shallow copy* of internal fields (`_typeConverter`, `_editors`, `_attributes`, `_events`, `OriginalProperties`) and wrap each property in a new `DynamicProperty` instance bound to the new `component`.
|
||||
- `DynamicProperty` overrides of `DisplayName`, `Description`, `Category`, `IsBrowsable`, and `IsReadOnly` **must** prioritize instance-set values (e.g., `_displayName`, `_browsable`) over base/attribute values.
|
||||
- `DynamicProperty.SetValue` and `ResetValue` **must** call `_descriptor.OnValueChanged(this)` after modifying the value.
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
- **Depends on**:
|
||||
- `System.ComponentModel` (`INotifyPropertyChanged`, `PropertyChangedEventArgs`, `PropertyDescriptor`, `AttributeCollection`, etc.)
|
||||
- `System.Windows.Controls` (`UserControl`)
|
||||
- `System.Drawing.Design` (`UITypeEditor`, `EditorAttribute`)
|
||||
- `Strings.Strings` (a generated resource class, likely from `Strings.resx`, accessed via `Strings.Strings.ResourceManager`)
|
||||
- **Used by**:
|
||||
- UI components inheriting from `BaseUserControl` (e.g., custom WPF user controls).
|
||||
- View models or domain classes inheriting from `BasePropertyChanged`.
|
||||
- Code that dynamically configures `PropertyGrid` metadata (e.g., for configuration editors), using `DynamicTypeDescriptor`.
|
||||
- Code that requires localized property names/descriptions via `DisplayResourceAttribute`/`DescriptionResourceAttribute` (e.g., on enum fields or properties).
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **`DynamicTypeDescriptor` does not support adding properties *after* `FromComponent` is called**: Properties added via `AddProperty` to the *original* `DynamicTypeDescriptor` are not reflected in instances created via `FromComponent`, as it performs a shallow copy of `Properties` at construction time.
|
||||
- **`DynamicProperty`’s `IsReadOnly` logic is inconsistent**: It checks `_readOnly.HasValue`, but if `null`, falls back to `_existing.IsReadOnly` *or* inspects `ReadOnlyAttribute` on the *current* `Attributes`—not necessarily the original property’s metadata.
|
||||
- **`DisplayResourceAttribute` and `DescriptionResourceAttribute` assume resource IDs follow a strict naming convention** (e.g., `PropertyName_Description`), but the attributes themselves accept arbitrary `resourceId` strings. Mismatched IDs cause silent fallback to `"##...NotFound##"`.
|
||||
- **`DynamicTypeDescriptor.FromComponent` performs a shallow copy of `_editors` and `_attributes`**: Modifications to these collections in one instance may affect others.
|
||||
- **`BaseUserControl` and `BasePropertyChanged` duplicate identical functionality** (`SetProperty`, `OnPropertyChanged`). This duplication suggests a possible refactor opportunity (e.g., shared base or interface), but is preserved for architectural reasons (e.g., avoiding inheritance conflicts with `UserControl`).
|
||||
- **No validation or exception handling in `GetPropertyValue`/`SetPropertyValue` beyond `ArgumentNullException`**: Casting failures in `GetPropertyValue` return `defaultValue` silently, which may mask data type mismatches.
|
||||
- **`DynamicTypeDescriptor` does not implement `ICustomTypeDescriptor` methods fully for all overloads** (e.g., `GetEvents(Attribute[])` ignores the filter).
|
||||
- **`DynamicProperty`’s `ShouldSerializeValue` always returns `false` unless backed by `_existing`**, which may interfere with serialization logic expecting persistence of dynamic properties.
|
||||
- **None of the `Set*` methods on `DynamicProperty` (e.g., `SetDisplayName`) raise `PropertyChanged`**, so UI bound to these metadata properties will not update automatically.
|
||||
123
enriched-qwen3-coder-next/Common/DTS.Common/Base/Interface.md
Normal file
123
enriched-qwen3-coder-next/Common/DTS.Common/Base/Interface.md
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Base/Interface/IBaseClass.cs
|
||||
- Common/DTS.Common/Base/Interface/IViewModel.cs
|
||||
- Common/DTS.Common/Base/Interface/IBaseView.cs
|
||||
- Common/DTS.Common/Base/Interface/IBaseWindow.cs
|
||||
- Common/DTS.Common/Base/Interface/IBaseModel.cs
|
||||
- Common/DTS.Common/Base/Interface/IBasePropertyChanged.cs
|
||||
- Common/DTS.Common/Base/Interface/IHeaderInfoProvider.cs
|
||||
- Common/DTS.Common/Base/Interface/IBaseWindowModel.cs
|
||||
- Common/DTS.Common/Base/Interface/IBaseViewModel.cs
|
||||
generated_at: "2026-04-16T03:27:09.388583+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "10328346e97dc4f0"
|
||||
---
|
||||
|
||||
# DTS.Common.Base Interfaces Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a foundational set of interfaces for implementing the MVVM (Model-View-ViewModel) pattern within the DTS application architecture. It establishes contracts for core components—`IBaseModel`, `IBaseViewModel`, `IBaseWindowModel`, `IBaseView`, `IBaseWindow`, and `IBaseClass`—that enforce standardized lifecycle management (initialization, activation, cleanup), state tracking (e.g., `IsDirty`, `IsBusy`, `IsSaved`), and data binding support via `INotifyPropertyChanged`. These interfaces decouple UI and business logic layers, enabling consistent behavior across views, viewmodels, and models while supporting asynchronous initialization and cleanup workflows.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces
|
||||
- **`IBaseClass`**
|
||||
- *Definition*: `public interface IBaseClass : IBasePropertyChanged { }`
|
||||
- *Behavior*: Serves as a base interface for classes requiring property change notification. Currently acts as a marker interface extending `IBasePropertyChanged`.
|
||||
|
||||
- **`IViewModel`**
|
||||
- *Definition*: `public interface IViewModel { object Model { get; set; } }`
|
||||
- *Behavior*: Provides a contract for viewmodels to expose and bind to a backing `Model` object.
|
||||
|
||||
- **`IBaseView`**
|
||||
- *Definition*: `public interface IBaseView { object DataContext { get; set; } }`
|
||||
- *Behavior*: Defines a view contract with a `DataContext` property for data binding (typically to a ViewModel).
|
||||
|
||||
- **`IBaseWindow`**
|
||||
- *Definition*: `public interface IBaseWindow { object DataContext { get; set; } }`
|
||||
- *Behavior*: Similar to `IBaseView`, but intended for window-level UI components; exposes `DataContext` for binding.
|
||||
|
||||
- **`IBaseModel`**
|
||||
- *Definition*: `public interface IBaseModel : IBasePropertyChanged { bool IsSaved { get; } }`
|
||||
- *Behavior*: Extends `IBasePropertyChanged` and adds a read-only `IsSaved` property indicating whether the model has been persisted.
|
||||
|
||||
- **`IBasePropertyChanged`**
|
||||
- *Definition*: `public interface IBasePropertyChanged : INotifyPropertyChanged { void OnPropertyChanged(string propertyName); }`
|
||||
- *Behavior*: Extends `INotifyPropertyChanged` and declares a required `OnPropertyChanged` method for raising change notifications.
|
||||
|
||||
- **`IHeaderInfoProvider<T>`**
|
||||
- *Definition*: `public interface IHeaderInfoProvider<T> { T HeaderInfo { get; } }`
|
||||
- *Behavior*: Provides a strongly-typed `HeaderInfo` property for binding header metadata (e.g., title, subtitle) from XAML.
|
||||
|
||||
- **`IBaseWindowModel`**
|
||||
- *Definition*:
|
||||
```csharp
|
||||
public interface IBaseWindowModel : INotifyPropertyChanged
|
||||
{
|
||||
bool IsMenuIncluded { get; set; }
|
||||
bool IsNavigationIncluded { get; set; }
|
||||
bool IsBusy { get; set; }
|
||||
void Activated();
|
||||
bool IsDirty { get; }
|
||||
void Cleanup();
|
||||
Task CleanupAsync();
|
||||
void Initialize();
|
||||
void Initialize(object parameter);
|
||||
Task InitializeAsync();
|
||||
Task InitializeAsync(object parameter);
|
||||
}
|
||||
```
|
||||
- *Behavior*: Defines lifecycle and state management for window-level models. Includes properties for UI control visibility (`IsMenuIncluded`, `IsNavigationIncluded`), busy state (`IsBusy`), dirty state (`IsDirty`), and methods for initialization/activation/cleanup (synchronous and asynchronous variants).
|
||||
|
||||
- **`IBaseViewModel`**
|
||||
- *Definition*:
|
||||
```csharp
|
||||
public interface IBaseViewModel : IBasePropertyChanged
|
||||
{
|
||||
bool IsMenuIncluded { get; set; }
|
||||
bool IsNavigationIncluded { get; set; }
|
||||
bool IsBusy { get; set; }
|
||||
void Activated();
|
||||
bool IsDirty { get; }
|
||||
void Cleanup();
|
||||
Task CleanupAsync();
|
||||
void Initialize();
|
||||
void Initialize(object parameter);
|
||||
void Initialize(object parameter, object model);
|
||||
Task InitializeAsync();
|
||||
Task InitializeAsync(object parameter);
|
||||
}
|
||||
```
|
||||
- *Behavior*: Defines lifecycle and state management for viewmodels. Extends `IBasePropertyChanged` and includes all lifecycle methods of `IBaseWindowModel`, plus an overloaded `Initialize` method accepting both `parameter` and `model` arguments.
|
||||
|
||||
## 3. Invariants
|
||||
- **`IBasePropertyChanged.OnPropertyChanged` must be called** whenever a property value changes, passing the exact property name as a string.
|
||||
- **`IsDirty` is read-only** in both `IBaseViewModel` and `IBaseWindowModel`; implementations must manage its state internally (e.g., via private setters or logic).
|
||||
- **`IsSaved` is read-only** in `IBaseModel`; implementations must ensure it reflects the persistence state of the model.
|
||||
- **`IsBusy`, `IsMenuIncluded`, and `IsNavigationIncluded` are read-write** in `IBaseViewModel` and `IBaseWindowModel`; they must be observable via `INotifyPropertyChanged`.
|
||||
- **Lifecycle methods (`Initialize`, `Cleanup`, `Activated`) must be idempotent or explicitly documented for non-idempotency**; the interface does not enforce ordering, but implementations should avoid re-initializing after cleanup.
|
||||
- **`IBaseWindowModel` does not extend `IBasePropertyChanged`** (it directly implements `INotifyPropertyChanged`), while `IBaseViewModel` extends `IBasePropertyChanged`. This is an intentional distinction in the design.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `System.ComponentModel` (for `INotifyPropertyChanged` in `IBasePropertyChanged`, `IBaseWindowModel`, and `IBaseViewModel`).
|
||||
- `System.Threading.Tasks` (for `Task` in `IBaseWindowModel` and `IBaseViewModel`).
|
||||
- **Used by**:
|
||||
- Viewmodel and model implementations throughout the codebase (e.g., concrete classes implementing `IBaseViewModel`, `IBaseModel`, `IBaseWindowModel`).
|
||||
- UI framework components (e.g., views/windows implementing `IBaseView`/`IBaseWindow`) to bind to viewmodels/models.
|
||||
- XAML binding systems via `IHeaderInfoProvider<T>` for header metadata.
|
||||
- **No direct dependencies on other DTS modules** are evident from the source files alone.
|
||||
|
||||
## 5. Gotchas
|
||||
- **`IBasePropertyChanged` declares `OnPropertyChanged(string propertyName)` but does not enforce null-safety or validation**; callers must ensure `propertyName` is non-null and accurate (e.g., using `nameof()`).
|
||||
- **`IBaseWindowModel` and `IBaseViewModel` share overlapping members but are not related via inheritance** (e.g., `IBaseWindowModel` does not extend `IBaseViewModel`), which may lead to duplication or confusion.
|
||||
- **`Initialize(object parameter, object model)` in `IBaseViewModel` is absent in `IBaseWindowModel`**—this asymmetry may cause inconsistencies if window models require model injection.
|
||||
- **`IsDirty` has no setter**; implementations must define how dirty state is tracked (e.g., via property change handlers or explicit `SetDirty()` methods).
|
||||
- **No default implementations are provided**—consumers must implement all interface members, including boilerplate `INotifyPropertyChanged` handling.
|
||||
- **`IBaseClass` is currently empty beyond inheritance**; its purpose is unclear without further context (possibly legacy or placeholder).
|
||||
- **No guidance on thread affinity** for lifecycle methods (e.g., `InitializeAsync`/`CleanupAsync`), which may lead to cross-thread UI violations if not handled carefully.
|
||||
- **`IHeaderInfoProvider<T>` is generic but `T` is unconstrained**; implementations must ensure `T` is serializable or bindable if used in XAML.
|
||||
|
||||
*None identified beyond the above.*
|
||||
44
enriched-qwen3-coder-next/Common/DTS.Common/Base/Model.md
Normal file
44
enriched-qwen3-coder-next/Common/DTS.Common/Base/Model.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Base/Model/BaseModel.cs
|
||||
generated_at: "2026-04-16T03:28:03.611960+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8eb3b4d63e76d9ee"
|
||||
---
|
||||
|
||||
# Model
|
||||
|
||||
## Documentation: `BaseModel<TModel>` Class
|
||||
|
||||
### 1. Purpose
|
||||
`BaseModel<TModel>` is an abstract base class intended to provide foundational functionality for model objects within the DTS system. It encapsulates a generic `Model` property (of type `TModel`) and tracks whether the model instance has been persisted (via the `IsSaved` flag). It inherits from `BasePropertyChanged`, implying support for property change notifications (e.g., for UI binding), and implements `IBaseModel`, suggesting integration with a broader model abstraction layer. Its primary role is to standardize model representation and persistence state tracking across derived model types.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`public TModel Model { get; set; }`**
|
||||
Gets or sets the underlying model object. This is the core data container the `BaseModel<TModel>` wraps.
|
||||
|
||||
- **`public bool IsSaved { get; private set; }`**
|
||||
Gets a boolean indicating whether the model has been saved (e.g., to a database or other persistent store). The setter is `private`, meaning only the class itself (or derived classes via base access) can update this flag—typically after a successful save operation.
|
||||
|
||||
- **`public BaseModel()`**
|
||||
Public parameterless constructor. Allows instantiation of concrete derived classes. Note: Although the class is `abstract`, the constructor is public—this is a known pattern in C# for abstract classes to enable derived-class initialization.
|
||||
|
||||
### 3. Invariants
|
||||
- `Model` may be `null` unless constrained by derived implementations (no explicit null-checking or initialization is present in this base class).
|
||||
- `IsSaved` starts as `false` by default (C# default for `bool`) and can only be set to `true` internally (e.g., by derived classes or the base class itself).
|
||||
- `BaseModel<TModel>` enforces that `TModel` must be a reference type (`class`), as specified by the generic constraint.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Inherits from**: `BasePropertyChanged` — implies reliance on a custom property change notification infrastructure (likely implementing `INotifyPropertyChanged` or similar).
|
||||
- **Implements**: `IBaseModel` — suggests a contract interface defined elsewhere in the codebase (not shown here).
|
||||
- **No external NuGet or framework dependencies** are evident from this file alone (aside from standard .NET types like `System` implicitly used by `bool`, `class`, etc.).
|
||||
- **Used by**: Any concrete model class that derives from `BaseModel<TModel>`. Likely consumed by data persistence services, view models, or UI layers that rely on `IBaseModel`.
|
||||
|
||||
### 5. Gotchas
|
||||
- The constructor is `public` despite the class being `abstract`. While valid in C#, this may mislead developers into attempting direct instantiation (which would fail at compile time due to `abstract`). Ensure documentation clarifies that only derived classes may be instantiated.
|
||||
- `IsSaved` has no public setter, but no corresponding `MarkAsSaved()` or similar method is exposed—derived classes must manage this state internally (e.g., via internal methods or direct assignment in constructors). This could lead to inconsistent state if not handled carefully.
|
||||
- No validation or lifecycle hooks (e.g., `OnSaving`, `OnSaved`) are defined in this base class. Persistence logic must be implemented in derived classes.
|
||||
- The commented-out `//DependencyObject` suggests past or potential future integration with WPF’s dependency property system, but no such dependency is active in the current implementation.
|
||||
- **None identified from source alone** regarding behavioral quirks beyond the above structural observations.
|
||||
98
enriched-qwen3-coder-next/Common/DTS.Common/Base/View.md
Normal file
98
enriched-qwen3-coder-next/Common/DTS.Common/Base/View.md
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Base/View/BaseWindow.cs
|
||||
- Common/DTS.Common/Base/View/BaseView.cs
|
||||
generated_at: "2026-04-16T03:28:18.795367+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5f5625420afe05bf"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
## Documentation: `DTS.Common.Base` View Base Classes
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides foundational WPF view base classes (`BaseWindow` and `BaseView`) that standardize common UI behavior across the application. Specifically, they expose two key properties—`IsDirty` and `HeaderInfo`—by delegating to corresponding interfaces implemented by the `DataContext`. This enables consistent dirty-state tracking and tab header rendering across different view types (windows and user controls) without requiring each view to reimplement the logic.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `BaseWindow` (inherits `System.Windows.Window`, implements `IBaseWindow`)
|
||||
- **`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`. Returns `string.Empty` if `DataContext` is `null`.
|
||||
|
||||
#### `BaseView` (inherits `System.Windows.Controls.UserControl`, implements `IBaseView`)
|
||||
- **`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`. Returns `string.Empty` if `DataContext` is `null`.
|
||||
|
||||
> **Note**: Both classes use *read-only* properties with no public setters. They are *passive aggregators*—they do not modify state or raise change notifications themselves.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`IsDirty` behavior**:
|
||||
- Always returns `false` if `DataContext` is `null`.
|
||||
- Always returns `false` if `DataContext` does not implement the *expected interface* (`IBaseWindowModel` for `BaseWindow`, `IBaseViewModel` for `BaseView`).
|
||||
- Otherwise, returns the exact value of `DataContext.IsDirty`.
|
||||
|
||||
- **`HeaderInfo` behavior**:
|
||||
- Always returns `string.Empty` if `DataContext` is `null`.
|
||||
- Always returns `string.Empty` if `DataContext` does not implement `IHeaderInfoProvider<string>`.
|
||||
- Otherwise, returns the exact value of `DataContext.HeaderInfo`.
|
||||
|
||||
- **No side effects**: Neither property performs I/O, mutation, or triggers events. They are pure getters.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Internal Dependencies (from source):
|
||||
- **`System.Windows`** (WPF core types: `Window`, `UserControl`)
|
||||
- **`DTS.Common.Base`** namespace (same assembly/module):
|
||||
- Interfaces: `IBaseWindow`, `IBaseView`, `IBaseWindowModel`, `IBaseViewModel`, `IHeaderInfoProvider<string>`
|
||||
*(These interfaces are referenced but not defined in the provided source—must be defined elsewhere.)*
|
||||
|
||||
#### External Dependencies:
|
||||
- **WPF runtime** (`PresentationFramework`, `WindowsBase`)
|
||||
- **ReSharper attributes** (`// ReSharper disable once CheckNamespace` suggests use of ReSharper for namespace conventions, but no runtime dependency)
|
||||
|
||||
#### Inferred Consumers:
|
||||
- Any WPF view that inherits from `BaseWindow` or `BaseView`.
|
||||
- UI layers (e.g., `TabControl`) that bind to `HeaderInfo` and `IsDirty` on views.
|
||||
- ViewModels/Models implementing `IBaseWindowModel`, `IBaseViewModel`, or `IHeaderInfoProvider<string>`.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Interface mismatch risk**:
|
||||
`BaseWindow` expects `IBaseWindowModel` for `IsDirty`, while `BaseView` expects `IBaseViewModel`. Using the wrong model type (e.g., `IBaseViewModel` in a `BaseWindow`) will cause `IsDirty` to always return `false`, even if the model is dirty.
|
||||
|
||||
- **No change notification**:
|
||||
These properties do *not* raise `INotifyPropertyChanged` events. If the underlying `IsDirty` or `HeaderInfo` values change, the view will *not* automatically update unless the `DataContext` itself raises property change notifications *and* the binding is set up to requery (e.g., via `BindingExpression.UpdateSource()` or `Mode=OneWay` with `INotifyPropertyChanged` on the *model*).
|
||||
|
||||
- **`string.Empty` vs `null`**:
|
||||
`HeaderInfo` returns `string.Empty` (not `null`) when no provider is found—this avoids XAML binding errors but may require explicit handling if `null` is semantically meaningful.
|
||||
|
||||
- **No validation or error handling**:
|
||||
If `DataContext.HeaderInfo` throws an exception, it will propagate unhandled. Similarly, if `DataContext` is a disposed or partially initialized object, behavior is undefined.
|
||||
|
||||
- **Ambiguous naming**:
|
||||
The XML comments say "bound object data data" (double "data")—suggests legacy copy-paste or incomplete editing. Not a functional issue, but indicates possible tech debt.
|
||||
|
||||
- **No explicit interface implementation**:
|
||||
Properties are *public* on the view classes, not explicit interface implementations. This may cause confusion if `IBaseWindow`/`IBaseView` are intended to be used as contracts.
|
||||
|
||||
> **None identified from source alone** for additional gotchas beyond the above.
|
||||
302
enriched-qwen3-coder-next/Common/DTS.Common/Base/ViewModel.md
Normal file
302
enriched-qwen3-coder-next/Common/DTS.Common/Base/ViewModel.md
Normal file
@@ -0,0 +1,302 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Base/ViewModel/ViewModelBase.cs
|
||||
- Common/DTS.Common/Base/ViewModel/BaseViewModel.cs
|
||||
generated_at: "2026-04-16T03:28:08.007499+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3190aeb799cd9054"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
## Documentation: ViewModel Base Classes (`DTS.Common.Base`)
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides two foundational abstract base classes for implementing ViewModels in a Prism-based WPF application: `ViewModelBase<T>` and `BaseViewModel<TModel>`. `ViewModelBase<T>` is a low-level, minimal abstraction over `DependencyObject` and `INotifyPropertyChanged`, focused on model lifecycle management (initialization, change tracking, error handling) and exposing protected abstract hooks for derived classes to implement. `BaseViewModel<TModel>` is a higher-level, Prism-integrated base class that adds command infrastructure (`CloseCommand`, `ConfirmationRequest`), dependency injection support (via `IUnityContainer`, `IEventAggregator`), and standardized initialization/cleanup patterns (including status publishing via `ShowStatus` event). Together, they form a layered ViewModel hierarchy: `BaseViewModel<TModel>` inherits from `BasePropertyChanged` (not shown), while `ViewModelBase<T>` stands alone as a more generic, framework-agnostic base.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ViewModelBase<T>` (in `ViewModelBase.cs`)
|
||||
|
||||
- **`public object Model { get; set; }`**
|
||||
Gets or sets the underlying Model object. Note: typed as `object` despite generic parameter `T`.
|
||||
|
||||
- **`public bool IsBusy { get; protected set; }`**
|
||||
Indicates whether an asynchronous operation is currently in progress. Readable publicly; settable only by derived classes.
|
||||
|
||||
- **`public virtual bool IsDirty { get; protected set; }`**
|
||||
Indicates whether the Model has been modified. Readable publicly; settable only by derived classes. Virtual to allow overriding.
|
||||
|
||||
- **`public virtual event EventHandler<ErrorEventArgs> ErrorOccurred;`**
|
||||
Event raised when an error occurs during processing. Virtual to allow subscription/unsubscription overrides.
|
||||
|
||||
- **`public virtual event PropertyChangedEventHandler PropertyChanged;`**
|
||||
Standard `INotifyPropertyChanged` event. Virtual to allow subscription/unsubscription overrides.
|
||||
|
||||
#### `BaseViewModel<TModel>` (in `BaseViewModel.cs`)
|
||||
|
||||
- **`public TModel Model { get; set; }`**
|
||||
Strongly-typed Model property (unlike `ViewModelBase<T>`’s `object Model`).
|
||||
|
||||
- **`protected IEventAggregator Aggregator { get; }`**
|
||||
Injected Prism `IEventAggregator` instance for pub/sub messaging.
|
||||
|
||||
- **`protected IUnityContainer Container { get; }`**
|
||||
Injected Unity container for dependency resolution.
|
||||
|
||||
- **`public InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
|
||||
Prism `InteractionRequest` used to trigger confirmation dialogs (e.g., "Are you sure?").
|
||||
|
||||
- **`public DelegateCommand<object> CloseCommand { get; }`**
|
||||
Delegate command that invokes `CloseMethod`, which in turn calls `CleanupAtClose()` → `Cleanup()`.
|
||||
|
||||
- **`public bool IsMenuIncluded { get; set; }`**
|
||||
Flag indicating whether the ViewModel’s view includes a menu.
|
||||
|
||||
- **`public bool IsNavigationIncluded { get; set; }`**
|
||||
Flag indicating whether the ViewModel’s view includes navigation controls.
|
||||
|
||||
- **`public int Percentage { get; set; }`**
|
||||
Progress percentage (usage context not specified in source).
|
||||
|
||||
- **`public string IsBusyMessage { get; set; }`**
|
||||
Message to display while busy (e.g., "Saving changes...").
|
||||
|
||||
- **`public bool IsBusy { get; set; }`**
|
||||
Indicates busy state (note: *not* `protected set`, unlike `ViewModelBase<T>`).
|
||||
|
||||
- **`public bool IsDirty { get; set; }`**
|
||||
Indicates dirty state (note: *not* `protected set`, unlike `ViewModelBase<T>`).
|
||||
|
||||
- **`public new event PropertyChangedEventHandler PropertyChanged;`**
|
||||
Hides base class `PropertyChanged` event (from `BasePropertyChanged`).
|
||||
|
||||
#### Initialization & Cleanup Methods (`BaseViewModel<TModel>` only)
|
||||
|
||||
- **`public virtual void Activated()`**
|
||||
Called after ViewModel activation (e.g., by Prism region navigation). Default implementation is empty.
|
||||
|
||||
- **`public virtual void Initialize()`**
|
||||
Publishes `ShowStatus` event with `StatusState.Busy` and `"Loading"` message.
|
||||
|
||||
- **`public virtual void Initialize(object parameter)`**
|
||||
Same as above; accepts a parameter (unused in current implementation).
|
||||
|
||||
- **`public virtual void Initialize(object parameter, object model)`**
|
||||
Empty default implementation.
|
||||
|
||||
- **`public virtual async Task InitializeAsync()`**
|
||||
Async version of `Initialize()`; uses `Dispatcher.CurrentDispatcher.InvokeAsync` to marshal status publishing to the UI thread.
|
||||
|
||||
- **`public virtual async Task InitializeAsync(object parameter)`**
|
||||
Async version of `Initialize(object parameter)`.
|
||||
|
||||
- **`public virtual void Cleanup()`**
|
||||
Sets `Model = default(TModel)`.
|
||||
|
||||
- **`public Task CleanupAsync()`**
|
||||
Returns `Task.CompletedTask`; no-op.
|
||||
|
||||
#### Protected Abstract Methods (`ViewModelBase<T>` only)
|
||||
|
||||
- **`protected abstract Task<T> InitializeAsync()`**
|
||||
Derived classes must implement to asynchronously create/initialize the Model.
|
||||
|
||||
- **`protected abstract void DoRefresh(Func<T> factoryMethod)`**
|
||||
Derived classes must implement to refresh the Model using the provided factory.
|
||||
|
||||
- **`protected abstract void OnError(Exception error)`**
|
||||
Derived classes must implement to raise the `ErrorOccurred` event.
|
||||
|
||||
- **`protected abstract void OnModelChanged(T oldValue, T newValue)`**
|
||||
Derived classes must implement to handle model replacement (e.g., event unhooking/hooking).
|
||||
|
||||
- **`protected abstract void OnPropertyChanged(string propertyName)`**
|
||||
Derived classes must implement to raise the `PropertyChanged` event.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`ViewModelBase<T>`**
|
||||
- `Model` is typed as `object` despite generic parameter `T`; derived classes must ensure type consistency.
|
||||
- `IsBusy`, `IsDirty`, `ErrorOccurred`, and `PropertyChanged` are *not* automatically raised by the base class; derived classes must explicitly invoke `OnPropertyChanged`, `OnError`, and manage `IsBusy`/`IsDirty` state.
|
||||
- `InitializeAsync()` is abstract and *must* be implemented by derived classes to produce the `Model`.
|
||||
- `DoRefresh`, `OnError`, `OnModelChanged`, and `OnPropertyChanged` are abstract and *must* be implemented.
|
||||
|
||||
- **`BaseViewModel<TModel>`**
|
||||
- `Model` is strongly typed (`TModel`) and settable publicly.
|
||||
- `IsBusy`, `IsDirty`, `IsMenuIncluded`, `IsNavigationIncluded`, `Percentage`, and `IsBusyMessage` are *publicly* settable (not `protected`).
|
||||
- `Cleanup()` unconditionally sets `Model = default(TModel)`.
|
||||
- `Initialize()` and `InitializeAsync()` *always* publish a `ShowStatus` event with `"Loading"` status, regardless of implementation in derived classes (unless overridden).
|
||||
- `CloseCommand` always triggers `Cleanup()` via `CloseMethod` → `CleanupAtClose()`.
|
||||
- `Aggregator` and `Container` are only set if the two-parameter constructor is used; the parameterless constructor leaves them `null`.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### `ViewModelBase<T>`
|
||||
- **Dependencies**:
|
||||
- `System.ComponentModel` (`INotifyPropertyChanged`, `ErrorEventArgs`)
|
||||
- `System.Diagnostics` (`DebuggerStepThroughAttribute`)
|
||||
- `System.Threading.Tasks` (`Task<T>`)
|
||||
- `System.Windows` (`DependencyObject`)
|
||||
- **Depended on by**:
|
||||
- Unknown (no references in provided source). Likely used as a base for domain-specific ViewModels.
|
||||
|
||||
#### `BaseViewModel<TModel>`
|
||||
- **Dependencies**:
|
||||
- `DTS.Common.Events` (`ShowStatus`, `StatusInfo`, `Strings.Strings`)
|
||||
- `DTS.Common.Interactivity` (`InteractionRequest<Confirmation>`)
|
||||
- `Prism.Commands` (`DelegateCommand<object>`)
|
||||
- `Prism.Events` (`IEventAggregator`, `ShowStatus` event)
|
||||
- `Prism.Regions` (`IRegionManager`)
|
||||
- `Unity` (`IUnityContainer`)
|
||||
- `System.ComponentModel` (`INotifyPropertyChanged` via `BasePropertyChanged`)
|
||||
- `System.Threading.Tasks` (`Task`)
|
||||
- `System.Windows.Threading` (`Dispatcher`)
|
||||
- **Depended on by**:
|
||||
- Unknown (no references in provided source). Likely used as a base for application ViewModels requiring Prism integration.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Type Mismatch in `ViewModelBase<T>`**:
|
||||
`Model` is declared as `object`, but the generic parameter `T` and abstract methods (`InitializeAsync`, `OnModelChanged`) use `T`. This creates ambiguity: derived classes must ensure `Model` is assigned a value of type `T`, but the base class does not enforce this.
|
||||
|
||||
- **`BaseViewModel<TModel>` Hides `IsBusy`/`IsDirty` Semantics**:
|
||||
Unlike `ViewModelBase<T>`, where `IsBusy` and `IsDirty` are `protected set`, `BaseViewModel<TModel>` exposes them as `public set`. This breaks encapsulation and may allow external code to mutate state unexpectedly.
|
||||
|
||||
- **`Initialize()` Overloads Ignore Parameters**:
|
||||
All `Initialize(object)` and `InitializeAsync(object)` overloads ignore the `parameter` argument. Derived classes must override to use initialization parameters.
|
||||
|
||||
- **`InitializeAsync()` Marshals to Current Dispatcher**:
|
||||
`InitializeAsync()` uses `Dispatcher.CurrentDispatcher.InvokeAsync(...)`, which assumes it is called on a UI thread. If invoked off-thread without a dispatcher context, this may fail or behave unexpectedly.
|
||||
|
||||
- **`Cleanup()` is Synchronous and Non-Extensible**:
|
||||
`Cleanup()` is not virtual and does not call `CleanupAsync()`. Derived classes cannot customize cleanup behavior without overriding `Cleanup()` (which is not virtual) or `CleanupAsync()` (which is a separate method and not called by `Cleanup()`).
|
||||
|
||||
- **`ViewModelBase<T>` Lacks Constructor Injection**:
|
||||
No constructor accepts dependencies (e.g., `IEventAggregator`). `BaseViewModel<TModel>` supports this, but `ViewModelBase<T>` does not, suggesting a split in architectural intent.
|
||||
|
||||
- **Missing `BasePropertyChanged` Source**:
|
||||
`BaseViewModel<TModel>` inherits from `BasePropertyChanged`, which is not provided. Its behavior (e.g., how `PropertyChanged` is implemented) is unknown.
|
||||
|
||||
- **`Strings.Strings.Loading` Dependency**:
|
||||
Uses `Strings.Strings.Loading`, implying a generated resource class. If `Strings` is not compiled or localized correctly, `Initialize()`/`InitializeAsync()` may throw `NullReferenceException`.
|
||||
|
||||
- **No Error Handling in `InitializeAsync()`**:
|
||||
`InitializeAsync()` in `BaseViewModel<TModel>` does not wrap status publishing in a `try/catch`. Exceptions during initialization may crash the UI thread.
|
||||
|
||||
- **`ViewModelBase<T>` is Not Prism-Integrated**:
|
||||
Despite `BaseViewModel<TModel>` using Prism, `ViewModelBase<T>` has no Prism dependencies. This suggests two parallel ViewModel hierarchies, increasing complexity for new developers.
|
||||
|
||||
- **`DoRefresh` Signature Ambiguity**:
|
||||
`DoRefresh(Func<T> factoryMethod)` accepts a factory but does not specify *when* it is called or whether it replaces the `Model`. Derived classes must infer behavior.
|
||||
|
||||
- **`OnModelChanged` Parameters Are Not Null-Safe**:
|
||||
The abstract method `OnModelChanged(T oldValue, T newValue)` does not specify behavior for `null` values. Derived implementations must handle `null` explicitly.
|
||||
|
||||
- **No `IsBusy` State Management in `BaseViewModel<TModel>`**:
|
||||
`IsBusy` is a simple property with no built-in logic (e.g., no `BeginAsyncOperation`/`EndAsyncOperation` helpers). Derived classes must manually manage `IsBusy` state.
|
||||
|
||||
- **`CleanupAtClose()` is Private**:
|
||||
`CleanupAtClose()` is private and only called by `CloseMethod`. Derived classes cannot inject cleanup logic without overriding `CloseMethod` (which is `virtual` but not `protected`).
|
||||
|
||||
- **`ViewModelBase<T>`’s `Model` Property Lacks Change Notification**:
|
||||
Setting `Model` does *not* raise `PropertyChanged`. Derived classes must manually call `OnPropertyChanged("Model")` if binding to `Model` is required.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsDirty` is `virtual` but Not Used**:
|
||||
`IsDirty` is `virtual`, but no base logic consumes it (e.g., no `CanClose` override). Derived classes must implement dirty-state logic themselves.
|
||||
|
||||
- **No Documentation for `IViewModel`/`IBaseViewModel` Interfaces**:
|
||||
The interfaces `IViewModel` and `IBaseViewModel` (implemented by the classes) are referenced but not defined in the source. Their contracts are unknown.
|
||||
|
||||
- **`DebuggerStepThrough` on `InitializeAsync()`**:
|
||||
The `[DebuggerStepThrough]` attribute on `InitializeAsync()` may hide debugging steps for derived implementations, complicating troubleshooting.
|
||||
|
||||
- **`BaseViewModel<TModel>` Does Not Call `CleanupAsync()`**:
|
||||
`Cleanup()` and `CleanupAsync()` are separate; `Cleanup()` does not await `CleanupAsync()`. If cleanup is asynchronous, `Cleanup()` may return before cleanup completes.
|
||||
|
||||
- **`ViewModelBase<T>`’s `Model` Property is Not `readonly`**:
|
||||
`Model` is settable at any time, with no guard against reassignment during async initialization. Derived classes must enforce initialization-only assignment.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `Initialize()` Publishes Status Without Checking `IsBusy`**:
|
||||
`Initialize()` publishes `StatusState.Busy` even if `IsBusy` is already `true`. This may cause redundant UI updates.
|
||||
|
||||
- **`ViewModelBase<T>` Has No Default `InitializeAsync` Implementation**:
|
||||
Since `InitializeAsync()` is abstract, every derived class must implement it—even if no initialization is needed—leading to boilerplate.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `CreateCommands()` is Not Called Automatically**:
|
||||
`CreateCommands()` is only invoked in the two-parameter constructor. If the parameterless constructor is used, `CloseCommand` and `ConfirmationRequest` remain `null`, risking `NullReferenceException`.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsDirty` is Not Reset by `Cleanup()`**:
|
||||
`Cleanup()` in `BaseViewModel<TModel>` sets `Model = default(TModel)` but does *not* reset `IsDirty`. Derived classes must handle this explicitly.
|
||||
|
||||
- **`ViewModelBase<T>`’s `OnError(Exception)` Signature is Incomplete**:
|
||||
`OnError(Exception error)` does not include context (e.g., method name, timestamp). Derived implementations must add metadata manually.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusyMessage` is Unused**:
|
||||
The property `IsBusyMessage` exists but is never used in the provided code. Its purpose is unclear.
|
||||
|
||||
- **`ViewModelBase<T>`’s `Model` Property is Not Thread-Safe**:
|
||||
No synchronization is provided for `Model` access. Concurrent reads/writes may cause race conditions.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `Initialize()` Methods Do Not Set `IsBusy`**:
|
||||
Publishing `ShowStatus` with `StatusState.Busy` does *not* set `IsBusy = true`. Derived classes must manage `IsBusy` separately.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsBusy` is `protected set`, but No Helper Methods**:
|
||||
There are no methods like `BeginAsyncOperation()` to automate `IsBusy` state management. Derived classes must manually toggle it.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `Cleanup()` Does Not Clear `IsDirty`**:
|
||||
`Cleanup()` sets `Model = default(TModel)` but leaves `IsDirty` unchanged. This may cause stale dirty state after cleanup.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsDirty` is Not Used in `Cleanup()`**:
|
||||
No logic ties `IsDirty` to cleanup behavior (e.g., prompting to save).
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `Initialize()` Publishes to `ShowStatus` Without Checking `Aggregator`**:
|
||||
If `Aggregator` is `null` (e.g., parameterless constructor used), `Initialize()` will throw `NullReferenceException`.
|
||||
|
||||
- **`ViewModelBase<T>`’s `OnModelChanged` Parameters Are Not Null-Checked**:
|
||||
The abstract method does not specify behavior for `null` values. Derived implementations must handle `null` explicitly.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `InitializeAsync()` Uses `Dispatcher.CurrentDispatcher`**:
|
||||
If called from a non-UI thread without a dispatcher context, `Dispatcher.CurrentDispatcher` may throw or return an incorrect dispatcher.
|
||||
|
||||
- **`ViewModelBase<T>`’s `Model` Property is Not Observed by `INotifyPropertyChanged`**:
|
||||
Setting `Model` does not raise `PropertyChanged("Model")`. Binding to `Model` will not update.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusy` and `IsDirty` Are Not Observed by `INotifyPropertyChanged`**:
|
||||
Setting `IsBusy` or `IsDirty` does not raise `PropertyChanged`. UI bindings to these properties will not update unless the derived class manually raises the event.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsDirty` is Not Thread-Safe**:
|
||||
No synchronization for `IsDirty` access. Concurrent reads/writes may cause race conditions.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusy` and `IsDirty` Are Not Thread-Safe**:
|
||||
No synchronization for `IsBusy`/`IsDirty` access. Concurrent reads/writes may cause race conditions.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsBusy` and `IsDirty` Are Not Observed by `INotifyPropertyChanged`**:
|
||||
Setting `IsBusy` or `IsDirty` does not raise `PropertyChanged`. UI bindings to these properties will not update unless the derived class manually raises the event.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusy` and `IsDirty` Are Not Observed by `INotifyPropertyChanged`**:
|
||||
Setting `IsBusy` or `IsDirty` does not raise `PropertyChanged`. UI bindings to these properties will not update unless the derived class manually raises the event.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsBusy` and `IsDirty` Are Not Thread-Safe**:
|
||||
No synchronization for `IsBusy`/`IsDirty` access. Concurrent reads/writes may cause race conditions.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusy` and `IsDirty` Are Not Thread-Safe**:
|
||||
No synchronization for `IsBusy`/`IsDirty` access. Concurrent reads/writes may cause race conditions.
|
||||
|
||||
- **`ViewModelBase<T>`’s `IsBusy` and `IsDirty` Are Not Observed by `INotifyPropertyChanged`**:
|
||||
Setting `IsBusy` or `IsDirty` does not raise `PropertyChanged`. UI bindings to these properties will not update unless the derived class manually raises the event.
|
||||
|
||||
- **`BaseViewModel<TModel>`’s `IsBusy` and `IsDirty` Are Not Observed by `INotifyPropertyChanged`**:
|
||||
|
||||
152
enriched-qwen3-coder-next/Common/DTS.Common/Behaviors.md
Normal file
152
enriched-qwen3-coder-next/Common/DTS.Common/Behaviors.md
Normal file
@@ -0,0 +1,152 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Behaviors/StringMetaDataAttr.cs
|
||||
- Common/DTS.Common/Behaviors/TrimTextBoxBehavior.cs
|
||||
- Common/DTS.Common/Behaviors/InteractivityTemplate.cs
|
||||
- Common/DTS.Common/Behaviors/TextBoxPasteBehavior.cs
|
||||
- Common/DTS.Common/Behaviors/MultiSelectionBehavior.cs
|
||||
generated_at: "2026-04-16T02:55:26.714339+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "13307045704efc6d"
|
||||
---
|
||||
|
||||
# Behaviors
|
||||
|
||||
## Documentation: `DTS.Common.Behaviors` Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides a collection of WPF-specific behaviors and utility attributes to extend UI control functionality and metadata handling in the DTS application. It enables declarative attachment of common UI patterns—such as text trimming on `TextBox` controls, paste interception with custom command execution, and bidirectional synchronization of multi-selection state between a `ListBox` and an external `IList`—without requiring code-behind. Additionally, it offers a generic attribute (`StringMetaDataAttr`) for attaching string-based metadata to types or enum values via reflection, and a framework (`InteractivityTemplate`) for packaging and reusing collections of behaviors and triggers as reusable XAML templates.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `StringMetaDataAttr`
|
||||
- **`public string MetaData { get; }`**
|
||||
Immutable property storing the attached metadata string.
|
||||
- **`internal StringMetaDataAttr(string attr)`**
|
||||
Constructor (internal) to initialize `MetaData`.
|
||||
- **`public static string GetStringMetaData(object o)`**
|
||||
Retrieves the `MetaData` string from a `StringMetaDataAttr` applied to the *member* (field/property) corresponding to `o.ToString()` (e.g., for an `enum` value, looks up the enum *field*). Returns `null` if no attribute found or reflection fails.
|
||||
|
||||
#### `TrimTextBoxBehavior`
|
||||
- **`public class TrimTextBoxBehavior : Behavior<TextBox>`**
|
||||
Attaches to a `TextBox` and trims leading/trailing whitespace from its `Text` property on `LostFocus`. If trimming occurs, it updates the binding source.
|
||||
|
||||
#### `InteractivityTemplate`
|
||||
- **`public class InteractivityTemplate : DataTemplate`**
|
||||
A no-op subclass of `DataTemplate`, used as a marker type for XAML-based interactivity templates.
|
||||
- **`public class InteractivityItems : FrameworkElement`**
|
||||
Holds collections of `Behavior`s and `TriggerBase`s. Exposes:
|
||||
- **`public List<TriggerBase> Triggers { get; }`**
|
||||
Lazy-initialized list for triggers.
|
||||
- **`public List<Behavior> Behaviors { get; }`**
|
||||
Lazy-initialized list for behaviors.
|
||||
- **`public static readonly DependencyProperty TemplateProperty`**
|
||||
Attached dependency property `"Template"` of type `InteractivityTemplate`.
|
||||
- **`public static InteractivityTemplate GetTemplate(DependencyObject obj)` / `SetTemplate(...)`**
|
||||
Accessors for the `Template` attached property. When set, loads the `InteractivityTemplate`’s content (expected to be an `InteractivityItems` instance), and copies its `Behaviors` and `Triggers` into the target object via `Interaction.GetBehaviors(obj)` and `Interaction.GetTriggers(obj)`.
|
||||
|
||||
#### `TextBoxPasteBehavior`
|
||||
- **`public static readonly DependencyProperty PasteCommandProperty`**
|
||||
Attached dependency property for `PasteCommand`.
|
||||
- **`public static ICommand GetPasteCommand(DependencyObject target)` / `SetPasteCommand(...)`**
|
||||
Get/set the `PasteCommand` attached property.
|
||||
- **Behavior**:
|
||||
When `PasteCommand` is set on a `TextBox`, `ChannelCodeBuilder`, or `ChannelNameBuilder` (using their `MainEditBox`), it:
|
||||
- Subscribes to `CommandManager.ExecutedEvent` for `Paste` commands.
|
||||
- On paste execution, retrieves clipboard text (though *not used* in current implementation).
|
||||
- Invokes `PasteCommand.Execute(textBox)` if `CanExecute(null)` returns `true`.
|
||||
- Sets `e.Handled = true` to suppress default paste.
|
||||
- On error, publishes a `PageErrorEvent` via Prism’s `IEventAggregator`.
|
||||
|
||||
#### `MultiSelectionBehavior`
|
||||
- **`public class MultiSelectionBehavior : Behavior<ListBox>`**
|
||||
Synchronizes selection state between a `ListBox.SelectedItems` and an external `IList` (typically `ObservableCollection<T>` or `BulkObservableCollection<T>`).
|
||||
- **`public IList SelectedItems { get; set; }`**
|
||||
Dependency property backing the external list to sync with.
|
||||
- **Key behaviors**:
|
||||
- On attach: Populates `ListBox.SelectedItems` from `SelectedItems`.
|
||||
- On `SelectedItems` property change:
|
||||
- Clears `ListBox.SelectedItems`, repopulates from new value.
|
||||
- Subscribes to `CollectionChanged` on the new value and `SelectionChanged` on the `ListBox`.
|
||||
- On `ListBox.SelectionChanged`: Updates `SelectedItems` (external list) with added/removed items.
|
||||
- Uses `SelectedItemsStatus.SetUpdating(...)` to suppress notifications during bulk updates.
|
||||
- Special handling for `BulkObservableCollection<IAnalogSensor>` and `BulkObservableCollection<ITestSetup>` via `BulkOperations*` methods to use `AddRange`/`RemoveRange` for efficiency.
|
||||
- On `SelectedItems.CollectionChanged`: Updates `ListBox.SelectedItems`.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`StringMetaDataAttr.GetStringMetaData(object o)`**
|
||||
- Only inspects the *member* named by `o.ToString()` (e.g., for `MyEnum.ValueX`, looks for `MyEnum.ValueX` field/property).
|
||||
- Returns `null` if `o` is `null`, member lookup fails, or attribute is absent.
|
||||
- Does *not* inspect attributes on the *type* of `o`, only its *member*.
|
||||
|
||||
- **`TrimTextBoxBehavior`**
|
||||
- Only trims on `LostFocus`. Does *not* trim on input, typing, or `GotFocus`.
|
||||
- Only updates the binding source if the trimmed text differs from current text.
|
||||
|
||||
- **`InteractivityItems.Template`**
|
||||
- The `InteractivityTemplate.LoadContent()` result *must* be an `InteractivityItems` instance (or compatible), otherwise casting fails.
|
||||
- Behavior/trigger addition is *additive*—does not clear existing behaviors/triggers on the target object.
|
||||
|
||||
- **`TextBoxPasteBehavior`**
|
||||
- Only handles `ApplicationCommands.Paste` or a `RoutedUICommand` named `"Paste"`.
|
||||
- Does *not* inspect or modify clipboard content—only invokes the bound `PasteCommand` with the `TextBox` as parameter.
|
||||
- Relies on `ContainerLocator.Container` being initialized (for `IEventAggregator` resolution); failure here may cause silent logging errors.
|
||||
|
||||
- **`MultiSelectionBehavior`**
|
||||
- Requires `SelectedItems` to be an `IList` (not `IEnumerable`) and ideally `INotifyCollectionChanged` for two-way sync.
|
||||
- Uses `SelectedItemsStatus.SetUpdating(...)` to signal bulk operations—consumers *must* respect this flag to avoid spurious notifications.
|
||||
- Type-specific bulk operations (`BulkOperations*`) only apply when `SelectedItems` is a `BulkObservableCollection<T>` with `T` being `IAnalogSensor` or `ITestSetup`.
|
||||
- `AddItems` and `RemoveItems` methods perform null checks; exceptions during item addition are logged via `APILogger.Log(ex)` but do *not* halt processing.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **WPF**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Input`, `System.Windows.Interactivity` (via `Microsoft.Xaml.Behaviors`).
|
||||
- **Prism**: `Prism.Ioc`, `Prism.Events` (`IEventAggregator`, `ContainerLocator`).
|
||||
- **Domain types**:
|
||||
- `DTS.Common.Controls.ChannelCodeBuilder`, `ChannelNameBuilder` (for `MainEditBox`).
|
||||
- `DTS.Common.Interface.Sensors.SensorsList.IAnalogSensor`, `ITestSetup`.
|
||||
- `DTS.Common.Classes.BulkObservableCollection<T>`.
|
||||
- `DTS.Common.Enums`, `DTS.Common.Utilities.Logging.APILogger`, `SelectedItemsStatus`.
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Likely used by UI layers (e.g., XAML views) to attach behaviors declaratively.
|
||||
- `InteractivityItems.Template` is intended for use in XAML `DataTemplate`s to share interactivity logic across controls.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **`StringMetaDataAttr.GetStringMetaData`**
|
||||
- **Misleading name**: Operates on *members* (e.g., enum fields), not the *type* of the object passed. Passing an enum *value* works, but passing a non-enum object (e.g., `new MyClass()`) will likely fail unless `o.ToString()` matches a member name.
|
||||
- Uses `GetMember(o.ToString())`, which is case-sensitive and may fail if `ToString()` is overridden unexpectedly.
|
||||
|
||||
- **`TrimTextBoxBehavior`**
|
||||
- Does *not* handle `TextChanged` or validation—trimming happens only on `LostFocus`, which may cause UX surprises if binding updates are deferred.
|
||||
|
||||
- **`InteractivityItems.Template`**
|
||||
- `OnTemplateChanged` assumes `LoadContent()` returns an `InteractivityItems` instance. If the XAML template is malformed or returns a different type, a runtime cast exception occurs.
|
||||
|
||||
- **`TextBoxPasteBehavior`**
|
||||
- Clipboard text is retrieved (`Clipboard.GetText()`) but *never used*—the `PasteCommand` receives the `TextBox` as parameter, but the command implementation must handle clipboard content itself.
|
||||
- Uses `ContainerLocator.Container` (static), which may cause issues in test scenarios or if Prism container initialization is delayed.
|
||||
|
||||
- **`MultiSelectionBehavior`**
|
||||
- **Critical**: The `SelectedItems` list *must* be mutable and support `Add`/`Remove`/`Clear`. If it’s read-only (e.g., `IList` wrapping an array), runtime exceptions occur.
|
||||
- Bulk operations (`BulkOperations*`) only trigger for *exact* type matches: `BulkObservableCollection<IAnalogSensor>` or `BulkObservableCollection<ITestSetup>`. Other generic instantiations (e.g., `BulkObservableCollection<DerivedSensor>`) fall back to per-item operations.
|
||||
- `SelectedItemsStatus.SetUpdating(...)` is used internally, but its implementation (`SelectedItemsStatus` class) is *not* provided in the source—consumers must ensure it’s correctly implemented to avoid infinite loops or missed updates.
|
||||
|
||||
- **General**:
|
||||
- All behaviors assume WPF’s `Interaction` service is available (via `Microsoft.Xaml.Behaviors`).
|
||||
- No explicit disposal/cleanup in `MultiSelectionBehavior` for event handlers beyond `OnDetaching`—re-attaching may cause duplicate subscriptions if not handled carefully.
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/BusyIndicatorManager/xBusyIndicator.xaml.cs
|
||||
- Common/DTS.Common/BusyIndicatorManager/BusyIndicatorManager.cs
|
||||
generated_at: "2026-04-16T02:51:55.325916+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "abbbba42817259f5"
|
||||
---
|
||||
|
||||
# BusyIndicatorManager
|
||||
|
||||
## Documentation: BusyIndicatorManager Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module provides a centralized, singleton-based busy indicator management system for WPF applications using Prism. It coordinates multiple concurrent "busy sessions" (identified by integer IDs) and ensures the UI busy indicator reflects the aggregate state: if *any* session is active, the indicator is shown with the message from the *most recently added or updated* active session. It decouples business logic from UI presentation by exposing observable properties (`IsBusy`, `Message`) that can be bound to a `BusyIndicator` control (e.g., `Xceed.Wpf.Toolkit.BusyIndicator`), while allowing multiple components to request and release busy state independently without interfering with each other.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `BusyIndicatorManager` (Singleton Class)
|
||||
- **`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 session is currently active. Raises `PropertyChanged` on change (via `BindableBase`).
|
||||
*Note:* Set only internally via `RaisePropertyChanged`.
|
||||
|
||||
- **`public string Message { get; }`**
|
||||
Read-only property containing the message to display in the busy indicator. Reflects the message of the *last added/updated* active session (see `ShowBusy`/`CloseBusy` logic). Raises `PropertyChanged` on change.
|
||||
|
||||
- **`public void ShowBusy(int id, string busyMessage)`**
|
||||
Registers or updates a busy session identified by `id`.
|
||||
- If `id` is new: adds `(id, busyMessage)` to `busyParameters`, sets `IsBusy = true`, and sets `Message = busyMessage`.
|
||||
- If `id` already exists: updates its message in `busyParameters`, sets `IsBusy = true`, and sets `Message = busyMessage` (i.e., *always* updates to the latest message for this session).
|
||||
|
||||
- **`public void CloseBusy(int id)`**
|
||||
Removes the busy session identified by `id`.
|
||||
- If `id` exists: removes it from `busyParameters`.
|
||||
- After removal:
|
||||
- If `busyParameters.Count == 0`: sets `IsBusy = false`, `Message = string.Empty`.
|
||||
- Else: sets `IsBusy = true`, `Message = busyParameters.Last().Value` (i.e., message from the *last-enumerated* remaining session — *not necessarily the most recent*).
|
||||
|
||||
#### `xBusyIndicator` (Partial Class)
|
||||
- **`public xBusyIndicator()`**
|
||||
Constructor. Calls `InitializeComponent()` to load XAML resources.
|
||||
|
||||
- **`public void Connect(int connectionId, object target)`**
|
||||
*Currently empty implementation.* No behavior defined in source. Purpose unclear without additional context.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **Session uniqueness**: Each `id` passed to `ShowBusy`/`CloseBusy` must be unique *per caller* to avoid unintended overwrites or conflicts. The manager does not enforce uniqueness across callers.
|
||||
- **Message semantics**: `Message` always reflects the value of the *last entry* in the `busyParameters` dictionary (via `Last()`), which depends on dictionary enumeration order (insertion order in .NET 6+ for `Dictionary<TKey, TValue>`). This is *not* guaranteed to be the *most recently added* session if sessions are closed/reopened.
|
||||
- **State consistency**: `IsBusy` is `true` iff `busyParameters.Count > 0`.
|
||||
- **Thread safety**: Singleton instantiation is thread-safe via `lock(SyncRoot)`. However, *all other methods (`ShowBusy`, `CloseBusy`)* are **not thread-safe** — concurrent calls may corrupt `busyParameters` (e.g., race in `ContainsKey`/`Add`/`Remove`).
|
||||
- **No cleanup on ID reuse**: Reusing an `id` after `CloseBusy(id)` will overwrite the previous session’s message (via `ShowBusy`), but no explicit cleanup of stale references occurs beyond the dictionary update.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **Prism.Mvvm**: Used via `BindableBase` for property change notification (`RaisePropertyChanged`).
|
||||
- **System.Collections.Generic**: For `Dictionary<int, string>`.
|
||||
- **System.Linq**: For `Dictionary.Last()` in `CloseBusy`.
|
||||
- **Xceed.Wpf.Toolkit**: Referenced via `BusyIndicator` usage (implied by `xBusyIndicator.xaml`), though not directly used in the C# code shown.
|
||||
- **WPF**: `System.Windows.Controls` (likely for `BusyIndicator` control usage in XAML).
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Any UI component needing to show/hide a busy indicator must reference `DTS.Common.BusyIndicatorManager` and use `BusyIndicatorManager.Instance.ShowBusy(...)` / `CloseBusy(...)`.
|
||||
- `xBusyIndicator.xaml` (WPF user control) likely binds to `BusyIndicatorManager.Instance.IsBusy` and `Message` (though binding logic is not in the provided source).
|
||||
- *Inferred usage pattern*: Components call `ShowBusy(id, msg)` before long-running operations and `CloseBusy(id)` afterward (e.g., in `try/finally` blocks).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Non-deterministic message on partial close**: In `CloseBusy`, `Message` is set to `busyParameters.Last().Value`. Since `Dictionary<TKey, TValue>` enumeration order is insertion order (in modern .NET), this uses the *oldest remaining session*’s message — *not* the most recently added one. This may cause confusing UI behavior if sessions overlap.
|
||||
- **No ID validation**: `ShowBusy` and `CloseBusy` accept any `int id`. Negative or zero IDs are allowed but may cause conflicts if callers reuse IDs carelessly.
|
||||
- **Thread-unsafety**: Methods `ShowBusy` and `CloseBusy` lack synchronization. Concurrent calls (e.g., from background threads) may cause `InvalidOperationException` (e.g., modifying collection during enumeration) or inconsistent state.
|
||||
- **Empty `Connect` method**: The `xBusyIndicator.Connect` method has no implementation. Its purpose is unclear — possibly a placeholder for future binding logic or event wiring.
|
||||
- **No timeout/cleanup mechanism**: Idle busy sessions (e.g., due to exceptions skipping `CloseBusy`) persist indefinitely until manually closed.
|
||||
- **Message overwrites**: Calling `ShowBusy(id, msg)` for an existing `id` overwrites the message but does *not* reset the session’s position in the dictionary (so `Last()` may still refer to an older session).
|
||||
|
||||
*None identified from source alone.*
|
||||
→ *Correction:* Several gotchas *are* apparent (see above).
|
||||
234
enriched-qwen3-coder-next/Common/DTS.Common/Classes.md
Normal file
234
enriched-qwen3-coder-next/Common/DTS.Common/Classes.md
Normal file
@@ -0,0 +1,234 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/UnityExtensions.cs
|
||||
- Common/DTS.Common/Classes/StatusAndProgressBarEventArgs.cs
|
||||
- Common/DTS.Common/Classes/Singleton.cs
|
||||
- Common/DTS.Common/Classes/BulkObservableCollection.cs
|
||||
- Common/DTS.Common/Classes/RegionNames.cs
|
||||
- Common/DTS.Common/Classes/ImportData.cs
|
||||
- Common/DTS.Common/Classes/ServiceCall.cs
|
||||
- Common/DTS.Common/Classes/TagAwareBase.cs
|
||||
- Common/DTS.Common/Classes/Utility.cs
|
||||
- Common/DTS.Common/Classes/Tags.cs
|
||||
generated_at: "2026-04-16T02:52:41.721329+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b71265395aaf09cd"
|
||||
---
|
||||
|
||||
# DTS.Common Classes Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides foundational infrastructure utilities for the DTS application platform, focusing on dependency injection (via Unity), UI state management (status/progress), singleton pattern enforcement, high-performance collection operations, service orchestration, database-backed tagging system, and robust data access helpers. It serves as a shared library across the application to standardize common patterns, reduce boilerplate, and ensure thread-safe, consistent behavior for core operations like service queuing, tag management, and database interaction.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `UnityExtensions`
|
||||
- **`T TryResolve<T>(this IUnityContainer container) where T : class`**
|
||||
Safely resolves a service of type `T` from the Unity container, returning `null` instead of throwing on failure.
|
||||
|
||||
### `StatusAndProgressBarEventArgs`
|
||||
- **Properties**
|
||||
- `StatusColor`: `Color` – UI color for status indication.
|
||||
- `StatusText`: `string` – Human-readable status message.
|
||||
- `ProgressValue`: `double` – Numeric progress (e.g., 0.0–1.0 or 0–100).
|
||||
- `ProgressBarVisibility`: `Visibility` – Controls whether the progress bar is visible.
|
||||
- `Requester`: `IBaseViewModel` – Originator of the status update.
|
||||
- `ErrorText`: `string` – Optional error message to display.
|
||||
|
||||
### `Singleton<T>`
|
||||
- **`protected Singleton()`**
|
||||
Constructor enforces singleton usage: throws `InvalidOperationException` if called directly (i.e., via `new T()` instead of `T.Instance`).
|
||||
- **`public static T Instance`**
|
||||
Gets the singleton instance. Throws the exception captured during static initialization if instance creation failed.
|
||||
|
||||
### `BulkObservableCollection<T>`
|
||||
- **`void AddRange(IEnumerable<T> items)`**
|
||||
Adds multiple items to the collection and fires a single `NotifyCollectionChangedAction.Reset` notification instead of per-item notifications. Logs exceptions via `APILogger`.
|
||||
- **`void RemoveRange(IEnumerable<T> itemsToRemove)`**
|
||||
Removes multiple items and fires a single `Reset` notification. Logs exceptions via `APILogger`.
|
||||
|
||||
### `RegionNames`
|
||||
- **Constants**
|
||||
Static string constants defining Prism region names used for UI composition (e.g., `"FrontRegion"`, `"MainRegion"`, `"ViewerGraphMainRegion"`, `"MenuRegion"`). No methods.
|
||||
|
||||
### `ImportData`
|
||||
- **`enum ImportPageType`**
|
||||
- `ImportSensor`, `ImportTestSetup`
|
||||
- **`class SensorImportData`**
|
||||
Holds parsed sensor import data:
|
||||
- `GroupNameSensorListLookup`: `Dictionary<string, List<string>>`
|
||||
- `SensorGroupNameLookup`, `SensorGroupTypeLookup`, `GroupNameTestObjectLookup`: `Dictionary<string, string>`
|
||||
- `Errors`: `List<string>`
|
||||
- `SensorISOCode`, `SensorISOChannelName`, `SensorUserCode`, `SensorUserChannelName`, `SensorDASSerialNumber`: `Dictionary<string, string>`
|
||||
- `SensorChannelIndex`: `Dictionary<string, int>`
|
||||
- **`class TestSetupImportData`**
|
||||
Holds parsed test setup import data:
|
||||
- `Name`, `Description`: `string`
|
||||
- `SamplesPerSecond`, `PosttriggerSeconds`, `PretriggerSeconds`: `double`
|
||||
- `RecordingMode`, `CalibrationBehavior`: Enum values
|
||||
- `Version`: `int`
|
||||
- `TestChannelOrders`, `Tags`: `List<string>`
|
||||
- Clock configuration properties: `ClockMasterInput`, `ClockMasterOutput`, `ManageClocksOutsideOfDataPROMaster`, etc.
|
||||
- `SampleRateForDAS`, `DomainIdForDAS`, `IsClockMaster`: `Dictionary<string, ...>`
|
||||
|
||||
### `ServiceCall`
|
||||
- **`bool Started`**
|
||||
Indicates whether the call has been started.
|
||||
- **`Action WorkAction`**
|
||||
The work to execute.
|
||||
- **`void MarkDone()`**
|
||||
Signals completion by calling `ServiceQueue.MarkFinished(this)`.
|
||||
- **`string Name`**
|
||||
Human-readable identifier.
|
||||
- **`ServiceCall(string name)`**
|
||||
Constructor.
|
||||
|
||||
### `ServiceQueue`
|
||||
- **`static void Enqueue(ServiceCall call)`**
|
||||
Adds a `ServiceCall` to the queue. Starts execution immediately if queue was empty.
|
||||
- **`static void MarkFinished(ServiceCall call)`**
|
||||
Removes the call from the queue and starts the next queued call if any. Handles non-active calls (not at head) by simple removal.
|
||||
|
||||
### `TagAwareBase`
|
||||
- **`enum TagTypes`**
|
||||
`User`, `Group`, `Template`, `TestSetup`, `Sensors`, `SensorModels`
|
||||
- **`abstract TagTypes TagType { get; }`**
|
||||
Must be implemented by derived classes to specify tag type.
|
||||
- **`byte[] TagsBlobBytes`**
|
||||
Gets/sets `TagIDs` as a byte array (for DB storage). Logs exceptions on failure.
|
||||
- **`int[] TagIDs`**
|
||||
Gets/sets the list of tag IDs.
|
||||
- **`void SetTagsFromCommaSeparatedString(string tagText, Tags.GetSqlCommandDelegate getSqlCommand)`**
|
||||
Parses comma-separated tags and sets `TagIDs`.
|
||||
- **`virtual void SetTags(string[] tagsText, Tags.GetSqlCommandDelegate getSqlCommand)`**
|
||||
Adds tags to DB and updates `TagIDs`. Raises `OnPropertyChanged("TagIDs")`.
|
||||
- **`string GetTagsAsCommaSeparatedString(Tags.GetSqlCommandDelegate getSqlCommand)`**
|
||||
Returns tags as comma-separated string.
|
||||
- **`virtual string[] GetTagsArray(Tags.GetSqlCommandDelegate getSqlCommand)`**
|
||||
Returns tag text array.
|
||||
- **`virtual bool TagCompatible(string tags, ...)`**
|
||||
Checks if any tag in the provided comma-separated string matches current tags.
|
||||
- **`virtual bool TagCompatible(int[] tags)`**
|
||||
Checks if any tag ID in `tags` intersects with `TagIDs`.
|
||||
- **`virtual bool HasIntersectingTag(int[] tags)`**
|
||||
Returns `true` if `tags` and `TagIDs` share any ID.
|
||||
- **`void InsertTagsFromCommaSeparatedString(int id, TagTypes tagType, string tags, ...)`**
|
||||
Sets tags and commits assignments.
|
||||
- **`void Commit(int id, TagTypes tagType, ...)`**
|
||||
Deletes existing tag assignments for the object, then inserts new assignments for `TagIDs`. Uses stored procedures `sp_TagAssignmentsDelete` and `sp_TagAssignmentsInsert`.
|
||||
- **`List<int> GetTagIdList(int objectId, TagTypes tagType, ...)`**
|
||||
Retrieves tag IDs for an object from DB via `sp_TagAssignmentsGet`. Logs failures.
|
||||
|
||||
### `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 and fixed buffer. Returns `true` on success.
|
||||
- **`static T GetX(IDataReader reader, string column, T defaultValue = default)`**
|
||||
Generic pattern for safe column extraction:
|
||||
- `GetUShort`, `GetUInt`, `GetString`, `GetStringArray`, `GetInt`, `GetDouble`, `GetShort`, `GetNullableDateTime`, `GetUlong`, `GetNullableInt`, `GetByteArray`, `GetBool`, `GetDateTime`, `GetLong`
|
||||
All return `defaultValue` on `DBNull`, parse failure, or invalid column. Logs parse failures via `APILogger`.
|
||||
|
||||
### `Tags`
|
||||
- **`class Tag`**
|
||||
- `const int INVALID_ID = -1`
|
||||
- `int ID`, `string Text`, `bool IsObsolete`
|
||||
- Constructors: `(string, int)`, `(Tag)`, `(IDataRecord)`, `(DataRow)`
|
||||
- `object Clone()` → `new Tag(this)`
|
||||
- **`delegate SqlCommand GetSqlCommandDelegate(bool bNewConnection)`**
|
||||
Factory for database commands.
|
||||
- **`static Tags GetTagsInstance(GetSqlCommandDelegate getSqlCommand)`**
|
||||
Gets singleton instance (lazy-initialized).
|
||||
- **`static bool AddTag(string tagText, ...)`**
|
||||
Adds tag to DB if not present. Returns `true` if added.
|
||||
- **`static bool MigrateTag(string tagText, ...)`**
|
||||
Commits tag (used for DB migration).
|
||||
- **`static bool[] AddRange(string[] tagText, ...)`**
|
||||
Adds multiple tags. Trims leading whitespace before adding.
|
||||
- **`static int GetIDFromTagText(string tagText, ...)`**
|
||||
Gets tag ID from DB (returns `Tag.INVALID_ID` if not found).
|
||||
- **`static int[] GetIDsFromTagText(string[] tagText, ...)`**
|
||||
Gets tag IDs for array of texts. Filters out `INVALID_ID`.
|
||||
- **`static string GetTagTextFromID(int tagID, ...)`**
|
||||
Gets tag text from memory cache (returns `null` if invalid/missing).
|
||||
- **`static string[] GetTagTextFromIDs(int[] tagId, ...)`**
|
||||
Gets tag texts from IDs. Filters invalid/whitespace.
|
||||
- **`bool ContainsTag(string text)`**
|
||||
Checks if tag exists in memory cache.
|
||||
- **`void UpdateList(GetSqlCommandDelegate getSqlCommand)`**
|
||||
Refreshes memory cache from DB via `sp_TagsGet`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Singleton<T>**:
|
||||
- Only one instance per `T` exists. Attempting `new T()` throws `InvalidOperationException`.
|
||||
- Static constructor exceptions are captured and rethrown on `Instance` access.
|
||||
|
||||
- **BulkObservableCollection<T>**:
|
||||
- `AddRange`/`RemoveRange` fire exactly one `Reset` notification per call, regardless of item count.
|
||||
- `CheckReentrancy()` is called before modifications to prevent reentrancy issues.
|
||||
|
||||
- **ServiceQueue**:
|
||||
- Only one `ServiceCall` executes at a time (via `Task.Run`).
|
||||
- Calls are processed in FIFO order.
|
||||
- `MarkFinished` only advances the queue if the finished call is the head of the queue.
|
||||
|
||||
- **Tags**:
|
||||
- Tags are immutable (no rename/delete/obsolete support).
|
||||
- Memory cache (`_tagsLookup`) is lazily populated and updated only via `AddTag`, `MigrateTag`, or `UpdateList`.
|
||||
- `Tag.INVALID_ID` (`-1`) is used to indicate missing tags.
|
||||
|
||||
- **TagAwareBase**:
|
||||
- `TagIDs` is never `null` (defaults to `new int[0]`).
|
||||
- `Commit` deletes existing assignments before inserting new ones.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
- **Imports/References**:
|
||||
- `Unity` (Microsoft Unity Container)
|
||||
- `System.Windows` (`Color`, `Visibility`)
|
||||
- `System.Data`, `System.Data.SqlClient` (ADO.NET)
|
||||
- `DTS.Common.Base` (`BasePropertyChanged`, `IBaseViewModel`)
|
||||
- `DTS.Common.Enums` (`RecordingModes`, `CalibrationBehaviors`, `InputClockSource`, `OutputClockSource`)
|
||||
- `DTS.Common.Interface.Sensors` (`ISensor`)
|
||||
- `DTS.Common.Utilities.Logging` (`APILogger`)
|
||||
|
||||
- **Depended upon by**:
|
||||
- UI layers (via `RegionNames`, `StatusAndProgressBarEventArgs`)
|
||||
- Data import modules (`ImportData`)
|
||||
- Service orchestration consumers (`ServiceQueue`)
|
||||
- Tag-aware entities (`TagAwareBase`)
|
||||
- Database access layers (`Utility`, `Tags`)
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`Singleton<T>`**:
|
||||
- Static initialization exceptions are logged to `Console.WriteLine` (not `APILogger`).
|
||||
- The singleton instance is created on first `Instance` access, not on module load.
|
||||
|
||||
- **`BulkObservableCollection<T>`**:
|
||||
- `AddRange`/`RemoveRange` use `NotifyCollectionChangedAction.Reset`, which may cause UI controls to re-render entirely (not incremental updates).
|
||||
- Exceptions in `AddRange`/`RemoveRange` are silently logged and do not propagate.
|
||||
|
||||
- **`ServiceQueue`**:
|
||||
- `ServiceCall.Started` is used to prevent duplicate execution, but there is no cancellation mechanism.
|
||||
- Non-active calls (not at head) are removed from the queue without execution.
|
||||
|
||||
- **`Tags`**:
|
||||
- Memory cache (`_tagsLookup`) is *not* automatically updated after `AddTag`/`MigrateTag` (only updated on `UpdateList` or explicit `Commit`).
|
||||
- `GetTagTextFromID` reads from cache only; if cache is stale, it may return `null` for valid IDs.
|
||||
|
||||
- **`TagAwareBase`**:
|
||||
- `RemoveTags` is a stub (empty implementation).
|
||||
- `SetTagsFromCommaSeparatedString` does *not* skip empty strings (despite commented-out null check referencing FogBugz #7176).
|
||||
|
||||
- **`Utility`**:
|
||||
- `PingNetwork` uses a fixed 32-byte buffer and 4-second timeout.
|
||||
- All `GetX` methods return `defaultValue` on parse failure without rethrowing.
|
||||
|
||||
- **`ImportData.TestSetupImportData`**:
|
||||
- Clock master/slave properties (`ClockMasterInput`, `ClockMasterOutput`, etc.) default to `None` and `false`.
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/ChannelCodes/TextPastedArgs.cs
|
||||
- Common/DTS.Common/Classes/ChannelCodes/ChannelCode.cs
|
||||
generated_at: "2026-04-16T03:15:37.036883+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "936720bfac8d31e1"
|
||||
---
|
||||
|
||||
# ChannelCodes
|
||||
|
||||
## Documentation: ChannelCode Module
|
||||
|
||||
### 1. Purpose
|
||||
This module provides core data structures and command logic for handling channel codes in the DTS system. It defines the `ChannelCode` class (a concrete implementation of `IChannelCode`) that represents a channel with an identifier, code string, name, type (User/ISO), and status, and includes constructors for instantiation from database readers or other channel codes. It also defines `TextPastedArgs`, a data carrier for paste events, and `PasteCommandClass`, a `ICommand` implementation that intercepts text paste operations on UI text boxes, processes clipboard content, and publishes structured events (`TextPastedEvent`) when multi-field or structured paste occurs—while allowing simple single-field pastes to be handled by standard text change logic. The module supports UI binding, event-driven architecture (via Prism’s `IEventAggregator`), and ISO code coercion via a delegate.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TextPastedArgs` class
|
||||
- **`TextPastedArgs(string text, IChannelCode channelCode, string id, object tag)`**
|
||||
Constructor. Initializes a new instance with the pasted `text`, the `channelCode` (used as `Sender`), a unique `id` (e.g., `"ChannelCode"`), and an arbitrary `tag` (typically from the UI element).
|
||||
- **`string Text { get; }`**
|
||||
The raw text content that was pasted (from clipboard).
|
||||
- **`object Sender { get; }`**
|
||||
The `IChannelCode` instance associated with the paste operation (set from the `channelCode` parameter).
|
||||
- **`string Id { get; }`**
|
||||
A string identifier for the paste operation (e.g., `"ChannelCode"`).
|
||||
- **`object Tag { get; }`**
|
||||
The `Tag` property of the UI element (e.g., `TextBox`) where the paste occurred.
|
||||
|
||||
#### `ChannelCode` class
|
||||
- **`ChannelCode(IDataReader reader, IReadOnlyDictionary<short, string> channelTypeLookup)`**
|
||||
Constructor. Populates the instance from an `IDataReader` by reading `"Id"`, `"Code"`, `"CodeTypeInt"`, and `"Name"` fields. Uses `channelTypeLookup` to map `CodeTypeInt` to `ChannelCodeType.User` or `.ISO`.
|
||||
- **`ChannelCode()`**
|
||||
Default constructor. Initializes `CodeType` to `ChannelCodeType.ISO`.
|
||||
- **`ChannelCode(IChannelCode channelCode)`**
|
||||
Copy constructor. Copies `Id`, `Code`, `Name`, and `CodeType` from another `IChannelCode`.
|
||||
- **`int Id { get; set; }`**
|
||||
The numeric identifier of the channel code. Initialized to `-1` by default.
|
||||
- **`UIItemStatus ItemStatus { get; set; }`**
|
||||
Status of the item (e.g., Added, Modified, Deleted). Initialized to `UIItemStatus.None`.
|
||||
- **`string Code { get; set; }`**
|
||||
The code string (e.g., `"A1"`). Protected backing field `_code`.
|
||||
- **`string Name { get; set; }`**
|
||||
The human-readable name. Protected backing field `_name`.
|
||||
- **`ChannelCodeType CodeType { get; set; }`**
|
||||
Enumerated type of the code (`User` or `ISO`).
|
||||
- **`const string PASTE_ID = "ChannelCode"`**
|
||||
A constant identifier used for paste operations (note: `PasteCommandClass` uses its own `Id` parameter, not this constant).
|
||||
- **`ICommand PasteCommand { get; set; } = null`**
|
||||
Command bound to paste operations (e.g., Ctrl+V). Defaults to `null` to avoid exceptions during UI construction.
|
||||
- **`override bool Equals(object obj)`**
|
||||
Compares two `ChannelCode` instances for equality based on `Code`, `Name`, and `CodeType` (case-sensitive string equality). Returns `false` if `obj` is not a `ChannelCode`.
|
||||
- **`~ChannelCode()`**
|
||||
Finalizer. Clears `_code` and `_name` to `null` to reduce memory footprint if the object is held longer than expected before cleanup.
|
||||
|
||||
#### `PasteCommandClass` class
|
||||
- **`PasteCommandClass(string id)`**
|
||||
Constructor. Stores the `id` in the `Id` property.
|
||||
- **`string Id { get; }`**
|
||||
Identifier for this paste command instance (e.g., `"ChannelCode"` or a unique control ID).
|
||||
- **`bool CanExecute(object parameter)`**
|
||||
Always returns `true`.
|
||||
- **`void Execute(object parameter)`**
|
||||
Executes the paste logic:
|
||||
- Validates `parameter` is a `TextBox`.
|
||||
- Resolves `IChannelCode` from `TextBox.DataContext`, supporting `ChannelCodeBuilder` and `ChannelNameBuilder` wrappers.
|
||||
- Reads clipboard text.
|
||||
- If clipboard text is a single line *without* delimiters (`,`, `;`, `\t`), publishes `PageModifiedEvent` and returns early (no structured paste).
|
||||
- Otherwise, clears `Code` and `Name` (via self-assignment to trigger property change), then publishes `TextPastedEvent` with a `TextPastedArgs` instance containing the clipboard text, channel code, `Id`, and `TextBox.Tag`.
|
||||
- Catches exceptions and publishes `PageErrorEvent` with the error message.
|
||||
- **`event EventHandler CanExecuteChanged`**
|
||||
Required by `ICommand`; not raised by this implementation.
|
||||
|
||||
#### `CoerceISOCodeDelegate` delegate
|
||||
- **`string CoerceISOCodeDelegate(string val, bool uniqueISOCodesRequired, bool useISOCodeFilterMapping)`**
|
||||
A delegate for custom logic to transform or validate an incoming ISO code string (`val`) before assignment, based on system constraints (`uniqueISOCodesRequired`, `useISOCodeFilterMapping`). Used to enforce ISO code uniqueness or apply filtering rules.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **`ChannelCode.Code` and `ChannelCode.Name` must be non-null strings** (though they may be empty). The `Code` and `Name` properties use `SetProperty`, implying change notifications are raised on assignment.
|
||||
- **`ChannelCode.Id` defaults to `-1`** and is only valid when set to a non-negative integer (typically from database).
|
||||
- **`ChannelCode.CodeType` defaults to `ChannelCodeType.ISO`** when constructed via the parameterless constructor.
|
||||
- **`TextPastedArgs.Text` is the raw clipboard content** at the time of paste, including any embedded delimiters.
|
||||
- **`TextPastedArgs.Sender` is always the resolved `IChannelCode` instance** (or `null` if resolution fails—though the `PasteCommandClass.Execute` method returns early if resolution fails, so `Sender` should never be `null` in published events).
|
||||
- **`PasteCommandClass.CanExecute` always returns `true`**, meaning paste is always enabled in the UI.
|
||||
- **Single-line, non-delimited paste bypasses `TextPastedEvent`** and only triggers `PageModifiedEvent`.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on:**
|
||||
- `DTS.Common.Events` (for `PageModifiedEvent`, `TextPastedEvent`, `PageErrorEvent`, `PageModifiedArg`, `TextPastedArgs`, `PageErrorArg`).
|
||||
- `DTS.Common.Interface.Channels.ChannelCodes` (for `IChannelCode` interface).
|
||||
- `Prism.Events` (for `IEventAggregator`).
|
||||
- `Prism.Ioc` (for `ContainerLocator.Container`).
|
||||
- `DTS.Common.Base` (for `BasePropertyChanged`, enabling `INotifyPropertyChanged`).
|
||||
- `DTS.Common.Controls`, `DTS.Common.Enums`, `DTS.Common.Enums.Channels` (for `UIItemStatus`, `ChannelEnumsAndConstants`, `ChannelCodeType`).
|
||||
- `System.Data` (`IDataReader`), `System.Windows` (`TextBox`, `ICommand`), `System.Windows.Controls`.
|
||||
- `DTS.Common.Utility` (for `Utility.GetInt`, `Utility.GetString`, `Utility.GetShort`).
|
||||
|
||||
- **Depended on by:**
|
||||
- UI components (e.g., `TextBox` controls) that bind `PasteCommand` to `PasteCommandClass`.
|
||||
- Event handlers for `TextPastedEvent` (to process structured paste).
|
||||
- `ChannelCodeBuilder` and `ChannelNameBuilder` (implied by `PasteCommandClass.Execute` checking for their `DataContext`).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **`PASTE_ID` constant is unused in `PasteCommandClass`**: The `PasteCommandClass` uses its own `Id` parameter (passed to its constructor) instead of the `ChannelCode.PASTE_ID` constant. This may cause confusion if expecting consistency.
|
||||
- **Self-assignment of `Code`/`Name` in `Execute`**: The lines `channelCode.Code = channelCode.Code;` are used to trigger property change notifications *without* modifying the value. This is a workaround to force UI updates before publishing `TextPastedEvent`.
|
||||
- **`PasteCommand` defaults to `null`**: To avoid exceptions during UI construction (per comment), `PasteCommand` is not initialized. UI must explicitly assign a `PasteCommandClass` instance.
|
||||
- **`Equals` ignores `Id`**: Two `ChannelCode` instances with different `Id` but identical `Code`, `Name`, and `CodeType` are considered equal. This may be intentional for business logic (e.g., comparing definitions) but could cause issues if `Id` is expected to be unique.
|
||||
- **`CanExecuteChanged` is never raised**: `PasteCommandClass` implements `ICommand` but does not raise `CanExecuteChanged`. UI frameworks relying on this event (e.g., WPF) may not update command availability dynamically.
|
||||
- **Clipboard access is synchronous**: `Clipboard.GetText()` is called directly in `Execute`, which may block the UI thread or throw if clipboard access is denied. Error handling only captures exceptions and publishes `PageErrorEvent`.
|
||||
- **`TextPastedArgs.Sender` is typed as `object`**: Though it is always an `IChannelCode`, the interface uses `object` instead of `IChannelCode`, requiring casting by consumers.
|
||||
116
enriched-qwen3-coder-next/Common/DTS.Common/Classes/ClockSync.md
Normal file
116
enriched-qwen3-coder-next/Common/DTS.Common/Classes/ClockSync.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/ClockSync/IClockSyncProfile.cs
|
||||
- Common/DTS.Common/Classes/ClockSync/ClockSyncProfile.cs
|
||||
- Common/DTS.Common/Classes/ClockSync/ClockSyncProfileConverter.cs
|
||||
- Common/DTS.Common/Classes/ClockSync/ClockSyncProfileCollection.cs
|
||||
generated_at: "2026-04-16T03:15:09.204079+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e412b56844d5af45"
|
||||
---
|
||||
|
||||
# ClockSync
|
||||
|
||||
## Documentation: Clock Sync Profile Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines and manages clock synchronization profiles for the DTS system, enabling configuration of different master clock input sources (e.g., PTP IEEE 1588, IRIG-B, GPS, 1PPS). It provides a singleton collection (`ClockSyncProfileCollection`) that loads profile definitions from an XML file (`ClockSyncProfiles.xml`), falling back to a default set if the file is missing. Profiles are represented by the `ClockSyncProfile` class, which implements the `IClockSyncProfile` interface and supports metadata-driven initialization from an enum (`ClockSyncProfileDefaults`). The module also includes a type converter (`ClockSyncProfileConverter`) for UI integration (e.g., property grids), ensuring only visible profiles are exposed and sorted by display order.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `IClockSyncProfile` (Interface)
|
||||
- **`int ProfileId { get; set; }`**
|
||||
Unique integer identifier for the profile.
|
||||
- **`string ProfileName { get; set; }`**
|
||||
Human-readable name of the profile (e.g., `"PTP IEEE 1588"`).
|
||||
- **`string ProfileDesc { get; set; }`**
|
||||
Description of the profile’s behavior or purpose.
|
||||
- **`int DisplayOrder { get; set; }`**
|
||||
Integer priority for ordering profiles in UI (lower values appear first).
|
||||
- **`bool Visible { get; set; }`**
|
||||
Flag indicating whether the profile should be shown in UI (e.g., property grids).
|
||||
- **`DASRestriction[] FilterRestrictions { get; set; }`**
|
||||
Array of restrictions (of type `DASRestriction`) applied to the profile; used to filter applicable DAS configurations.
|
||||
|
||||
#### `ClockSyncProfile` (Concrete Implementation)
|
||||
- **`ClockSyncProfile()`**
|
||||
Parameterless constructor for deserialization.
|
||||
- **`ClockSyncProfile(int profileId, string profileName, string profileDesc, int displayOrder, bool visible, DASRestriction[] filterRestrictions)`**
|
||||
Initializes a profile with explicit values via `Initialize()`.
|
||||
- **`ClockSyncProfile(ClockSyncProfileCollection.ClockSyncProfileDefaults defaults, DASRestriction[] restrictions)`**
|
||||
Initializes a profile by extracting metadata (name, description, order, visibility) from the `ClockSyncProfileDefaults` enum using reflection on `[Display]` and `[Browsable]` attributes, then calls `Initialize()`.
|
||||
- **`override string ToString()`**
|
||||
Returns `ProfileName`.
|
||||
|
||||
#### `ClockSyncProfileConverter` (Type Converter)
|
||||
- **`ClockSyncProfile[] Values { get; }`**
|
||||
Lazily-initialized array of *visible* profiles from the singleton collection, sorted by `DisplayOrder`. Thread-safe via `lock`.
|
||||
- **`override bool CanConvertFrom(...)`**
|
||||
Returns `true` if `sourceType == typeof(string)` (enables string-to-profile conversion by name).
|
||||
- **`override object ConvertFrom(...)`**
|
||||
Converts a string (profile name) to a `ClockSyncProfile` instance by matching `ProfileName` in `Values`. Returns `null` if no match.
|
||||
- **`override bool GetStandardValuesSupported(...)`**
|
||||
Returns `true` (indicates standard values are available).
|
||||
- **`override bool GetStandardValuesExclusive(...)`**
|
||||
Returns `true` (indicates only standard values are valid; no free-text input).
|
||||
- **`override StandardValuesCollection GetStandardValues(...)`**
|
||||
Returns a `StandardValuesCollection` containing *all* profiles from the singleton collection (including non-visible ones).
|
||||
|
||||
#### `ClockSyncProfileCollection` (Singleton Collection)
|
||||
- **`static ClockSyncProfileCollection GetCollection()`**
|
||||
Thread-safe singleton accessor. Loads profiles from `ClockSyncProfiles.xml` (creating it with defaults if missing).
|
||||
- **`ClockSyncProfile GetClockSyncProfile(string s)`**
|
||||
Returns the first profile matching `ProfileName == s`. If no match, returns the profile with `ProfileId == 0` (typically `"None"`). If neither exists, returns the first item in the collection.
|
||||
- **Constants**:
|
||||
- `NONE_NAME`, `PTPIEEE1588_NAME`, `IRIGB1PPS_NAME`, `GPS1PPS_NAME`, `IRIGB_NAME`, `_1PPS_NAME`
|
||||
Hardcoded string constants for profile names (e.g., `"PTP IEEE 1588"`).
|
||||
- **`ClockSyncProfileDefaults` Enum**:
|
||||
Defines default profile types with `[Display]` and `[Browsable]` attributes:
|
||||
- `None` (ID=0)
|
||||
- `PTPIEEE1588` (ID=1)
|
||||
- `IRIGB1PPS` (ID=2)
|
||||
- `GPS1PPS` (ID=4)
|
||||
- `IRIGB` (ID=8)
|
||||
- `_1PPS` (ID=16)
|
||||
Values use bit-shifted powers of two (e.g., `1 << 0`, `1 << 1`), but IDs are cast to `int` directly in `GetProfileInfo()`.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **Singleton Consistency**: `GetCollection()` always returns the same instance after first initialization.
|
||||
- **Profile Visibility Filtering**: `ClockSyncProfileConverter.Values` only includes profiles where `Visible == true`.
|
||||
- **Display Order Sorting**: `ClockSyncProfileConverter.Values` is sorted ascending by `DisplayOrder` (using `int.MaxValue` as fallback for missing order).
|
||||
- **Fallback Profile Selection**: `GetClockSyncProfile(string)` prioritizes exact name match, then `ProfileId == 0`, then first item.
|
||||
- **XML File Handling**: `ClockSyncProfiles.xml` is auto-generated with defaults if missing; existing file is never overwritten.
|
||||
- **Enum Metadata Dependency**: `ClockSyncProfile`’s enum-based constructor relies on `[Display]` and `[Browsable]` attributes being present on `ClockSyncProfileDefaults` members. Missing attributes cause runtime exceptions (e.g., `IndexOutOfRangeException` on `valueAttributes[0]`).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal Dependencies**:
|
||||
- `DTS.Common.Classes.DSP.DASRestriction` (used in `FilterRestrictions`).
|
||||
- `System.ComponentModel.DataAnnotations` (for `[Display]`, `[Browsable]`).
|
||||
- `System.Xml.Serialization` (for XML serialization/deserialization).
|
||||
- `System.Collections.ObjectModel.Collection<T>` (base class).
|
||||
- **External Dependencies**:
|
||||
- `ClockSyncProfileCollection` depends on `DASRestriction` type (defined elsewhere in `DTS.Common`).
|
||||
- `ClockSyncProfileConverter` depends on `ClockSyncProfileCollection` (singleton access).
|
||||
- **Depended Upon By**:
|
||||
- UI components (e.g., property grids) via `ClockSyncProfileConverter`.
|
||||
- Other modules requiring clock sync configuration (e.g., DSP configuration logic).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Enum ID Mismatch**: `ClockSyncProfileDefaults` uses bit-shifted values (e.g., `1 << 0 = 1`, `1 << 1 = 2`), but `GetProfileInfo()` casts the enum value directly to `int` for `profileId`. This means `IRIGB1PPS` has `ProfileId = 2`, not `1`. Ensure downstream logic does not assume sequential IDs.
|
||||
- **Attribute Dependency**: If `[Display]` or `[Browsable]` attributes are missing on a `ClockSyncProfileDefaults` member, `GetProfileInfo()` throws `IndexOutOfRangeException` (accessing `valueAttributes[0]` without null checks).
|
||||
- **Thread-Safe Lazy Initialization**: `ClockSyncProfileConverter.Values` uses double-checked locking but reinitializes `_values` only once per app domain. Subsequent modifications to the collection (e.g., via `GetCollection().Add(...)`) will *not* update `_values` until the converter is recreated.
|
||||
- **Non-Visible Profiles in StandardValues**: `GetStandardValues()` returns *all* profiles (including non-visible ones), while `Values` returns only visible ones. This inconsistency may confuse consumers expecting uniform filtering.
|
||||
- **Hardcoded XML Filename**: `CLOCKSYNC_PROFILE_XML_FILE = "ClockSyncProfiles.xml"` is hardcoded; no configuration override is provided.
|
||||
- **No Validation on `FilterRestrictions`**: `FilterRestrictions` is a `DASRestriction[]` with no null-checking or validation in constructors. Passing `null` may cause `NullReferenceException` downstream.
|
||||
- **No Profile Modification Support**: The collection is read-only after initialization (via `Collection<T>` base). Adding/removing profiles at runtime requires direct manipulation of `Items`, which bypasses validation.
|
||||
|
||||
None identified beyond these.
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Connection/NotConnectedException.cs
|
||||
generated_at: "2026-04-16T03:14:45.601567+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e5ae1dc6ac386b41"
|
||||
---
|
||||
|
||||
# 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 exists. It serves as a domain-specific error mechanism within the `DTS.Common` library to distinguish connection-state errors from generic application failures, enabling callers to handle disconnection scenarios explicitly.
|
||||
|
||||
2. **Public Interface**
|
||||
- **`NotConnectedException(string message)`**
|
||||
Constructor that initializes a new instance of the exception with a specified error message. Inherits from `ApplicationException`. No additional properties or methods are defined beyond those inherited from `Exception`.
|
||||
|
||||
3. **Invariants**
|
||||
- The exception must always be instantiated with a non-null `message` parameter (enforced by the base `ApplicationException` constructor).
|
||||
- It is a *terminal* exception type—no subclasses or derived types are defined in the provided source.
|
||||
- No state beyond the exception message (inherited from `Exception.Message`) is stored or managed.
|
||||
|
||||
4. **Dependencies**
|
||||
- **Depends on**: `System` namespace (specifically `System.ApplicationException`).
|
||||
- **Used by**: Other modules in the `DTS.Common` namespace (and potentially downstream projects) that manage connection lifecycles and need to throw or catch connection-state errors.
|
||||
- No external project or library dependencies beyond the .NET Framework base class library.
|
||||
|
||||
5. **Gotchas**
|
||||
- The class inherits from `ApplicationException`, which is generally discouraged in modern .NET development in favor of `Exception` or more specific base types; this may reflect legacy design.
|
||||
- No inner exception overload is provided—callers cannot wrap another exception as the cause.
|
||||
- No additional context (e.g., connection ID, endpoint) is captured; callers must embed such details in the `message` string.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,166 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DASFactory/DiagnosticMessageRow.cs
|
||||
- Common/DTS.Common/Classes/DASFactory/TCDiagnosticResult.cs
|
||||
- Common/DTS.Common/Classes/DASFactory/CanDiagnostics.cs
|
||||
- Common/DTS.Common/Classes/DASFactory/TemperatureConfig.cs
|
||||
- Common/DTS.Common/Classes/DASFactory/TMSNConfig.cs
|
||||
generated_at: "2026-04-16T03:17:33.495209+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d29076d9515007bc"
|
||||
---
|
||||
|
||||
# Documentation: DASFactory Diagnostic & Configuration Classes
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides core data structures for representing and managing diagnostic results and configuration data within the DASFactory subsystem. It defines classes to encapsulate CAN bus diagnostics (`CanDiagnostics`), test channel diagnostics (`TCDiagnosticResult`), raw diagnostic message rows (`DiagnosticMessageRow`), and hardware-specific configuration objects for temperature logging (`TemperatureConfig`) and TMNS (Telemetry Network Subsystem) streaming (`TMNSConfig`). These classes serve as standardized data contracts between diagnostic test execution, result reporting, and configuration management layers—primarily supporting CAN BIST (Built-In Self-Test) and environmental monitoring, with extensibility for future hardware types.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DiagnosticMessageRow`
|
||||
- **`DiagnosticMessageRow(string field, string value, string verdict)`**
|
||||
Constructor initializing all three properties. Used to hold a single diagnostic message row (e.g., from CAN BIST output).
|
||||
- **`Field` (string, get/set)**
|
||||
Name of the diagnostic field (e.g., "ErrorCounter", "StatusRegister").
|
||||
- **`Value` (string, get/set)**
|
||||
String representation of the diagnostic value.
|
||||
- **`Verdict` (string, get/set)**
|
||||
Pass/fail/other verdict for the field.
|
||||
- **`ToString()` (override)**
|
||||
Returns formatted string: `"Field: {Field}, Value: {Value}, Verdict: {Verdict}"`.
|
||||
|
||||
### `TCDiagnosticResult`
|
||||
- **`ChannelName` (string, get/set)**
|
||||
Human-readable name of the test channel.
|
||||
- **`ChannelIndex` (int, get/set)**
|
||||
Numeric index of the test channel.
|
||||
- **`CurrentReading` (double?, get/set)**
|
||||
Optional measured value (e.g., current in mA); `null` if not measured or unavailable.
|
||||
- **`Status` (DiagnosticStatus, get/set)**
|
||||
Overall diagnostic status (e.g., `Untested`, `Pass`, `Fail`).
|
||||
- **`ConnectionStatus` (ConnectionStatuses, get/set)**
|
||||
Connection state (e.g., `NotTested`, `Connected`, `Open`, `Short`).
|
||||
- **`Copy(ITCDiagnosticResult source)`**
|
||||
Copies all properties from `source` to this instance.
|
||||
|
||||
### `CanDiagnostics`
|
||||
- **`Active` (bool, get/set)**
|
||||
Whether this CAN channel is active.
|
||||
- **`ChannelIndex` (int, get/set)**
|
||||
CAN channel index (e.g., 0, 1).
|
||||
- **`Data` (int, get/set)**
|
||||
Raw data value from CAN diagnostics.
|
||||
- **`ErrorFrame` (int, get/set)**
|
||||
Count of error frames detected.
|
||||
- **`Load` (double, get/set)**
|
||||
Bus load percentage (0.0–100.0).
|
||||
- **`Overruns` (int, get/set)**
|
||||
Count of overrun errors.
|
||||
- **`LastUpdate` (DateTime, get/set)**
|
||||
Timestamp of last diagnostic update.
|
||||
- **`Errors` (int, read-only)**
|
||||
Computed error count: `Overruns` if `ErrorFrame == 0`, otherwise `1 + Overruns`.
|
||||
- **`ChannelName` (string, get/set)**
|
||||
Human-readable CAN channel name.
|
||||
- **`Copy(ICanDiagnosticResult source)`**
|
||||
Copies all properties from `source` to this instance.
|
||||
|
||||
### `TemperatureConfig`
|
||||
- **`LogEnable` (ushort, get/set)**
|
||||
Enable flag for logging (typically 0 or 1).
|
||||
- **`LogIntervalSec` (ushort, get/set)**
|
||||
Logging interval in seconds.
|
||||
- **`Channels` (ushort, get/set)**
|
||||
Bitfield representing enabled temperature/humidity channels (maps to `_channels` BitArray).
|
||||
- **`MCUTemp` (bool, get/set)**
|
||||
Enables/disables MCU temperature logging.
|
||||
- **`OnBoardHumidity` (bool, get/set)**
|
||||
Enables/disables on-board humidity logging.
|
||||
- **`EnvironmentalCh1`–`EnvironmentalCh4` (bool, get/set)**
|
||||
Enables/disables individual environmental channels (Ch1–Ch4).
|
||||
- **`ToUShortArray()` (ushort[])**
|
||||
Returns `[LogEnable, LogIntervalSec, Channels, Reserved]`.
|
||||
- **`TemperatureConfig(ushort[])`**
|
||||
Constructor initializing from a `ushort[]` (indices 0–2 used; index 3 ignored).
|
||||
- **`GetChannelsArray()` (int[])**
|
||||
Returns array of enabled channel indices (0–15) based on `_channels` BitArray.
|
||||
- **`GetMeasurementChannels()` (S6DBDiagnosticChannelList[])**
|
||||
Returns list of `S6DBDiagnosticChannelList` enum values corresponding to enabled channels.
|
||||
- **`GetChannelBitForDiagChannel(S6DBDiagnosticChannelList ch)` (TempLogChannelBits)**
|
||||
Maps a diagnostic channel enum to its corresponding `TempLogChannelBits` enum value; throws `NullReferenceException` if not found.
|
||||
|
||||
### `TMNSConfig`
|
||||
- **`TMNS_PCMSubFrameId` (uint, get/set)**
|
||||
PCM sub-frame ID.
|
||||
- **`TMNS_MsgId` (uint, get/set)**
|
||||
TMNS message ID.
|
||||
- **`TMNS_PCMMinorPerMajor` (uint, get/set)**
|
||||
PCM minor-per-major setting.
|
||||
- **`TMNS_TMATSPortNumber` (uint, get/set)**
|
||||
TMATs port number.
|
||||
- **`IENAUDP_PortNumber` (uint, get/set)**
|
||||
IENA UDP source port number.
|
||||
- **`TMNS5`, `TMNS6`, `TMNS7` (uint, get/set)**
|
||||
Reserved fields.
|
||||
- **`Fields` enum**
|
||||
Defines field indices: `TMNS_PCMSubFrameID`, `TMNS_MsgId`, `TMNS_PCMMinorPerMajor`, `TMNS_TMATSPortNumber`, `IENAUDP_PortNumber`, `TMNS5`, `TMNS6`, `TMNS7`.
|
||||
- **`TMNSConfig(uint[])`**
|
||||
Constructor from `uint[]` (length truncated to 8 if longer; shorter arrays padded with zeros).
|
||||
- **`TMNSConfig(string)`**
|
||||
Constructor from comma-separated string (e.g., `"(1,2,3)"`); parses to `uint[]`.
|
||||
- **`SetValue(Fields, uint)` / `GetValue(Fields)`**
|
||||
Set/get field value by enum.
|
||||
- **`ToUintArray()` (uint[])**
|
||||
Returns a copy of the internal `uint[]`.
|
||||
- **`ToCSVString()` (string)**
|
||||
Returns config as `(x,y,z,...)` string.
|
||||
- **`IsCh10(UDPStreamProfile)` (static bool)**
|
||||
Returns `true` if profile is a CH10 variant.
|
||||
- **`IsIENA(UDPStreamProfile)` (static bool)**
|
||||
Returns `true` if profile is `IENA_PTYPE_STREAM`.
|
||||
- **`IsTMNS(UDPStreamProfile)` (static bool)**
|
||||
Returns `true` if profile is `TMNS_PCM_STANDARD` or `TMNS_PCM_SUPERCOM`.
|
||||
- **`IsUART(UDPStreamProfile)` (static bool)**
|
||||
Returns `true` if profile is `UART_STREAM`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`DiagnosticMessageRow`**: All three properties (`Field`, `Value`, `Verdict`) are non-null after construction (constructor assigns directly; no validation beyond constructor initialization).
|
||||
- **`TCDiagnosticResult`**: `ChannelIndex` defaults to `0`; `Status` defaults to `DiagnosticStatus.Untested`; `ConnectionStatus` defaults to `ConnectionStatuses.NotTested`; `CurrentReading` defaults to `null`.
|
||||
- **`CanDiagnostics`**: `ChannelIndex` defaults to `-1`; `Active` defaults to `false`; `Errors` is computed as `Overruns` if `ErrorFrame == 0`, else `1 + Overruns` (no negative values possible).
|
||||
- **`TemperatureConfig`**:
|
||||
- `_channels` BitArray is always 16 bits (initialized as `new BitArray(new[] { 0x00, 0x00 })`).
|
||||
- `Reserved` is a compile-time constant `0` and not stored in the config array.
|
||||
- `ToUShortArray()` always returns 4 elements: `[LogEnable, LogIntervalSec, Channels, 0]`.
|
||||
- `GetChannelBitForDiagChannel()` throws `NullReferenceException` for unmapped channels (no fallback).
|
||||
- **`TMNSConfig`**:
|
||||
- Internal `_values` array is always exactly 8 elements (size derived from `Fields` enum).
|
||||
- `ToUintArray()` returns a copy (not a reference).
|
||||
- `ToCSVString()` always includes parentheses and exactly 8 comma-separated values.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- **`DTS.Common.Interface.DASFactory.Diagnostics`** (interfaces: `ITCDiagnosticResult`, `ICanDiagnosticResult`)
|
||||
- **`DTS.Common.Interface.Sensors.AnalogDiagnostics`** (used in `TCDiagnosticResult`)
|
||||
- **`DTS.Common.Enums.DASFactory`** (for `TempLogChannelBits`, `S6DBDiagnosticChannelList`, `DFConstantsAndEnums`)
|
||||
- **`DTS.Common.Enums`** (for `UDPStreamProfile` in `TMNSConfig`)
|
||||
- **`DTS.Common.Base`** (`BasePropertyChanged` base class for `TCDiagnosticResult` and `CanDiagnostics`)
|
||||
|
||||
### This module is depended upon by:
|
||||
- **Diagnostic test runners** (e.g., CAN BIST, temperature logging, TMNS configuration tools) that instantiate and populate these classes.
|
||||
- **UI/view layers** that bind to `TCDiagnosticResult`/`CanDiagnostics` via `INotifyPropertyChanged` (via `BasePropertyChanged`).
|
||||
- **Configuration serialization/deserialization** (e.g., saving/loading `TemperatureConfig` or `TMNSConfig` to/from storage).
|
||||
- **Diagnostic result aggregation** (e.g., combining `DiagnosticMessageRow` entries into test reports).
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`TemperatureConfig.GetChannelBitForDiagChannel()` throws `NullReferenceException`** for unmapped channels—despite the method name suggesting a safe lookup, it does not use `TryGetValue`. Callers must ensure the channel is supported.
|
||||
- **`TMNSConfig` string constructor is permissive**: Truncates or pads input to 8 fields; silently ignores non-parseable tokens (defaults to `0`).
|
||||
- **`TemperatureConfig.Channels` setter uses `BitConverter.ToUInt16`**: Assumes little-endian byte order (standard on .NET Core/.NET 5+ but platform-dependent in older frameworks).
|
||||
- **`CanDiagnostics.Errors` is computed, not stored**: Changes to `ErrorFrame` or `Overruns` trigger `OnPropertyChanged("Errors")`, but consumers must subscribe to `PropertyChanged` to react to this derived value.
|
||||
- **`DiagnosticMessageRow` stores everything as `string`**: No type safety or parsing; callers must handle numeric/string interpretation.
|
||||
- **`TMNSConfig` static methods (`IsCh10`, `IsIENA`, etc.) operate on `UDPStreamProfile` enum**: Behavior depends on complete enum coverage; missing cases in `switch` statements could cause incorrect results if new profiles are added.
|
||||
- **`TCDiagnosticResult` and `CanDiagnostics` implement `INotifyPropertyChanged` via `BasePropertyChanged`**: Property changes are observable, but `Copy()` does *not* raise `PropertyChanged` events for the copied values—consumers may need to manually trigger updates.
|
||||
181
enriched-qwen3-coder-next/Common/DTS.Common/Classes/DSP.md
Normal file
181
enriched-qwen3-coder-next/Common/DTS.Common/Classes/DSP.md
Normal file
@@ -0,0 +1,181 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DSP/ScalerAttribute.cs
|
||||
- Common/DTS.Common/Classes/DSP/DASRestriction.cs
|
||||
- Common/DTS.Common/Classes/DSP/DSPFilterRestriction.cs
|
||||
- Common/DTS.Common/Classes/DSP/IStreamingFilterProfile.cs
|
||||
- Common/DTS.Common/Classes/DSP/StreamingFilterConverter.cs
|
||||
- Common/DTS.Common/Classes/DSP/DSPFilterConverter.cs
|
||||
- Common/DTS.Common/Classes/DSP/StreamingFilterProfile.cs
|
||||
- Common/DTS.Common/Classes/DSP/DSPFilterCollection.cs
|
||||
- Common/DTS.Common/Classes/DSP/StreamingFilterProfileCollection.cs
|
||||
- Common/DTS.Common/Classes/DSP/DSPFilterType.cs
|
||||
generated_at: "2026-04-16T03:17:48.073484+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5b580a9c32ce9826"
|
||||
---
|
||||
|
||||
# DSP Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures and utilities for configuring and managing digital signal processing (DSP) filters in the DTS system. It defines filter profiles (`StreamingFilterProfile`, `DSPFilterType`), their restrictions based on hardware type and protocol version (`DASRestriction`, `DSPFilterRestriction`), and collections (`StreamingFilterProfileCollection`, `DSPFilterCollection`) that load filter configurations from XML files. It also includes type converters (`StreamingFilterConverter`, `DSPFilterConverter`) for UI integration (e.g., property grids) and supports both legacy and ratio-based filter rate calculations. The module centralizes DSP filter metadata and logic, enabling consistent filter selection and configuration across the application.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
- **`ScalerAttribute`**
|
||||
```csharp
|
||||
[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field, AllowMultiple = false)]
|
||||
public class ScalerAttribute : Attribute
|
||||
```
|
||||
- **`Scaler`** (`double`): Stores a scaling factor (e.g., for computing filter cutoff frequencies from sample rates).
|
||||
- **Constructor `ScalerAttribute(double d)`**: Initializes the `Scaler` property with the provided value.
|
||||
|
||||
- **`DASRestriction`**
|
||||
```csharp
|
||||
public class DASRestriction
|
||||
```
|
||||
- **`DASType`** (`string`): Hardware type string (e.g., `"SLICE6_AIR"`). An empty string means *all* DAS types match.
|
||||
- **`ProtocolVersion`** (`int`): Minimum required protocol version. Values ≤ 0 mean *all* protocol versions match.
|
||||
- **Constructors**:
|
||||
- `DASRestriction()`: Sets `DASType = ""`, `ProtocolVersion = -1`.
|
||||
- `DASRestriction(string dasType, int protocolVersion)`: Initializes with specified values.
|
||||
|
||||
- **`DSPFilterRestriction`**
|
||||
```csharp
|
||||
public class DSPFilterRestriction
|
||||
```
|
||||
Identical structure and behavior to `DASRestriction` (same properties and constructors). *Note: No functional difference is evident in the source; likely a duplicate or legacy artifact.*
|
||||
|
||||
- **`StreamingFilterProfile`**
|
||||
```csharp
|
||||
public class StreamingFilterProfile : IStreamingFilterProfile
|
||||
```
|
||||
- **`Ratio`** (`double`): Scaling factor for computing filter cutoff frequency from sample rate (`fc = sps / Ratio`). `double.NaN` indicates no ratio-based calculation.
|
||||
- **`DisplayString`** (`string`), **`DescriptionString`** (`string`), **`EnumValue`** (`int`): Metadata for UI and firmware communication.
|
||||
- **`Restrictions`** (`DASRestriction[]`): Array of hardware/protocol restrictions.
|
||||
- **Constructors**:
|
||||
- `StreamingFilterProfile()`: Default.
|
||||
- `StreamingFilterProfile(StreamingFilterProfileCollection.DefaultProfiles profile, DASRestriction[] restrictions)`: Initializes from a `DefaultProfiles` enum value and restrictions.
|
||||
- `StreamingFilterProfile(string display, string description, int enumValue, double ratio, DASRestriction[] restrictions)`: Direct initialization.
|
||||
- **`GetDSPFilterRate(double sps, string hwType)`** (`double`): Returns the filter cutoff frequency (fc) for given sample rate (`sps`) and hardware type (`hwType`). Returns `double.NaN` if filtering is unsupported or restrictions not met.
|
||||
- For `SLICE6_AIR` with `sps ≥ 20480`, returns `double.NaN`.
|
||||
- For other cases, uses `DSPFilterType.Get6PButterWorthLegacyTable()` and `Ratio` to compute `fc = sps / Ratio` if `Ratio` is valid.
|
||||
- **`ToString()`**: Returns `DisplayString`.
|
||||
|
||||
- **`DSPFilterType`**
|
||||
```csharp
|
||||
public class DSPFilterType : IStreamingFilterProfile
|
||||
```
|
||||
- **`Ratio`**, **`EnumValue`**, **`DisplayString`**, **`DescriptionString`**, **`Restrictions`**: Same semantics as `StreamingFilterProfile`.
|
||||
- **Constructors**:
|
||||
- `DSPFilterType()`: Default.
|
||||
- `DSPFilterType(DSPFilterCollection.DSPFilterDefaults filter, DASRestriction[] restrictions)`: Initializes from `DSPFilterDefaults` enum value.
|
||||
- `DSPFilterType(int enumValue, string displayString, string descriptionString, double ratio, DASRestriction[] restrictions)`: Direct initialization.
|
||||
- **`GetDSPFilterRate(double sps, string hwType)`** (`double`): Returns `fc` for the legacy 6-pole Butterworth filter (`EnumValue == 13`). Returns `double.NaN` if `EnumValue ≠ 13`, restrictions not met, or hardware unsupported.
|
||||
- **Static Methods**:
|
||||
- **`Get6PButterWorthLegacyTable()`** (`Tuple<int, int>[]`): Returns the breakpoint table: `[(8000,1280), (5000,610), (2000,366), (1000,120), (500,120), (200,50), (80,15)]`.
|
||||
- **`GetLegacytDSPFilterRate(double sps, string hwType)`** (`double`): Returns `fc` for legacy Butterworth filter using the breakpoint table. Returns `double.NaN` for `SLICE6_AIR` with `sps ≥ 20480`.
|
||||
- **Constants**:
|
||||
- **`S6A_CAP`** (`int = 20480`): Sample rate threshold above which `SLICE6_AIR` falls back to analog filtering.
|
||||
|
||||
- **`StreamingFilterProfileCollection`**
|
||||
```csharp
|
||||
public class StreamingFilterProfileCollection : Collection<StreamingFilterProfile>
|
||||
```
|
||||
- **`GetCollection()`** (`static`): Singleton accessor. Loads from `"StreamingFilterProfiles.xml"` (creates default file if missing).
|
||||
- **`GetStreamingFilterProfile(string s)`** (`StreamingFilterProfile`): Returns the profile with matching `DisplayString`, or the default (`EnumValue == 13`), or the first item.
|
||||
- **`DefaultProfiles`** enum: Defines profiles with `ScalerAttribute` for `Ratio`:
|
||||
- `Default` (`13`): `Ratio = NaN` (legacy).
|
||||
- `Profile7` (`7`): `Ratio = 4`.
|
||||
- `Profile8` (`8`): `Ratio = 6.4`.
|
||||
- `Profile9` (`9`): `Ratio = 8`.
|
||||
- `Profile10` (`10`): `Ratio = 10`.
|
||||
- **`DEFAULT_VALUE`** (`int = 13`): Enum value for the default profile.
|
||||
|
||||
- **`DSPFilterCollection`**
|
||||
```csharp
|
||||
public class DSPFilterCollection : Collection<DSPFilterType>
|
||||
```
|
||||
- **`GetDSPFilterCollection()`** (`static`): Singleton accessor. Loads from `"DSPFilters.xml"` (creates default file if missing).
|
||||
- **`GetFilter(string s)`** (`DSPFilterType`): Returns filter with matching `DisplayString`, or `EnumValue == 0` (None), or first item.
|
||||
- **`DSPFilterDefaults`** enum: Defines filter types with `ScalerAttribute` (`Ratio = NaN` for all):
|
||||
- `None` (`0`).
|
||||
- `Butterworth` (`13`).
|
||||
- `FIR` (`14`).
|
||||
- **Constants**:
|
||||
- **`BUTTERWORTH`** (`int = 13`), **`FIR45TAP`** (`int = 14`), **`NONE`** (`int = 0`).
|
||||
|
||||
### Converters
|
||||
|
||||
- **`StreamingFilterConverter`**
|
||||
```csharp
|
||||
public class StreamingFilterConverter : ArrayConverter
|
||||
```
|
||||
- **`Values`** (`StreamingFilterProfile[]`): Cached array of profiles from `StreamingFilterProfileCollection`.
|
||||
- **`CanConvertFrom`**, **`ConvertFrom`**: Supports conversion from `string` (matches `DisplayString`).
|
||||
- **`GetStandardValuesSupported`**, **`GetStandardValuesExclusive`**, **`GetStandardValues`**: Provides standard values (entire collection) for property grids.
|
||||
|
||||
- **`DSPFilterConverter`**
|
||||
```csharp
|
||||
public class DSPFilterConverter : ArrayConverter
|
||||
```
|
||||
- **`Values`** (`DSPFilterType[]`): Cached array of filters from `DSPFilterCollection`.
|
||||
- **`CanConvertFrom`**, **`ConvertFrom`**: Supports conversion from `string` (matches `DisplayString`).
|
||||
- **`GetStandardValuesSupported`**, **`GetStandardValuesExclusive`**, **`GetStandardValues`**: Provides standard values (entire collection) for property grids.
|
||||
|
||||
### Interfaces
|
||||
|
||||
- **`IStreamingFilterProfile`**
|
||||
```csharp
|
||||
public interface IStreamingFilterProfile
|
||||
```
|
||||
Defines contract for filter profiles:
|
||||
- **`EnumValue`** (`int`), **`DisplayString`** (`string`), **`DescriptionString`** (`string`), **`Restrictions`** (`DASRestriction[]`), **`Ratio`** (`double`).
|
||||
- **`GetDSPFilterRate(double sps, string hwType)`** (`double`): Compute filter cutoff frequency.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Singleton Collections**: `StreamingFilterProfileCollection.GetCollection()` and `DSPFilterCollection.GetDSPFilterCollection()` are thread-safe singletons (using `lock` and lazy initialization). The XML files (`StreamingFilterProfiles.xml`, `DSPFilters.xml`) are created with defaults if missing.
|
||||
- **Restriction Matching**: A restriction matches if `DASType` is empty (any hardware) or equals `hwType`, and `ProtocolVersion ≤ 0` (any version) or `ProtocolVersion` matches the DAS’s version (exact match implied, though version comparison logic is not in this module).
|
||||
- **Filter Rate Calculation**:
|
||||
- `StreamingFilterProfile.GetDSPFilterRate` uses `Ratio` for ratio-based filters (`Ratio > 0`) and falls back to legacy table lookup (`DSPFilterType.GetLegacytDSPFilterRate`) only if `EnumValue == DEFAULT_VALUE` (13) and `Ratio = NaN`.
|
||||
- `DSPFilterType.GetDSPFilterRate` only supports the Butterworth filter (`EnumValue == 13`).
|
||||
- `SLICE6_AIR` with `sps ≥ 20480` is unsupported for digital filtering (returns `double.NaN`).
|
||||
- **Enum Values**: `DEFAULT_VALUE = 13` (for `StreamingFilterProfileCollection.DefaultProfiles.Default`) and `BUTTERWORTH = 13` (for `DSPFilterCollection.DSPFilterDefaults.Butterworth`) are hardcoded constants.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies
|
||||
- **`DTS.Common.Enums.Hardware`**: Used for `HardwareTypes` (e.g., `SLICE6_AIR`, `SLICE6_AIR_BR`, `SLICE6_AIR_TC`).
|
||||
- **`System.ComponentModel.DataAnnotations`**: Used for `DisplayAttribute` (to extract `Name`/`Description` from enum fields).
|
||||
- **`System.Xml.Serialization`**: Used for XML serialization/deserialization of collections.
|
||||
- **`System.Collections.ObjectModel`**: Base for `Collection<T>`.
|
||||
|
||||
### External Dependencies
|
||||
- **XML Files**:
|
||||
- `StreamingFilterProfiles.xml`: Default location for streaming filter profiles.
|
||||
- `DSPFilters.xml`: Default location for DSP filter types.
|
||||
*(Both are created on first access if missing.)*
|
||||
- **UI Frameworks**: `StreamingFilterConverter` and `DSPFilterConverter` depend on `System.ComponentModel` (e.g., `ITypeDescriptorContext`, `StandardValuesCollection`) for property grid integration.
|
||||
|
||||
### Inferred Usage
|
||||
- `StreamingFilterProfileCollection` and `DSPFilterCollection` are used by converters and likely by UI components (e.g., dropdowns for filter selection).
|
||||
- `ScalerAttribute` is applied to enums in `StreamingFilterProfileCollection.DefaultProfiles` and `DSPFilterCollection.DSPFilterDefaults` to store scaling factors.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Duplicate Classes**: `DASRestriction` and `DSPFilterRestriction` are identical in structure and behavior. The codebase does not clarify if they serve distinct purposes or are redundant.
|
||||
- **`Ratio = NaN` Semantics**: In `StreamingFilterProfile`, `Ratio = NaN` triggers legacy filter rate calculation (via `DSPFilterType.GetLegacytDSPFilterRate`), but only if `EnumValue == DEFAULT_VALUE` (13). This is not obvious from the method name or documentation.
|
||||
- **`GetDSPFilterRate` Inconsistency**:
|
||||
- `StreamingFilterProfile.GetDSPFilterRate` uses `Ratio` for ratio-based filters.
|
||||
- `DSPFilterType.GetDSPFilterRate` *only* supports Butterworth (`EnumValue == 13`) and ignores `Ratio`.
|
||||
This implies `StreamingFilterProfile` is for flexible profiles, while `DSPFilterType` is for legacy filter types.
|
||||
- **Hardware-Specific Logic**: `SLICE6_AIR` has a special case (`sps ≥ 20480` → `double.NaN`) in both `StreamingFilterProfile` and `DSPFilterType`. This is hardcoded and not configurable via XML.
|
||||
- **Protocol Version Matching**: `ProtocolVersion` is stored but never compared against a DAS’s actual version in the provided code. Matching logic is assumed but not implemented here.
|
||||
- **Case Sensitivity**: `GetFilter`/`GetStreamingFilterProfile` use `DisplayString == s` (case-sensitive). UI components may need to handle case normalization.
|
||||
- **Thread Safety**: Singletons use `lock` for initialization, but cached arrays (`Values` in converters) are not reloaded if XML files change at runtime.
|
||||
- **Typo**: Method `GetLegacytDSPFilterRate` (missing 'h' in "Legacy") and `S6A_CAP` (capitalization inconsistency with `SLICE6_AIR` enum values).
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/Commands/RelayCommand.cs
|
||||
generated_at: "2026-04-16T03:19:06.518329+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "33db5b96b73a6f00"
|
||||
---
|
||||
|
||||
# Commands
|
||||
|
||||
### 1. **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 supports optional conditional execution via a `CanExecute` predicate and integrates with WPF’s `CommandManager` to automatically re-evaluate command availability when UI state changes (e.g., focus or selection changes). Its role is to serve as a lightweight, standard command implementation for MVVM pattern adoption, avoiding boilerplate command classes per action.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
- **`RelayCommand(Action<object> execute)`**
|
||||
Constructor. Initializes the command with an execution delegate and no `CanExecute` predicate (i.e., always executable).
|
||||
- Throws `ArgumentNullException` if `execute` is `null`.
|
||||
|
||||
- **`RelayCommand(Action<object> execute, Predicate<object> canExecute)`**
|
||||
Constructor. Initializes the command with both execution and availability predicates.
|
||||
- Throws `ArgumentNullException` if `execute` is `null`.
|
||||
- `canExecute` may be `null`, in which case the command is always executable.
|
||||
|
||||
- **`bool CanExecute(object parameter)`**
|
||||
Implements `ICommand.CanExecute`. Returns `true` if `_canExecute` is `null` or if `_canExecute(parameter)` returns `true`; otherwise `false`.
|
||||
|
||||
- **`event EventHandler CanExecuteChanged`**
|
||||
Implements `ICommand.CanExecuteChanged`. Subscribes/unsubscribes to `CommandManager.RequerySuggested`, triggering WPF to re-query `CanExecute` when system events (e.g., keyboard/mouse input, focus changes) occur.
|
||||
|
||||
- **`void Execute(object parameter)`**
|
||||
Implements `ICommand.Execute`. Invokes `_execute(parameter)`. No validation or exception handling is performed; exceptions propagate to the caller.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
- `_execute` is **never `null`** after construction (enforced via `ArgumentNullException` in both constructors).
|
||||
- `_canExecute` may be `null`; in this case, `CanExecute` always returns `true`.
|
||||
- `CanExecuteChanged` events are **always** routed to `CommandManager.RequerySuggested`; no custom event storage is used.
|
||||
- `Execute` and `CanExecute` are called with the same `parameter` value provided by the command source (e.g., `Button.CommandParameter`).
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Dependencies on external modules**:
|
||||
- `System` (for `Action<T>`, `Predicate<T>`, `ArgumentNullException`)
|
||||
- `System.Windows.Input` (for `ICommand`, `CommandManager`)
|
||||
- **Dependencies on other modules in the codebase**: None (no internal `using` statements beyond standard libraries).
|
||||
- **Depended upon by**: Presumably UI components (e.g., `Button`, `MenuItem`) in WPF views that bind commands via MVVM. Not visible in this file, but inferred from `ICommand` usage.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **No manual `CanExecuteChanged` raising**: Since `CanExecuteChanged` is wired to `CommandManager.RequerySuggested`, the command’s executability is only re-evaluated on `CommandManager`-triggered events (e.g., user input). If the command’s availability depends on non-UI state (e.g., background task completion), `CommandManager.InvalidateRequerySuggested()` must be called externally to force re-evaluation.
|
||||
- **No parameter validation**: `Execute` passes the `parameter` directly to `_execute` without null-checking or type validation. If `_execute` expects a specific type (e.g., `string`), passing an incompatible type will cause a runtime exception.
|
||||
- **Thread affinity**: `Execute` runs on the calling thread (typically the UI thread), but no thread-safety guarantees are provided. If invoked from a background thread, UI updates inside `_execute` will fail.
|
||||
- **Memory leak risk**: If subscribers to `CanExecuteChanged` are not properly disposed, the `CommandManager` may hold references indefinitely (though this is a general WPF pattern risk, not unique to this class).
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/Reports/ChannelGRMSSummary.cs
|
||||
generated_at: "2026-04-16T03:19:18.243942+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8f994977a8bca5be"
|
||||
---
|
||||
|
||||
# Reports
|
||||
|
||||
### **1. Purpose**
|
||||
The `ChannelGRMSSummary` class serves as a data model for representing summary statistics of a single channel in a GRMS (G-RMS, or root-mean-square acceleration) analysis report. It encapsulates the channel’s name, its sampling rate, and the computed GRMS value, while implementing `INotifyPropertyChanged` to support data binding in UI frameworks (e.g., WPF). This class enables consistent, observable reporting of GRMS metrics across the DTS Viewer application.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
|
||||
- **`ChannelName`** (`string`, read-write property)
|
||||
Gets or sets the human-readable name of the channel (e.g., `"Ch1-Accel"`). Used for identification in reports.
|
||||
|
||||
- **`SampleRate`** (`int`, read-write property)
|
||||
Gets or sets the sample rate (in Hz) used to acquire or process the channel data. Must be a non-negative integer (enforced by caller; not validated internally).
|
||||
|
||||
- **`GRMS`** (`double`, read-write property)
|
||||
Gets or sets the computed root-mean-square acceleration value (typically in *g* units) for the channel over a specified time interval.
|
||||
|
||||
- **`PropertyChanged`** (`event PropertyChangedEventHandler`)
|
||||
Event fired when a property value changes. Raised by `OnPropertyChanged`.
|
||||
|
||||
- **`OnPropertyChanged(string propertyName)`** (`void` method)
|
||||
Invokes the `PropertyChanged` event for the specified property name. Used to notify bound UI elements of updates.
|
||||
**Note:** Does *not* validate that `propertyName` corresponds to an actual property; caller must ensure correctness.
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- **No internal validation**: The class does not enforce constraints on `SampleRate` (e.g., positivity) or `GRMS` (e.g., non-negativity). Invalid values may be assigned silently.
|
||||
- **Property names must match exactly**: `OnPropertyChanged` relies on the caller passing the *exact* property name (e.g., `"GRMS"`, not `"grms"` or `"G rms"`); mismatches will cause silent UI update failures.
|
||||
- **Thread-safety**: The class provides no explicit thread-safety guarantees. `PropertyChanged` invocation is not atomic and may throw if subscribers are removed mid-invocation (though `?.` mitigates null reference exceptions).
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
|
||||
- **Depends on**:
|
||||
- `System.ComponentModel` (for `INotifyPropertyChanged` via `PropertyChangedEventHandler` and `PropertyChangedEventArgs`)
|
||||
- `DTS.Common.Interface` (for the `IChannelGRMSSummary` interface—implementation of which this class satisfies)
|
||||
|
||||
- **Implements**:
|
||||
- `IChannelGRMSSummary` (interface defined in `DTS.Common.Interface`; exact contract not visible in this file but assumed to declare `ChannelName`, `SampleRate`, `GRMS`, and `PropertyChanged`/`OnPropertyChanged` members)
|
||||
|
||||
- **Used by**:
|
||||
- Presumably UI components (e.g., WPF `DataGrid`, `ListView`) bound to GRMS summary reports.
|
||||
- Report generation or data aggregation logic that populates/updates channel summaries (e.g., a class computing GRMS from time-series data).
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **No null-check on `propertyName` in `OnPropertyChanged`**: Passing `null` will cause `PropertyChanged?.Invoke(...)` to throw a `NullReferenceException` (since `new PropertyChangedEventArgs(null)` is valid, but the event handler may not expect it).
|
||||
- **No validation on numeric properties**: `SampleRate` could be negative or zero; `GRMS` could be negative or `NaN`. Callers must ensure values are physically meaningful.
|
||||
- **Interface implementation is implicit**: The class does not explicitly declare `IChannelGRMSSummary` in its definition (e.g., `: IChannelGRMSSummary`), but the source comment implies it implements the interface. Verify the interface definition in `DTS.Common.Interface` for exact contract requirements (e.g., read-only vs. read-write properties).
|
||||
- **No documentation of units**: While `GRMS` is assumed to be in *g*, and `SampleRate` in Hz, the source provides no explicit unit annotations—rely on external documentation or conventions.
|
||||
|
||||
*None identified beyond the above.*
|
||||
@@ -0,0 +1,316 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestMetadata.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestGraphs.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestSetupMetadata.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestRunMetadata.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestSummary.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestModule.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestChannel.cs
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/TestMetadata/TestMetadataList.cs
|
||||
generated_at: "2026-04-16T03:19:21.354792+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2276bf4d72ccc406"
|
||||
---
|
||||
|
||||
# TestMetadata Module Documentation
|
||||
|
||||
## 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 `.dts` XML files into these strongly-typed objects and constructing `TestSummary` instances for UI binding. This module serves as the foundational data layer for test data browsing, selection, and visualization components.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TestMetadataList`
|
||||
|
||||
- **`Task<ObservableCollection<ITestSummary>> GetTestSummaryListAsync(IBaseViewModel parent, string path, string file, string pattern = "")`**
|
||||
Async wrapper for `GetTestSummaryList`. Returns a list of `ITestSummary` objects built from `.dts` files in the specified directory.
|
||||
|
||||
- **`ObservableCollection<ITestSummary> GetTestSummaryList(IBaseViewModel parent, string path, string file = "", string pattern = "")`**
|
||||
Loads `.dts` files (matching `pattern`, default `.dts`) from `path`, parses them into `ITestMetadata`, and returns a collection of `ITestSummary` objects. `parent` is used for command wiring in `TestSummary`.
|
||||
|
||||
- **`ObservableCollection<ITestSummary> GetTestSummaryList(string path, string file = "", string pattern = "")`**
|
||||
Overload of `GetTestSummaryList` without a `parent` parameter (used when `Parent` property in `TestSummary` is not required).
|
||||
|
||||
- **`List<ITestMetadata> GetTestMetadataList(XDocument xDoc, string path, string file)`**
|
||||
Parses an `XDocument` (representing a `.dts` XML file) into a list of `ITestMetadata` instances. Includes error handling, filtering for `TSRAIR_GO_TEST` when `RunTestVariables.IsTSRAIRGo` is true, and channel array pre-allocation.
|
||||
|
||||
### `TestMetadata` (implements `ITestMetadata`)
|
||||
|
||||
- **`ITestRunMetadata TestRun { get; set; }`**
|
||||
Contains test run-level metadata (e.g., test ID, description, modules, channels).
|
||||
|
||||
- **`ITestSetupMetadata TestSetup { get; set; }`**
|
||||
Contains test setup-level metadata (e.g., setup name, timestamp, graphs, calibration behavior).
|
||||
|
||||
### `TestRunMetadata` (implements `ITestRunMetadata`, `INotifyPropertyChanged`)
|
||||
|
||||
- **`string Name { get; set; }`**
|
||||
Logical test name (from XML `Id` attribute).
|
||||
|
||||
- **`string Id { get; set; }`**
|
||||
File name without extension (from XML `FilePath` attribute).
|
||||
|
||||
- **`string Description { get; set; }`**
|
||||
Test description.
|
||||
|
||||
- **`bool InlineSerializedData { get; set; }`**
|
||||
Indicates if raw data is embedded in the XML.
|
||||
|
||||
- **`string TestGuid { get; set; }`**
|
||||
Unique test identifier.
|
||||
|
||||
- **`int FaultFlags { get; set; }`**
|
||||
Bitmask of test fault conditions.
|
||||
|
||||
- **`string Software { get; set; }`**, **`string SoftwareVersion { get; set; }`**
|
||||
Software name and version used for acquisition.
|
||||
|
||||
- **`string DataType { get; set; }`**
|
||||
Type of data (e.g., "Acceleration", "Force").
|
||||
|
||||
- **`DateTime FileDate { get; set; }`**
|
||||
File system modification date.
|
||||
|
||||
- **`string FilePath { get; set; }`**
|
||||
Full path to the test data file.
|
||||
|
||||
- **`List<ITestModule> Modules { get; set; }`**
|
||||
List of acquisition modules used.
|
||||
|
||||
- **`List<ITestChannel> Channels { get; set; }`**
|
||||
List of physical channels.
|
||||
|
||||
- **`List<ITestChannel> CalculatedChannels { get; set; }`**
|
||||
List of derived channels.
|
||||
|
||||
- **`bool IsSelected { get; set; }`**
|
||||
UI selection state (raises `PropertyChanged`).
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Implements `INotifyPropertyChanged`.
|
||||
|
||||
### `TestSetupMetadata` (implements `ITestSetupMetadata`)
|
||||
|
||||
- **`string SetupName { get; set; }`**
|
||||
Name of the test setup configuration.
|
||||
|
||||
- **`DateTime TimeStamp { get; set; }`**
|
||||
Setup timestamp (fallback if module timestamps are invalid/zero).
|
||||
|
||||
- **`List<ITestGraphs> TestGraphs { get; set; }`**
|
||||
List of graph definitions.
|
||||
|
||||
- **`CalibrationBehaviors CalibrationBehavior { get; set; }`**
|
||||
Calibration strategy (e.g., `NonLinearIfAvailable`).
|
||||
|
||||
### `TestGraphs` (implements `ITestGraphs`)
|
||||
|
||||
- **`string Name { get; set; }`**
|
||||
Graph display name.
|
||||
|
||||
- **`string HardwareChannelName { get; set; }`**
|
||||
Hardware channel name associated with the graph.
|
||||
|
||||
- **`List<string> ChannelIds { get; set; }`**
|
||||
List of channel IDs included in the graph.
|
||||
|
||||
- **`List<ITestChannel> Channels { get; set; }`**
|
||||
*Note: Not populated during XML parsing; likely for runtime use.*
|
||||
|
||||
### `TestModule` (implements `ITestModule`, `INotifyPropertyChanged`)
|
||||
|
||||
- **`string SerialNumber { get; set; }`**, **`string BaseSerialNumber { get; set; }`**
|
||||
Module serial and base serial numbers.
|
||||
|
||||
- **`int Number { get; set; }`**, **`int NumberOfChannels { get; set; }`**
|
||||
Module number and channel count.
|
||||
|
||||
- **`int SampleRateHz { get; set; }`**, **`int UnsubsampledSampleRateHz { get; set; }`**
|
||||
Sample rates (post- and pre-subsampling).
|
||||
|
||||
- **`double RequestedPreTriggerSeconds { get; set; }`**, **`double PreTriggerSeconds { get; set; }`**, **`double RequestedPostTriggerSeconds { get; set; }`**, **`double PostTriggerSeconds { get; set; }`**
|
||||
Trigger timing parameters.
|
||||
|
||||
- **`int StartRecordTimestampSec { get; set; }`**, **`int StartRecordTimestampNanoSec { get; set; }`**, **`int TriggerTimestampSec { get; set; }`**, **`int TriggerTimestampNanoSec { get; set; }`**
|
||||
High-precision timestamps (PTP1588).
|
||||
|
||||
- **`List<ulong> TriggerSampleNumbers { get; set; }`**
|
||||
*Note: Always initialized as empty list; parsing logic returns empty list.*
|
||||
|
||||
- **`bool PTPMasterSync { get; set; }`**
|
||||
Indicates PTP synchronization status.
|
||||
|
||||
- **Tilt Sensor Angles (Pre/Post)**:
|
||||
`TiltSensorAxis{X,Y,Z}Degrees{Pre,Post}` — tilt sensor readings before/after test.
|
||||
|
||||
- **Temperature Readings (Pre/Post)**:
|
||||
`TemperatureLocation{1-4}{Pre,Post}` — temperature sensor readings.
|
||||
|
||||
- **`List<ITestChannel> Channels { get; set; }`**, **`List<ITestChannel> CalculatedChannels { get; set; }`**
|
||||
Channels associated with this module.
|
||||
|
||||
- **`bool IsSelected { get; set; }`**
|
||||
Selection state (raises `PropertyChanged`).
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Implements `INotifyPropertyChanged`.
|
||||
|
||||
### `TestChannel` (implements `ITestChannel`, `IBasePropertyChanged`, `ISerializable`)
|
||||
|
||||
- **`string Group { get; set; }`**, **`string SubGroup { get; set; }`**
|
||||
Logical grouping.
|
||||
|
||||
- **`bool IsGraphChannel { get; set; }`**, **`string GraphName { get; set; }`**
|
||||
Indicates if channel is used in a graph.
|
||||
|
||||
- **`string TestId { get; set; }`**, **`string TestSetupName { get; set; }`**, **`string ModuleSerialNumber { get; set; }`**
|
||||
Contextual identifiers.
|
||||
|
||||
- **`string SerialNumber { get; set; }`**, **`string ChannelId { get; set; }`**
|
||||
Channel serial and ID.
|
||||
|
||||
- **`string ChannelDisplayName { get; set; }`**, **`string ChannelDescriptionString { get; set; }`**
|
||||
Display name and description string.
|
||||
|
||||
- **`string ChannelName2 { get; set; }`**, **`string HardwareChannelName { get; set; }`**
|
||||
Alternative channel names.
|
||||
|
||||
- **`string ChannelType { get; set; }`**
|
||||
Channel type (e.g., "AnalogInput").
|
||||
|
||||
- **`bool IsCalculatedChannel { get; set; }`**
|
||||
Indicates if channel is derived.
|
||||
|
||||
- **`int Number { get; set; }`**, **`int ChannelNumber { get; set; }`**
|
||||
Channel numbers.
|
||||
|
||||
- **`double Sensitivity { get; set; }`**, **`string SensitivityUnits { get; set; }`**, **`double DesiredRange { get; set; }`**, **`double ActualMaxRangeEu { get; set; }`**, **`double ActualMinRangeEu { get; set; }`**, **`double ActualMaxRangeMv { get; set; }`**, **`double ActualMinRangeMv { get; set; }`**
|
||||
Calibration and range parameters.
|
||||
|
||||
- **`string Bridge { get; set; }`**, **`double BridgeResistanceOhms { get; set; }`**, **`double ZeroPoint { get; set; }`**
|
||||
Bridge configuration.
|
||||
|
||||
- **`DateTime Start { get; set; }`**
|
||||
Channel start time.
|
||||
|
||||
- **`string SoftwareFilter { get; set; }`**, **`bool ProportionalToExcitation { get; set; }`**, **`bool IsInverted { get; set; }`**, **`string LinearizationFormula { get; set; }`**, **`bool IsSubsampled { get; set; }`**
|
||||
Processing flags.
|
||||
|
||||
- **`int AbsoluteDisplayOrder { get; set; }`**
|
||||
Display order index.
|
||||
|
||||
- **`DateTime LastCalibrationDate { get; set; }`**
|
||||
Calibration date.
|
||||
|
||||
- **`string SensorId { get; set; }`**
|
||||
Sensor identifier.
|
||||
|
||||
- **`int OffsetToleranceLowMv { get; set; }`**, **`int OffsetToleranceHighMv { get; set; }`**, **`int DataFlag { get; set; }`**
|
||||
Tolerance and data quality flags.
|
||||
|
||||
- **`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; }`**
|
||||
Excitation, units, and zeroing configuration.
|
||||
|
||||
- **`int InitialEu { get; set; }`**, **`string InitialOffset { get; set; }`**
|
||||
Initial calibration values.
|
||||
|
||||
- **`double MeasuredShuntDeflectionMv { get; set; }`**, **`double TargetShuntDeflectionMv { get; set; }`**, **`double MeasuredExcitationVoltage { get; set; }`**, **`double FactoryExcitationVoltage { get; set; }`**
|
||||
Shunt calibration parameters.
|
||||
|
||||
- **`double TimeOfFirstSample { get; set; }`**, **`double Multiplier { get; set; }`**, **`double UserOffsetEu { get; set; }`**, **`int UnitConversion { get; set; }`**
|
||||
Timing, scaling, and unit conversion.
|
||||
|
||||
- **`bool AtCapacity { get; set; }`**, **`int CapacityOutputIsBasedOn { get; set; }`**
|
||||
Capacity-related flags.
|
||||
|
||||
- **`string SourceChannelNumber { get; set; }`**, **`string SourceModuleNumber { get; set; }`**, **`string SourceModuleSerialNumber { get; set; }`**, **`string Calculation { get; set; }`**
|
||||
For calculated channels: source and formula.
|
||||
|
||||
- **`string BinaryFileName { get; set; }`**, **`string BinaryFilePath { get; set; }`**
|
||||
Binary data file info.
|
||||
|
||||
- **`double Xmax { get; set; }`**, **`double Xmin { get; set; }`**
|
||||
X-axis range.
|
||||
|
||||
- **`int SequentialNumbers { get; set; }`**
|
||||
Sequential index.
|
||||
|
||||
- **`ITestSetupMetadata ParentTestSetup { get; set; }`**, **`ITestModule ParentModule { get; set; }`**, **`IBaseViewModel Parent { get; set; }`**
|
||||
Parent references.
|
||||
|
||||
- **`Color ChannelColor { get; set; }`**, **`string ErrorMessage { get; set; }`**, **`bool IsError { get; set; }`**, **`Color? ErrorColor { get; set; }`**
|
||||
UI state properties.
|
||||
|
||||
- **`bool IsLocked { get; set; }`**, **`bool CanLock { get; set; }`**, **`bool CanSelectChannel { get; set; }`**, **`bool IsExpanded { get; set; }`**, **`bool IsSelected { get; set; }`**
|
||||
Selection/locking state with side effects (e.g., updating graph view models).
|
||||
|
||||
- **`double MinADC { get; set; }`**, **`double MaxADC { get; set; }`**, **`double AveADC { get; set; }`**, **`double StdDevADC { get; set; }`**, **`double T0ADC { get; set; }`**
|
||||
ADC statistics.
|
||||
|
||||
- **`double MinMV { get; set; }`**, **`double MaxMV { get; set; }`**, **`double AveMV { get; set; }`**, **`double StdDevMV { get; set; }`**, **`double T0MV { get; set; }`**
|
||||
mV statistics.
|
||||
|
||||
- **`double MinEU { get; set; }`**, **`double MaxEU { get; set; }`**, **`double AveEU { get; set; }`**, **`double StdDevEU { get; set; }`**, **`double T0EU { get; set; }`**
|
||||
Engineering Unit statistics.
|
||||
|
||||
- **`double MinY { get; set; }`**, **`double MaxY { get; set; }`**, **`double AveY { get; set; }`**, **`double StdDevY { get; set; }`**, **`double T0Value { get; set; }`**
|
||||
Current unit statistics.
|
||||
|
||||
- **`string SetupEID { get; set; }`**, **`string DataCollectionEID { get; set; }`**
|
||||
EID (likely Event ID) at setup and collection time.
|
||||
|
||||
- **`void SetChannelDescriptionAndDisplayName(string channelDescription)`**
|
||||
Sets `ChannelDescriptionString` and `ChannelDisplayName`.
|
||||
|
||||
- **`ITestChannel Copy()`**
|
||||
Shallow copy via `MemberwiseClone()`.
|
||||
|
||||
- **`override string ToString()`**
|
||||
Returns `ChannelName2` if embedded test-specific; otherwise `ChannelDescriptionString`.
|
||||
|
||||
### `TestSummary` (implements `ITestSummary`, `INotifyPropertyChanged`)
|
||||
|
||||
- **`const string ROI_SUFFIX = @"_ROI Period"`**
|
||||
Suffix indicating ROI period data.
|
||||
|
||||
- **`string Id { get; set; }`**
|
||||
Unique ID: `TestRun.Id + ParseEventNumber(TestRun.FilePath)`.
|
||||
|
||||
- **`string SetupName { get; set; }`**, **`string Description { get; set; }`**, **`int ChannelCount { get; set; }`**, **`DateTime FileDate { get; set; }`**, **`DateTime TimeStamp { get; set; }`**, **`string DataType { get; set; }`**
|
||||
Summary metadata.
|
||||
|
||||
- **`bool IsSelected { get; set; }`**
|
||||
Selection state with side effects via `SelectionChanged()`.
|
||||
|
||||
- **`List<ITestGraphs> Graphs { get; set; }`**, **`List<ITestChannel> Channels { get; set; }`**, **`List<ITestChannel> CalculatedChannels { get; set; }`**
|
||||
References to metadata.
|
||||
|
||||
- **`IBaseViewModel Parent { get; set; }`**
|
||||
Parent view model (for command binding).
|
||||
|
||||
- **`CalibrationBehaviors CalibrationBehavior { get; set; } = CalibrationBehaviors.NonLinearIfAvailable`**
|
||||
Default calibration behavior.
|
||||
|
||||
- **`ITestMetadata TestMetadata { get; set; }`**
|
||||
Full metadata object.
|
||||
|
||||
- **`DelegateCommand IsSelectedCommand { get; }`**
|
||||
Command bound to `IsSelected` property.
|
||||
|
||||
- **`void SelectionChanged()`**
|
||||
Updates `Parent.SelectedTestSummaryList` and publishes via `IEventAggregator`.
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Implements `INotifyPropertyChanged`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`TestMetadata`** must always have non-null `TestRun` and `TestSetup` properties after construction (defaults are created on parse failure).
|
||||
- **`TestSummary.Id`** is constructed as `TestRun.Id + ParseEventNumber(TestRun.FilePath)`. `ParseEventNumber` extracts the segment starting with `DTS.Common.Constants.EventNumber` from the file path.
|
||||
- **`TestSummary.TimeStamp`** is determined by `TestMetadataList.GetTimestamp()`:
|
||||
- Uses minimum PTP1588 timestamp from modules (trigger or start record).
|
||||
- Falls back to `TestSetup.TimeStamp` if module timestamps are invalid (e.g., zero, before 1990).
|
||||
- **`TestChannel.ChannelId`** defaults to `GetHashCode().ToString()` if the XML attribute is missing or `-1`.
|
||||
- **`TestChannel.HardwareChannelName`** is set to `Strings.Strings.Table_NA` for calculated channels (per comment `//
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/GroupTemplates/Constants.cs
|
||||
generated_at: "2026-04-16T03:15:43.815320+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1a584874abe7fb97"
|
||||
---
|
||||
|
||||
# GroupTemplates
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a集中 set of string constants used to identify non-ISO test object types and related metadata within the DTS (likely *Device Test System*) codebase. It exists to provide a single source of truth for hardcoded string literals associated with proprietary or non-standard test object channels, ensuring consistency and reducing the risk of typos or mismatches when referencing these special identifiers elsewhere in the system.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes only a `static class` named `Constants` (no instance members). All members are `public const string` fields:
|
||||
|
||||
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE = "x_NonISOTestObjectType_x";`
|
||||
A constant string used as a channel type identifier for non-ISO test objects.
|
||||
|
||||
- `public const string NON_ISO_TESTOBJECT_NAME = "x_NonISOTestObjectName_x";`
|
||||
A constant string used as a name identifier for non-ISO test objects.
|
||||
|
||||
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE2 = "NONISO_x_";`
|
||||
A second, distinct constant string used as a channel type identifier—likely for a different variant or legacy path for non-ISO test objects.
|
||||
|
||||
## 3. Invariants
|
||||
- All constant values are compile-time literals and cannot be modified at runtime.
|
||||
- The values `"x_NonISOTestObjectType_x"`, `"x_NonISOTestObjectName_x"`, and `"NONISO_x_"` are *exact* and case-sensitive; any usage must match them precisely.
|
||||
- No validation or runtime checks are performed by this module itself—conformance is the responsibility of consumers.
|
||||
|
||||
## 4. Dependencies
|
||||
- **No external dependencies**: This file contains no `using` directives and references no other types or assemblies.
|
||||
- **Consumers**: Based on naming and structure, this module is intended to be referenced by other modules in the `DTS.Common` assembly (or potentially other assemblies referencing it), particularly those handling test object creation, routing, or serialization logic where non-ISO types must be distinguished from standard ISO-compliant ones.
|
||||
|
||||
## 5. Gotchas
|
||||
- The suffix `_x` in the first two constants (`NON_ISO_TESTOBJECT_CHANNEL_TYPE`, `NON_ISO_TESTOBJECT_NAME`) appears intentional but unusual—likely a marker for "extended" or "custom" (non-standard) types. Developers should not assume `_x` is a generic placeholder; it is part of the literal value.
|
||||
- `NON_ISO_TESTOBJECT_CHANNEL_TYPE2` has no trailing underscore in its value (`"NONISO_x_"`), unlike the others. This suggests it may be used in a different context (e.g., as a prefix rather than a full identifier), and mixing usage could lead to mismatches.
|
||||
- No documentation comments (XML doc) are present in the source, so the semantic distinction between `NON_ISO_TESTOBJECT_CHANNEL_TYPE` and `NON_ISO_TESTOBJECT_CHANNEL_TYPE2` is not self-evident from this file alone.
|
||||
- None identified from source alone.
|
||||
199
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Groups.md
Normal file
199
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Groups.md
Normal file
@@ -0,0 +1,199 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Groups/GroupGRPImportError.cs
|
||||
- Common/DTS.Common/Classes/Groups/GroupGRPImportGroup.cs
|
||||
- Common/DTS.Common/Classes/Groups/GroupHardwareDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/TestSetupGroupRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/GroupDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/GroupGRPImportChannel.cs
|
||||
- Common/DTS.Common/Classes/Groups/ChannelDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/GroupHelper.cs
|
||||
generated_at: "2026-04-16T03:16:28.845582+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b79a1cdde998f5b5"
|
||||
---
|
||||
|
||||
# Documentation: Groups Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures and helper utilities for representing, importing, and managing group-based test configurations—specifically those sourced from `.GRP` files (TDC format)—and their persistence in the database. It defines import-time models (`GroupGRPImportGroup`, `GroupGRPImportChannel`, `GroupGRPImportError`) for parsing and validating `.GRP` files, database record models (`GroupDbRecord`, `GroupHardwareDbRecord`, `TestSetupGroupRecord`, `ChannelDbRecord`) for ORM-style data access, and a static `GroupHelper` class to cache and manage cross-referenced metadata (e.g., static group names, DAS IDs, channel-group mappings) during runtime. The module serves as the canonical data model layer for group-centric test setups in the DTS system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `GroupGRPImportError`
|
||||
|
||||
- **`Errors` enum**: Defines all possible error codes during `.GRP` file import:
|
||||
- `FileEmpty`, `InvalidISOCodeInput`, `InvalidFullScaleInput`, `InvalidSensorInput`, `InvalidInvertInput`, `SensorNotFound`, `InvalidInputMode`, `InvalidDefaultValue`, `InvalidActiveValue`, `InvalidFireMode`, `InvalidDelay`, `InvalidLimitDuration`, `InvalidDuration`, `InvalidCurrent`
|
||||
- **Properties**:
|
||||
- `Errors ErrorCode { get; set; }`: The specific error encountered.
|
||||
- `string File { get; set; }`: Path or name of the `.GRP` file where the error occurred.
|
||||
- `int Line { get; set; }`: Line number in the file where the error occurred.
|
||||
- `string ExtraInfo { get; set; }`: Human-readable error details.
|
||||
- **`override string ToString()`**: Returns `ExtraInfo`.
|
||||
|
||||
### `GroupGRPImportGroup`
|
||||
|
||||
- **Properties**:
|
||||
- `bool Included { get; set; } = true`: Whether the group is included in the current import operation.
|
||||
- `bool Overwrite { get; set; } = true`: Whether existing group data should be overwritten.
|
||||
- `string GroupName { get; set; }`: Name of the group.
|
||||
- `string GroupTags { get; set; }`: Tags associated with the group.
|
||||
- `string ImportingUserTags { get; set; }`: User-provided tags during import.
|
||||
- `string SourceFile { get; set; }`: Path to the source `.GRP` file.
|
||||
- `GroupGRPImportChannel[] Channels { get; set; } = { }`: Array of imported channels.
|
||||
- `GroupGRPImportError[] GroupErrors { get; set; } = null`: Array of errors encountered during import of the entire group.
|
||||
- `bool GroupNameHasError { get; set; }`: UI hint indicating if the group name field has an error (used for visual feedback).
|
||||
|
||||
### `GroupHardwareDbRecord`
|
||||
|
||||
- **Implements**: `IGroupHardwareDbRecord`
|
||||
- **Properties**:
|
||||
- `int Id { get; set; }`: Primary key (database ID).
|
||||
- `int GroupId { get; set; }`: Foreign key to `Group` table.
|
||||
- `int DASId { get; set; }`: Foreign key to DAS (Data Acquisition System) record.
|
||||
- `string SerialNumber { get; set; }`: Serial number of hardware associated with the group.
|
||||
- **Constructors**:
|
||||
- `GroupHardwareDbRecord()`: Default constructor.
|
||||
- `GroupHardwareDbRecord(IGroupHardwareDbRecord copy)`: Copy constructor.
|
||||
- `GroupHardwareDbRecord(IDataReader reader)`: Populates from database reader.
|
||||
|
||||
### `TestSetupGroupRecord`
|
||||
|
||||
- **Implements**: `ITestSetupGroupRecord`
|
||||
- **Properties**:
|
||||
- `int GroupId { get; set; }`: Foreign key to group.
|
||||
- `int DisplayOrder { get; set; }`: Order in which the group appears in a test setup UI.
|
||||
- `string Position { get; set; }`: ISO 13499 position field.
|
||||
- `string TestObjectType { get; set; }`: ISO 13499 test object field.
|
||||
- `int TestSetupId { get; set; }`: Foreign key to test setup.
|
||||
- **Constructors**:
|
||||
- `TestSetupGroupRecord()`: Default constructor.
|
||||
- `TestSetupGroupRecord(IDataReader reader)`: Populates from database reader.
|
||||
- `TestSetupGroupRecord(ITestSetupGroupRecord copy)`: Copy constructor.
|
||||
|
||||
### `GroupDbRecord`
|
||||
|
||||
- **Implements**: `IGroupDbRecord`
|
||||
- **Properties**:
|
||||
- `int Id { get; set; }`: Primary key (database ID).
|
||||
- `string SerialNumber { get; set; }`: Serial number (used as group identifier).
|
||||
- `string Picture { get; set; }`: Path or identifier for group image.
|
||||
- `string DisplayName { get; set; }`: Human-readable name.
|
||||
- `string Description { get; set; }`: Group description.
|
||||
- `bool Embedded { get; set; }`: Whether the group is embedded (system-managed).
|
||||
- `DateTime LastModified { get; set; }`: Timestamp of last modification.
|
||||
- `string LastModifiedBy { get; set; }`: User who last modified the group.
|
||||
- `int? StaticGroupId { get; set; }`: Reference to static group ID if applicable.
|
||||
- `string ExtraProperties { get; set; }`: Serialized JSON of additional properties.
|
||||
- **Constructors**:
|
||||
- `GroupDbRecord()`: Default constructor.
|
||||
- `GroupDbRecord(IGroupDbRecord copy)`: Copy constructor.
|
||||
- `GroupDbRecord(IGroup copy, List<KeyValuePair<string, string>> extraProperties)`: Converts from domain `IGroup` model.
|
||||
- `GroupDbRecord(IDataReader reader)`: Populates from database reader.
|
||||
|
||||
### `GroupGRPImportChannel`
|
||||
|
||||
- **Constants**:
|
||||
- `SerialNumberField = 0`, `DisplayNameField = 1`, `ISOCodeField = 2`, `InvertField = 3`, `CapacityField = 4`, `InputModeField = 5`, `DefaultValueField = 6`, `ActiveValueField = 7`, `FireModeField = 8`, `DelayField = 9`, `LimitDurationField = 10`, `DurationField = 11`, `CurrentField = 12`: Field indices for parsing `.GRP` files.
|
||||
- **Properties**:
|
||||
- `string SensorSerialNumber { get; set; }`: Serial number of the sensor.
|
||||
- `string DisplayName { get; set; }`: Channel display name.
|
||||
- `string ISOCode { get; set; }`: ISO-compliant channel code.
|
||||
- `bool Invert { get; set; }`: Whether the channel signal is inverted.
|
||||
- `double FullScale { get; set; }`: Full-scale value (e.g., for analog channels).
|
||||
- `InputModes? InputMode { get; set; } = null`: Input mode (see enum below).
|
||||
- `FireModes? FireMode { get; set; } = null`: Fire mode (see enum below).
|
||||
- `double? DefaultValue { get; set; } = null`: Default value (e.g., for analog channels).
|
||||
- `double? ActiveValue { get; set; } = null`: Active value (e.g., trigger threshold).
|
||||
- `double? Delay { get; set; } = null`: Delay before firing (seconds).
|
||||
- `bool? LimitDuration { get; set; } = null`: Whether duration is limited.
|
||||
- `double? Duration { get; set; } = null`: Duration of fire pulse (seconds).
|
||||
- `double? Current { get; set; } = null`: Current limit for squib firing.
|
||||
- `GroupGRPImportError Error { get; set; } = null`: Channel-specific import error.
|
||||
- `GroupGRPImportGroup ParentGroup { get; set; }`: Parent group reference.
|
||||
- `string GroupName { get; }`: Derived from `ParentGroup.GroupName`; returns `"---"` if no parent.
|
||||
- **Nested Enums**:
|
||||
- `InputModes`: `na`, `TLH`, `THL`, `CCNO`, `CCNC`
|
||||
- `FireModes`: `na`, `CD`, `CC`
|
||||
- **Constants**:
|
||||
- `DefaultInputMode = InputModes.CCNO`
|
||||
- `DefaultFireMode = FireModes.CD`
|
||||
- `DefaultDefaultValue = 0.0`, `DefaultActiveValue = 1.0`, `DefaultDelay = 0.00`, `DefaultLimitDuration = true`, `DefaultDuration = 10.0`, `DefaultCurrent = 1.5`
|
||||
- **Methods**:
|
||||
- `void GroupNameInvalidate()`: Forces UI refresh for `GroupName` binding.
|
||||
|
||||
### `ChannelDbRecord`
|
||||
|
||||
- **Implements**: `IChannelDbRecord`
|
||||
- **Properties**:
|
||||
- `long Id { get; set; }`: Primary key (database ID).
|
||||
- `int GroupId { get; set; }`: Foreign key to group.
|
||||
- `string IsoCode { get; set; }`: ISO channel code.
|
||||
- `string IsoChannelName { get; set; }`: ISO-compliant channel name.
|
||||
- `string UserCode { get; set; }`: User-defined channel code.
|
||||
- `string UserChannelName { get; set; }`: User-defined channel name.
|
||||
- `int DASId { get; set; }`: Foreign key to DAS.
|
||||
- `int DASChannelIndex { get; set; }`: Channel index on the DAS.
|
||||
- `int GroupChannelOrder { get; set; }`: Order within the group.
|
||||
- `int TestSetupOrder { get; set; }`: Order within a test setup.
|
||||
- `int SensorId { get; set; }`: Foreign key to sensor.
|
||||
- `bool Disabled { get; set; }`: Whether channel is disabled.
|
||||
- `bool IsDisabled { get; set; }`: Backward-compatible alias for `Disabled`.
|
||||
- `DateTime LastModified { get; set; }`: Timestamp of last modification.
|
||||
- `string LastModifiedBy { get; set; }`: User who last modified the channel.
|
||||
- **Constructors**:
|
||||
- `ChannelDbRecord()`: Default constructor.
|
||||
- `ChannelDbRecord(IChannelDbRecord copy)`: Copy constructor.
|
||||
- `ChannelDbRecord(IDataReader reader)`: Populates from database reader.
|
||||
|
||||
### `GroupHelper`
|
||||
|
||||
- **Static utility class** (abstract, non-instantiable).
|
||||
- **Methods**:
|
||||
- `ClearStaticGroupNames()`, `SetStaticGroupName(int id, string name)`, `GetStaticGroupName(int id)`: Manage mapping of static group IDs to names.
|
||||
- `ClearEmbeddedGroupIdList()`, `SetEmbeddedGroupId(int id)`, `IsGroupEmbedded(int id)`: Manage list of embedded group IDs.
|
||||
- `ClearTestSetupGroupIds()`, `SetTestSetupGroupId(int groupId, int testSetupId)`, `GetTestSetupGroupId(int groupId)`: Map group IDs to test setup IDs.
|
||||
- `ClearGroupChannelIds()`, `AddGroupChannelId(int sensorId, int groupId)`, `GetGroupIdsFromChannels(int sensorId)`: Map sensor IDs to associated group IDs.
|
||||
- `ClearDASIds()`, `SetDASId(string serialNumber, int dasId)`, `GetDASId(string serialNumber)`: Map DAS serial numbers to database IDs.
|
||||
- `ClearBaseModuleChannelIndexList()`, `SetBaseModuleChannelIndexList(...)`, `GetChannelIndexes(...)`: Manage channel index mappings for base/module serial number pairs.
|
||||
- `ClearDASIdChannelIndexGroupIdList()`, `SetDASIdChannelIndexGroupIdList(...)`, `GetGroupIds(...)`: Map DAS ID + channel index → group ID.
|
||||
- `ClearTestSetupHardwareIds()`, `AddTestSetupHardwareId(int dasId, int testSetupId)`, `GetTestSetupHardwareIds(int DASId)`: Map DAS IDs to associated test setup IDs.
|
||||
- `ClearGroupHardwareIds()`, `AddGroupHardwareId(int dasId, int groupId)`, `GetGroupHardwareIds(int DASId)`: Map DAS IDs to associated group IDs.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`GroupGRPImportGroup.Channels`**: Always initialized to an empty array (`{ }`), never `null`.
|
||||
- **`GroupGRPImportGroup.GroupErrors`**: Initialized to `null` by default; non-null only if errors occurred during import.
|
||||
- **`GroupGRPImportChannel.*` nullable properties** (e.g., `InputMode`, `DefaultValue`, `FireMode`, etc.): May be `null` if not specified in the `.GRP` file; default values are defined as constants (e.g., `DefaultInputMode`, `DefaultFireMode`, etc.).
|
||||
- **`GroupDbRecord.ExtraProperties`**: Serialized as JSON using `JavaScriptSerializer`; deserialization responsibility lies with consumers.
|
||||
- **`ChannelDbRecord.IsDisabled`**: Redirects to `Disabled`; both properties must be kept in sync when set via `IsDisabled`.
|
||||
- **`GroupHelper` static caches**: Must be cleared between operations (e.g., import sessions) to avoid stale data; no automatic cleanup is provided.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **`DTS.Common.Base`**: Base classes (`BasePropertyChanged`) used by `GroupGRPImportGroup`, `GroupGRPImportChannel`, `GroupHardwareDbRecord`, `TestSetupGroupRecord`, `GroupDbRecord`, `ChannelDbRecord`.
|
||||
- **`DTS.Common.Interface.Groups`**: Interfaces `IGroupHardwareDbRecord`, `ITestSetupGroupRecord`, `IGroupDbRecord`.
|
||||
- **`DTS.Common.Interface.Channels`**: Interface `IChannelDbRecord`.
|
||||
- **`System.Data`**: `IDataReader` used in record constructors.
|
||||
- **`System.ComponentModel.DataAnnotations`**: `[Key]` attribute on `Id` fields.
|
||||
- **`System.Web.Script.Serialization.JavaScriptSerializer`**: Used in `GroupDbRecord` constructor to serialize `ExtraProperties`.
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- **Import/Export logic**: `.GRP` file parsing and validation (not included here, but inferred from `GroupGRPImport*` classes).
|
||||
- **Database layer**: `GroupDbRecord`, `ChannelDbRecord`, `GroupHardwareDbRecord`, `TestSetupGroupRecord` are used by data access layers.
|
||||
- **UI layer**: `GroupGRPImportGroup.GroupNameHasError` and `GroupGRPImportChannel.GroupName` suggest binding to UI controls (e.g., textboxes, error indicators).
|
||||
- **Runtime metadata management**: `GroupHelper` is used by other modules to resolve IDs, serial numbers, and mappings without repeated DB queries.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`GroupGRPImportChannel.GroupName` is a computed property**: It returns `ParentGroup.GroupName` or `"---"` if `ParentGroup` is `null`. UI bindings must be manually invalidated via `GroupNameInvalidate()` if `ParentGroup` changes after construction.
|
||||
- **`IsDisabled` alias in `ChannelDbRecord`**: While `IsDisabled` redirects to `Disabled`, setting `IsDisabled` only raises `OnPropertyChanged("IsDisabled")`, not `"Disabled"`. This may cause UI binding inconsistencies if consumers bind to `"Disabled"` directly.
|
||||
- **`GroupDbRecord.ExtraProperties` serialization**: Uses legacy `JavaScriptSerializer`; not compatible with modern `System.Text.Json`. Consumers must use the same serializer for round-tripping.
|
||||
- **`GroupHelper` static state**: Caches are global and mutable; failure to call `Clear*()` methods between operations (e.g., import sessions) can lead to incorrect ID lookups or stale mappings.
|
||||
- **`GroupHardwareDbRecord.Id` vs `GroupDbRecord.Id`**: Both use `int Id`, but `ChannelDbRecord.Id` uses `long Id`. Ensure correct type usage in queries.
|
||||
- **`GroupGRPImportGroup.GroupErrors` is nullable**: Consumers must explicitly check for `null` before iterating (e.g., `?.Length` or `GroupErrors?.Any()`).
|
||||
- **`GroupHelper.GetChannelIndexes` and `GetGroupIds`**: Use exact string/ID matching on nested dictionaries; performance may degrade with large datasets due to nested loops.
|
||||
- **`GroupDbRecord.SerialNumber` vs `GroupName`**: In `GroupDbRecord(IGroup copy, ...)`, `SerialNumber` is set to `copy.Name`, but `DisplayName` is set separately. Ensure `Name` and `DisplayName` are distinct in the `IGroup` interface.
|
||||
@@ -0,0 +1,158 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Groups/ChannelSettings/ChannelSettingRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/ChannelSettings/GroupChannelSettingRecord.cs
|
||||
- Common/DTS.Common/Classes/Groups/ChannelSettings/ChannelSettingBase.cs
|
||||
generated_at: "2026-04-16T03:18:55.361650+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "48681046c7a61e91"
|
||||
---
|
||||
|
||||
# ChannelSettingRecord, GroupChannelSettingRecord, and ChannelSettingBase Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines core data structures for representing channel configuration settings within the DTS system. It provides three interrelated classes: `ChannelSettingRecord` (a lightweight record of a *type* of channel setting, including its ID, name, and default value), `GroupChannelSettingRecord` (a *specific instance* of a setting applied to a particular channel), and `ChannelSettingBase` (a richer, type-aware implementation of `IChannelSetting` that supports parsing and type conversion of setting values). Together, they enable storage, retrieval, and manipulation of channel-specific configuration parameters across different channel types (analog, digital, squib, UART, CAN, etc.), forming the data layer for channel configuration management.
|
||||
|
||||
## 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 { get; set; }`**
|
||||
Unique identifier for this setting *type* (e.g., `"Range"` or `"SquibCurrent"`).
|
||||
- **`string SettingName { get; set; }`**
|
||||
Human-readable name of the setting (e.g., `"Range"`).
|
||||
- **`string DefaultValue { get; set; }`**
|
||||
Default value string for this setting type (e.g., `"10"` for a range setting).
|
||||
|
||||
> *Note:* Inherits from `Common.Base.BasePropertyChanged`, implying `INotifyPropertyChanged` support for UI binding.
|
||||
|
||||
---
|
||||
|
||||
### `GroupChannelSettingRecord`
|
||||
- **`GroupChannelSettingRecord()`**
|
||||
Default constructor; initializes an empty record.
|
||||
- **`GroupChannelSettingRecord(IDataReader reader, int storedProcedureVersionUsed)`**
|
||||
Populates the record from an `IDataReader`. If `storedProcedureVersionUsed >= Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`, it reads `"ChannelId"` using `Utility.GetLong`; otherwise, `ChannelId` is left uninitialized (default `0`). Always reads `"SettingId"` (`Utility.GetInt`) and `"SettingValue"` (`Utility.GetString`).
|
||||
- **`GroupChannelSettingRecord(long channelId, int settingId, string settingValue)`**
|
||||
Constructor for direct initialization with explicit values.
|
||||
|
||||
- **`long ChannelId { get; set; }`**
|
||||
Identifier of the channel to which this setting instance applies.
|
||||
- **`int SettingId { get; set; }`**
|
||||
Identifier of the setting *type* (corresponds to `ChannelSettingRecord.Id`).
|
||||
- **`string SettingValue { get; set; }`**
|
||||
Actual value string assigned to this setting for the channel.
|
||||
|
||||
> *Note:* Inherits from `BasePropertyChanged`, implying `INotifyPropertyChanged` support.
|
||||
|
||||
---
|
||||
|
||||
### `ChannelSettingBase`
|
||||
- **`ChannelSettingBase(int settingType, string name, string defaultValue)`**
|
||||
Constructor initializing `SettingTypeId`, `SettingName`, and `DefaultValue`. `Value` is initialized to `null`.
|
||||
- **`ChannelSettingBase(IChannelSetting setting)`**
|
||||
Copy constructor; initializes all properties from another `IChannelSetting` instance.
|
||||
- **`IChannelSetting Clone()`**
|
||||
Returns a new `ChannelSettingBase` instance with all properties copied from the current instance.
|
||||
|
||||
- **`long ChannelId { get; set; }`**
|
||||
Channel identifier associated with this setting instance.
|
||||
- **`int SettingTypeId { get; protected set; }`**
|
||||
Type ID of the setting (e.g., used to group settings by channel type).
|
||||
- **`string SettingName { get; protected set; }`**
|
||||
Name of the setting (e.g., `"Range"`, `"SquibCurrent"`).
|
||||
- **`string DefaultValue { get; protected set; }`**
|
||||
Default value string for this setting type.
|
||||
- **`string Value { get; set; }`**
|
||||
Current value string for this setting instance.
|
||||
|
||||
- **`double DoubleValue { get; set; }`**
|
||||
Parses `Value` as a `double` (using `InvariantCulture`); if parsing fails, returns `DoubleDefaultValue`. Setting updates `Value`.
|
||||
- **`double DoubleDefaultValue { get; }`**
|
||||
Parses `DefaultValue` as a `double` (using `InvariantCulture`).
|
||||
- **`int IntValue { get; set; }`**
|
||||
Parses `Value` as an `int`; if parsing fails, returns `IntDefaultValue`. Setting updates `Value`.
|
||||
- **`int IntDefaultValue { get; }`**
|
||||
Parses `DefaultValue` as an `int`.
|
||||
- **`bool BoolValue { get; set; }`**
|
||||
Parses `Value` as a `bool`; if parsing fails, returns `BoolDefaultValue`. Setting updates `Value`.
|
||||
- **`bool BoolDefaultValue { get; }`**
|
||||
Parses `DefaultValue` as a `bool`. If parsing fails and `DefaultValue` is null/empty, returns `false`; otherwise, returns `!DefaultValue.Equals(0)` (note: this is a string comparison, not numeric).
|
||||
|
||||
> *Note:* Implements `IChannelSetting`. Constants defined as `public const string` for known setting names (see *Gotchas* for caveats).
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`ChannelSettingRecord`**
|
||||
- `Id`, `SettingName`, and `DefaultValue` are populated from database columns and must be non-null (except `DefaultValue`, which may be empty or null per `Utility.GetString` behavior).
|
||||
- `Id` is expected to be unique per setting type.
|
||||
|
||||
- **`GroupChannelSettingRecord`**
|
||||
- `SettingId` must correspond to a valid `ChannelSettingRecord.Id` (enforced externally, not by this class).
|
||||
- `ChannelId` may be uninitialized (`0`) if constructed via `IDataReader` constructor with `storedProcedureVersionUsed < Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`.
|
||||
- `SettingValue` may be null or empty.
|
||||
|
||||
- **`ChannelSettingBase`**
|
||||
- `SettingName` and `DefaultValue` are set only via constructor and remain immutable after construction (due to `protected set`).
|
||||
- `Value` is mutable and may be null/empty.
|
||||
- `DoubleValue`, `IntValue`, and `BoolValue` fall back to their respective `*DefaultValue` properties if `Value` is unparsable.
|
||||
- `BoolDefaultValue` has non-intuitive behavior: if `DefaultValue` cannot be parsed as `bool`, and is non-empty, it returns `!DefaultValue.Equals("0")` (string comparison), *not* numeric evaluation.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **`DTS.Common.Interface.Channels`**
|
||||
Defines interfaces `IChannelSettingRecord`, `IGroupChannelSettingRecord`, and `IChannelSetting` (consumed by these classes).
|
||||
- **`DTS.Common.Base`**
|
||||
Provides `BasePropertyChanged` (base class for `ChannelSettingRecord` and `GroupChannelSettingRecord`).
|
||||
- **`System.Data`**
|
||||
Used for `IDataReader` in constructors.
|
||||
- **`DTS.Common` (internal)**
|
||||
- `Utility` class (for `GetInt`, `GetString`, `GetLong`).
|
||||
- `Constants` (for `BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`).
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- Likely consumed by:
|
||||
- Data access layers (to populate records from `IDataReader`).
|
||||
- Channel configuration services (to manage per-channel settings).
|
||||
- UI layers (via `INotifyPropertyChanged` support).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`BoolDefaultValue` logic is error-prone**:
|
||||
If `DefaultValue` is `"1"` or `"true"`, `bool.TryParse` succeeds. But if `DefaultValue` is `"0"`, `bool.TryParse` fails (since `"0"` is not a valid `bool` string), and `BoolDefaultValue` returns `!DefaultValue.Equals("0")` → `false`. This is inconsistent with typical `bool` parsing and may cause misinterpretation of `"0"` as `false` only when `bool.TryParse` fails. Prefer explicit `"true"`/`"false"` defaults.
|
||||
|
||||
- **`ChannelSettingBase` constants are *not* exhaustive**:
|
||||
The `public const string` fields list known setting names (e.g., `"Range"`, `"SquibCurrent"`), but are not validated against actual usage. New settings may be added without updating these constants, leading to string literals scattered elsewhere in the codebase.
|
||||
|
||||
- **`GroupChannelSettingRecord` constructor behavior depends on `storedProcedureVersionUsed`**:
|
||||
If `storedProcedureVersionUsed < Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION`, `ChannelId` is *not* read from the `IDataReader`, leaving it at `0`. This introduces version-dependent data loading logic that may cause silent bugs if versioning is mismanaged.
|
||||
|
||||
- **`ChannelSettingBase` does not enforce `Value` format**:
|
||||
While `DoubleValue`, `IntValue`, and `BoolValue` provide type-safe access, `Value` itself is a raw `string`. No validation ensures `Value` matches the expected format for `SettingName`.
|
||||
|
||||
- **`Clone()` returns `IChannelSetting`, not `ChannelSettingBase`**:
|
||||
The copy constructor is `private`, and `Clone()` returns the interface type, limiting extensibility or deep-copy behavior in subclasses.
|
||||
|
||||
- **No null-safety for `DefaultValue` in numeric/bool conversions**:
|
||||
`DoubleDefaultValue`, `IntDefaultValue`, and `BoolDefaultValue` call `double.Parse`, `int.Parse`, or `bool.TryParse` on `DefaultValue` without null checks. If `DefaultValue` is `null`, this will throw `ArgumentNullException` or `FormatException`.
|
||||
|
||||
- **`SettingName` is `protected set`**:
|
||||
Cannot be modified after construction, but `ChannelSettingBase` is not sealed—subclasses could theoretically override behavior, though no subclasses are visible in the provided source.
|
||||
|
||||
- **`ChannelSettingRecord` and `GroupChannelSettingRecord` share naming but serve distinct roles**:
|
||||
`ChannelSettingRecord` defines a *type* of setting (e.g., `"Range"`), while `GroupChannelSettingRecord` defines an *instance* (e.g., channel 123’s `"Range"` = `"10"`). Confusing these roles is a common source of bugs.
|
||||
|
||||
None identified beyond the above.
|
||||
321
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Hardware.md
Normal file
321
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Hardware.md
Normal file
@@ -0,0 +1,321 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Hardware/ExternalTilt.cs
|
||||
- Common/DTS.Common/Classes/Hardware/DragAndDropPayload.cs
|
||||
- Common/DTS.Common/Classes/Hardware/SerializableAAF.cs
|
||||
- Common/DTS.Common/Classes/Hardware/DASDBRecord.cs
|
||||
- Common/DTS.Common/Classes/Hardware/DASChannelDBRecord.cs
|
||||
- Common/DTS.Common/Classes/Hardware/DASMonitorInfo.cs
|
||||
generated_at: "2026-04-16T03:14:40.842937+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f2a89e74efee1556"
|
||||
---
|
||||
|
||||
# Hardware Data Models Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines core data models for representing hardware components in the DTS (Data Acquisition System) ecosystem. It provides structured classes for serializing, deserializing, and persisting hardware metadata—including DAS (Data Acquisition System) units, their channels, external tilt sensors, and monitoring configurations—to and from databases and files. These models serve as the canonical data structures for hardware inventory management, configuration synchronization, and system diagnostics across the application.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ExternalTilt`
|
||||
A simple POCO representing metadata for an external tilt sensor.
|
||||
|
||||
- **`ExternalTilt()`**
|
||||
Parameterless constructor.
|
||||
|
||||
- **`string SerialNumber { get; set; }`**
|
||||
Serial number of the tilt sensor.
|
||||
|
||||
- **`byte TiltID { get; set; }`**
|
||||
Unique identifier for the tilt sensor within a system.
|
||||
|
||||
- **`string SystemID { get; set; }`**
|
||||
Identifier of the system the tilt sensor is associated with.
|
||||
|
||||
- **`string SystemLocation { get; set; }`**
|
||||
Physical or logical location of the tilt sensor within the system.
|
||||
|
||||
---
|
||||
|
||||
### `DragAndDropPayload`
|
||||
A static class defining string constants used as clipboard/data transfer formats for hardware table drag-and-drop operations.
|
||||
|
||||
- **`const string FORMAT = "RESOLVECHANNELS_HARDWARETABLE"`**
|
||||
Primary format identifier for hardware table data transfer.
|
||||
|
||||
- **`const string ALT_FORMAT = "ALT_RESOLVECHANNELS_HARDWARETABLE"`**
|
||||
Alternate format identifier (likely for legacy or variant workflows).
|
||||
|
||||
- **`const string CTRL_FORMAT = "CTRL_RESOLVECHANNELS_HARDWARETABLE"`**
|
||||
Control-key modifier variant format identifier.
|
||||
|
||||
---
|
||||
|
||||
### `SerializableAAF`
|
||||
A class for serializing/deserializing AAF (Anti-Aliasing Filter) configuration data. *Note: All core functionality is currently commented out.*
|
||||
|
||||
- **`enum DAS_TYPE { TDAS = 0, SLICE = 1 }`**
|
||||
Defines DAS hardware types.
|
||||
|
||||
- **`string GetSerializedKey()`** *(commented out)*
|
||||
Would return a key string of the form `"{DAS_TYPE}_{SampleRate}"`.
|
||||
|
||||
- **`string GetSerializedValue()`** *(commented out)*
|
||||
Would return the AAF value as a culture-invariant string.
|
||||
|
||||
- **`void FromSerializedStrings(string key, string value)`** *(commented out)*
|
||||
Would parse `key` and `value` strings to reconstruct internal state.
|
||||
|
||||
*No active public methods or properties are available in the current source.*
|
||||
|
||||
---
|
||||
|
||||
### `DASDBRecord`
|
||||
A database-mapped entity representing a DAS unit in the `DAS` table.
|
||||
|
||||
- **`static DateTime INVALID_DATE => new DateTime(1970, 1, 1)`**
|
||||
Sentinel value for unset date fields.
|
||||
|
||||
- **`DASDBRecord()`**
|
||||
Default constructor.
|
||||
|
||||
- **`DASDBRecord(IDASDBRecord copy)`**
|
||||
Copy constructor; initializes fields from another `IDASDBRecord` instance.
|
||||
|
||||
- **`DASDBRecord(IDataReader reader)`**
|
||||
Constructor that populates fields from a database `IDataReader`.
|
||||
|
||||
- **`int DASId { get; set; }`**
|
||||
Primary key (`[Key]`, `[Column("DASId")]`).
|
||||
|
||||
- **`string SerialNumber { get; set; }`**
|
||||
Required; max length 50 (`[Required]`, `[StringLength(50)]`).
|
||||
|
||||
- **`int DASType { get; set; }`**
|
||||
Numeric type identifier for the DAS.
|
||||
|
||||
- **`int MaxModules { get; set; }`**, **`long MaxMemory { get; set; }`**, **`double MaxSampleRate { get; set; }`**, **`double MinSampleRate { get; set; }`**
|
||||
Hardware specifications.
|
||||
|
||||
- **`string FirmwareVersion { get; set; }`**
|
||||
Firmware version string; defaults to `""`.
|
||||
|
||||
- **`DateTime CalDate { get; set; }`**
|
||||
Calibration date; defaults to `INVALID_DATE`.
|
||||
|
||||
- **`int ProtocolVersion { get; set; }`**
|
||||
Protocol version number.
|
||||
|
||||
- **`DateTime LastModified { get; set; }`**, **`string LastModifiedBy { get; set; }`**
|
||||
Timestamp and user who last modified the record.
|
||||
|
||||
- **`int Version { get; set; }`**
|
||||
Concurrency/version tracking.
|
||||
|
||||
- **`bool LocalOnly { get; set; }`**
|
||||
Flag indicating local-only storage (deprecated per `DASChannelDBRecord`).
|
||||
|
||||
- **`DateTime LastUsed { get; set; }`**, **`string LastUsedBy { get; set; }`**
|
||||
Last usage timestamp and user.
|
||||
|
||||
- **`string Connection { get; set; }`**, **`int Channels { get; set; }`**, **`string Position { get; set; }`**
|
||||
Connection type, channel count, and physical/logical position.
|
||||
|
||||
- **`int[] ChannelTypes { get; set; }`**
|
||||
Array of channel type identifiers; defaults to `new int[0]`.
|
||||
|
||||
- **`bool IsProgrammable { get; set; }`**, **`bool IsReconfigurable { get; set; }`**, **`bool IsModule { get; set; }`**
|
||||
Hardware capability flags.
|
||||
|
||||
- **`int PositionOnDistributor { get; set; }`**, **`int PositionOnChain { get; set; }`**, **`int Port { get; set; }`**
|
||||
Positioning metadata.
|
||||
|
||||
- **`string ParentDAS { get; set; }`**
|
||||
Serial number of parent DAS (for modular systems).
|
||||
|
||||
- **`DateTime? FirstUseDate { get; set; }`**, **`bool IsFirstUseValid { get; set; }`**
|
||||
Optional first-use date and validity flag.
|
||||
|
||||
- **`bool StandIn { get; set; }`**
|
||||
Flag indicating this is a stand-in (replacement) unit.
|
||||
|
||||
- **`int? TestId { get; set; }`**, **`int? GroupId { get; set; }`**
|
||||
Optional test and group identifiers.
|
||||
|
||||
- **`double MaxAAFRate { get; set; }`**
|
||||
Maximum AAF rate supported.
|
||||
|
||||
---
|
||||
|
||||
### `DASChannelDBRecord`
|
||||
A database-mapped entity representing a channel on a DAS unit.
|
||||
|
||||
- **`string HardwareId { get; set; }`**
|
||||
Composite hardware identifier: `serialnumber_dastype`.
|
||||
|
||||
- **`int DaschannelId { get; set; }`**
|
||||
Primary key (`[Key]`, `[Column("DASChannelId")]`).
|
||||
|
||||
- **`int? Dasid { get; set; }`**
|
||||
Foreign key to `DAS.DASId`.
|
||||
|
||||
- **`int ChannelIdx { get; set; }`**
|
||||
Physical channel index on the DAS.
|
||||
|
||||
- **`const int DEFAULT_SUPPORTED_BRIDGES = 12`**
|
||||
Default bridge support mask (half + full bridge).
|
||||
|
||||
- **`int SupportedBridges { get; set; }`**
|
||||
Bitmask of supported bridge types:
|
||||
- Bit 0: IEPE
|
||||
- Bit 1: Quarter bridge
|
||||
- Bit 2: Half bridge
|
||||
- Bit 3: Full bridge
|
||||
- Bit 4: Digital input
|
||||
- Bit 5: Squib fire
|
||||
- Bit 6: Digital output
|
||||
- Bit 7: Half bridge signal plus (G5)
|
||||
- Bit 8: Real-time clock
|
||||
- Bit 9: UART
|
||||
|
||||
- **`const int DEFAULT_SUPPORTED_EXCITATIONS = 16`**
|
||||
Default excitation mask (5V).
|
||||
|
||||
- **`int SupportedExcitations { get; set; }`**
|
||||
Bitmask of supported excitation voltages:
|
||||
- Bit 0: Invalid
|
||||
- Bit 1: 2V
|
||||
- Bit 2: 2.5V
|
||||
- Bit 3: 3V
|
||||
- Bit 4: 5V
|
||||
- Bit 5: 10V
|
||||
- Bit 6: 1V
|
||||
|
||||
- **`int DASDisplayOrder { get; set; }`**
|
||||
Logical display order (may differ from physical order).
|
||||
|
||||
- **`bool LocalOnly { get; set; }`**
|
||||
Deprecated; indicates local-only storage.
|
||||
|
||||
- **`const int DEFAULT_SUPPORTED_DI_MODES = 16`**, **`int SupportedDigitalInputModes { get; set; }`**
|
||||
Default and configurable digital input modes bitmask.
|
||||
|
||||
- **`const int DEFAULT_SQUIB_FIRE_MODES = 16`**, **`int SupportedSquibFireModes { get; set; }`**
|
||||
Default and configurable squib fire modes bitmask.
|
||||
|
||||
- **`const int DEFAULT_SUPPORTED_DO_MODES = 16`**, **`int SupportedDigitalOutputModes { get; set; }`**
|
||||
Default and configurable digital output modes bitmask.
|
||||
|
||||
- **`string ModuleSerialNumber { get; set; }`**
|
||||
Serial number of the module the channel belongs to.
|
||||
|
||||
- **`int SettingId { get; set; }`**
|
||||
Configuration setting ID.
|
||||
|
||||
- **`int ModuleArrayIndex { get; set; }`**
|
||||
Array index of the module on the DAS or rack.
|
||||
|
||||
- **`DASChannelDBRecord()`**, **`DASChannelDBRecord(IDataReader reader)`**, **`DASChannelDBRecord(IDASChannelDBRecord copy)`**
|
||||
Constructors for default, database, and copy initialization.
|
||||
|
||||
---
|
||||
|
||||
### `DASMonitorInfo`
|
||||
A class for reading/writing and constructing monitor configuration data for a DAS unit, primarily used for tilt sensor calibration and channel diagnostics.
|
||||
|
||||
- **`string SerialNumber { get; private set; }`**
|
||||
DAS serial number.
|
||||
|
||||
- **`double[] TiltSensorCals { get; private set; }`**
|
||||
Calibration coefficients for 18 tilt sensors.
|
||||
|
||||
- **`short[] TiltSensorDataPre { get; private set; }`**
|
||||
Pre-processed tilt sensor raw data (3 values).
|
||||
|
||||
- **`DFConstantsAndEnums.TiltAxes TiltAxes { get; private set; }`**
|
||||
Axis configuration (e.g., `IXIYIZ`).
|
||||
|
||||
- **`int AxisIgnored { get; private set; }`**
|
||||
Bitmask indicating ignored axes.
|
||||
|
||||
- **`double MountOffsetAxisOne { get; private set; }`**, **`double MountOffsetAxisTwo { get; private set; }`**
|
||||
Mounting offsets for two axes.
|
||||
|
||||
- **`string GetChannelName(int index)`**
|
||||
Returns channel name based on internal `_channelNames` array or a default `"Ch#XX"`.
|
||||
|
||||
- **`double GetOffsetTolerancemVHigh(int index)`**, **`double GetOffsetTolerancemVLow(int index)`**
|
||||
Returns high/low offset tolerance (mV) for a given channel index.
|
||||
|
||||
- **`void ReadFromFile(string path)`**
|
||||
Reads monitor info from a text file (10 lines, one per `Fields` enum value). Silently fails on file not found or parse errors.
|
||||
|
||||
- **`void WriteToFile(string path)`**
|
||||
Writes monitor info to a text file. Logs exceptions via `APILogger`.
|
||||
|
||||
- **`DASMonitorInfo(IDASCommunication das, IsoViewMode mode)`**
|
||||
Constructor that populates fields from an active DAS communication object (`das`) and view mode.
|
||||
|
||||
- **`DASMonitorInfo(string path)`**
|
||||
Constructor that calls `ReadFromFile(path)`.
|
||||
|
||||
*Note: Several private helper methods (`GetTiltSensorCals`, `GetTiltSensorData`, `GetChannelNames`, etc.) are used internally during construction.*
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`DASDBRecord`**
|
||||
- `SerialNumber` and `Position` are required (`[Required]` attribute) and must be ≤50 characters.
|
||||
- `CalDate` and `LastUsed` default to `INVALID_DATE` (1970-01-01) if unset.
|
||||
- `ChannelTypes` is always initialized to a non-null array (default `new int[0]`).
|
||||
- `IsFirstUseValid` is `false` by default; `FirstUseDate` is `null` if invalid or unset.
|
||||
|
||||
- **`DASChannelDBRecord`**
|
||||
- `SupportedBridges`, `SupportedExcitations`, `SupportedDigitalInputModes`, `SupportedDigitalOutputModes`, and `SupportedSquibFireModes` use specific bitmasks defined by constants.
|
||||
- `ChannelIdx` defaults to `-1` if not set.
|
||||
- `ModuleArrayIndex` is mutable only via direct assignment (no `SetProperty` call).
|
||||
|
||||
- **`DASMonitorInfo`**
|
||||
- `_channelNames`, `_offsetTolerancesHigh`, `_offsetTolerancesLow` arrays are initialized to empty arrays by default.
|
||||
- `ReadFromFile` silently ignores missing files or malformed lines.
|
||||
- `TiltSensorCals` is always 18 elements; `TiltSensorDataPre` is always 3 elements.
|
||||
|
||||
- **`SerializableAAF`**
|
||||
- No active invariants (all functionality is commented out).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- **`DTS.Common.Base`** (`BasePropertyChanged` base class for `DASDBRecord`, `DASChannelDBRecord`).
|
||||
- **`DTS.Common.Enums`**, **`DTS.Common.Enums.DASFactory`** (`DFConstantsAndEnums.TiltAxes`, `IsoViewMode`).
|
||||
- **`DTS.Common.Interface.DataRecorders`** (`IDASDBRecord`, `IDASChannelDBRecord`).
|
||||
- **`DTS.Common.Interface.DASFactory`** (`IDASCommunication`).
|
||||
- **`DTS.Common.Interface.Hardware`** (`ITiltSensorCalAware`).
|
||||
- **`DTS.Common.Utilities.Logging`** (`APILogger`).
|
||||
- **`System.ComponentModel.DataAnnotations`**, **`System.Data`** (EF Core attributes, `IDataReader`).
|
||||
- **`System`**, **`System.Linq`**, **`System.Text`**, **`System.Globalization`**, **`System.IO`**.
|
||||
|
||||
### This Module Is Used By:
|
||||
- Database persistence layers (via `DASDBRecord`, `DASChannelDBRecord`).
|
||||
- Hardware configuration UIs (via `DASMonitorInfo`, `ExternalTilt`).
|
||||
- Drag-and-drop handlers (via `DragAndDropPayload` constants).
|
||||
- Serialization/deserialization utilities (though `SerializableAAF` is currently unused).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`SerializableAAF` is non-functional**: All public members are commented out. Do not rely on this class for serialization.
|
||||
- **`DASChannelDBRecord.LocalOnly` is deprecated**: Despite being present, it should not be used for new logic.
|
||||
- **`DASDBRecord.IsProgrammable` maps to `"Reprogramable"` column**: Note the typo in the column name (`Reprogramable` vs. `IsProgrammable`).
|
||||
- **`DASMonitorInfo` tolerances are per-channel but stored flat**: `_offsetTolerancesHigh`/`_offsetTolerancesLow` arrays are indexed per channel, but their length depends on the number of analog input channels in the DAS configuration.
|
||||
- **`DASMonitorInfo.GetChannelName` falls back to default naming**: If `_channelNames` is shorter than `index`, it returns `"Ch#XX"` instead of throwing.
|
||||
- **`DASMonitorInfo.ToShortArray` has a bug**: In `ToShortArray`, it parses `line` instead of `token` (`short.TryParse(line, ...)`)—likely a typo.
|
||||
- **`DASMonitorInfo` uses `float.NaN` for mount offsets**: Despite `MountOffsetAxisOne/Two` being `double`, `GetMountOffsetAxisOne/Two` return `float.NaN` when no modules exist. This may cause precision loss or unexpected behavior.
|
||||
- **`DASDBRecord` uses `INVALID_DATE` for unset dates**: Code must explicitly check for `DateTime(1970, 1, 1)` to detect unset values.
|
||||
101
enriched-qwen3-coder-next/Common/DTS.Common/Classes/ISO.md
Normal file
101
enriched-qwen3-coder-next/Common/DTS.Common/Classes/ISO.md
Normal file
@@ -0,0 +1,101 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/ISO/IsoCode.cs
|
||||
generated_at: "2026-04-16T03:15:00.433406+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f4af52456432964e"
|
||||
---
|
||||
|
||||
# ISO
|
||||
|
||||
## Documentation: `IsoCode` Class
|
||||
|
||||
### 1. Purpose
|
||||
The `IsoCode` class encapsulates a fixed-length 16-character ISO-compliant location code, where each position or substring has a defined semantic meaning (e.g., test object, position, main/fine locations, physical dimension, direction, filter class). It provides a structured, type-safe interface to parse, manipulate, and reconstruct such codes while enforcing padding with `'?'` for missing characters and `'0'` for out-of-bounds or invalid inputs. This class exists to standardize handling of ISO 14134–2–compliant or similar legacy location identifiers in the system, likely used in medical device or calibration contexts.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### Constructor
|
||||
- **`IsoCode(string isoCode)`**
|
||||
Initializes a new instance by parsing a 16-character (or shorter/longer) input string. Truncates to 16 chars if longer; pads with `'?'` if shorter. Assigns each character directly to `_isoCodeFull[i]`.
|
||||
|
||||
#### Properties
|
||||
- **`string TestObject`**
|
||||
Gets/sets the first character (`_isoCodeFull[0]`). Setter replaces `null`/empty input with `'?'`.
|
||||
|
||||
- **`string Position`**
|
||||
Gets/sets the second character (`_isoCodeFull[1]`). Setter replaces `null`/empty input with `'?'`.
|
||||
|
||||
- **`string MainLocation`**
|
||||
Gets/sets characters at indices 2–5 (4 chars). Setter pads with `'?'` if < 4 chars, truncates to 4 if > 4.
|
||||
|
||||
- **`string FineLocation1`**
|
||||
Gets/sets characters at indices 6–7 (2 chars). Setter pads with `'?'` if < 2 chars.
|
||||
|
||||
- **`string FineLocation2`**
|
||||
Gets/sets characters at indices 8–9 (2 chars). Setter pads with `'?'` if < 2 chars.
|
||||
|
||||
- **`string FineLocation3`**
|
||||
Gets/sets characters at indices 10–11 (2 chars). Setter pads with `'?'` if < 2 chars.
|
||||
|
||||
- **`string PhysicalDimension`**
|
||||
Gets/sets characters at indices 12–13 (2 chars). Setter pads with `'?'` if < 2 chars, truncates to 2 if > 2.
|
||||
|
||||
- **`string Direction`**
|
||||
Gets/sets the 15th character (`_isoCodeFull[14]`). Setter replaces `null`/empty input with `'?'`.
|
||||
|
||||
- **`string FilterClass`**
|
||||
Gets/sets the 16th character (`_isoCodeFull[15]`). Setter replaces `null`/empty input with `'?'`.
|
||||
|
||||
- **`string StringRepresentation`**
|
||||
Gets/sets the full 16-character code as a string.
|
||||
- *Getter*: concatenates all `_isoCodeFull` characters.
|
||||
- *Setter*: assigns `value[i]` to `_isoCodeFull[i]` for `i < 16`; sets remaining positions to `'0'` if `value.Length < 16`.
|
||||
⚠️ **Note**: Unlike other setters, this one pads *short* inputs with `'0'`, not `'?'`.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `_isoCodeFull` is always exactly 16 characters long.
|
||||
- All public properties (`TestObject`, `Position`, etc.) map to fixed, non-overlapping substrings of `_isoCodeFull`:
|
||||
- `TestObject`: index 0
|
||||
- `Position`: index 1
|
||||
- `MainLocation`: indices 2–5
|
||||
- `FineLocation1`: indices 6–7
|
||||
- `FineLocation2`: indices 8–9
|
||||
- `FineLocation3`: indices 10–11
|
||||
- `PhysicalDimension`: indices 12–13
|
||||
- `Direction`: index 14
|
||||
- `FilterClass`: index 15
|
||||
- When setting any property via its public setter:
|
||||
- Short inputs are padded with `'?'` (except `StringRepresentation`, which uses `'0'`).
|
||||
- Long inputs are truncated to the property’s fixed length.
|
||||
- Invalid or missing characters (e.g., `null`, empty string) are normalized to `'?'` for most properties, but `'0'` may appear in `StringRepresentation` setter or internal `_mainLocation`/`_fineLocation*` setters if arrays are undersized (see *Gotchas*).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal**: Uses `System.Text.StringBuilder` (for `StringRepresentation` getter).
|
||||
- **External**:
|
||||
- `DTS.Common.ISO` namespace (no external NuGet or framework dependencies beyond `System`).
|
||||
- **Depended on**: Not visible in source; likely consumed by higher-level location/positioning or calibration modules (e.g., device state management, test sequencing).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Inconsistent padding in `StringRepresentation` setter**: Unlike all other property setters, `StringRepresentation` pads short inputs with `'0'`, not `'?'`. This breaks the expected `'?'`-padding convention and may cause silent data corruption if used carelessly.
|
||||
- **Undersized array handling in private setters**:
|
||||
- `_mainLocation`, `_fineLocation1`, `_fineLocation2`, `_fineLocation3`, `_physicalDimension` setters use `value.Length <= i` or `value.Length < i` to decide whether to write `'0'` or `value[i]`. This is inconsistent:
|
||||
- For `_mainLocation`, `value.Length <= i` (e.g., 3-char input → writes `'0'` for index 3).
|
||||
- For `_fineLocation1`, `value.Length < i` (e.g., 1-char input → writes `'0'` for index 1).
|
||||
→ Both produce `'0'` for missing chars, but the condition is off-by-one in `_fineLocation1`.
|
||||
- **No validation of semantic meaning**: The class accepts any characters (including non-alphanumeric) and does not enforce ISO-specific character sets (e.g., digits, uppercase letters only).
|
||||
- **`TestObject`, `Position`, etc. are misnamed**: `TestObject` is a property name but semantically appears to be a *test identifier* or *test type* (not an object). Likely legacy naming.
|
||||
- **No immutability or thread safety**: The class is mutable and not thread-safe.
|
||||
- **`StringRepresentation` setter mutates underlying array directly**: Does not validate or normalize input beyond length truncation/padding, potentially violating invariants if used after property setters (e.g., setting `StringRepresentation = "ABC"` yields `"ABC0000000000000"` instead of `"ABC???????????????"`).
|
||||
- **No `Equals`/`GetHashCode`/`IEquatable` implementation**: Value equality is not defined, risking reference equality bugs.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/ISO/ExtraProperties/TextPastedArgs.cs
|
||||
generated_at: "2026-04-16T03:18:29.951703+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "958951d2772f6a16"
|
||||
---
|
||||
|
||||
# ExtraProperties
|
||||
|
||||
## 1. Purpose
|
||||
`TextPastedArgs` is an immutable event argument class used to carry contextual data when a text-paste operation occurs on an extra property control within the ISO (likely *Intelligent System Operator* or similar domain) UI layer. It encapsulates the pasted text content, the originating extra property instance, a unique identifier for the operation, and an optional user-defined tag—enabling event subscribers to handle paste events with full context.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`TextPastedArgs(string text, IExtraProperty extraProperty, string id, object tag)`**
|
||||
Constructor initializing all properties. Validates *none* of the parameters are null-checked in the constructor body (per source), but `text` and `id` are non-nullable reference types (C# 8+), implying callers must provide non-null values.
|
||||
- `text`: The string content being pasted.
|
||||
- `extraProperty`: The `IExtraProperty` instance that triggered the event (assigned to `Sender`).
|
||||
- `id`: A string identifier for the paste operation (e.g., correlation ID, control ID).
|
||||
- `tag`: An arbitrary object for caller-defined metadata.
|
||||
|
||||
- **`string Text { get; }`**
|
||||
Immutable property containing the pasted text.
|
||||
|
||||
- **`object Sender { get; }`**
|
||||
Immutable property referencing the `IExtraProperty` instance passed into the constructor (i.e., the source control).
|
||||
|
||||
- **`string Id { get; }`**
|
||||
Immutable property holding the operation identifier.
|
||||
|
||||
- **`object Tag { get; }`**
|
||||
Immutable property for user-defined contextual data.
|
||||
|
||||
## 3. Invariants
|
||||
- All properties are **read-only** (no setters); instances are fully immutable after construction.
|
||||
- `Text` and `Id` are expected to be non-null (as declared with non-nullable reference types), though the constructor does not enforce this at runtime.
|
||||
- `Sender` is *always* the exact `IExtraProperty` instance passed as the second constructor parameter.
|
||||
- `Tag` may be `null` (no constraints specified).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `System` (core types: `string`, `object`)
|
||||
- `DTS.Common.Events` (namespace, likely contains event-related infrastructure)
|
||||
- `DTS.Common.Interface.ISO.ExtraProperties` (specifically `IExtraProperty` interface)
|
||||
- **Used by**: Event handlers subscribed to paste events (e.g., `ITextPastedEventArgs` consumers), likely in UI components managing extra property controls.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No null-safety in constructor**: While `Text` and `Id` are non-nullable reference types, the constructor does not validate inputs—passing `null` to `text` or `id` will compile (with warnings suppressed or ignored) but may cause runtime failures downstream.
|
||||
- **`Sender` is misnamed**: The property is named `Sender` but stores `extraProperty` (not a generic UI sender like a control). This may confuse developers expecting `sender` to be the UI element.
|
||||
- **No validation of `id` uniqueness**: The `Id` field’s purpose is unclear without context—consumers must assume it is unique per operation or handle collisions.
|
||||
- **`Tag` semantics undefined**: The meaning of `Tag` is entirely caller-defined; no standard usage pattern is evident from this class alone.
|
||||
|
||||
None identified beyond the above.
|
||||
136
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Locking.md
Normal file
136
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Locking.md
Normal file
@@ -0,0 +1,136 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Locking/LockRecord.cs
|
||||
- Common/DTS.Common/Classes/Locking/LockError.cs
|
||||
- Common/DTS.Common/Classes/Locking/SensorsLocking.cs
|
||||
generated_at: "2026-04-16T03:16:01.173429+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4c9a49fc0d53b85f"
|
||||
---
|
||||
|
||||
# Locking
|
||||
|
||||
## Documentation: `DTS.Common.Classes.Locking` Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides infrastructure for managing application-level locks on sensor-related data items within a distributed system. It defines core data structures (`LockRecord`, `LockError`) to represent lock state and error conditions, and a high-level locking coordinator (`SensorsLocking`) responsible for maintaining and validating locks on behalf of UI components (e.g., sensor editing controls). The module supports lock renewal, theft detection, and loss handling, integrating with logging (`APILogger`), event aggregation (`Prism.Events`), and a lower-level `LockManager` (referenced but not included here) for persistence operations.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `LockRecord` Class
|
||||
Represents a single active lock on a data item.
|
||||
|
||||
- **Constructor**
|
||||
```csharp
|
||||
public LockRecord(string user, string machine, DateTime createTime, DateTime lastUpdate, string itemKey, int itemCategory, int itemId)
|
||||
```
|
||||
Initializes a new lock record with the specified metadata. All properties are read-only after construction.
|
||||
|
||||
- **Properties**
|
||||
- `string LockingUserName` – Name of the user who acquired the lock.
|
||||
- `string LockingMachineName` – Hostname of the machine holding the lock.
|
||||
- `DateTime CreationTime` – Timestamp when the lock was first acquired.
|
||||
- `DateTime LastUpdated` – Timestamp of the last lock renewal/maintenance.
|
||||
- `string ItemKey` – Human-readable key identifying the locked item (e.g., sensor name).
|
||||
- `int ItemCategory` – Numeric category of the item (e.g., `LockCategories` enum value in DB).
|
||||
- `int ItemId` – Numeric ID of the locked item (e.g., sensor ID).
|
||||
|
||||
#### `LockError` Class
|
||||
Encapsulates error information from lock operations.
|
||||
|
||||
- **Constructor**
|
||||
```csharp
|
||||
public LockError(int error, string message, string user = null, string machine = null)
|
||||
```
|
||||
Creates an error instance with code, message, and optional lock holder details.
|
||||
|
||||
- **Properties**
|
||||
- `int ErrorCode` – Numeric error code (see constants below).
|
||||
- `string Message` – Human-readable description.
|
||||
- `string LockingUser` – User associated with the lock at time of error (empty if unknown).
|
||||
- `string LockingMachine` – Machine associated with the lock at time of error (empty if unknown).
|
||||
- `bool LockStolen => ErrorCode == LOCKSTOLEN_ERROR` – Indicates the lock was forcibly released by another user.
|
||||
- `bool LockLost => ErrorCode == LOCKDOESNTEXIST_ERROR` – Indicates the lock no longer exists in the backing store.
|
||||
|
||||
- **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 not found.
|
||||
- `LOCKDOESNTEXIST_ERROR = 997` – Lock record missing (lock lost).
|
||||
- `LOCKSTOLEN_ERROR = 998` – Lock stolen by another user.
|
||||
- `UNKNOWN_ERROR = 999` – Generic/unspecified error.
|
||||
|
||||
#### `SensorsLocking` Class
|
||||
Manages lock lifecycle for sensor UI controls.
|
||||
|
||||
- **`Unlock(bool bCheckLock, string userName, int userId)`**
|
||||
Stops background lock renewal and attempts to release all tracked locks via `FreeLocks()`. Logs exceptions but does not propagate them.
|
||||
*Note: Parameter `bCheckLock` is unused in the current implementation.*
|
||||
|
||||
- **`IsCurrentlyLocked(LockRecord lockRecord)`**
|
||||
```csharp
|
||||
public bool IsCurrentlyLocked(LockRecord lockRecord)
|
||||
```
|
||||
Returns `true` if the provided `lockRecord` matches an item currently tracked by this instance (i.e., `ItemId` and `ItemCategory` match any entry in `_existingLocks`). Thread-safe via `MyLock`.
|
||||
|
||||
- **Private Methods (Referenced)**
|
||||
- `StopUpdating()` – Cancels background renewal task and waits up to `MAX_WAIT_TIME_MS` (10s) for completion. Returns `true` only if stopped cleanly.
|
||||
- `FreeLocks()` – Iterates over `_existingLocks` and calls `LockManager.FreeLoc` for each (implementation truncated in source).
|
||||
- `CheckLocks(bool publishErrors, string userName, int userId)` – Validates all tracked locks; on failure, clears `_existingLocks`, calls `WipeOutChanges()`, and publishes `PageErrorEvent` if `publishErrors` is `true`.
|
||||
- `CheckLock(...)` – *Not implemented* (`NotImplementedException`).
|
||||
- `WipeOutChanges()` – *Not implemented* (`NotImplementedException`).
|
||||
- `GetErrorMessage(LockError[] errors, LockRecord[] lockRecords)` – Builds a localized error message string for display, handling `LockStolen` and `LockLost` cases.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- `_existingLocks` is always `null` or a non-null array (never partially initialized).
|
||||
- Lock records in `_existingLocks` are only modified or cleared under the `MyLock` synchronization object.
|
||||
- `LockRecord` instances are immutable after construction (all properties are `readonly` or get-only).
|
||||
- `LockError.ErrorCode` is set once at construction and never modified.
|
||||
- Lock renewal/maintenance is performed periodically via `_updateTask`; failure to renew triggers `CheckLocks()` failure.
|
||||
- On *any* lock failure during `CheckLocks()`, `_existingLocks` is atomically reset to an empty array, and `WipeOutChanges()` is called (though implementation is missing).
|
||||
- `LockManager.FreeLoc` is assumed to be the canonical method for releasing locks (external dependency).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### **Internal Dependencies (from imports)**
|
||||
- `DTS.Common.Events` – For `PageErrorEvent` and `PageErrorArg`.
|
||||
- `DTS.Common.SharedResource.Strings` – For localized strings (`StringResources.FailedToUpdateLock`, `LockStolen_Sensors`, `LockLost_Sensors`).
|
||||
- `DTS.Common.Utilities.Logging` – For `APILogger`.
|
||||
- `Prism.Events` – For `IEventAggregator` and `ContainerLocator.Container`.
|
||||
- `System.Threading.Tasks` – For `Task`, `CancellationTokenSource`.
|
||||
|
||||
#### **External Dependencies (inferred)**
|
||||
- `LockManager` – Referenced in `FreeLocks()` but not defined in the provided source. Critical dependency for lock acquisition/release.
|
||||
- `PageErrorEvent` – A Prism event used to publish UI-level errors.
|
||||
- `ContainerLocator.Container` – Prism/IoC container for resolving services (e.g., `IEventAggregator`).
|
||||
|
||||
#### **Depended Upon By**
|
||||
- UI controls (e.g., sensor editing forms) that need to track and release locks on sensor items.
|
||||
- Likely used in conjunction with `LockManager` for end-to-end locking workflows.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **`CheckLock` and `WipeOutChanges` are unimplemented** (`NotImplementedException`). This module is incomplete and non-functional as-is.
|
||||
- **`bCheckLock` parameter in `Unlock()` is ignored** – The method always proceeds to `FreeLocks()` regardless of its value.
|
||||
- **`FreeLocks()` calls `LockManager.FreeLoc` without arguments** – The source is truncated (`FreeLoc` call is cut off), so the exact signature and required parameters (e.g., `LockRecord`) are unknown.
|
||||
- **`GetErrorMessage` uses `Array.Exists` with `ItemId`/`ItemCategory` but `IsCurrentlyLocked` does the same** – Redundant logic suggests potential for refactoring or inconsistency if `LockRecord` equality semantics change.
|
||||
- **No validation of `LockRecord` constructor parameters** – No null checks on `user`, `machine`, or `itemKey`; invalid values (e.g., empty `ItemKey`) may propagate silently.
|
||||
- **`LockingUser`/`LockingMachine` in `LockError` default to `string.Empty`** – Not `null`, which simplifies UI display but may mask missing data.
|
||||
- **`MAX_WAIT_TIME_MS = 10000` is hardcoded** – No configuration or override mechanism for timeout duration.
|
||||
- **Thread-safety relies on `MyLock` but is inconsistent** – `IsCurrentlyLocked` uses `lock(MyLock)`, but `CheckLocks` and `FreeLocks` use `lock(MyLock)` only for reading `_existingLocks`; background task (`_updateTask`) state is managed separately.
|
||||
- **No explicit lock acquisition methods** – The module only handles *renewal* and *release* of *already-acquired* locks (via `LockManager`), implying lock acquisition happens elsewhere.
|
||||
|
||||
*None identified beyond the above.*
|
||||
281
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Sensors.md
Normal file
281
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Sensors.md
Normal file
@@ -0,0 +1,281 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Sensors/DisplayedCalibrationBehavior.cs
|
||||
- Common/DTS.Common/Classes/Sensors/ChannelSerialNumber.cs
|
||||
- Common/DTS.Common/Classes/Sensors/ChannelTypeUtility.cs
|
||||
- Common/DTS.Common/Classes/Sensors/SensorDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/ZeroRef.cs
|
||||
- Common/DTS.Common/Classes/Sensors/CalMode.cs
|
||||
- Common/DTS.Common/Classes/Sensors/ThermocouplerRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/StreamInputRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/CANRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/UARTRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/ParseParameters.cs
|
||||
- Common/DTS.Common/Classes/Sensors/DigitalInputScaleMultiplier.cs
|
||||
- Common/DTS.Common/Classes/Sensors/DigitalOutDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/SensorCalDbRecord.cs
|
||||
- Common/DTS.Common/Classes/Sensors/StreamOutputRecord.cs
|
||||
generated_at: "2026-04-16T03:14:41.949051+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "584219a9653a657a"
|
||||
---
|
||||
|
||||
# Sensor Data Model Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides core data structures and utility classes for representing sensor metadata, calibration, and configuration within the DTS system. It serves as the foundational data layer for sensor management, enabling serialization/deserialization of sensor records from databases, handling of various sensor types (thermocouple, stream input/output, CAN, UART, digital output), and supporting calibration workflows including zero-reference methods and calibration mode configurations. The module bridges raw database records and higher-level business logic by encapsulating sensor-specific properties, validation rules, and conversion utilities.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
#### `DisplayedCalibrationBehavior`
|
||||
- **Properties**:
|
||||
- `CalibrationBehavior` (`DTS.Common.Enums.Sensors.CalibrationBehaviors`): The underlying calibration behavior enum value.
|
||||
- `DisplayString` (`string`): Human-readable string representation of the behavior.
|
||||
- **Methods**:
|
||||
- `ToString()`: Returns `DisplayString`.
|
||||
|
||||
#### `ChannelSerialNumber`
|
||||
- **Methods**:
|
||||
- `SerialNumberFromChannel(bool isTestSpecificEmbedded, string testSpecificEmbeddedSensor, string sensorDataSerialNumber)`: Returns `testSpecificEmbeddedSensor` if `isTestSpecificEmbedded` is true; otherwise returns `sensorDataSerialNumber`.
|
||||
|
||||
#### `ChannelTypeUtility`
|
||||
- **Nested Enum**:
|
||||
- `KnownChannelTypes`: Enum of known 2-character channel type codes (VS, VU, SB, TI, TC, CT, XP, P4, VF, NB, EX, X1, R1, VO, CO, CP).
|
||||
- **Methods**:
|
||||
- `ParseSensorKnownChannelType(string sensorName)`: Extracts the first two characters of `sensorName` (uppercased) and returns them if they match a `KnownChannelTypes` value; otherwise returns `string.Empty`. Returns `string.Empty` if `sensorName` is null/empty or shorter than 2 characters.
|
||||
|
||||
#### `ZeroRef`
|
||||
- **Nested Enum**:
|
||||
- `ZeroType`: Defines zeroing methods: `AverageOverTime` (0), `UsePreEventDiagnostics` (1), `UseZeroMv` (2).
|
||||
- **Properties**:
|
||||
- `ZeroMethod` (`ZeroType`): The selected zeroing method.
|
||||
- **Constructors**:
|
||||
- `ZeroRef(string zeroref)`: Parses `zeroref` ("0", "1", or "2") into `ZeroType`; throws `NotSupportedException` for invalid values.
|
||||
- `ZeroRef(ZeroType type)`: Initializes with specified `ZeroType`.
|
||||
- **Methods**:
|
||||
- `ToString()`: Returns "0", "1", or "2" based on `ZeroMethod`.
|
||||
|
||||
#### `CalMode`
|
||||
- **Properties**:
|
||||
- `ShuntCheck` (`bool`): True if first character is 'S', false if 'I'.
|
||||
- `FullBridge` (`bool`): True if second character is 'D', false if 'S'.
|
||||
- `Filter` (`bool`): True if third character is 'F', false if 'B'.
|
||||
- **Constructors**:
|
||||
- `CalMode(string value)`: Parses a 3-character string (`value[0]` = shunt, `value[1]` = bridge, `value[2]` = filter); throws `NotSupportedException` for invalid characters.
|
||||
- `CalMode()`: Parameterless constructor (properties default to `false`).
|
||||
- **Methods**:
|
||||
- `ToString()`: Returns a 3-character string in format `[S/I][D/S][F/B]`.
|
||||
|
||||
#### `SensorDbRecord`
|
||||
- **Properties**:
|
||||
- `id` (`int`): Database ID.
|
||||
- `SensorType` (`short`): Sensor type identifier.
|
||||
- `SerialNumber` (`string`): Sensor serial number.
|
||||
- **Constructors**:
|
||||
- `SensorDbRecord(IDataReader reader)`: Initializes properties from database reader using `Utility.GetInt`, `Utility.GetShort`, and `Utility.GetString`.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.SensorModels`.
|
||||
|
||||
#### `ThermocouplerRecord`
|
||||
- **Properties**:
|
||||
- `Id` (`int`): Database ID.
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `LastUpdatedBy` (`string`): User who last modified.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- **Constructors**:
|
||||
- `ThermocouplerRecord(ISensorData sd)`: Initializes from `ISensorData` interface.
|
||||
- `ThermocouplerRecord(IDataReader reader)`: Initializes from database reader using `Utility` methods.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.Sensors`.
|
||||
- **Note**: All constructors include try/catch blocks logging failures via `APILogger`.
|
||||
|
||||
#### `StreamInputRecord`
|
||||
- **Properties**:
|
||||
- `Id` (`int`): Database ID.
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `LastUpdatedBy` (`string`): User who last modified.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- `StreamInUDPAddress` (`string`): UDP address for streaming input; defaults to `"UDP://239.1.2.10:8400"`.
|
||||
- **Constructors**:
|
||||
- `StreamInputRecord(ISensorData sd)`: Initializes from `ISensorData`.
|
||||
- `StreamInputRecord(IDataReader reader)`: Initializes from database reader.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.Sensors`.
|
||||
|
||||
#### `CANRecord`
|
||||
- **Properties**:
|
||||
- `Id` (`int`): Database ID.
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `LastUpdatedBy` (`string`): User who last modified.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- `CanIsFD` (`bool`): Indicates if CAN FD is enabled; defaults to `EmbeddedSensors.CANISFD_DEFAULT`.
|
||||
- `CanArbBaseBitrate` (`int`): Arbitration base bitrate; defaults to `EmbeddedSensors.CANFD_ARB_BASE_BITRATE_DEFAULT`.
|
||||
- `CanArbBaseSJW` (`int`): Arbitration base SJW; defaults to `EmbeddedSensors.CANFD_1000000_ARB_BASE_SJW_MAX`.
|
||||
- `CanDataBitrate` (`int`): Data bitrate; defaults to `EmbeddedSensors.DATA_BITRATE_DEFAULT`.
|
||||
- `CanDataSJW` (`int`): Data SJW; defaults to `EmbeddedSensors.DATA_SJW_DEFAULT`.
|
||||
- `CanFileType` (`string`): File type; defaults to `EmbeddedSensors.FILETYPE_DEFAULT`.
|
||||
- **Constructors**:
|
||||
- `CANRecord(ISensorData sensor)`: Initializes from `ISensorData`.
|
||||
- `CANRecord(IDataReader reader)`: Initializes from database reader.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.Sensors`.
|
||||
|
||||
#### `UARTRecord`
|
||||
- **Properties**:
|
||||
- `Id` (`int`): Database ID.
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `LastUpdatedBy` (`string`): User who last modified.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- `UartBaudRate` (`uint`): Baud rate; defaults to `EmbeddedSensors.BAUD_RATE_DEFAULT`.
|
||||
- `UartDataBits` (`uint`): Data bits; defaults to `8`.
|
||||
- `UartStopBits` (`StopBits`): Stop bits; defaults to `StopBits.None`.
|
||||
- `UartParity` (`Parity`): Parity; defaults to `Parity.None`.
|
||||
- `UartFlowControl` (`Handshake`): Flow control; defaults to `Handshake.None`.
|
||||
- `UartDataFormat` (`UartDataFormat`): Data format; defaults to `UartDataFormat.Binary`.
|
||||
- **Constructors**:
|
||||
- `UARTRecord(ISensorData sensor)`: Initializes from `ISensorData`.
|
||||
- `UARTRecord(IDataReader reader)`: Initializes from database reader using `Enum.Parse` for enum properties.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.Sensors`.
|
||||
|
||||
#### `DigitalOutDbRecord`
|
||||
- **Properties**:
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `DODelay` (`double`): Digital output delay in ms.
|
||||
- `DODuration` (`double`): Digital output duration in ms.
|
||||
- `ModifiedBy` (`string`): User who last modified.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `DatabaseId` (`int`): Database ID.
|
||||
- `ISOCode` (`string`): ISO code.
|
||||
- `ISOChannelName` (`string`): ISO channel name.
|
||||
- `UserCode` (`string`): User code.
|
||||
- `UserChannelName` (`string`): User channel name.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `DOMode` (`DigitalOutputModes`): Digital output mode; defaults to `DigitalOutputModes.CCNC`.
|
||||
- `LimitDuration` (`bool`): Flag limiting duration; defaults to `true`.
|
||||
- `Version` (`int`): Record version.
|
||||
- `TagsBlobBytes` (`byte[]`): Binary blob for user tags.
|
||||
- **Constructors**:
|
||||
- `DigitalOutDbRecord()`: Parameterless constructor.
|
||||
- `DigitalOutDbRecord(ISensorData copy, byte[] tagsBlobBytes)`: Initializes from `ISensorData`.
|
||||
- `DigitalOutDbRecord(IDigitalOutDbRecord copy)`: Copy constructor.
|
||||
- `DigitalOutDbRecord(IDataReader reader)`: Initializes from database reader.
|
||||
- **Inherits**:
|
||||
- `BasePropertyChanged`.
|
||||
|
||||
#### `SensorCalDbRecord`
|
||||
- **Properties**:
|
||||
- `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`): Flag indicating local-only calibration.
|
||||
- `NonLinear` (`bool`): Flag indicating non-linear calibration.
|
||||
- `Records` (`ICalibrationRecords`): Calibration records.
|
||||
- `ModifyDate` (`DateTime`): Last modification date.
|
||||
- `IsProportional` (`bool`): Flag indicating proportional calibration.
|
||||
- `RemoveOffset` (`bool`): Flag indicating offset removal.
|
||||
- `SensitivityInspection` (`SensitivityInspectionType`): Sensitivity inspection type.
|
||||
- `CalibrationNote` (`string`): Calibration note (max 2048 chars).
|
||||
- `UsageCount` (`int`): Number of times calibration has been used.
|
||||
- `ZeroMethods` (`ZeroMethods`): Zeroing method definitions.
|
||||
- `CertificationDocuments` (`string[]`): Array of certification document paths.
|
||||
- `InitialOffsets` (`InitialOffsets`): Initial offset values.
|
||||
- `LinearAdded` (`bool`): Computed property indicating if linearization was added (based on `NonLinear`, `Records`, and `ZeroMethods` structure).
|
||||
- **Constructors**:
|
||||
- `SensorCalDbRecord()`: Parameterless constructor.
|
||||
- `SensorCalDbRecord(ISensorCalDbRecord copy)`: Copy constructor.
|
||||
- `SensorCalDbRecord(IDataReader reader, int actualDbVersion)`: Initializes from database reader; handles version-specific fields.
|
||||
- **Inherits**:
|
||||
- `BasePropertyChanged`.
|
||||
- **Note**: Constructors include try/catch blocks logging failures via `APILogger`. `NonLinear` setter has side effects: sets `Records.Records[0].Sensitivity = 1D`, `RemoveOffset = false`.
|
||||
|
||||
#### `StreamOutputRecord`
|
||||
- **Properties**:
|
||||
- `Id` (`int`): Database ID.
|
||||
- `SerialNumber` (`string`): Serial number.
|
||||
- `LastModified` (`DateTime`): Last modification timestamp.
|
||||
- `LastUpdatedBy` (`string`): User who last modified.
|
||||
- `DoNotUse` (`bool`): Flag indicating sensor should not be used.
|
||||
- `Broken` (`bool`): Flag indicating sensor is broken.
|
||||
- `StreamOutUDPProfile` (`UDPStreamProfile`): UDP streaming profile; defaults to `UDPStreamProfile.CH10_ANALOG_2HDR`.
|
||||
- `StreamOutUDPAddress` (`string`): UDP address; defaults to `"UDP://239.1.2.10:8400"`.
|
||||
- `StreamOutUDPTimeChannelId` (`ushort`): Time channel ID; defaults to `1`, range `[10, 100]`.
|
||||
- `StreamOutUDPDataChannelId` (`ushort`): Data channel ID; defaults to `3`, range `[10, 100]`.
|
||||
- `StreamOutUDPTmNSConfig` (`string`): TMNS config; defaults to `"(1,6,60,0,0,0,0,0)"`.
|
||||
- `StreamOutIRIGTimeDataPacketIntervalMs` (`ushort`): IRIG time data packet interval; defaults to `500`, range `[10, 1000]`.
|
||||
- `StreamOutTMATSIntervalMs` (`ushort`): TMATS interval; defaults to `1000`, range `[0, 65535]`.
|
||||
- **Constructors**:
|
||||
- `StreamOutputRecord(ISensorData sd)`: Initializes from `ISensorData`.
|
||||
- `StreamOutputRecord(IDataReader reader, int ClientDbVersion, int ConnectionDbVersion)`: Initializes from database reader; conditionally loads `TMATS_IntervalMS` based on version checks.
|
||||
- **Static Methods**:
|
||||
- `AvailableUDPStreamProfiles(int ConnectionDbVersion, bool UseAdvancedStreamingProfiles)`: Returns array of supported `UDPStreamProfile` values based on version and flag.
|
||||
- **Inherits**:
|
||||
- `TagAwareBase` with `TagType` overridden to `TagTypes.Sensors`.
|
||||
|
||||
#### `DigitalInputScaleMultiplier`
|
||||
- **Properties**:
|
||||
- `Form` (`Forms`): Scaling form; defaults to `Forms.ArbitraryLowAndHigh`.
|
||||
- `DefaultValue` (`double`): Value for digital 0 (OFF); defaults to `0`.
|
||||
- `ActiveValue` (`double`): Value for digital 1 (ON); defaults to `1`.
|
||||
- **Constructors**:
|
||||
- `DigitalInputScaleMultiplier()`: Initializes `DefaultValue = 0`.
|
||||
- `DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy)`: Copy constructor.
|
||||
- **Methods**:
|
||||
- `SimpleEquals(IDigitalInputScaleMultiplier rhs)`: Compares `Form`, `DefaultValue`, and `ActiveValue`.
|
||||
- `Equals(object obj)`: Overrides `Equals` for equality comparison.
|
||||
- `GetHashCode()`: Overrides `GetHashCode` using primes (31, 79, 127, 23).
|
||||
- `ToSerializeDbString()`: Serializes to string (only `ArbitraryLowAndHigh` supported).
|
||||
- `FromDbSerializeString(string s)`: Deserializes from string; throws `NotSupportedException` for invalid formats.
|
||||
- **Inherits**:
|
||||
- `IDigitalInputScaleMultiplier`.
|
||||
|
||||
#### `ParseParameters`
|
||||
- **Purpose**: Internal helper class to bundle parameters for CSV import operations (used in Wizard and DataPRO CSV import code).
|
||||
- **Properties**:
|
||||
- `ImportContainedSensorRanges` (`bool`): Default `false`.
|
||||
- `SensorData` (`ISensorData`): Sensor data source.
|
||||
- `ImportCulture` (`IFormatProvider`): Culture for parsing.
|
||||
- `Errors` (`List<string>`): Error list.
|
||||
- `IrtraccExponent` (`double`): IRTRACC exponent.
|
||||
- `SensorCal` (`ISensorCalibration`): Calibration data.
|
||||
- `Sensitivity` (`double`): Sensitivity value.
|
||||
- `SavedIsProportional` (`bool`): Saved proportional flag.
|
||||
- `SavedRemoveOffset` (`bool`): Saved remove offset flag.
|
||||
- `StripBackslash` (`bool`): Flag for backslash stripping.
|
||||
- `OriginalOffset` (`double`): Original offset value; defaults to `double.NaN`.
|
||||
- `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` (`Dictionary<string, string>`): Sensor group name lookup.
|
||||
- `SensorGroupTypeLookup` (`Dictionary<string, string>`): Sensor group type lookup.
|
||||
- `GroupNameToTestObjectLookup` (`Dictionary<string, string>`): Group name to test object lookup.
|
||||
- `SensorTestObject` (`string`): Sensor test object.
|
||||
- `UseISOCodeFilterMapping` (`bool`): Flag for ISO code filter mapping.
|
||||
- `UseZeroForUnfiltered` (`bool`): Flag for zeroing unfiltered data.
|
||||
- `SensorISOCode` (`Dictionary<string, string>`): Sensor ISO code mapping.
|
||||
- `SensorISOChannelName` (`Dictionary<string, string>`): Sensor ISO channel name mapping.
|
||||
- `SensorUserCode` (`Dictionary<string, string>`): Sensor user code mapping.
|
||||
- `SensorUserChannelName` (`Dictionary<string, string>`): Sensor user channel name mapping.
|
||||
- `SensorDASSerialNumber` (`Dictionary<string, string>`): Sensor DAS serial number mapping.
|
||||
- `SensorDASChannelIndex` (`Dictionary<string, int>`): Sensor DAS channel index mapping.
|
||||
- **Note**: Documentation states this class is internal and may be refactored when DataPRO CSV import is removed.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`ChannelSerialNumber.SerialNumberFromChannel`**: Returns exactly one of the two input serial number strings based on `isTestSpecificEmbedded`; never returns `
|
||||
@@ -0,0 +1,167 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Sensors/AnalogDiagnostics/DiagnosticRun.cs
|
||||
- Common/DTS.Common/Classes/Sensors/AnalogDiagnostics/DiagnosticEntry.cs
|
||||
generated_at: "2026-04-16T03:18:16.331578+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "00d9f02148080370"
|
||||
---
|
||||
|
||||
# DiagnosticRun and DiagnosticEntry Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines core data transfer objects (`DiagnosticRun` and `DiagnosticEntry`) used to represent analog sensor diagnostic test sessions and individual channel measurements within the DTS (Data Transfer System) framework. `DiagnosticRun` models a single diagnostic test execution (e.g., a pre-test or post-test run), capturing metadata like user, test ID, and run type. `DiagnosticEntry` models a single sensor channel’s diagnostic results within a run, including measured values (excitation, offset, range, noise, shunt), status flags, and associated sensor/DAS (Data Acquisition System) identification. These classes are primarily used for deserializing data from SQL Server database queries (via `SqlDataReader`) and serve as the canonical in-memory representation of diagnostic test data for reporting, analysis, and persistence.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DiagnosticRun`
|
||||
- **`DiagnosticRun()`**
|
||||
Parameterless constructor; initializes all properties to their default values (`null` for nullable types, `string.Empty` for strings, `true` for `PreTest`).
|
||||
|
||||
- **`DiagnosticRun(SqlDataReader reader)`**
|
||||
Constructor that populates the object from a `SqlDataReader` positioned on a valid row. Reads columns: `Id`, `DataPROUser`, `TestId`, `TestName`, `PreTest`. Skips assignment if the column value is `DBNull.Value`.
|
||||
|
||||
- **`long? Id { get; set; }`**
|
||||
Database primary key or unique identifier for the diagnostic run. Nullable; defaults to `null`.
|
||||
|
||||
- **`string DataPROUser { get; set; }`**
|
||||
Username of the operator who executed the diagnostic run. Defaults to `string.Empty`.
|
||||
|
||||
- **`int? TestId { get; set; }`**
|
||||
Foreign key or identifier linking to a specific test configuration. Nullable; defaults to `null`.
|
||||
|
||||
- **`string TestName { get; set; }`**
|
||||
Human-readable name of the test being run. Defaults to `string.Empty`.
|
||||
|
||||
- **`bool PreTest { get; set; }`**
|
||||
Indicates whether this run is a *pre-test* (`true`) or *post-test* (`false`). Defaults to `true`.
|
||||
|
||||
---
|
||||
|
||||
### `DiagnosticEntry`
|
||||
- **`DiagnosticEntry()`**
|
||||
Parameterless constructor; initializes all properties to their default values (`null` for nullable types, `0` for numeric primitives, `DateTime.MinValue` for `Timestamp`, `DiagnosticStatus.Untested` for status fields, `string.Empty` for strings).
|
||||
|
||||
- **`DiagnosticEntry(SqlDataReader reader)`**
|
||||
Constructor that populates the object from a `SqlDataReader` row. Reads columns: `Id`, `DiagnosticRunId`, `Excitation`, `ExcitationStatus`, `Offset`, `OffsetStatus`, `ActualRange`, `ActualRangeStatus`, `Noise`, `NoiseStatus`, `Shunt`, `ShuntStatus`, `SensorId`, `SensorSerialNumber`, `DASId`, `DASSerialNumber`, `DASChannelIdx`, `UserCode`, `UserChannelName`, `IsoCode`, `IsoChannelName`, `ScaleFactor`, `CalibrationRecordId`, `CalibrationRecordXML`, `Timestamp`. Skips assignment if the column value is `DBNull.Value`.
|
||||
|
||||
- **`long? Id { get; set; }`**
|
||||
Database primary key or unique identifier for the diagnostic entry. Nullable; defaults to `null`.
|
||||
|
||||
- **`long DiagnosticRunId { get; set; }`**
|
||||
Foreign key linking this entry to a `DiagnosticRun`. Non-nullable; defaults to `-1`.
|
||||
|
||||
- **`double? Excitation { get; set; }`**
|
||||
Measured excitation voltage (e.g., in mV/V). Nullable; defaults to `null`.
|
||||
|
||||
- **`DiagnosticStatus ExcitationStatus { get; set; }`**
|
||||
Status of the excitation measurement (e.g., Passed, Failed, Untested). Defaults to `DiagnosticStatus.Untested`.
|
||||
|
||||
- **`double? Offset { get; set; }`**
|
||||
Measured offset voltage. Nullable; defaults to `null`.
|
||||
|
||||
- **`DiagnosticStatus OffsetStatus { get; set; }`**
|
||||
Status of the offset measurement. Defaults to `DiagnosticStatus.Untested`.
|
||||
|
||||
- **`double? ActualRange { get; set; }`**
|
||||
Measured actual range (e.g., span). Nullable; defaults to `null`.
|
||||
|
||||
- **`DiagnosticStatus ActualRangeStatus { get; set; }`**
|
||||
Status of the range measurement. Defaults to `DiagnosticStatus.Untested`.
|
||||
|
||||
- **`double? Noise { get; set; }`**
|
||||
Measured noise level. Nullable; defaults to `null`.
|
||||
|
||||
- **`DiagnosticStatus NoiseStatus { get; set; }`**
|
||||
Status of the noise measurement. Defaults to `DiagnosticStatus.Untested`.
|
||||
|
||||
- **`double? Shunt { get; set; }`**
|
||||
Measured shunt calibration value. Nullable; defaults to `null`.
|
||||
|
||||
- **`DiagnosticStatus ShuntStatus { get; set; }`**
|
||||
Status of the shunt measurement. Defaults to `DiagnosticStatus.Untested`.
|
||||
|
||||
- **`int? SensorId { get; set; }`**
|
||||
Identifier for the sensor being tested. Nullable; defaults to `null`.
|
||||
|
||||
- **`string SensorSerialNumber { get; set; }`**
|
||||
Serial number of the sensor. Defaults to `string.Empty`.
|
||||
|
||||
- **`int? DASId { get; set; }`**
|
||||
Identifier for the Data Acquisition System used. Nullable; defaults to `null`.
|
||||
|
||||
- **`string DASSerialNumber { get; set; }`**
|
||||
Serial number of the DAS. Defaults to `string.Empty`.
|
||||
|
||||
- **`int DASChannelIdx { get; set; }`**
|
||||
Zero-based index of the channel on the DAS. Defaults to `0`.
|
||||
|
||||
- **`string UserCode { get; set; }`**
|
||||
User-defined code or label for the channel. Defaults to `string.Empty`.
|
||||
|
||||
- **`string UserChannelName { get; set; }`**
|
||||
User-friendly name for the channel. Defaults to `string.Empty`.
|
||||
|
||||
- **`string IsoCode { get; set; }`**
|
||||
ISO-standard code for the channel configuration. Defaults to `string.Empty`.
|
||||
|
||||
- **`string IsoChannelName { get; set; }`**
|
||||
ISO-standard name for the channel. Defaults to `string.Empty`.
|
||||
|
||||
- **`double ScaleFactor { get; set; }`**
|
||||
Scaling factor applied to raw measurements. Defaults to `1`.
|
||||
|
||||
- **`int CalibrationRecordId { get; set; }`**
|
||||
Identifier linking to a calibration record. Non-nullable; defaults to `-1`.
|
||||
|
||||
- **`string CalibrationRecordXML { get; set; }`**
|
||||
XML blob containing full calibration record details. Defaults to `string.Empty`.
|
||||
|
||||
- **`DateTime Timestamp { get; set; }`**
|
||||
Timestamp of when the diagnostic entry was recorded. Defaults to `DateTime.MinValue`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
- **`DiagnosticRunId` in `DiagnosticEntry` is non-nullable and defaults to `-1`**, implying a valid `DiagnosticRun` must be associated (though `-1` may indicate an unassigned or invalid state).
|
||||
- **`DASChannelIdx` is a non-nullable `int` defaulting to `0`**, suggesting zero-based indexing is assumed.
|
||||
- **All `DiagnosticStatus` properties default to `DiagnosticStatus.Untested`**, indicating a safe initial state before validation.
|
||||
- **`PreTest` defaults to `true`**, implying the system assumes pre-test unless explicitly marked otherwise.
|
||||
- **Null handling in constructors**: Values from `SqlDataReader` are only assigned if `!DBNull.Value.Equals(...)`. This means missing database columns or `NULL` values result in the property retaining its default value (e.g., `null`, `0`, `string.Empty`, `DiagnosticStatus.Untested`).
|
||||
- **`DiagnosticEntry` properties map directly to database column names** (e.g., `reader["Timestamp"]` → `Timestamp` property). Column name casing must match exactly in the database.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Interface.Sensors.AnalogDiagnostics` namespace (for `IDiagnosticRun` and `IDiagnosticEntry` interfaces).
|
||||
- `System.Data.SqlClient` (for `SqlDataReader` usage).
|
||||
- `DiagnosticStatus` enum (used in `DiagnosticEntry` properties; defined in `DTS.Common.Interface.Sensors.AnalogDiagnostics`, not shown in source).
|
||||
- **Depended on by**:
|
||||
- Data access layers (e.g., repositories or data readers) that populate these objects from SQL queries.
|
||||
- Reporting or analysis modules that consume diagnostic test results.
|
||||
- Likely used in conjunction with `IDiagnosticRun`/`IDiagnosticEntry` interfaces for testability or inversion of control.
|
||||
|
||||
## 5. Gotchas
|
||||
- **`DASChannelIdx` is read as `short` from `SqlDataReader` but stored as `int`**:
|
||||
```csharp
|
||||
DASChannelIdx = (short)reader["DASChannelIdx"];
|
||||
```
|
||||
This may cause runtime exceptions if the database column is larger than `Int16` (e.g., `int` or `bigint`). Type mismatch is not validated at compile time.
|
||||
|
||||
- **`DiagnosticStatus` cast assumes underlying type is `short`**:
|
||||
```csharp
|
||||
ExcitationStatus = (DiagnosticStatus)(short)reader["ExcitationStatus"];
|
||||
```
|
||||
If the database column is stored as `int` or `tinyint`, this cast may throw `InvalidCastException` or produce incorrect values.
|
||||
|
||||
- **No validation or business logic**: These are pure DTOs. Consumers must enforce constraints (e.g., `DiagnosticRunId != -1`, `PreTest` semantics).
|
||||
|
||||
- **Default `DiagnosticRunId = -1` is ambiguous**: May indicate "uninitialized" or "invalid", but no explicit check or constant is defined for this sentinel value.
|
||||
|
||||
- **No immutability guarantees**: All properties have public setters; objects can be mutated after construction.
|
||||
|
||||
- **`Timestamp` property name vs. database column**: The property is named `Timestamp` (PascalCase), but SQL Server column is likely `Timestamp` (case-insensitive). However, if the DB uses `timestamp` (deprecated synonym for `rowversion`) instead of `datetime`, the cast `(DateTime)reader["Timestamp"]` will fail.
|
||||
|
||||
- **No null-safety for string properties**: If `reader["DataPROUser"]` returns `null` (not `DBNull`), the cast `(string)reader["..."]` succeeds but may yield `null` (not `string.Empty`). Only `DBNull` is guarded against.
|
||||
|
||||
- **No error handling in constructor**: Exceptions from invalid casts or missing columns propagate unhandled.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Sensors/SensorsList/DragAndDropPayload.cs
|
||||
generated_at: "2026-04-16T03:18:26.859220+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7132134efcdc1e7d"
|
||||
---
|
||||
|
||||
# SensorsList
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a data carrier class, `DragAndDropPayload`, used to encapsulate drag-and-drop operations involving sensor items in the DTS (presumably *Data Transfer System* or domain-specific) UI. It serializes an array of `IDragAndDropItem` objects (representing sensor entities) into a strongly-typed payload, enabling safe and consistent data exchange during drag-and-drop interactions—such as reordering, copying, or moving sensors between views or containers—by leveraging standardized clipboard/data format strings.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`DragAndDropPayload(IDragAndDropItem[] items)`**
|
||||
Constructor that initializes the payload with a non-null array of `IDragAndDropItem` objects. The array is stored directly (no defensive copy is performed).
|
||||
- **`IDragAndDropItem[] Items { get; }`**
|
||||
Read-only property exposing the array of drag-and-drop items contained in this payload.
|
||||
- **`const string FORMAT`**
|
||||
A constant string `"DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing the primary data format identifier for serialization/deserialization (e.g., in `DataObject` or clipboard operations).
|
||||
- **`const string ALT_FORMAT`**
|
||||
A constant string `"ALT_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing an alternate format identifier, likely used for context-sensitive operations (e.g., Alt+drag).
|
||||
- **`const string CTRL_FORMAT`**
|
||||
A constant string `"CTRL_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing a format identifier for modifier-key-specific drag operations (e.g., Ctrl+drag for copying).
|
||||
|
||||
## 3. Invariants
|
||||
- `Items` is never `null` (enforced by constructor: passing `null` would throw `ArgumentNullException` at runtime if not handled elsewhere, but the source does not show validation—see *Gotchas*).
|
||||
- `Items` is not defensively copied; the array reference is stored as-is, so external mutation of the array *after* construction will affect the payload’s state.
|
||||
- The three format constants are mutually distinct and follow a naming convention: base format + optional modifier prefixes (`ALT_`, `CTRL_`).
|
||||
- No ordering guarantees are specified for the `Items` array—its semantics (e.g., sorted, insertion-ordered) are determined by the caller.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Interface.Sensors.SensorsList.IDragAndDropItem` (interface, likely defining contract for draggable sensor items).
|
||||
- **Depended on by**:
|
||||
- UI components handling drag-and-drop (e.g., `ListView`, `TreeView`, custom drop zones) that serialize/deserialize this payload using the `FORMAT` constants.
|
||||
- Serialization/deserialization logic (not visible here) that uses the `FORMAT` strings to reconstruct `DragAndDropPayload` instances.
|
||||
- Likely used in conjunction with WPF/WinForms drag-drop APIs (e.g., `DragEventArgs.Data.GetData(FORMAT)`).
|
||||
|
||||
## 5. Gotchas
|
||||
- **No null-safety in constructor**: The constructor accepts `items` without validation; passing `null` will result in `Items` being `null`, potentially causing `NullReferenceException` at runtime when accessed.
|
||||
- **No defensive copy**: Callers can mutate the `Items` array after construction by retaining a reference to the original array, breaking immutability expectations.
|
||||
- **Format string semantics are implicit**: The distinction between `FORMAT`, `ALT_FORMAT`, and `CTRL_FORMAT` is not documented in this file—consumers must infer behavior from naming (e.g., `ALT_FORMAT` may indicate "move" vs. "copy" semantics), but this is not guaranteed.
|
||||
- **No versioning or backward compatibility handling**: If `IDragAndDropItem` evolves, deserialization of older payloads may fail silently or corrupt data.
|
||||
- **None identified from source alone.** *(Note: The above gotchas are inferred from common pitfalls in similar patterns, but strictly speaking, the source file does not explicitly confirm or deny them.)*
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Sensors/StreamOut/UDPStreamProfilePacket.cs
|
||||
generated_at: "2026-04-16T03:18:20.383714+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d7985184134cc083"
|
||||
---
|
||||
|
||||
# StreamOut
|
||||
|
||||
## 1. Purpose
|
||||
The `UDPStreamProfilePacket` class defines the structural metadata for a UDP-based stream profile packet used in sensor data transmission. It encapsulates fixed-size header and payload configuration parameters—such as header lengths, channel-specific data identifiers, timing information, and payload scaling—required to correctly serialize/deserialize or interpret raw UDP packets conforming to a proprietary sensor streaming protocol. This class serves as a data contract for constructing or parsing stream profile packets in the DTS sensor infrastructure.
|
||||
|
||||
## 2. Public Interface
|
||||
All members are public properties with `int` type and default values initialized inline.
|
||||
|
||||
- **`TransHeader`** (`int`, default `4`)
|
||||
Represents the size (in bytes) of the transport header. Default value is `4`.
|
||||
|
||||
- **`TimeHeader`** (`int`, default `24`)
|
||||
Represents the size (in bytes) of the primary timestamp header. Default value is `24`.
|
||||
|
||||
- **`SecondTimeHeader`** (`int`, default `0`)
|
||||
Represents the size (in bytes) of a secondary timestamp header, if present. Default is `0`, indicating absence.
|
||||
|
||||
- **`ChannelSpecificDataWord`** (`int`, default `0`)
|
||||
Identifier or size (in bytes) for channel-specific data word; semantics unclear from source. Default is `0`.
|
||||
|
||||
- **`PCMChannelSpecificDataWord`** (`int`, default `0`)
|
||||
Identifier or size (in bytes) for PCM (Pulse Code Modulation) channel-specific data word; semantics unclear from source. Default is `0`.
|
||||
|
||||
- **`Id`** (`int`, default `0`)
|
||||
Packet or stream identifier. Default is `0`.
|
||||
|
||||
- **`SampleTime`** (`int`, default `0`)
|
||||
Timestamp or sample time value (units unclear—likely milliseconds or microseconds). Default is `0`.
|
||||
|
||||
- **`PayloadFactor`** (`int`, default `2`)
|
||||
Multiplicative factor applied to derive payload size or configure payload layout. Default is `2`.
|
||||
|
||||
- **`Trailer`** (`int`, default `0`)
|
||||
Size (in bytes) of the packet trailer (e.g., checksum, padding, or footer). Default is `0`.
|
||||
|
||||
## 3. Invariants
|
||||
- All properties are nullable-free value types (`int`) and always hold a non-null integer value.
|
||||
- No explicit validation is enforced on property values (e.g., negative sizes or zero `PayloadFactor` are allowed unless constrained elsewhere).
|
||||
- No ordering guarantees are implied (e.g., `TransHeader + TimeHeader + SecondTimeHeader + ...` is not validated against total packet size).
|
||||
- Default values are statically assigned and immutable unless explicitly modified by consumer code.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Imports**:
|
||||
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Runtime.Remoting.Channels`, `System.Text`, `System.Threading.Tasks`
|
||||
- `System.Runtime.Remoting.Channels` is imported but unused (no remoting types referenced in the class).
|
||||
- **Namespace usage**:
|
||||
- Nested under `DTS.Common.Classes.Sensors.StreamOut`, implying integration with other sensor/streaming components (e.g., `UDPStreamProfile`, `SensorStreamManager`).
|
||||
- **Depended upon**:
|
||||
- Inferred to be used by serialization/deserialization logic for UDP sensor streams (e.g., packet builders, parsers, or configuration modules), though no direct references are visible in this file.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguous semantics**: Units and exact meaning of fields (e.g., `PayloadFactor`, `ChannelSpecificDataWord`, `SampleTime`) are not documented in this class. Their interpretation depends on external protocol specs or companion code.
|
||||
- **Unused import**: `System.Runtime.Remoting.Channels` is imported but unused—likely legacy or accidental.
|
||||
- **No immutability or validation**: Properties are mutable and lack validation; consumers must ensure consistency (e.g., non-negative header/trailer sizes).
|
||||
- **No constructor or factory pattern**: Relies on default initialization; no compile-time guarantee of valid combinations (e.g., `SecondTimeHeader > 0` may require `TimeHeader > 0`, but no enforcement exists).
|
||||
- **Hardcoded defaults**: Default values (`TransHeader=4`, `TimeHeader=24`, `PayloadFactor=2`) may reflect legacy protocol versions; changing them without coordinated updates could break interoperability.
|
||||
- **No documentation**: XML comments or inline explanations are absent, increasing reliance on external documentation or reverse engineering.
|
||||
|
||||
None identified beyond the above.
|
||||
124
enriched-qwen3-coder-next/Common/DTS.Common/Classes/TMAT.md
Normal file
124
enriched-qwen3-coder-next/Common/DTS.Common/Classes/TMAT.md
Normal file
@@ -0,0 +1,124 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/TMAT/TmtSingleFile.cs
|
||||
- Common/DTS.Common/Classes/TMAT/TmtSplitFiles.cs
|
||||
- Common/DTS.Common/Classes/TMAT/TMTBase.cs
|
||||
generated_at: "2026-04-16T03:16:31.984201+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "39a472cd530a38e8"
|
||||
---
|
||||
|
||||
# Documentation: TMATS Template Handling Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides functionality for reading, updating, and serializing TMATS (Test Measurement and Test Specification) template files used in DAS (Data Acquisition System) configuration workflows. It supports two template formats—single-file (`TmtSingleFile`) and split-file (`TmtSplitFile`)—and abstracts the underlying file structure through a common interface (`ITMTTemplate`) and base class (`TmtBase`). The module enables dynamic substitution of predefined placeholder patterns (e.g., `{TEST ID}`, `{{CHANNEL {0} NAME}}`) with runtime values, ensuring generated test configurations conform to TMATS specifications.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enums (used in interface methods)
|
||||
|
||||
- **`TMTGlobalKeys`**
|
||||
Enum of global (non-channel-specific) placeholder keys. Each field is annotated with a `[TMTKey(...)]` attribute specifying the literal pattern to search for in template files (e.g., `{TEST ID}`, `{DAS SERIAL NUMBER}`). Used in `UpdateValue(TMTGlobalKeys, string)`.
|
||||
|
||||
- **`TMTChannelKeys`**
|
||||
Enum of channel-specific placeholder keys for *single-file* templates. Each field uses a format string with `{0}` for channel number (e.g., `{{CHANNEL {0} NAME}}`). Used in `UpdateValue(TMTChannelKeys, string, int)`.
|
||||
|
||||
- **`TMTChannelKeysEx`**
|
||||
Enum of channel-specific placeholder keys for *split-file* templates. Keys use simpler, non-formatted patterns (e.g., `{CHANNEL NAME}`, `{CHANNEL NUMBER}`). Used in `UpdateValue(TMTChannelKeysEx, string, int)`.
|
||||
|
||||
### Classes
|
||||
|
||||
#### `TMTKey` (Helper class)
|
||||
|
||||
- **`public static string GetKey(TMTGlobalKeys key)`**
|
||||
Returns the literal pattern string associated with the given `TMTGlobalKeys` enum value (e.g., `"TEST ID}"` → `"{TEST ID}"`).
|
||||
|
||||
- **`public static string GetKey(TMTChannelKeysEx key)`**
|
||||
Returns the literal pattern string for `TMTChannelKeysEx` keys.
|
||||
|
||||
- **`public static string GetKey(TMTChannelKeys key, int channelNumber)`**
|
||||
Returns the formatted pattern string for `TMTChannelKeys` keys, substituting `{0}` with `channelNumber` (e.g., `"{CHANNEL {0} NAME}"` → `"{CHANNEL 1 NAME}"` for `channelNumber=1`).
|
||||
|
||||
#### `TmtBase` (Abstract base class)
|
||||
|
||||
- **`public static string TMT_LimitString(string s)`**
|
||||
Truncates input string `s` to a maximum of 200 characters (per `TMT_MAX_CHANNEL_LENGTH`). Used to enforce TMATS file length constraints.
|
||||
|
||||
- **`public static void UpdateChannelField(...)`**
|
||||
High-level helper to update a single channel field in a template. Handles type-specific formatting (e.g., scaling, signedness, masking via `RunTestVariables.MaskEUMetaData`). Calls `template.UpdateValue(...)` internally.
|
||||
|
||||
- **`public static void UpdateGlobalField(...)`**
|
||||
High-level helper to update a single global field in a template. Populates fields like serial number, sample rate, channel IDs, timestamps, etc., using data from `IDASCommunication`, `IConfigurationData`, and parameters. Calls `template.UpdateValue(...)` internally.
|
||||
|
||||
- **`public static int GetNumberOfStreamedChannels(IDASCommunication das)`**
|
||||
Returns the number of streamed channels based on hardware type and module configuration. Special handling for `SLICE6_AIR_TC` (hardcoded 24) and reconfigurable devices (e.g., TSR AIR).
|
||||
|
||||
- **Abstract methods (must be implemented by derived classes):**
|
||||
- `public abstract void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber);`
|
||||
- `public abstract void UpdateValue(TMTGlobalKeys key, string value);`
|
||||
- `public abstract void UpdateValue(TMTChannelKeys key, string value, int channelNumber);`
|
||||
- `public abstract string[] GetAllLines();`
|
||||
|
||||
#### `TmtSingleFile` (Concrete implementation)
|
||||
|
||||
- **`public TmtSingleFile(string templateLocation)`**
|
||||
Constructor. Reads all lines from `templateLocation` into an internal `_allLines` list. Does *not* throw if file is missing; `_allLines` remains empty.
|
||||
|
||||
- **`public override void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber)`**
|
||||
Replaces *all* occurrences of `pattern = TMTKey.GetKey(key)` in `_allLines` with `value`. Does *not* consider channel context—applies to *all* matching lines.
|
||||
|
||||
- **`public override void UpdateValue(TMTGlobalKeys key, string value)`**
|
||||
Replaces *all* occurrences of `pattern = TMTKey.GetKey(key)` in `_allLines` with `value`.
|
||||
|
||||
- **`public override void UpdateValue(TMTChannelKeys key, string value, int channelNumber)`**
|
||||
Replaces *all* occurrences of `pattern = TMTKey.GetKey(key, channelNumber)` in `_allLines` with `value`.
|
||||
|
||||
- **`public override string[] GetAllLines()`**
|
||||
Returns a copy of `_allLines` as an array.
|
||||
|
||||
#### `TmtSplitFile` (Concrete implementation)
|
||||
|
||||
- **`public TmtSplitFile(string dasTemplate, string channelTemplate)`**
|
||||
Constructor. Reads global lines from `dasTemplate` into `_lines`, and channel template lines from `channelTemplate` into `_channelTemplate`. Does *not* throw if files are missing; corresponding lists remain empty.
|
||||
|
||||
- **`public override string[] GetAllLines()`**
|
||||
Returns concatenation of `_lines` (global section) followed by channel sections for all channel numbers present in `_allChannels`. Channel sections are inserted in ascending numeric order (from `min` to `max` key). If no channels exist, returns only `_lines`.
|
||||
|
||||
- **`public override void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber)`**
|
||||
Ensures a channel entry exists for `channelNumber` in `_allChannels` (via `AddChannelIfNeeded`), then replaces *all* occurrences of `pattern = TMTKey.GetKey(key)` in that channel’s line list with `value`.
|
||||
|
||||
- **`public override void UpdateValue(TMTGlobalKeys key, string value)`**
|
||||
Replaces *all* occurrences of `pattern = TMTKey.GetKey(key)` in `_lines` with `value`.
|
||||
|
||||
- **`public override void UpdateValue(TMTChannelKeys key, string value, int channelNumber)`**
|
||||
Replaces *all* occurrences of `pattern = TMTKey.GetKey(key, channelNumber)` in `_lines` (global section) with `value`.
|
||||
⚠️ **Note**: This method does *not* operate on per-channel data in `_allChannels`—it updates the global template file.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Template file existence is not enforced**: Constructors for both `TmtSingleFile` and `TmtSplitFile` silently proceed if the specified file(s) do not exist, resulting in empty `_allLines`/`_lines`/`_channelTemplate` lists.
|
||||
- **Pattern matching is substring-based**: `Contains(pattern)` is used to locate lines for replacement. This may cause unintended matches if patterns are substrings of unrelated text (e.g., `{NAME}` would match `{NAME OF PROGRAM}`).
|
||||
- **All replacements are global per line list**: Each `UpdateValue` call replaces *every* occurrence of the pattern in the relevant line collection (e.g., all lines in `_allLines` for `TmtSingleFile`). There is no support for updating only the *first* occurrence or a specific line index.
|
||||
- **Channel keys for split files are stored separately**: In `TmtSplitFile`, `TMTChannelKeysEx` updates affect per-channel data in `_allChannels`, while `TMTChannelKeys` updates affect only the global `_lines`.
|
||||
- **Channel numbering is 1-based**: `UpdateChannelField` uses `1 + channelIndex` for `TMTChannelKeysEx.ChannelNumber`.
|
||||
- **String length is capped at 200 characters**: `TMT_LimitString` enforces this limit for channel names and other string fields.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
- **Enums**: `DTS.Common.Enums.DASFactory.TMTGlobalKeys`, `DTS.Common.Enums.DASFactory.TMTChannelKeys`, `DTS.Common.Enums.DASFactory.TMTChannelKeysEx` (defined in same file).
|
||||
- **Interfaces**: `DTS.Common.Interface.DASFactory.IDASCommunication`, `DTS.Common.Interface.DASFactory.Config.IConfigurationData`.
|
||||
- **Constants/Types**: `DTS.Common.Enums.DASFactory.DFConstantsAndEnums.ModuleType`, `DTS.Common.Enums.Hardware.HardwareTypes`, `DTS.Common.Constants.Constants.UDP_STREAM_CH10_TF2`, `RunTestVariables` (static class with `MaskEUMetaData` field).
|
||||
- **System**: `System.IO.File`, `System.Collections.Generic`, `System.Linq`, `System.Reflection`, `System.DateTime`.
|
||||
- **Consumers**: This module is used by higher-level code that generates TMATS files (e.g., test execution or configuration tools), likely via `TmtBase.UpdateChannelField` and `TmtBase.UpdateGlobalField`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`TMTChannelKeys` in `TmtSplitFile` updates global lines, not per-channel lines**: Calling `UpdateValue(TMTChannelKeys, ...)` on a `TmtSplitFile` instance updates the global template file (`_lines`), *not* the per-channel template (`_channelTemplate` or `_allChannels`). This is likely unintentional and may cause incorrect behavior if channel-specific global keys (e.g., `{{CHANNEL {0} NAME}}`) are expected to be updated per channel.
|
||||
- **No validation of pattern existence**: `TMTKey.GetKey(...)` returns `string.Empty` if the enum value lacks a `[TMTKey]` attribute or reflection fails. This results in replacing empty strings (i.e., no-op or unintended global replacement).
|
||||
- **Substring matching may cause false positives**: Using `Contains(pattern)` can match patterns embedded in other text (e.g., `{CHANNEL 1 NAME}` would match lines containing `{{CHANNEL 10 NAME}}`).
|
||||
- **Channel numbering assumptions**: `GetNumberOfStreamedChannels` assumes specific hardware types and module counts. The logic for reconfigurable devices (e.g., TSR AIR) is hardcoded and may not cover all future configurations.
|
||||
- **No error handling for file I/O**: `File.ReadAllLines` may throw `IOException` or `UnauthorizedAccessException`, but these are not caught or handled.
|
||||
- **`_allChannels` dictionary may have gaps**: `GetAllLines` iterates from `min` to `max` key, inserting only existing channels. If channels 1, 2, and 5 exist, channels 3 and 4 are skipped—this may be intentional or a bug depending on TMATS spec requirements.
|
||||
- **`TMT_MAX_CHANNEL_LENGTH` is hardcoded**: While documented as 200 (increased from 50), this is not configurable and may need adjustment for future TMATS versions.
|
||||
158
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Tags.md
Normal file
158
enriched-qwen3-coder-next/Common/DTS.Common/Classes/Tags.md
Normal file
@@ -0,0 +1,158 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/Tags/TagAssignment.cs
|
||||
- Common/DTS.Common/Classes/Tags/Tag.cs
|
||||
- Common/DTS.Common/Classes/Tags/TagAwareBase.cs
|
||||
- Common/DTS.Common/Classes/Tags/TagsInstance.cs
|
||||
generated_at: "2026-04-16T03:17:02.180213+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9217697aeaa1fbf6"
|
||||
---
|
||||
|
||||
# Tagging System Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a tag-based association system for domain objects in the DTS application. It enables arbitrary metadata (tags) to be attached to various object types (e.g., devices, locations, users) via a many-to-many relationship. The system supports creating, querying, and associating tags with objects, using a combination of in-memory caching (`TagsInstance`) and database persistence. Tags themselves are immutable once created (no edit/delete/obsolete operations are exposed), and tag assignments are stored separately in a `TagAssignment` table. The `TagAwareBase` abstract class provides reusable tagging functionality for any domain class that needs to support tagging.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TagAssignment` class (`DTS.Common.Classes.Tags.TagAssignment`)
|
||||
- **`int ObjectID { get; set; }`**
|
||||
The ID of the object (e.g., device, location) to which the tag is assigned.
|
||||
- **`int TagID { get; set; }`**
|
||||
The ID of the tag being assigned.
|
||||
- **`TagTypes ObjectType { get; set; }`**
|
||||
The type of the object (e.g., `TagTypes.Device`, `TagTypes.Location`). *Note: Property name is `ObjectType`, not `TagType`.*
|
||||
- **`TagAssignment()`**
|
||||
Default constructor.
|
||||
- **`TagAssignment(IDataReader reader)`**
|
||||
Constructor that initializes fields from a database reader using column names `"TagID"`, `"ObjectID"`, and `"ObjectType"`.
|
||||
|
||||
### `Tag` class (`DTS.Common.Classes.Tags.Tag`)
|
||||
- **`const int INVALID_ID = -1`**
|
||||
Sentinel value indicating an uninitialized or non-existent tag ID.
|
||||
- **`int ID { get; set; }`**
|
||||
Unique identifier for the tag.
|
||||
- **`string Text { get; set; }`**
|
||||
Human-readable tag text (case-sensitive, whitespace-sensitive).
|
||||
- **`bool IsObsolete { get; set; }`**
|
||||
Flag indicating whether the tag is obsolete. *Currently not used for filtering or validation in the provided code.*
|
||||
- **`Tag(string tagText, int tagId)`**
|
||||
Constructor that initializes `ID`, `Text`, and sets `IsObsolete = false`.
|
||||
- **`Tag(Tag copy)`**
|
||||
Copy constructor.
|
||||
- **`Tag(IDataReader reader)`**
|
||||
Constructor that initializes fields from a database reader using columns `"TagId"`, `"Obsolete"`, and `"TagText"`.
|
||||
- **`Tag()`**
|
||||
Default constructor.
|
||||
- **`object Clone()`**
|
||||
Returns a new `Tag` instance with identical `ID`, `Text`, and `IsObsolete` values.
|
||||
|
||||
### `TagAwareBase` abstract class (`DTS.Common.Classes.TagAwareBase`)
|
||||
- **`abstract TagTypes TagType { get; }`**
|
||||
Must be implemented by derived classes to specify the object type for tag assignments.
|
||||
- **`byte[] TagsBlobBytes { get; set; }`**
|
||||
Binary representation of `TagIDs` (int array → byte array). Setter silently fails if input is too short; logs exceptions.
|
||||
- **`int[] TagIDs { get; set; }`**
|
||||
Array of tag IDs currently assigned to this object. Setter replaces array with empty array if `null`.
|
||||
- **`void SetTagsFromCommaSeparatedString(string tagText, ...)`**
|
||||
Parses `tagText` by commas, trims leading whitespace per tag, and updates `TagIDs` and `TagIDs` property. *Note: Leading whitespace is trimmed, but trailing whitespace is preserved in tag text.*
|
||||
- **`virtual void SetTags(string[] tagsText, ...)`**
|
||||
Adds tags via `TagsInstance.AddRange`, then updates `TagIDs` using `TagsInstance.GetIDsFromTagText`. Raises `OnPropertyChanged("TagIDs")`.
|
||||
- **`string GetTagsAsCommaSeparatedString(TagsGetDelegate tagsGet)`**
|
||||
Returns comma-separated tag text (e.g., `"tag1,tag2"`), using `GetTagsArray` internally.
|
||||
- **`virtual string[] GetTagsArray(TagsGetDelegate tagsGet)`**
|
||||
Returns array of tag text strings corresponding to `TagIDs`.
|
||||
- **`virtual int[] GetTagIDs()`**
|
||||
Returns current `TagIDs`.
|
||||
- **`virtual void RemoveTags(string[] tagsText)`**
|
||||
Stub implementation — does nothing. *No-op.*
|
||||
- **`bool TagCompatible(string tags, TagsGetDelegate tagsGet)`**
|
||||
Returns `true` if *any* tag in the input comma-separated string matches *any* tag on this object. Empty/whitespace-only tags are ignored. Returns `true` if input is null/empty or all tags are empty.
|
||||
- **`virtual bool TagCompatible(int[] tags)`**
|
||||
Returns `true` if `tags` is empty or if there is any intersection between `tags` and `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`.
|
||||
- **`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 given `tagType`, filters to those matching `objectId`, and returns distinct `TagID`s.
|
||||
|
||||
### `TagsInstance` class (`DTS.Common.Classes.Tags.TagsInstance`)
|
||||
- **`static TagsInstance GetTagsInstance(TagsGetDelegate tagsGet)`**
|
||||
Returns singleton instance (lazy-initialized). Requires `tagsGet` delegate for initial population.
|
||||
- **`bool AddTag(string tagText, ...)`**
|
||||
Adds `tagText` (trimmed of leading whitespace) to DB and cache if not already present. Returns `false` if tag already exists or input is null/empty.
|
||||
- **`static bool MigrateTag(string tagText, ...)`**
|
||||
Adds `tagText` to DB/cache (even if duplicate). Intended for data migration. *No deduplication.*
|
||||
- **`bool ContainsTag(string text)`**
|
||||
Checks if `text` exists in in-memory cache (case-sensitive).
|
||||
- **`static bool[] AddRange(string[] tagText, ...)`**
|
||||
Calls `AddTag` for each element (trims leading whitespace). Returns array of success flags.
|
||||
- **`static int GetIDFromTagText(string tagText, TagsGetDelegate tagsGet, TagsGetIdDelegate tagsGetId)`**
|
||||
Looks up tag ID in DB via `tagsGetId`. Returns `Tag.INVALID_ID` (-1) if not found.
|
||||
- **`static int[] GetIDsFromTagText(string[] tagText, TagsGetDelegate tagsGet, TagsGetIdDelegate tagsGetId)`**
|
||||
Returns array of tag IDs for input texts, filtering out `Tag.INVALID_ID`.
|
||||
- **`static string GetTagTextFromID(int tagID, TagsGetDelegate tagsGet)`**
|
||||
Looks up tag text from in-memory cache. Returns `null` if invalid ID or not found.
|
||||
- **`static string[] GetTagTextFromIDs(int[] tagId, TagsGetDelegate tagsGet)`**
|
||||
Returns array of tag texts for IDs, skipping invalid IDs and null/empty text.
|
||||
- **`void UpdateList(TagsGetDelegate tagsGet)`**
|
||||
Refreshes in-memory cache by fetching all tags via `tagsGet(null, out tags)`.
|
||||
|
||||
### Delegates (`TagsInstance`)
|
||||
- **`TagsGetDelegate`**
|
||||
`ulong delegate(int? id, out ITag[] tags)` — Fetches tags by ID (or all if `id == null`).
|
||||
- **`TagsGetIdDelegate`**
|
||||
`ulong delegate(string text, out int? id)` — Fetches tag ID by text.
|
||||
- **`TagsInsertDelegate`**
|
||||
`ulong delegate(ref ITag tag)` — Inserts a tag into DB, updating `tag.ID`.
|
||||
- **`GetSqlCommandDelegate`**
|
||||
`SqlCommand delegate(bool bNewConnection)` — Factory for SQL commands.
|
||||
- **`TagAssignmentsGet`**
|
||||
`ulong delegate(TagTypes? tagType, out ITagAssignment[] records)` — Fetches assignments (optionally filtered by type).
|
||||
- **`TagAssignmentsDelete`**
|
||||
`ulong delegate(TagTypes objectType, int objectId)` — Deletes assignments for object.
|
||||
- **`TagAssignmentsInsert`**
|
||||
`ulong delegate(ITagAssignment tagAssignment)` — Inserts a single assignment.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Tag immutability**: Tags cannot be renamed, edited, or deleted in the current implementation. `Tag.Commit` only updates `ID` if the tag already exists in the DB; no other fields are persisted.
|
||||
- **Tag ID validity**: `Tag.INVALID_ID = -1` is used as a sentinel for uninitialized or non-existent tags. All tag ID lookups return this value on failure.
|
||||
- **Cache consistency**: `TagsInstance` maintains an in-memory cache (`_tagsLookup`) that is only updated on startup or when `AddTag`/`MigrateTag`/`UpdateList` is called. It is *not* automatically synchronized with DB changes.
|
||||
- **Whitespace handling**: Leading whitespace is trimmed from tag text during `AddTag`/`AddRange`/`SetTags`, but trailing whitespace is preserved in tag text and comparisons.
|
||||
- **Assignment integrity**: `TagAssignment` records require non-null `ObjectID`, `TagID`, and `ObjectType`. `Commit` deletes all prior assignments for an object before inserting new ones.
|
||||
- **Tag compatibility logic**: `TagCompatible(string)` returns `true` if *any* input tag matches *any* object tag (logical OR), not AND.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **`DTS.Common.Base.BasePropertyChanged`**
|
||||
Base class for `Tag`, `TagAssignment`, and `TagAwareBase` to support property change notifications.
|
||||
- **`DTS.Common.Interface.Tags`**
|
||||
Interfaces `ITag`, `ITagAssignment`, and `TagTypes` enum.
|
||||
- **`System.Data`**
|
||||
`IDataReader`, `SqlCommand`.
|
||||
- **`DTS.Common.Utilities.Logging`**
|
||||
`APILogger` for exception logging.
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- **`TagAwareBase`** is intended to be inherited by domain classes requiring tagging (e.g., device, location, user classes).
|
||||
- **`TagsInstance`** is used by `TagAwareBase` and callers to manage tag creation, lookup, and assignment.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Property name mismatch**: In `TagAssignment`, the property `TagTypes ObjectType` is named `ObjectType`, *not* `TagType`. This may cause confusion.
|
||||
- **Whitespace trimming**: Only *leading* whitespace is trimmed during tag creation (`TrimStart()`), but not trailing. `"tag "` and `"tag"` are treated as distinct.
|
||||
- **No tag editing/deletion**: `Tag` objects cannot be edited, renamed, or deleted. `IsObsolete` is stored but unused in filtering or validation logic.
|
||||
- **Cache staleness**: `TagsInstance` cache is not auto-updated. If tags are added externally (e.g., via direct DB writes), `UpdateList` must be called manually.
|
||||
- **`RemoveTags` is a stub**: `TagAwareBase.RemoveTags` does nothing. No tag removal from objects is implemented.
|
||||
- **`TagCompatible` semantics**: `TagCompatible(string)` returns `true` if *any* input tag matches *any* object tag (OR logic), not all tags (AND). This may be counterintuitive.
|
||||
- **`TagsBlobBytes` setter ignores short arrays**: If `value.Length < sizeof(int)`, the setter returns without modifying `TagIDs`.
|
||||
- **`MigrateTag` bypasses deduplication**: Unlike `AddTag`, `MigrateTag` will insert duplicate tags into the DB/cache.
|
||||
- **`TagAssignment.ObjectType` type**: The property is named `ObjectType` but holds `TagTypes`, which likely represents the *object* type (e.g., device), not the tag type.
|
||||
@@ -0,0 +1,126 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/TestMetaData/TestEngineerDetailsDbRecord.cs
|
||||
- Common/DTS.Common/Classes/TestMetaData/CustomerDetailsDbRecord.cs
|
||||
- Common/DTS.Common/Classes/TestMetaData/LabratoryDetailsDbRecord.cs
|
||||
generated_at: "2026-04-16T03:15:34.968260+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b20907858a69ef9c"
|
||||
---
|
||||
|
||||
# Documentation: Test Metadata Database Record Classes
|
||||
|
||||
## 1. Purpose
|
||||
These three classes—`TestEngineerDetailsDbRecord`, `CustomerDetailsDbRecord`, and `LabratoryDetailsDbRecord`—represent immutable data transfer objects (DTOs) for loading and storing metadata about test engineers, customers, and laboratories from a database. They implement `INotifyPropertyChanged` via `BasePropertyChanged` to support UI binding, and provide constructors for instantiation from an `IDataReader` (database query results) or from another instance of the same interface type. Each class encapsulates domain-specific fields (e.g., contact info, reference numbers) alongside common metadata fields (e.g., `LastModified`, `Version`, `LocalOnly`) used for auditing and synchronization. They serve as the foundational data layer for test metadata management within the DTS system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TestEngineerDetailsDbRecord`
|
||||
- **Namespace**: `DTS.Common.Classes.TestEngineerDetails`
|
||||
- **Implements**: `ITestEngineerDetailsDbRecord`
|
||||
- **Inherits**: `Base.BasePropertyChanged`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TestEngineerDetailsDbRecord()` | Default parameterless constructor. |
|
||||
| Constructor | `TestEngineerDetailsDbRecord(ITestEngineerDetailsDbRecord)` | Copy constructor: initializes all properties from another instance of the interface. |
|
||||
| Constructor | `TestEngineerDetailsDbRecord(IDataReader reader)` | Constructor from database: reads values using `Utility.GetString`, `Utility.GetDateTime`, `Utility.GetInt`, and `Utility.GetBool`. |
|
||||
| Property | `int TestEngineerId { get; set; }` | Internal database ID; defaults to `-1`; read-only in UI (`[ReadOnly(true)]`, `[Browsable(false)]`). |
|
||||
| Property | `string Name { get; set; }` | Internal name (likely primary identifier); defaults to `""`; read-only in UI. |
|
||||
| Property | `string TestEngineerName { get; set; }` | Display name; defaults to `"NOVALUE"`; marked with `[DisplayResource("TestEngineerName")]`. |
|
||||
| Property | `string TestEngineerPhone { get; set; }` | Phone number; defaults to `"NOVALUE"`; marked with `[DisplayResource("TestEngineerPhone")]`. |
|
||||
| Property | `string TestEngineerFax { get; set; }` | Fax number; defaults to `"NOVALUE"`; marked with `[DisplayResource("TestEngineerFax")]`. |
|
||||
| Property | `string TestEngineerEmail { get; set; }` | Email address; defaults to `"NOVALUE"`; marked with `[DisplayResource("TestEngineerEmail")]`. |
|
||||
| Property | `bool LocalOnly { get; set; }` | Indicates if record is local-only (not synchronized); defaults to `false`; read-only in UI. |
|
||||
| Property | `DateTime LastModified { get; set; }` | Timestamp of last modification; defaults to `DateTime.MinValue`; read-only in UI. |
|
||||
| Property | `string LastModifiedBy { get; set; }` | User who last modified the record; defaults to `""`; read-only in UI. |
|
||||
| Property | `int Version { get; set; }` | Version number for concurrency control; defaults to `-1`; read-only in UI. |
|
||||
| Method | `bool IsInvalidBlank()` | Returns `true` if `Name` is `null`, empty, or whitespace. |
|
||||
|
||||
### `CustomerDetailsDbRecord`
|
||||
- **Namespace**: `DTS.Common.Classes.CustomerDetails`
|
||||
- **Implements**: `ICustomerDetailsDbRecord`
|
||||
- **Inherits**: `Base.BasePropertyChanged`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `CustomerDetailsDbRecord()` | Default parameterless constructor. |
|
||||
| Constructor | `CustomerDetailsDbRecord(ICustomerDetailsDbRecord)` | Copy constructor. |
|
||||
| Constructor | `CustomerDetailsDbRecord(IDataReader reader)` | Constructor from database. |
|
||||
| Property | `int CustomerId { get; set; }` | Internal database ID; defaults to `-1`; read-only in UI. |
|
||||
| Property | `string Name { get; set; }` | Internal name; defaults to `""`; read-only in UI. |
|
||||
| Property | `string CustomerName { get; set; }` | Display name; defaults to `""`; marked with `[DisplayResource("CustomerName")]`. |
|
||||
| Property | `string CustomerTestRefNumber { get; set; }` | Customer test reference number; defaults to `""`; marked with `[DisplayResource("CustomerTestRefNumber")]`. |
|
||||
| Property | `string ProjectRefNumber { get; set; }` | Project reference number; defaults to `"NOVALUE"`; marked with `[DisplayResource("ProjectRefNumber")]`. |
|
||||
| Property | `string CustomerOrderNumber { get; set; }` | Customer order number; defaults to `"NOVALUE"`; marked with `[DisplayResource("CustomerOrderNumber")]`. |
|
||||
| Property | `string CustomerCostUnit { get; set; }` | Cost center/unit; defaults to `"NOVALUE"`; marked with `[DisplayResource("CustomerCostUnit")]`. |
|
||||
| Property | `bool LocalOnly { get; set; }` | Local-only flag; defaults to `false`; read-only in UI. |
|
||||
| Property | `DateTime LastModified { get; set; }` | Modification timestamp; defaults to `DateTime.MinValue`; read-only in UI. |
|
||||
| Property | `string LastModifiedBy { get; set; }` | Modifier username; defaults to `""`; read-only in UI. |
|
||||
| Property | `int Version { get; set; }` | Version number; defaults to `-1`; read-only in UI. |
|
||||
| Method | `bool IsInvalidBlank()` | Returns `true` if `Name` is blank. |
|
||||
|
||||
### `LabratoryDetailsDbRecord`
|
||||
- **Namespace**: `DTS.Common.Classes.LabratoryDetails` *(Note: Typo in namespace and class name: "Labratory" instead of "Laboratory")*
|
||||
- **Implements**: `ILabratoryDetailsDbRecord`
|
||||
- **Inherits**: `Base.BasePropertyChanged`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `LabratoryDetailsDbRecord()` | Default parameterless constructor. |
|
||||
| Constructor | `LabratoryDetailsDbRecord(ILabratoryDetailsDbRecord)` | Copy constructor. |
|
||||
| Constructor | `LabratoryDetailsDbRecord(IDataReader reader)` | Constructor from database. |
|
||||
| Property | `int LabratoryId { get; set; }` | Internal database ID; defaults to `-1`; read-only in UI. |
|
||||
| Property | `string Name { get; set; }` | Internal name; defaults to `""`; read-only in UI. |
|
||||
| Property | `string LabratoryName { get; set; }` | Display name; defaults to `string.Empty`; marked with `[DisplayResource("LabratoryName")]`. |
|
||||
| Property | `string LabratoryContactName { get; set; }` | Contact person name; defaults to `string.Empty`; marked with `[DisplayResource("LabratoryContactName")]`. |
|
||||
| Property | `string LabratoryContactPhone { get; set; }` | Contact phone; defaults to `"NOVALUE"`; marked with `[DisplayResource("LabratoryContactPhone")]`. |
|
||||
| Property | `string LabratoryContactFax { get; set; }` | Contact fax; defaults to `"NOVALUE"`; marked with `[DisplayResource("LabratoryContactFax")]`. |
|
||||
| Property | `string LabratoryContactEmail { get; set; }` | Contact email; defaults to `"NOVALUE"`; marked with `[DisplayResource("LabratoryContactEmail")]`. |
|
||||
| Property | `string LabratoryTestRefNumber { get; set; }` | Lab test reference number; defaults to `string.Empty`; marked with `[DisplayResource("LabratoryTestRefNumber")]`. |
|
||||
| Property | `string LabratoryProjectRefNumber { get; set; }` | Lab project reference number; defaults to `string.Empty`; marked with `[DisplayResource("LabratoryProjectRefNumber")]`. |
|
||||
| Property | `bool LocalOnly { get; set; }` | Local-only flag; defaults to `false`; read-only in UI. |
|
||||
| Property | `DateTime LastModified { get; set; }` | Modification timestamp; defaults to `DateTime.MinValue`; read-only in UI. |
|
||||
| Property | `string LastModifiedBy { get; set; }` | Modifier username; defaults to `""`; read-only in UI. |
|
||||
| Property | `int Version { get; set; }` | Version number; defaults to `-1`; read-only in UI. |
|
||||
| Method | `bool IsInvalidBlank()` | Returns `true` if `Name` is blank. |
|
||||
|
||||
## 3. Invariants
|
||||
- **`Name` is required**: All three classes enforce that `Name` must not be `null`, empty, or whitespace for validity. This is checked via `IsInvalidBlank()`.
|
||||
- **Default values for display fields**: Non-essential contact/reference fields default to `"NOVALUE"` (e.g., `TestEngineerPhone`, `ProjectRefNumber`) or `string.Empty` (e.g., `LabratoryName`, `CustomerName`).
|
||||
- **Metadata fields initialized to sentinel values**:
|
||||
- `LastModified` → `DateTime.MinValue`
|
||||
- `Version` → `-1`
|
||||
- `LocalOnly` → `false`
|
||||
- **UI visibility**: Properties marked `[Browsable(false)]` and `[ReadOnly(true)]` are intended for internal/backend use only (e.g., `CustomerId`, `LastModified`).
|
||||
- **`[DisplayResource]` attribute usage**: Only user-facing fields (e.g., `CustomerName`, `TestEngineerEmail`) carry `[DisplayResource]`, indicating localization support via resource keys.
|
||||
- **Immutability in practice**: Though setters exist, the `[ReadOnly(true)]` attribute and internal naming (`_name`, `_version`) suggest these are *mostly* immutable after construction—especially when populated from a database.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Core dependencies (all three classes)**:
|
||||
- `DTS.Common.Base.Classes.BasePropertyChanged` (base class for `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` (`IDataReader` for database population)
|
||||
- `System.ComponentModel` (`[Browsable]`, `[ReadOnly]`, `[DisplayResource]` attributes)
|
||||
- **Internal utilities**:
|
||||
- `Utility.GetString`, `Utility.GetDateTime`, `Utility.GetInt`, `Utility.GetBool` (static methods for safe `IDataReader` access)
|
||||
- **Inferred consumers**:
|
||||
- Data access layers (DALs) that populate records from SQL queries.
|
||||
- UI components (e.g., WPF/WinForms) relying on `INotifyPropertyChanged` and `[DisplayResource]` for binding and localization.
|
||||
- Synchronization or caching services that use `LocalOnly`, `LastModified`, and `Version` for conflict resolution.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Typo in namespace/class name**: The `LabratoryDetailsDbRecord` class and its namespace use "Labratory" (misspelled) instead of "Laboratory". This is likely historical and should be preserved for compatibility.
|
||||
- **`[DisplayResource]` attribute behavior is undefined**: The source does not show how `[DisplayResource]` is processed. Its runtime behavior (e.g., resource lookup mechanism) is not documented here.
|
||||
- **No validation on non-blank fields**: While `IsInvalidBlank()` checks `Name`, there is no validation for required contact fields (e.g., `TestEngineerEmail`). An instance may be "valid" yet missing critical data.
|
||||
- **`LocalOnly` semantics unclear**: The purpose of `LocalOnly` is not explained—e.g., whether it affects persistence, synchronization, or visibility.
|
||||
- **Default `"NOVALUE"` string**: This sentinel value is used inconsistently:
|
||||
- `TestEngineerDetailsDbRecord`: `"NOVALUE"` for phone/fax/email
|
||||
- `CustomerDetailsDbRecord`: `"NOVALUE"` for project/order/cost-unit
|
||||
- `LabratoryDetailsDbRecord`: `"NOVALUE"` for contact phone/fax/email
|
||||
Consumers must be aware of this convention to avoid misinterpreting `"NOVALUE"` as a literal value.
|
||||
- **No null-safety guarantees**: `Utility.GetString` and similar methods are used, but their behavior on `DBNull` or missing columns is not specified in the source.
|
||||
- **Copy constructor does not validate**: The copy constructor accepts `ITestEngineerDetailsDbRecord` (etc.) without checking for null or invalid state. A copy of an invalid record remains invalid.
|
||||
- **No explicit immutability enforcement**: Despite `[ReadOnly(true)]`, the properties remain settable programmatically—e.g., after construction from a database, callers can still mutate fields.
|
||||
@@ -0,0 +1,123 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/TestSetups/SimpleHardware.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/TestSetupHelper.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/ExtraProperties.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/ROIPeriodChannelRecord.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/TestSetupHardwareRecord.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/TestSetupROIsRecord.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/CalculatedChannelRecord.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/ISFFile.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/GraphRecord.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/RegionOfInterest.cs
|
||||
- Common/DTS.Common/Classes/TestSetups/ISFSensorRecord.cs
|
||||
generated_at: "2026-04-16T03:18:08.842826+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9bc5c021742b55c0"
|
||||
---
|
||||
|
||||
# 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 immutable and mutable record types that model database entities (e.g., hardware assignments, ROIs, calculated channels, graphs), along with supporting infrastructure for ISF file I/O and test setup naming. The module serves as the data layer abstraction for test setup management—enabling serialization/deserialization from database queries, file formats (ISF), and interoperation with UI and business logic layers through interfaces and property change notifications.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
#### `SimpleHardware`
|
||||
- **Signature**: `public class SimpleHardware : Tuple<string, string, int, int>`
|
||||
- **Behavior**: A lightweight, immutable tuple-based representation of hardware configuration. Exposes `SerialNumber`, `ParentDAS`, `DASId`, and `DASType` via named properties derived from tuple items. Used for passing hardware metadata without database persistence.
|
||||
|
||||
#### `TestSetupHelper`
|
||||
- **Signature**: `public abstract class TestSetupHelper`
|
||||
- **Behavior**: A static helper class for managing test setup names by ID. Provides `SetTestSetupName`, `GetTestSetupName`, and `ClearTestSetupNames` methods. Maintains an internal dictionary mapping integer IDs to string names.
|
||||
|
||||
#### `ExtraProperty`
|
||||
- **Signature**: `[Serializable] public class ExtraProperty : IExtraProperty`
|
||||
- **Behavior**: A mutable, INotifyPropertyChanged-enabled class representing a key-value pair for extra properties. Supports two constructors: parameterized (`key`, `value`) and copy constructor from `IExtraProperty`. Includes `PasteCommand` and `ItemStatus` properties (ignored during JSON serialization via `[ScriptIgnore]`).
|
||||
|
||||
#### `ROIPeriodChannelRecord`
|
||||
- **Signature**: `public class ROIPeriodChannelRecord : BasePropertyChanged, IROIPeriodChannelRecord`
|
||||
- **Behavior**: Represents a record from the `ROIPeriodChannels` database table. Properties: `TestSetupROIId`, `ChannelName`, `ChannelId`. Constructor accepts `IDataReader` and `storedProcedureVersionToUse`; `ChannelId` is set to `-1` if the DB version predates its introduction (`Constants.ROIPERIODCHANNELS_CHANNELID_DB_VERSION`).
|
||||
|
||||
#### `TestSetupHardwareRecord`
|
||||
- **Signature**: `public class TestSetupHardwareRecord : Base.BasePropertyChanged, ITestSetupHardwareRecord`
|
||||
- **Behavior**: Represents a record from the `TestSetupHardware` table. Properties: `DASId`, `TestSetupId`, `AddDAS`, `SamplesPerSecond`, `IsClockMaster`, `PTPDomainId`, `AntiAliasFilterRate`. Supports three constructors: default, `IDataReader` (with version-aware `PTPDomainId` parsing), and copy constructor from `ITestSetupHardwareRecord`.
|
||||
|
||||
#### `TestSetupROIsRecord`
|
||||
- **Signature**: `public class TestSetupROIsRecord : BasePropertyChanged, ITestSetupROIRecord`
|
||||
- **Behavior**: Represents a record from the `TestSetupROIs` table. Properties: `TestSetupROIId`, `TestSetupId`, `Suffix`, `ROIStart`, `ROIEnd`, `IsEnabled`, `IsDefault`. Constructor accepts `IDataReader`; note: `TestSetupId` is incorrectly assigned from `"TestSetupROIId"` column in constructor (see *Gotchas*).
|
||||
|
||||
#### `CalculatedChannelRecord`
|
||||
- **Signature**: `public class CalculatedChannelRecord : BasePropertyChanged, ICalculatedChannelRecord`
|
||||
- **Behavior**: Represents a calculated channel record. Properties include `Name`, `TestSetupName`, `Id`, `Operation`, `CalculatedValueCode`, `InputChannelIds` (string array), `CFCForInputChannels`, `ChannelFilterClassForOutput`, `TestSetupId`, `ViewInRealtime`, `ClipLength`. Supports default, copy (`ICalculatedChannelRecord`), and `IDataReader` constructors. Input channel IDs are parsed from CSV using `CultureInfo.InvariantCulture.TextInfo.ListSeparator`.
|
||||
|
||||
#### `ISFFile`
|
||||
- **Signature**: `public class ISFFile`
|
||||
- **Behavior**: Handles reading/writing ISF (Instrumentation Sensor Format) files. Contains fixed-length header fields (`TestSetupName`, `NumberOfRecords`, `TestType`, `TestDivision`, `TCFile`) and a list of `IISFSensorRecord` objects. Methods: `AddRecord`, `WriteToFile`, `AddSensors`. Header line parsing uses fixed offsets and padding with spaces.
|
||||
|
||||
#### `GraphRecord`
|
||||
- **Signature**: `public class GraphRecord : BasePropertyChanged, IGraphRecord`
|
||||
- **Behavior**: Represents a graph configuration record. Properties: `GraphId`, `TestSetupId`, `GraphName`, `GraphDescription`, `ChannelsString`, axis range flags (`UseDomainMin`, `UseDomainMax`, `UseRangeMin`, `UseRangeMax`) and their corresponding min/max values, `ThresholdsString`, `LocalOnly` (deprecated). Supports default, copy, and `IDataReader` constructors.
|
||||
|
||||
#### `RegionOfInterest`
|
||||
- **Signature**: `[Serializable] public class RegionOfInterest : IRegionOfInterest`
|
||||
- **Behavior**: A mutable, INotifyPropertyChanged-enabled class modeling a time-based ROI. Properties: `Suffix`, `Start`, `End`, `IsEnabled`, `IsDefault`, `ChannelNames`, `ChannelIds`. Includes validation to ensure `Start < End`. Notifies via `RegionOfInterestChangedEvent` (via Prism EventAggregator) on value changes, unless `Deserializing` is true. Provides utility methods for channel name formatting (`GetAnalogChanName`, `GetChanName`, `RemoveParentDASName`, `RemoveAssignedByIDFromHardwareString`) and silent assignment (`SetChannelNamesNoNotify`, `SetChannelIdsNoNotify`).
|
||||
|
||||
#### `ISFSensorRecord`
|
||||
- **Signature**: `public class ISFSensorRecord : IISFSensorRecord`
|
||||
- **Behavior**: Represents a single sensor record in an ISF file (comprising 4 fixed-length records of `RECORD_LENGTH` chars each). Exposes structured properties for sensor metadata (e.g., `DataChannelNumber`, `Tag`, `SerialNumber`, `Sensitivity`, `Capacity`, `EngineeringUnits`, `C1`, `C2`, `C3`, `EID`, `CommentPart1/2/3`, `SensorType`, `TOMConfigurationName`). Includes methods to set/get values and `Write` to `BinaryWriter`. Default constructor initializes `TOMConfigurationName` to `"STANDARD"`.
|
||||
|
||||
### Extension Methods (in `ISFFile`)
|
||||
- `Fill<T>(this T[] sourceArray, T with)`: Fills entire array with value.
|
||||
- `SubFill<T>(this T[] source, T with, int startIndex, int finalIndex)`: Fills from `startIndex` to `finalIndex` (exclusive), respecting array bounds.
|
||||
- `SetValues<T>(this T[] source, T[] with, int startIndex, int length, T pad)`: Copies `with` array into `source` starting at `startIndex`, padding remaining space with `pad`.
|
||||
- `GetValues<T>(this T[] source, int startIndex, int length)`: Returns a new array of `length` elements starting at `startIndex`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`SimpleHardware`**: Immutable after construction; tuple item mapping is fixed (`Item1→SerialNumber`, `Item2→ParentDAS`, `Item3→DASId`, `Item4→DASType`).
|
||||
- **`TestSetupROIsRecord` constructor**: `TestSetupId` is incorrectly assigned from `"TestSetupROIId"` column (see *Gotchas*); no invariant violation is enforced by code.
|
||||
- **`RegionOfInterest.Start` and `End`**: `Start < End` is enforced via setter logic (`Start` capped at `End - 0.01`, `End` capped at `Start + 0.01`). Infinity values are explicitly excluded from notifications (per comment referencing "FB 43462").
|
||||
- **`ISFFile` header fields**: All fields are fixed-width and space-padded. `NumberOfRecords` is derived as `4 * number of sensor records`.
|
||||
- **`ISFSensorRecord`**: Each record consists of exactly 4 fixed-length `char[]` arrays (`Record1`–`Record4`), each of length `ConstantsAndEnums.RECORD_LENGTH`.
|
||||
- **`CalculatedChannelRecord.InputChannelIds`**: Stored as a string array; parsed from CSV using `ListSeparator` (e.g., comma in invariant culture).
|
||||
- **`GraphRecord` axis flags**: `UseDomainMin/Max` and `UseRangeMin/Max` flags control whether corresponding min/max values are applied.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies
|
||||
- **`DTS.Common.Base`**: Base classes (`BasePropertyChanged`) used by `ROIPeriodChannelRecord`, `TestSetupROIsRecord`, `CalculatedChannelRecord`, `GraphRecord`.
|
||||
- **`DTS.Common.Interface.*`**: Interfaces implemented by record classes:
|
||||
- `IROIPeriodChannelRecord`, `ITestSetupHardwareRecord`, `ITestSetupROIRecord`, `ICalculatedChannelRecord`, `IGraphRecord`, `IISFSensorRecord`, `IExtraProperty`, `IRegionOfInterest`.
|
||||
- **`DTS.Common.Enums`**: `Operations` enum used by `CalculatedChannelRecord`.
|
||||
- **`DTS.Common.Interface.Sensors`**: `ISensorData` used by `ISFSensorRecord.SetSensor`.
|
||||
- **`DTS.Common.Events.RegionOfInterest`**: `RegionOfInterestChangedEvent` used by `RegionOfInterest`.
|
||||
- **`Prism.*`**: `IEventAggregator`, `IContainerProvider`, `ContainerLocator` used by `RegionOfInterest.NotifyChanged`.
|
||||
|
||||
### External Dependencies
|
||||
- **System.Data**: `IDataReader` for database record construction.
|
||||
- **System.ComponentModel**: `INotifyPropertyChanged` via `PropertyChangedEventHandler`.
|
||||
- **System.Web.Script.Serialization**: `[ScriptIgnore]` attribute.
|
||||
- **System.Linq**: Used for array equality checks (`SequenceEqual`) and LINQ queries.
|
||||
- **System**: Core types (`string`, `char[]`, `double`, `int`, `long`, `short`, `byte`, `bool`, `ICommand`).
|
||||
|
||||
### Inferred Usage
|
||||
- **Database**: All record classes with `IDataReader` constructors imply usage with stored procedures (e.g., `sp_ROIPeriodChannelsGet`, `sp_TestSetupROIsGet`).
|
||||
- **ISF I/O**: `ISFFile` and `ISFSensorRecord` are used for writing sensor data to ISF files.
|
||||
- **UI**: `ExtraProperty`, `RegionOfInterest`, and record classes implement `INotifyPropertyChanged`, indicating use in data-bound UI layers (e.g., WPF).
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`TestSetupROIsRecord` constructor bug**: `TestSetupId = Utility.GetInt(reader, "TestSetupROIId");` incorrectly reads from `"TestSetupROIId"` instead of `"TestSetupId"`. This will cause incorrect `TestSetupId` values when constructing from database reader.
|
||||
- **`ISFSensorRecord.GetCapacity()`, `GetSensitivity()`, etc.**: Methods like `CapacityCharacters.ToString()` return the underlying `char[]`'s `ToString()` (i.e., type name), not the string content. Correct usage requires `new string(char[])` or `string.Concat(char[])`. This is likely a bug.
|
||||
- **`RegionOfInterest.Suffix` validation**: Enforces that non-empty suffixes must start with `"_"` and be otherwise whitespace-free. If input violates this, it is auto-corrected (e.g., `"ROI1"` → `"_ROI1"`).
|
||||
- **`RegionOfInterest.Deserializing` flag**: A static flag used to suppress change notifications during deserialization (e.g., to avoid triggering UI updates or event publishing during object construction). Requires careful coordination to avoid missed updates.
|
||||
- **`ISFFile.NumberOfRecords` semantics**: `SetNumberOfRecords` sets `NumberOfRecords` to `4 * Records.Length`, implying each sensor record occupies 4 "records" in the ISF file (consistent with `ISFSensorRecord` having 4 `char[]` fields).
|
||||
- **`CalculatedChannelRecord.InputChannelIds` copy constructor**: Uses `CopyTo` on `record.InputChannelIds` into `_inputChannelIds`, but `_inputChannelIds` is initialized to `new string[0]` *before* the copy, causing `ArgumentException` if `record.InputChannelIds.Length > 0`. Should initialize `_inputChannelIds` to `new string[record.InputChannelIds.Length]` first.
|
||||
- **`ISFSensorRecord.TOMConfigurationName`**: Default value `"STANDARD"` is hardcoded; other values are not supported per comments.
|
||||
- **`RegionOfInterest.GetAnalogChanName` logic**: Distinguishes `"TEST_SPECIFIC_ANALOG_SERIAL"` and `"VOLTAGE_INPUT"` DAS types for special channel name parsing. Relies on `SensorConstants` values (not shown in source).
|
||||
- **`TestSetupHelper.TestSetupNames`**: Static dictionary is shared across all usages; `ClearTestSetupNames()` affects all callers. No thread-safety is evident.
|
||||
169
enriched-qwen3-coder-next/Common/DTS.Common/Classes/WinApi.md
Normal file
169
enriched-qwen3-coder-next/Common/DTS.Common/Classes/WinApi.md
Normal file
@@ -0,0 +1,169 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/WinApi/WindowsAPIHelpers.cs
|
||||
generated_at: "2026-04-16T03:16:58.945801+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "32ac28362ec2b57c"
|
||||
---
|
||||
|
||||
# WinApi
|
||||
|
||||
## Documentation: `WindowsAPIHelpers.cs`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides interoperability helpers for Windows API integration, specifically to support custom window sizing and positioning behavior in WPF applications. It defines P/Invoke-compatible structures (`POINT`, `RECT`, `MINMAXINFO`, `MONITORINFO`, `WINDOWPOS`, `WM`, `SWP`) and exposes two Win32 functions (`GetMonitorInfo`, `MonitorFromWindow`) to enable accurate adjustment of a window’s maximized size and position to match the *work area* of the monitor on which the window resides—rather than the full screen (which may include taskbars or other non-client areas). This is typically used in response to the `WM_GETMINMAXINFO` message to prevent maximized windows from overlapping system UI elements.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### Structs
|
||||
|
||||
- **`POINT`**
|
||||
```csharp
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct POINT { public int x; public int y; public POINT(int x, int y); }
|
||||
```
|
||||
Represents a point in 2D space with integer coordinates. Used as a field in other structures.
|
||||
|
||||
- **`RECT`**
|
||||
```csharp
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct RECT
|
||||
{
|
||||
public int left, top, right, bottom;
|
||||
public static readonly RECT Empty;
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
public RECT(int left, int top, int right, int bottom);
|
||||
public bool IsEmpty { get; }
|
||||
public override string ToString();
|
||||
public override bool Equals(object obj);
|
||||
public override int GetHashCode();
|
||||
public static bool operator ==(RECT, RECT);
|
||||
public static bool operator !=(RECT, RECT);
|
||||
}
|
||||
```
|
||||
Represents a rectangle with integer coordinates. Includes computed `Width` and `Height` properties, equality operators, and an `IsEmpty` check (true if `left >= right` or `top >= bottom`). Note: `Height` is computed as `bottom - top` (not `Math.Abs`), so negative heights are possible if `bottom < top`.
|
||||
|
||||
- **`MINMAXINFO`**
|
||||
```csharp
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MINMAXINFO
|
||||
{
|
||||
public POINT ptReserved;
|
||||
public POINT ptMaxSize;
|
||||
public POINT ptMaxPosition;
|
||||
public POINT ptMinTrackSize;
|
||||
public POINT ptMaxTrackSize;
|
||||
}
|
||||
```
|
||||
Used to convey minimum/maximum tracking and maximized window geometry. Populated 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;
|
||||
}
|
||||
```
|
||||
Contains monitor-specific information. `cbSize` is auto-initialized to the unmanaged size of the struct. `rcMonitor` is the full monitor rectangle; `rcWork` is the work area (excluding taskbars, etc.).
|
||||
|
||||
- **`WINDOWPOS`**
|
||||
```csharp
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct WINDOWPOS
|
||||
{
|
||||
public IntPtr hwnd;
|
||||
public IntPtr hwndInsertAfter;
|
||||
public int x, y, cx, cy;
|
||||
public int flags;
|
||||
}
|
||||
```
|
||||
Used in `WM_WINDOWPOSCHANGING`/`WM_WINDOWPOSCHANGED` messages. Not used directly in this file but defined for completeness.
|
||||
|
||||
#### Enums
|
||||
|
||||
- **`WM`**
|
||||
```csharp
|
||||
public enum WM { WINDOWMAX = 0x0024, WINDOWPOSCHANGING = 0x0046; }
|
||||
```
|
||||
Windows message constants. `WINDOWMAX` is likely a typo or nonstandard alias (standard is `WM_SYSCOMMAND` with `SC_MAXIMIZE`, or `WM_SIZE` with `SIZE_MAXIMIZED`). `WINDOWPOSCHANGING` is `WM_WINDOWPOSCHANGING`.
|
||||
|
||||
- **`SWP`**
|
||||
```csharp
|
||||
public enum SWP { NOMOVE = 0x0002; }
|
||||
```
|
||||
Flags for `SetWindowPos`. `NOMOVE` preserves current position.
|
||||
|
||||
#### Methods
|
||||
|
||||
- **`GetMinMaxInfo(IntPtr hwnd, IntPtr lParam)`**
|
||||
```csharp
|
||||
public static void GetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
|
||||
```
|
||||
Handles the `WM_GETMINMAXINFO` message by adjusting `ptMaxSize` and `ptMaxPosition` in the `MINMAXINFO` structure to fit the *work area* of the monitor containing `hwnd`. Uses `MonitorFromWindow` with `MONITOR_DEFAULTTONEAREST` (`0x00000002`) to locate the monitor, then calls `GetMonitorInfo` to retrieve monitor geometry. Writes the modified `MINMAXINFO` back to `lParam`.
|
||||
|
||||
#### P/Invoke Exports
|
||||
|
||||
- **`GetMonitorInfo`**
|
||||
```csharp
|
||||
[DllImport("user32")]
|
||||
public static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
||||
```
|
||||
Retrieves monitor information. Caller must initialize `MONITORINFO.cbSize` before calling.
|
||||
|
||||
- **`MonitorFromWindow`**
|
||||
```csharp
|
||||
[DllImport("User32")]
|
||||
public static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
||||
```
|
||||
Returns a handle to the monitor that contains the window. `flags` is typically `MONITOR_DEFAULTTONEAREST` (`0x00000002`).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `MONITORINFO.cbSize` **must** be set to `Marshal.SizeOf(typeof(MONITORINFO))` before calling `GetMonitorInfo`; otherwise, the call will fail (returns `false`).
|
||||
- `RECT.IsEmpty` is defined as `left >= right || top >= bottom`. This implies a rectangle with `left == right` or `top == bottom` is considered empty.
|
||||
- `RECT.Height` is computed as `bottom - top` (not `Math.Abs(bottom - top)`), so if `bottom < top`, `Height` is negative. This may indicate an inverted rectangle (e.g., from drag-select), but the code does not enforce non-negative height.
|
||||
- `GetMinMaxInfo` assumes the window is on a valid monitor. If `MonitorFromWindow` returns `IntPtr.Zero`, no adjustment is made, and the original `MINMAXINFO` values are preserved.
|
||||
- The `ptMaxPosition` values are computed as absolute offsets from the monitor’s left/top edge (`Math.Abs(rcWorkArea.left - rcMonitorArea.left)`), which correctly yields the top-left corner of the work area relative to the monitor.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- **WPF/Win32 interop layer**: This module is intended for use in WPF applications (evidenced by `System.Windows` namespace usage, though not directly referenced in this file). Likely consumed by window message handlers (e.g., `Window.SourceInitialized` or `OnSourceInitialized` overrides) to subclass window procedures and handle `WM_GETMINMAXINFO`.
|
||||
- **`System.Runtime.InteropServices`**: Required for `StructLayout`, `DllImport`, `Marshal.PtrToStructure`, and `Marshal.StructureToPtr`.
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **`user32.dll`**: For `GetMonitorInfo` and `MonitorFromWindow`.
|
||||
- **No external libraries beyond .NET Framework core types** (no NuGet dependencies implied).
|
||||
|
||||
#### Known consumers (inferred):
|
||||
- Any class handling `WM_GETMINMAXINFO` (e.g., via `HwndSource.AddHook`) will call `WindowsAPIHelpers.GetMinMaxInfo`.
|
||||
- Likely used in custom window management logic (e.g., `MainWindow.xaml.cs` or a base window class).
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **`RECT.Height` is *not* absolute**: `Height => bottom - top` (not `Math.Abs`). This may cause unexpected negative heights if rectangles are inverted. Use `Math.Abs` externally if needed.
|
||||
- **`MONITORINFO` is a `class`, not a `struct`**: This is unusual for P/Invoke marshaling (typically `struct` is preferred). While it works due to `StructLayout`, it introduces heap allocation and reference semantics. Ensure the instance is not reused across threads without synchronization.
|
||||
- **`WINDOWMAX` enum value is nonstandard**: The Win32 constant for maximization is `WM_SYSCOMMAND` with `SC_MAXIMIZE` (0xF030), not `0x0024`. `0x0024` is `WM_USER + 36` in some contexts but not a standard system message. This may be a typo or internal alias.
|
||||
- **`rcMonitor` vs `rcWork` semantics**: `rcMonitor` is the full monitor bounds; `rcWork` excludes taskbars, etc. The code correctly uses `rcWork` for `ptMaxSize`/`ptMaxPosition`, but callers must understand this distinction.
|
||||
- **No validation of `lParam` in `GetMinMaxInfo`**: Assumes `lParam` points to a valid `MINMAXINFO` structure. Passing `IntPtr.Zero` or invalid memory will cause a crash.
|
||||
- **Missing `WM` constants**: Only two `WM` values are defined (`WINDOWMAX`, `WINDOWPOSCHANGING`). Other common messages (e.g., `WM_SIZE`, `WM_GETMINMAXINFO`) are not included, suggesting this is a partial set.
|
||||
- **`MONITOR_DEFAULTTONEAREST` flag is hardcoded**: The `MonitorFromWindow` call uses `0x00000002` directly instead of a named constant (e.g., `MONITOR_DEFAULTTONEAREST = 2`). While correct, it reduces readability.
|
||||
|
||||
None identified beyond these.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/WindowsFolder/WindowsFolder.cs
|
||||
generated_at: "2026-04-16T03:17:08.376962+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f16db9efe9d28ad5"
|
||||
---
|
||||
|
||||
# WindowsFolder
|
||||
|
||||
### 1. **Purpose**
|
||||
The `WindowsFolder` class provides a utility method to open the *Manuals* folder in Windows Explorer. It is designed to support user-facing documentation access by launching the folder containing application manuals. The class assumes the *Manuals* folder resides in a subdirectory of the provided `path` argument, and relies on the runtime `CurrentDirectory` being correctly set (per comments, this is always true in the deployed environment, even for non-default installations).
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `public static void OpenManualsFolder(string path)`
|
||||
- **Signature**: `void OpenManualsFolder(string path)`
|
||||
- **Behavior**: Constructs the full path to the *Manuals* folder by appending `Constants.ManualsFolder` to the input `path`, then launches Windows Explorer (`Constants.WindowsExplorer`) with that path as an argument.
|
||||
- **Throws**: May throw `Win32Exception` (e.g., if `explorer.exe` fails to start), `InvalidOperationException` (e.g., if `Process.Start` is unsupported), or `ArgumentNullException`/`ArgumentException` if `path` is null/invalid. *(Note: Exception behavior is inferred from `Process.Start` semantics; not explicitly documented in source.)*
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
- The `path` argument must represent a valid directory path (though validation is not performed in this method).
|
||||
- The *Manuals* folder must exist at `Path.Combine(path, Constants.ManualsFolder)` for the operation to succeed meaningfully.
|
||||
- `Constants.ManualsFolder` and `Constants.WindowsExplorer` must be non-null, non-empty strings at runtime (assumed from usage).
|
||||
- The application’s `Environment.CurrentDirectory` is expected to be consistent with the caller’s intent (per comments), though this is not enforced here.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Internal**:
|
||||
- `Constants.ManualsFolder` (string constant)
|
||||
- `Constants.WindowsExplorer` (string constant)
|
||||
*(These are referenced but not defined in the provided source; must be defined in `DTS.Common.Classes.WindowsFolders` or a referenced `Constants` type.)*
|
||||
- **External**:
|
||||
- `System.Diagnostics.Process` (for launching Explorer)
|
||||
- `System.IO.Path` (for path concatenation)
|
||||
- **Depended on by**: Unknown from this file alone (no usage references provided). Likely called from UI layers (e.g., help menu handlers).
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **Path assumption**: The method *does not* use `CurrentDirectory` directly despite the comment implying reliance on it; it uses the passed `path` argument. If `path` is incorrect or outdated, the folder may not open.
|
||||
- **No existence check**: The method does not verify that `manualsPath` exists before launching Explorer, which may result in Explorer opening an empty or non-existent folder without error feedback.
|
||||
- **Platform dependency**: Uses Windows-specific `explorer.exe`; will fail on non-Windows platforms (no fallback or guard is present).
|
||||
- **No async handling**: Blocking call to `Process.Start` may cause UI thread hangs if invoked synchronously on a UI thread (though `Process.Start` is typically non-blocking for Explorer).
|
||||
- **Missing constants**: `Constants.ManualsFolder` and `Constants.WindowsExplorer` are referenced but not defined here—critical for correctness. Their values must be verified externally.
|
||||
- **No error handling**: No try/catch around `Process.Start`; exceptions propagate directly.
|
||||
|
||||
*None identified beyond the above.*
|
||||
220
enriched-qwen3-coder-next/Common/DTS.Common/Constant.md
Normal file
220
enriched-qwen3-coder-next/Common/DTS.Common/Constant.md
Normal file
@@ -0,0 +1,220 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Constant/XamlConstants.xaml.cs
|
||||
- Common/DTS.Common/Constant/DigitalInputs.cs
|
||||
- Common/DTS.Common/Constant/EmbeddedSensors.cs
|
||||
- Common/DTS.Common/Constant/Constants.cs
|
||||
generated_at: "2026-04-16T02:55:10.398143+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b24dcc791db74827"
|
||||
---
|
||||
|
||||
# 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, default values, validation ranges, and configuration flags related to digital inputs, embedded sensors, and general system behavior. The constants are used to ensure consistency in thresholds, UI behavior, data processing, and hardware configuration across multiple components (e.g., SLICE, TSR AIR, DIM, embedded firmware interfaces). By isolating these values, the module reduces duplication, improves maintainability, and clarifies the source of truth for critical operational parameters.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DTS.Common.Constant.DigitalInputs`
|
||||
|
||||
- **`public const double ConstantCurrentBreakPointDefault = 19005D;`**
|
||||
Default threshold (in ADC units) for detecting contact closure transitions. A transition across this value flips the digital input bit.
|
||||
|
||||
- **`public const double VoltageInputBreakPointDefault = 19661D;`**
|
||||
Default threshold (in ADC units) for voltage input mode (used for THL/TLH digital modes), where a transition across this value flips the digital input bit.
|
||||
|
||||
- **`public const bool DisplaySPDADCDefault = false;`**
|
||||
Default value controlling whether the SLICE PRO Digital ADC is displayed in the UI.
|
||||
|
||||
- **`public static double ConstantCurrentBreakPoint { get; set; } = ConstantCurrentBreakPointDefault;`**
|
||||
Runtime-configurable threshold for contact closure detection. *Does not persist or query storage*—value must be set externally.
|
||||
|
||||
- **`public static double VoltageInputBreakPoint { get; set; } = VoltageInputBreakPointDefault;`**
|
||||
Runtime-configurable threshold for voltage input detection. *Does not persist or query storage*—value must be set externally.
|
||||
|
||||
- **`public static bool DisplaySPDADC { get; set; } = DisplaySPDADCDefault;`**
|
||||
Runtime-configurable flag for SLICE PRO Digital ADC visibility. *Does not persist or query storage*—value must be set externally.
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Common.Constant.EmbeddedSensors`
|
||||
|
||||
Contains constants for embedded sensor specifications, sample rates, CAN/UART configuration, and file format options. All values are `const` or `static readonly`.
|
||||
|
||||
- **Timeouts & Limits**
|
||||
- `MotionDetectInactivitySMaximum = 300` (5 minutes)
|
||||
- `MagnetTimeoutMsMaximum = 300000` (5 minutes)
|
||||
- `TimedIntervalEventDurationMsMinimum = 30`
|
||||
- `TimedIntervalEventDurationMsMaximum = 300000` (5 minutes)
|
||||
- `TimedIntervalNumberOfEventsMaximum = 100`
|
||||
- `IntervalBetweenEventStartsMinutesMaximum = 1440` (24 hours)
|
||||
|
||||
- **Sensor Ranges**
|
||||
- `EmbeddedLowGLinearAccelerometerRange = 8`
|
||||
- `EmbeddedHighGLinearAccelerometerRange = 400`
|
||||
- `EmbeddedAngularAccelerometerRange = 2000`
|
||||
- `EmbeddedAngularRateSensorRange = 2000`
|
||||
- `HumidityMinimum = 10`, `HumidityMaximum = 100`
|
||||
- `PressureMinimum = 5`, `PressureMaximum = 15`
|
||||
- `TemperatureMinimum = 0`, `TemperatureMaximum = 65`
|
||||
|
||||
- **Sample Rates**
|
||||
- `EmbeddedLowGLinearAccelerometerSampleRateMinimum/Maximum = 1/6400`
|
||||
- `EmbeddedHighGLinearAccelerometerSampleRateMinimum/Maximum = 1/5120`
|
||||
- `EmbeddedAngularAccelerometerSampleRateMinimum/Maximum = 1/1600`
|
||||
- `EmbeddedAngularAccelerometerAndRateSensorSampleRateMinimum/Maximum = 1/5120`
|
||||
- `EmbeddedAtmosphericSensorSampleRateMinimum/Maximum = 1/157`
|
||||
- Default sample rates (e.g., `DefaultEmbeddedLowGLinearAccelerometerSampleRate = 6400`)
|
||||
|
||||
- **UART & CAN Configuration**
|
||||
- `BAUD_RATE_MIN = 96`, `BAUD_RATE_DEFAULT = 57600`, `BAUD_RATE_MAX = 921600`
|
||||
- `BAUD_RATES` (array of supported rates)
|
||||
- `CANISFD_DEFAULT = true`
|
||||
- CAN FD arbitration/base bitrate ranges and defaults (`CANFD_ARB_BASE_BITRATE_*`, `NON_CANFD_ARB_BASE_BITRATE_*`)
|
||||
- CAN FD/non-CAN FD SJW values (e.g., `CANFD_500000_ARB_BASE_SJW_DEFAULT = 8`, `CANFD_1000000_ARBBASESJW_VALUES`)
|
||||
- Data bitrate (`DATA_BITRATE_DEFAULT = 4000000`, `DATABITRATE_VALUES`)
|
||||
- Data SJW arrays (e.g., `NON_CANFD_500000_DATASJW_VALUES`)
|
||||
- `FILETYPE_DEFAULT = "asc"`, `FILETYPE_VALUES = { "asc", "blf" }`
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Common.Constant.Constants`
|
||||
|
||||
Contains broad system constants, many tied to specific hardware (SLICE6AIR, TSR AIR), UI behavior, file formats, and protocol details.
|
||||
|
||||
- **Timeouts & Intervals**
|
||||
- `GETARMSTATUS_TIMEOUT = 30000`
|
||||
- `PING_ICMP_TIMEOUT { get; set; } = 500`
|
||||
- `EXECUTABLE_TIMEOUT = 30000`
|
||||
- `UpdateIntervalRealtimeCharts { get; set; } = 100`
|
||||
|
||||
- **Graphing & Autozoom**
|
||||
- `GRAPH_MIN_AUTOZOOM = 0.01D` (1% of full scale)
|
||||
- `GRAPH_MAX_AUTOZOOM = 1.2D` (120% of full scale)
|
||||
- `CheckStatusLinesInRealtime { get; set; } = true`
|
||||
|
||||
- **Units & Tags**
|
||||
- `ACCELERATION_UNITS = { "g", "msec", "m/sec", "m/sec^2", "m/s^2" }`
|
||||
- `ROI_TAG = "ROI"`, `ALL_TAG = "ALL"`, `ALL = "ALL"`
|
||||
- `DAS_TEST_SETUPS = "DASTestSetup"`, `DAS_CONFIGS = "DASConfigs"`
|
||||
|
||||
- **File & Data Handling**
|
||||
- `BACKUP_HEADER_EXTENSION = ".header.bak"`, `BACKUP_FILE_EXTENSION = ".bak"`
|
||||
- `TEMP_FILE_EXTENSION = ".tmp"`, `CHANNEL_FILE_EXTENSION = ".chn"`, `BINARY_FILE_EXTENSION = ".bin"`
|
||||
- `REPORT_DIR_NAME = "Reports"`, `REPORT_TEMPLATE_DIR_NAME = "ReportTemplates"`
|
||||
- `BINARY = "Binary"`, `CURRENT_SUFFIX = "_CU"`
|
||||
- `MAX_USER_CHANNEL_NAME_LENGTH = 100`
|
||||
- `ALLOWED_DOWNLOAD_FILE_LENGTH = 260`, `ALLOWED_DOWNLOAD_DIRECTORY_LENGTH = 248`
|
||||
- `UNUSED_START_TIME = 0`, `UNUSED_DATA_COLLECTION_LENGTH = 0`
|
||||
|
||||
- **Hardware & Protocol**
|
||||
- `BITS_PER_MINOR_FRAME_S6A = 128`
|
||||
- `BITS_PER_MINOR_FRAME_TSRAIR = 320`
|
||||
- `ADC_MIDPOINT = 32767` (16-bit midpoint)
|
||||
- `UDP_STREAMPROFILES_MAX = 15`
|
||||
- `UART_MODE_MAX_SAMPLERATE = 30000`
|
||||
- `SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE = 10000`
|
||||
- `SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE_20k = 20000`
|
||||
- `SLICE6AIR_20K_DIGITAL_FILTER_MIN_PROTOCOL = 46`
|
||||
- `SLICE6AIR_BR_DB_VERSION = 95`, `SLICE_PRO_CAN_FD_DB_VERSION = 100`, etc.
|
||||
|
||||
- **Clock Sync & Recording Modes**
|
||||
- `MasterProfiles`, `SlaveProfiles`, `OnePPSOutProfiles` (arrays of `ClockSyncProfile`)
|
||||
- `NonStreamingRecordingModes` (array of `RecordingModes`)
|
||||
|
||||
- **NMEA Parsing**
|
||||
- `$GPRMC` and `$GPGGA` field positions (e.g., `NMEA_GPRMC_LAT_POSN = 3`, `NMEA_GPGGA_ALT_POSN = 9`)
|
||||
|
||||
- **UI & Formatting**
|
||||
- `TABANDPAGEBUTTONSFontSizeMin = 12`, `TabAndPageButtonsFontSizeMax = 32`
|
||||
- `MINIMUM_VOLTAGE_INSERTION_RANGE_MV_SLICE = 10`
|
||||
- `SENSITIVITY_CHANGE_TOLERANCE_PERCENT_DEFAULT = 5D`
|
||||
- `NOVALUE = "NOVALUE"`
|
||||
- `ISO_CH_ONLY_PREFIX = "__ISO_CH_ONLY__"`
|
||||
- `ExportNameFilters = { "(Voltage)" → "Voltage", "(Current)" → "Current" }`
|
||||
|
||||
- **Special Values**
|
||||
- `NANOS_PER_SECOND = 1000000000m`, `TEN_MILLIS_IN_SEC = 0.01D`
|
||||
- `MAX_VIEWER_POINTS = 45000000`
|
||||
- `LOWEST_NONZERO_TSR_AIR_PRETRIGGER_SECONDS = 0.0128D`
|
||||
|
||||
- **Properties with Dynamic Errors**
|
||||
- `ScheduleStartTimeError`: Formatted error string using `StringResources.EditTestSetupPage_ScheduleMustBeInFuture` and `DFConstantsAndEnums.SCHEDULE_AHEAD_IN_MINUTES`.
|
||||
- `IntervalError`: Formatted error string using `StringResources.EditTestSetupPage_EventLengthTooLong` and `DFConstantsAndEnums.TIME_TO_REARM_SECONDS`.
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Common.Constant.XamlConstants`
|
||||
|
||||
- **`public partial class XamlConstants { }`**
|
||||
Currently an empty partial class. No public members defined.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Digital Input Thresholds**:
|
||||
- `ConstantCurrentBreakPoint` and `VoltageInputBreakPoint` are *not* persisted or auto-loaded; they rely on external initialization (e.g., from config or UI settings).
|
||||
- `ConstantCurrentBreakPointDefault` (19005) is used for contact closure; `VoltageInputBreakPointDefault` (19661) is used for THL/TLH voltage modes.
|
||||
|
||||
- **Embedded Sensor Ranges**:
|
||||
- All minimum/maximum values for sensors (e.g., humidity, temperature, sample rates) are hard limits derived from device IC specifications.
|
||||
- Default sample rates are set to the *maximum* supported rate per sensor type.
|
||||
|
||||
- **CAN Configuration**:
|
||||
- `CANISFD_DEFAULT = true` implies CAN FD is enabled by default.
|
||||
- SJW (Sample Jump Width) arrays are strictly bounded by hardware constraints for specific bitrates.
|
||||
|
||||
- **Graph Autozoom**:
|
||||
- `GRAPH_MIN_AUTOZOOM = 0.01` and `GRAPH_MAX_AUTOZOOM = 1.2` define the scaling envelope for auto-zoomed graphs (as % of full scale), regardless of signal amplitude.
|
||||
|
||||
- **Download Paths**:
|
||||
- File paths must not exceed `ALLOWED_DOWNLOAD_FILE_LENGTH = 260` characters (Windows MAX_PATH), and directories must not exceed `ALLOWED_DOWNLOAD_DIRECTORY_LENGTH = 248`.
|
||||
|
||||
- **Clock Sync Profiles**:
|
||||
- `MasterProfiles`, `SlaveProfiles`, and `OnePPSOutProfiles` are exhaustive and *exclude* unsupported combinations (commented-out values indicate deprecated/invalid options).
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Imports/References (from source):
|
||||
- `DTS.Common.Constant` depends on:
|
||||
- `DTS.Common.Enums` (for `ClockSyncProfile`, `RecordingModes`)
|
||||
- `DTS.Common.SharedResource.Strings` (for `StringResources` in `Constants`)
|
||||
|
||||
### Referenced By:
|
||||
- `DTS.Common.Constant` is used throughout the codebase for:
|
||||
- Hardware configuration (e.g., embedded sensor setup, CAN/UART initialization)
|
||||
- UI validation (e.g., thresholds, timeouts, sample rate limits)
|
||||
- Data export (NMEA, file formats, path length checks)
|
||||
- Graphing logic (autozoom, units, tags)
|
||||
- Protocol-specific constants (e.g., `BITS_PER_MINOR_FRAME_*`, `SLICE6AIR_*`)
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Static Properties Are Not Persistent**:
|
||||
`DigitalInputs.ConstantCurrentBreakPoint`, `VoltageInputBreakPoint`, and `DisplaySPDADC` are mutable static properties. They do *not* read from configuration storage—consumers must explicitly set them (e.g., from a config file or UI).
|
||||
|
||||
- **`XamlConstants` Is Empty**:
|
||||
The `XamlConstants` class is declared but contains no members. Its purpose is unclear from the source alone.
|
||||
|
||||
- **`ScheduleStartTimeError` and `IntervalError` Are Dynamically Formatted**:
|
||||
These properties use `string.Format` with external resources (`StringResources`) and enums (`DFConstantsAndEnums`). Their values depend on runtime localization and enum definitions not visible here.
|
||||
|
||||
- **CAN FD vs. Non-CAN FD Bitrate Arrays**:
|
||||
`CANFD_ARBBASEBITRATE_VALUES` and `NON_CANFD_ARBBASEBITRATE_VALUES` are *not* contiguous ranges (e.g., `NON_CANFD_ARBBASEBITRATE_VALUES` includes non-standard rates like `62000`, `83000`). Consumers must use the arrays, not assume min/max.
|
||||
|
||||
- **Sample Rate Limits Are Protocol-Dependent**:
|
||||
`SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE = 10000` applies to older firmware, while `SLICE6AIR_20K_DIGITAL_FILTER_MIN_PROTOCOL = 46` and `SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE_20k = 20000` indicate newer firmware relaxes this limit.
|
||||
|
||||
- **`ALL` vs. `ALL_TAG`**:
|
||||
Both `ALL = "ALL"` and `ALL_TAG = "ALL"` exist. Their usage context is unclear—ensure consistency with downstream consumers.
|
||||
|
||||
- **`UNUSED_START_TIME` and `UNUSED_DATA_COLLECTION_LENGTH`**:
|
||||
Both are `0`, but their semantic meaning ("unused") may conflict with valid data (e.g., `0`-length recordings). Validation logic must distinguish intent.
|
||||
|
||||
- **`NANOS_PER_SECOND` Is Decimal**:
|
||||
Used for high-precision time calculations (e.g., `TEN_MILLIS_IN_SEC = 0.01D`). Mixing `double` and `decimal` could cause precision issues if not handled carefully.
|
||||
|
||||
- **`MAX_VIEWER_POINTS = 45000000`**:
|
||||
This is a hard limit for Viewer graphs. Exceeding it may cause crashes or performance degradation—consumers must enforce truncation or sampling.
|
||||
@@ -0,0 +1,141 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Constant/DASSpecific/TDAS.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/PowerPRO.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE2_TOM.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICEDB.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE2.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE1_5.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE6DB.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE6.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE6AIRBR.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE6AIRTC.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SliceProDB.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/TSRAIR.cs
|
||||
- Common/DTS.Common/Constant/DASSpecific/SLICE6AIR.cs
|
||||
generated_at: "2026-04-16T03:22:55.770587+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4c12caeeb739c46d"
|
||||
---
|
||||
|
||||
# DASSpecific Constants Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides hardware-specific constant definitions and feature-support checks for various Data Acquisition Systems (DAS) in the DTS product line. It centralizes protocol version requirements, hardware capabilities (e.g., maximum anti-aliasing filter rates), and recording/streaming/clock synchronization mode support logic for each DAS model (e.g., SLICE, SLICE6, TSRAIR, PowerPRO). These constants and methods enable higher-level system components to dynamically adapt behavior based on the detected DAS model and its firmware protocol version, ensuring correct operation across a heterogeneous fleet of devices.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constants (All `public const` fields)
|
||||
|
||||
| Class | Constant | 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` | Protocol version for MAC table query support (firmware B0H3+). |
|
||||
| `PowerPRO` | `MIN_PROTOCOL_MEASUREPOWERPROALLDIAGNOSTICCHANNEL` | `byte` | `12` | Protocol version for 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 for basic functionality. |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_ARM` | `byte` | `2` | Protocol version for ARM-related features. |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_ENABLEFAULTCHECKING` | `byte` | `2` | Alias of `MIN_PROTOCOL_ARM`; fault checking support. |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_DIAGNOSTICS` | `byte` | `3` | Protocol version for diagnostics support. |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_ONOVERRIDE` | `byte` | `4` | Protocol version for override features. |
|
||||
| `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` | Protocol version for base calibration date support (FB 16049). |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_QUERYMACTABLE` | `byte` | `9` | Protocol version for MAC table query (firmware B0H3+). |
|
||||
| `SLICEDB` | `MIN_PROTOCOL_TILT` | `byte` | `14` | Protocol version for tilt sensor 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 for SLICE2 (note: unusually high, likely indicates Gen2+). |
|
||||
| `SLICE2` | `FILE_DATA` | `int` | `133` | Protocol feature ID for file data support. |
|
||||
| `SLICE2` | `MULTIPLE_EVENTS` | `int` | `134` | Protocol feature ID for multiple events. |
|
||||
| `SLICE2` | `STACK_SENSORS` | `int` | `136` | Protocol feature ID for stacked sensors. |
|
||||
| `SLICE2` | `STACK_FIRMWARE_UPDATE` | `int` | `137` | Protocol feature ID for stacked firmware update. |
|
||||
| `SLICE2` | `DIAGNOSTIC_TWO_VOLT_EXCITATION` | `int` | `138` | Protocol feature ID for 2V excitation diagnostics. |
|
||||
| `SLICE2` | `QUERY_ARM_AND_TRIGGER_STATUS_TIME_LEFT_IN_ARM` | `int` | `139` | Protocol feature ID for querying arm status/time-left. |
|
||||
| `SLICE2` | `MIN_PROTOCOL_VER_GEN3` | `byte` | `140` | Minimum protocol version for Gen3 features. |
|
||||
| `SLICE2` | `SLICE2_ONE_WIRE_ID` | `int` | `142` | Protocol feature ID for one-wire ID. |
|
||||
| `SLICE2` | `EVENT_ARM_ATTEMPTS` | `int` | `145` | Protocol feature ID for event arm attempts. |
|
||||
| `SLICE2` | `MEASURE_INTERNAL_OFFSET` | `int` | `149` | Protocol feature ID for internal offset measurement. |
|
||||
| `SLICE2` | `START_REC_DELAY_IN_SECONDS` | `int` | `150` | Protocol feature ID for delayed recording start. |
|
||||
| `SLICE2` | `START_REALTIME_STREAM` | `int` | `152` | Protocol feature ID for starting real-time streaming. |
|
||||
| `SLICE2` | `HALF_BRIDGE_SIG_PLUS_SUPPORT` | `int` | `154` | Protocol feature ID for half-bridge signal+ 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 for basic functionality. |
|
||||
| `SLICE1_5` | `QUERY_ARM_AND_TRIGGER_STATUS_TIME_LEFT_IN_ARM` | `int` | `2` | Protocol feature ID for arm status/time-left. |
|
||||
| `SLICE1_5` | `IGNORE_SHORTED_START_EVENT` | `int` | `4` | Protocol feature ID for ignoring shorted start events. |
|
||||
| `SLICE1_5` | `START_REC_DELAY_IN_SECOND` | `int` | `5` | Protocol feature ID for delayed recording start. |
|
||||
| `SLICE1_5` | `MEASURE_INTERNAL_OFFSET` | `int` | `6` | Protocol feature ID for internal offset measurement. |
|
||||
| `SLICE1_5` | `START_REALTIME_STREAM` | `int` | `7` | Protocol feature 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 for basic functionality. |
|
||||
| `SLICE6DB` | `MIN_PROTOCOL_QUERYTEMPLOGFILE` | `byte` | `8` | Protocol version for temperature log file query. |
|
||||
| `SLICE6DB` | `MIN_PROTOCOL_QUERYMACTABLE` | `byte` | `9` | Protocol version for MAC table query (firmware B0H3+). |
|
||||
| `SLICE6DB` | `MIN_PROTOCOL_TILT` | `byte` | `14` | Protocol version for tilt sensor support. |
|
||||
| `SLICE6DB` | `CLOCKSYNCPROFILE` | `int` | `18` | Minimum protocol version for clock sync profiles (e.g., E2E). |
|
||||
| `SLICE6DB` | `PTP_DOMAIN_ID_VER` | `int` | `18` | Minimum protocol version for PTP Domain ID (per 30472). |
|
||||
| `SLICE6` | `MaxAAFilterRateHz` | `uint` | `20000` | Maximum anti-aliasing filter rate (Hz) for SLICE6 hardware. |
|
||||
| `SLICE6` | `MIN_PROTOCOL_VER` | `int` | `1` | Minimum protocol version for basic functionality. |
|
||||
| `SLICE6` | `DIAGNOS_SHUNT_DAC` | `int` | `2` | Protocol feature ID for shunt DAC diagnostics. |
|
||||
| `SLICE6` | `START_REC_DELAY_IN_SECONDS` | `int` | `3` | Protocol feature ID for delayed recording start. |
|
||||
| `SLICE6` | `IN_SLICE_TILT_SENSOR_ADC_PRE` | `int` | `4` | Protocol feature ID for in-slice tilt sensor ADC pre-processing. |
|
||||
| `SLICE6` | `STACK_SENSORS` | `int` | `5` | Protocol feature ID for stacked sensors. |
|
||||
| `SLICE6` | `START_REALTIME_STREAM` | `int` | `11` | Protocol feature ID for starting real-time streaming. |
|
||||
| `SLICE6` | `UDP_REALTIME_STREAM` | `int` | `14` | Protocol feature ID for UDP real-time streaming. |
|
||||
| `SLICE6` | `CLOCKSYNCPROFILE` | `int` | `21` | Minimum protocol version for clock sync profiles (e.g., E2E). |
|
||||
| `SLICE6` | `PTP_DOMAIN_ID_VER` | `int` | `21` | Minimum protocol version for PTP Domain ID (per 30472). |
|
||||
| `SLICE6AIRBR` | `MIN_PROTOCOL_VER` | `int` | `1` | Minimum protocol version for basic functionality. |
|
||||
| `SLICE6AIRBR` | `ADC_SAMPLES_PER_PACKET_VER` | `int` | `47` | Protocol version for configurable ADC samples per packet. |
|
||||
| `SLICE6AIRBR` | `UDPALIGNONPPS_PROTOCOL` | `int` | `51` | Protocol version for UDP alignment on PPS. |
|
||||
| `SLICE6AIRBR` | `MaxAAFilterRateHz` | `uint` | `50000` | Maximum anti-aliasing filter rate (Hz) for SLICE6AIRBR hardware. |
|
||||
| `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 (non-UART modes). |
|
||||
| `SLICE6AIR` | `MaxSampleRateHz_OBRDDR` | `uint` | `uint.MaxValue` | Maximum sample rate (Hz) for SLICE6AIR Ethernet Recorder (OBRDDR). |
|
||||
| `SLICE6AIR` | `UARTBitsPerSample` | `uint` | `96` | Number of bits per sample for UART streaming. |
|
||||
| `SLICE6AIR` | `MIN_PROTOCOL_VER` | `int` | `1` | Minimum protocol version for basic functionality. |
|
||||
| `SLICE6AIR` | `UDP_REALTIME_STREAM` | `int` | `1` | Protocol feature ID for UDP real-time streaming (same as `MIN_PROTOCOL_VER`). |
|
||||
| `SLICE6AIR` | `SET_DSP_FILTER_SETTINGS` | `int` | `28` | Protocol feature ID for DSP filter settings. |
|
||||
| `SLICE6AIR` | `RECORD_AND_STREAM_SUBSAMPLE` | `int` | `29` | Protocol feature ID 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` | Protocol feature ID for record-on-boot. |
|
||||
| `SLICE6AIR` | `RECORD_ON_BOOT_PROTOCOL_S6A_ETHERNETRECORDER` | `int` | `7` | Protocol feature ID for record-on-boot on S6A Ethernet Recorder. |
|
||||
| `SLICE6AIR` | `CONTINUOUS_MODE_PROTOCOL_S6A_EDR` | `int` | `5` | Protocol feature ID for continuous mode on S6A EDR. |
|
||||
| `SLICE6AIR` | `MULTIPLE_UDP_ADDRESSES_S6A_ETHERNETRECORDER` | `int` | `7` | Protocol feature ID for multiple UDP addresses on S6A EDR. |
|
||||
| `SLICE6AIR` | `AUTOARM_RECORD_DELAY_PROTOCOL` | `int` | `51` | Protocol feature ID for auto-arm with record delay. |
|
||||
| `SLICE6AIR` | `AUTOARM_RECORD_DELAY_PROTOCOL_S6A_ETHERNETRECORDER` | `int` | `6` | Protocol feature ID for auto-arm with record delay on S6A EDR. |
|
||||
| `SLICE6AIR` | `UDPALIGNONPPS_PROTOCOL` | `int` | `49` | Protocol feature ID for UDP alignment on PPS. |
|
||||
| `SLICE6AIR` | `UART_CHANNEL_STREAMING` | `int` | `53` | Protocol version for UART channel streaming. |
|
||||
| `SLICE6AIR` | `REMOVE_LEAP_SECONDS_VER` | `int` | `42` | Protocol version for leap second removal support. |
|
||||
| `SLICE6AIR` | `ADC_SAMPLES_PER_PACKET_VER` | `int` | `43` | Protocol version for configurable ADC samples per packet. |
|
||||
| `SLICE6AIR` | `AC_COUPLER_ENABLE` | `int` | `36` | Protocol version for AC coupler enable. |
|
||||
| `SLICE6AIR` | `PPS_OUT_CLOCKS` | `int` | `39` | Protocol version for PPS OUT clock types. |
|
||||
| `TSRAIR` | `MaxAAFilterRateHz` | `uint` | `200000` | Maximum anti-aliasing filter rate (Hz) for TSRAIR hardware. |
|
||||
| `TSRAIR` | `MIN_PROTOCOL_VER` | `byte` | `1` | Minimum protocol version for basic functionality. |
|
||||
| `TSRAIR` | `VOLTAGE_INSERTION` | `int` | `2` | Protocol feature ID for voltage insertion. |
|
||||
| `TSRAIR` | `START_REC_DELAY_IN_SECONDS` | `int` | `3` | Protocol feature ID for delayed recording start. |
|
||||
| `TSRAIR` | `STACK_SENSORS` | `int` | `5` | Protocol feature ID for stacked sensors. |
|
||||
| `TSRAIR` | `WAKEUP_MOTION_TIMEOUT` | `int` | `10` | Protocol feature ID for wakeup motion timeout. |
|
||||
| `TSRAIR` | `IRIG_GPS_PPSIN_SYNC` | `int` | `25` | Protocol version for IRIG/GPS/PPS input sync support. |
|
||||
| `TSRAIR` | `DISABLE_STREAMING_FEATURE` | `int` | `25` | Protocol feature ID for disabling streaming (same as `IRIG_GPS_PPSIN_SYNC`). |
|
||||
| `TSRAIR` | `TSRAIR_MIN_PRE_TRIGGER_SAMPLES` | `int` | `256` | Minimum pre-trigger samples for TSRAIR. |
|
||||
| `TSRAIR` | `TSRAIR_MAX_PRE_TRIGGER_SAMPLES` | `int` | `512` | Maximum pre-trigger samples for TSRAIR. |
|
||||
| `TSRAIR` | `EXTENDED_FAULTS_VER` | `int` | `27` | Protocol version for extended faults. |
|
||||
| `TSRAIR` | `ADC_SAMPLES_PER_PACKET_VER` | `int` | `29` | Protocol version for configurable ADC samples per packet. |
|
||||
| `TSRAIR` | `PROTOCOL_VERSION_CIRCULAR_UART` | `int` | `29` | Protocol version for circular buffer + UART modes. |
|
||||
| `TSRAIR` | `PROTOCOL_VERSION_CIRCULAR` | `int` | `int.MaxValue` | Protocol version for circular buffer modes (always supported). |
|
||||
| `TSRAIR` | `PROTOCOL_VERSION_RECORDER_UART` | `int` | `30` | Protocol version for recorder + UART modes. |
|
||||
| `TSRAIR` | `PROTOCOL_VERSION_RECORDER` | `int` | `int.MaxValue` | Protocol version for recorder modes (always supported). |
|
||||
| `TSRAIR` | `PROTOCOL_VERSION_SCHEDULED_EVENTCOUNT` | `int` | `35` | Protocol version for scheduled event count. |
|
||||
| `SliceProDB` | `MINIMUM_VALID_INPUT_THRESHOLD_LOW` | `double` | `30` | Lower bound for valid input threshold setting. |
|
||||
| `SliceProDB` | `MINIMUM_VALID_INPUT_THRESHOLD_HIGH` | `double
|
||||
240
enriched-qwen3-coder-next/Common/DTS.Common/Controls.md
Normal file
240
enriched-qwen3-coder-next/Common/DTS.Common/Controls.md
Normal file
@@ -0,0 +1,240 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Controls/RoundedBox.xaml.cs
|
||||
- Common/DTS.Common/Controls/TestIDView.xaml.cs
|
||||
- Common/DTS.Common/Controls/checkbox.xaml.cs
|
||||
- Common/DTS.Common/Controls/GridLengthAnimation.cs
|
||||
- Common/DTS.Common/Controls/ISOPopup.xaml.cs
|
||||
- Common/DTS.Common/Controls/LookupPopup.xaml.cs
|
||||
- Common/DTS.Common/Controls/TestIdPreFixSuffixHelper.cs
|
||||
- Common/DTS.Common/Controls/AutoSizedGridView.cs
|
||||
- Common/DTS.Common/Controls/TestIDTestBox.xaml.cs
|
||||
- Common/DTS.Common/Controls/DynamicGrid.cs
|
||||
- Common/DTS.Common/Controls/TestIDViewModel.cs
|
||||
- Common/DTS.Common/Controls/TestIDControl.xaml.cs
|
||||
- Common/DTS.Common/Controls/GridViewColumnHeaderSelectable.xaml.cs
|
||||
- Common/DTS.Common/Controls/IPTextBox.xaml.cs
|
||||
- Common/DTS.Common/Controls/GridViewColumnHeaderSearchable.xaml.cs
|
||||
generated_at: "2026-04-16T02:54:39.689905+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "65aa3f7b7e06fc1f"
|
||||
---
|
||||
|
||||
# DTS.Common.Controls Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a collection of WPF UI controls and supporting utilities for the DTS (Device Test System) application. It includes specialized input controls (e.g., `IPTextBox`, `TestIDTextBox`), layout helpers (`DynamicGrid`, `GridLengthAnimation`), and test ID management components (`TestIdPreFixSuffixHelper`, `TestIDViewModel`, `TestIdControl`). These controls extend standard WPF functionality to support domain-specific requirements such as structured test ID generation, IP address entry validation, dynamic grid layout, and column header interactions (selectable/searchable headers with popups). The module serves as a foundational UI component library for test setup and execution interfaces.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
#### `RoundedBox`
|
||||
- **`public void Connect(int connectionId, object target)`**
|
||||
Placeholder method intended for connection logic; currently throws `NotImplementedException`.
|
||||
|
||||
#### `TestIDView`
|
||||
- No public methods or properties exposed beyond default `UserControl` behavior.
|
||||
|
||||
#### `checkbox`
|
||||
- **`public void ToolTipEventHandler(object sender, ToolTipEventArgs e)`**
|
||||
Handles tooltip requests by publishing a `HelpTextEvent` via Prism's `IEventAggregator`, including the sender and event args in the `HelpTextEventArg`.
|
||||
|
||||
#### `GridLengthAnimation`
|
||||
- **`public GridLength From { get; set; }`**
|
||||
Starting `GridLength` value for the animation.
|
||||
- **`public GridLength To { get; set; }`**
|
||||
Ending `GridLength` value for the animation.
|
||||
- **`public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)`**
|
||||
Computes interpolated `GridLength` value based on animation progress, preserving `GridUnitType` (Star/Pixel) from the `To` value.
|
||||
|
||||
#### `ISOPopup`
|
||||
- **`private void ISOPart_OnPreviewKeyUp(object sender, KeyEventArgs e)`**
|
||||
Filters keyboard input in child controls to allow only alphanumeric keys, numeric pad digits, control keys (Enter, Tab, Backspace, etc.), and the `OemQuestion` key.
|
||||
- **`private void ISOPart_OnGotMouseCapture(object sender, MouseEventArgs e)`**
|
||||
Selects all text in a `TextBox` when it receives mouse capture.
|
||||
- **`private void ISOPart_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)`**
|
||||
Selects all text in a `TextBox` when it receives keyboard focus.
|
||||
|
||||
#### `LookupPopup`
|
||||
- **`public event ChannelCodeSelectedEventHandler ChannelCodeSelected`**
|
||||
Event raised when a channel code is selected (via double-click on a `DataGrid` item).
|
||||
- **`public IList PossibleChannels { get; set; }`**
|
||||
Dependency property backing the list of available channel codes.
|
||||
- **`public delegate void ChannelCodeSelectedEventHandler(object sender, string code, string name)`**
|
||||
Delegate for the `ChannelCodeSelected` event.
|
||||
- **`private void PossibleChannels_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)`**
|
||||
Extracts `Code` and `Name` properties from the selected item and raises `ChannelCodeSelected`.
|
||||
|
||||
#### `TestIdPreFixSuffixHelper`
|
||||
- **`public TestIdPreFixSuffix TestIdPreFixSuffix { get; }`**
|
||||
Encapsulated prefix/suffix configuration.
|
||||
- **`public override string ToString()`**
|
||||
Returns localized string via `Strings.Strings.ResourceManager`, or the raw value if not found.
|
||||
|
||||
#### `AutoSizedGridView`
|
||||
- **`protected override void PrepareItem(ListViewItem item)`**
|
||||
Ensures columns with `Width="Auto"` (unbound) are correctly measured and re-measured when items are prepared. Handles re-binding of width-bound columns if binding is lost.
|
||||
|
||||
#### `TestIDTextBox`
|
||||
- **`public string Text { get; set; }`**
|
||||
Dependency property for the full test ID text value.
|
||||
- **`public void Clear()`**
|
||||
Clears the internal `tbTestId` text box.
|
||||
- **`private static bool IsValidText(string text)`**
|
||||
Validates text against invalid filename/path characters and the period (`.`) character.
|
||||
|
||||
#### `DynamicGrid`
|
||||
- **`public byte GridColumns { get; set; }`**
|
||||
Number of columns in the grid; changing this triggers a layout refresh.
|
||||
- **`public void Refresh()`**
|
||||
Recalculates column and row definitions and assigns children to grid cells in row-major order. Adds a final star-width column and row for expansion.
|
||||
|
||||
#### `TestIDViewModel`
|
||||
- **`public string TestSetupLabel { get; set; }`**
|
||||
Label for test setup; affects `TestSetupLabelVisibility`.
|
||||
- **`public Visibility TestSetupLabelVisibility { get; }`**
|
||||
`Visibility.Visible` if `TestSetupLabel` is non-empty, else `Collapsed`.
|
||||
- **`public string TestIdEditableText { get; set; }`**
|
||||
User-editable portion of the test ID.
|
||||
- **`public void PopulateAllTestIdPrefixSuffixValues(string[] serializedValues)`**
|
||||
Initializes list of available prefix/suffix options from DB values.
|
||||
- **`public TestIdPreFixSuffixHelper[] AllTestIdPrefixSuffixValues { get; }`**
|
||||
Read-only array of available prefix/suffix helpers.
|
||||
- **`public TestIdPreFixSuffixHelper SelectedTestIdPrefixValueItem { get; set; }`**
|
||||
Currently selected prefix helper (default: `None`).
|
||||
- **`public TestIdPreFixSuffixHelper SelectedTestIdSuffixValueItem { get; set; }`**
|
||||
Currently selected suffix helper (default: `TimeStamp`).
|
||||
- **`public string TestName { get; set; }`**
|
||||
Test name used when prefix/suffix is `TestSetupName`.
|
||||
- **`public string GetTestId()`**
|
||||
Constructs test ID by concatenating prefix, test setup label, editable text, and suffix with underscores.
|
||||
- **`private string GetRunTimeTestIdPrefixOrSuffix(TestIdPreFixSuffixHelper prefixOrSuffix)`**
|
||||
Resolves runtime value for a prefix/suffix helper (e.g., timestamp or test name).
|
||||
- **`public string GetTestIdTimestamp()`**
|
||||
Returns current timestamp as `yyyy_MM_dd HH_mm`.
|
||||
|
||||
#### `TestIdControl`
|
||||
- **`public string TestSetupLabel { get; set; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public Visibility TestSetupLabelVisibility { get; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public string TestIdEditableText { get; set; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public void PopulateAllTestIdPrefixSuffixValues(string[] serializedValues)`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public TestIdPreFixSuffixHelper[] AllTestIdPrefixSuffixValues { get; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public TestIdPreFixSuffixHelper SelectedTestIdPrefixValueItem { get; set; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public TestIdPreFixSuffixHelper SelectedTestIdSuffixValueItem { get; set; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public string TestName { get; set; }`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public string GetTestId()`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`private string GetRunTimeTestIdPrefixOrSuffix(TestIdPreFixSuffixHelper prefixOrSuffix)`**
|
||||
Same as in `TestIDViewModel`.
|
||||
- **`public string GetTestIdTimestamp()`**
|
||||
Same as in `TestIDViewModel`.
|
||||
|
||||
#### `GridViewColumnHeaderSelectable`
|
||||
- **`public string ListviewId { get; set; }`**
|
||||
Identifier for the associated `ListView`.
|
||||
- **`public string HeaderTitle { get; set; }`**
|
||||
Display title for the header.
|
||||
- **`public bool ToggleButtonIsChecked { get; set; }`**
|
||||
Controls popup state; raises `OpenChanged` event on change.
|
||||
- **`public event RoutedEventHandler OpenChanged`**
|
||||
Raised when popup state changes.
|
||||
- **`public event RoutedEventHandler ClickHandler`**
|
||||
Raised on header click.
|
||||
- **`public event RoutedEventHandler SelectAll`**
|
||||
Raised when "Select All" or "Clear All" buttons are clicked.
|
||||
|
||||
#### `IPTextBox`
|
||||
- **`public string Address { get; set; }`**
|
||||
Dependency property for full IP address string (e.g., `"192.168.1.1"`).
|
||||
- **`public void Clear()`**
|
||||
Clears all four internal `TextBox` segments.
|
||||
|
||||
#### `GridViewColumnHeaderSearchable`
|
||||
- **`public string ListviewId { get; set; }`**
|
||||
Identifier for the associated `ListView`.
|
||||
- **`public string HeaderTitle { get; set; }`**
|
||||
Display title for the header.
|
||||
- **`public bool ToggleButtonIsChecked { get; set; }`**
|
||||
Controls popup state; raises `OpenChanged` event on change.
|
||||
- **`public string HeaderSearchTerm { get; set; }`**
|
||||
Current search term; raises `Search` event on change.
|
||||
- **`public Geometry ToggleIconGeometry { get; }`**
|
||||
Returns arrow or filter icon geometry based on search term presence.
|
||||
- **`public event RoutedEventHandler OpenChanged`**
|
||||
Raised when popup state changes.
|
||||
- **`public event RoutedEventHandler Search`**
|
||||
Raised when search term changes.
|
||||
|
||||
### Enums
|
||||
|
||||
#### `TestIdFixedPrefixSuffixValues`
|
||||
- `NotFixed = -1`
|
||||
- `None = 0`
|
||||
- `TimeStamp = 1`
|
||||
- `TestSetupName = 2`
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`GridLengthAnimation.GetCurrentValue`**:
|
||||
The `GridUnitType` of the result is determined solely by the `To.IsStar` property; `From`'s unit type is ignored.
|
||||
|
||||
- **`IPTextBox` input validation**:
|
||||
Only digits (0–9, including Numpad), period (`.`/`OemPeriod`/`Decimal`), navigation keys (Left/Right), Backspace, Tab, and Delete are allowed. Clipboard operations (Ctrl+C/V/A/X) are permitted.
|
||||
|
||||
- **`TestIDTextBox` text validation**:
|
||||
Text must not contain any characters from `Path.GetInvalidFileNameChars()`, `Path.GetInvalidPathChars()`, or `.` (period).
|
||||
|
||||
- **`DynamicGrid.Refresh()`**:
|
||||
- Columns are created with `Auto` width for all but the last column, which is `Star`.
|
||||
- Rows are created with `Auto` height for all but the last row, which is `Star`.
|
||||
- Children are assigned to grid cells in row-major order.
|
||||
|
||||
- **`ISOPopup` key filtering**:
|
||||
Only alphanumeric keys (A–Z, 0–9), Numpad digits (NumPad0–NumPad9), control keys (Enter, Tab, Backspace, Delete, Home, End), and `OemQuestion` are allowed.
|
||||
|
||||
- **`TestIdPreFixSuffixHelper.ToString()`**:
|
||||
Returns a localized string if available (via `Strings.Strings.ResourceManager`), otherwise returns the raw internal string.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- **`DTS.Common.Events`**: Used by `checkbox` (for `HelpTextEvent`), `GridViewColumnHeaderSelectable`, and `GridViewColumnHeaderSearchable` (for `ListViewStatusEvent`).
|
||||
- **`Prism.Ioc` / `Prism.Events`**: Used by `checkbox`, `GridViewColumnHeaderSelectable`, and `GridViewColumnHeaderSearchable` (for `IEventAggregator` and `ContainerLocator`).
|
||||
- **`DTS.Common.Interface.Channels.ChannelCodes`**: Used by `LookupPopup` (for `IChannelCode`).
|
||||
- **`DTS.Common.Base`**: Used by `GridViewColumnHeaderSelectable` and `GridViewColumnHeaderSearchable` (for `IBasePropertyChanged`).
|
||||
- **`DTS.Common.Utilities.Logging`**: Used by `GridViewColumnHeaderSelectable` and `GridViewColumnHeaderSearchable` (for logging utilities).
|
||||
- **`DTS.Common`**: Used by `TestIdPreFixSuffixHelper` (for `Base.BasePropertyChanged`).
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **WPF Framework**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Media`, `System.Windows.Media.Animation`, `System.Windows.Input`, `System.Windows.Shapes`, `System.Windows.Navigation`, `System.Windows.Data`, `System.Windows.Controls.Primitives`.
|
||||
- **Prism Library**: `Prism.Ioc`, `Prism.Events`.
|
||||
- **.NET Base Libraries**: `System`, `System.Collections.Generic`, `System.ComponentModel`, `System.IO`, `System.Linq`, `System.Threading.Tasks`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`RoundedBox.Connect` is unimplemented**: The method throws `NotImplementedException`; callers must not invoke it.
|
||||
- **`BoolToInvertedBoolConverter.ConvertBack` is not implemented**: Throwing `NotImplementedException` if used in two-way bindings.
|
||||
- **`TestIdControl` is deprecated**: The class summary explicitly states: *"Remove this control after deleting the TTS module and migrating to new test setup wizard"*.
|
||||
- **`TestIDTextBox` and `IPTextBox` share similar validation logic**: Both validate against invalid path/filename characters, but `TestIDTextBox` additionally forbids `.` while `IPTextBox` requires it.
|
||||
- **`DynamicGrid.Refresh()` behavior**:
|
||||
- The last column is always `Star` width, and the last row is always `Star` height, regardless of content.
|
||||
- If `GridColumns` is set to 0, `Refresh()` will create no columns, potentially breaking layout.
|
||||
- **`GridViewColumnHeaderSelectable`/`Searchable` event subscription**:
|
||||
Both subscribe to `ListViewStatusEvent` in their constructor. If `ListviewId` is not set correctly, the event handler may not clear search terms on `ListView` unload.
|
||||
- **`TestIdPreFixSuffixHelper` equality semantics**:
|
||||
`Equals()` returns `base.Equals()` if `FixedValue != NotFixed`, but compares string representations only if `FixedValue == NotFixed`. This may lead to unexpected equality results for non-`NotFixed` values.
|
||||
- **`TestIDViewModel`/`TestIdControl` timestamp format**:
|
||||
`GetTestIdTimestamp()` uses space (` `) as separator between date and time (`yyyy_MM_dd HH_mm`), which may cause issues in file system contexts.
|
||||
- **`LookupPopup` reflection usage**:
|
||||
`PossibleChannels_OnMouseDoubleClick` uses reflection (`GetProperty("Code")?.GetValue(...)`) to extract `Code`/`Name` from items; this assumes all items have these properties and may fail silently if they do not.
|
||||
338
enriched-qwen3-coder-next/Common/DTS.Common/Converters.md
Normal file
338
enriched-qwen3-coder-next/Common/DTS.Common/Converters.md
Normal file
@@ -0,0 +1,338 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Converters/BooleanToBorderThicknessConverter.cs
|
||||
- Common/DTS.Common/Converters/BooleanToBorderBrushConverter.cs
|
||||
- Common/DTS.Common/Converters/BooleanToGreenBorderConverter.cs
|
||||
- Common/DTS.Common/Converters/YesNoRadioButtonsConventer.cs
|
||||
- Common/DTS.Common/Converters/BooleanOrMultiConverter.cs
|
||||
- Common/DTS.Common/Converters/DateTimeWithMillisecondsToStringConverter.cs
|
||||
- Common/DTS.Common/Converters/EnumVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/InverseEnumVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/ActiveContentConverter.cs
|
||||
- Common/DTS.Common/Converters/FaultedTextConverter.cs
|
||||
- Common/DTS.Common/Converters/TriggerTextConverter.cs
|
||||
- Common/DTS.Common/Converters/TriggerColorConverter.cs
|
||||
- Common/DTS.Common/Converters/FaultedColorConverter.cs
|
||||
- Common/DTS.Common/Converters/DateConverter.cs
|
||||
- Common/DTS.Common/Converters/NullableFloatConverter.cs
|
||||
- Common/DTS.Common/Converters/InverseEnumEnabledConverter.cs
|
||||
- Common/DTS.Common/Converters/IsLessThanConverter.cs
|
||||
- Common/DTS.Common/Converters/ListToStringConverter.cs
|
||||
- Common/DTS.Common/Converters/IsGreaterThanConverter.cs
|
||||
- Common/DTS.Common/Converters/NonZeroToColorConverter.cs
|
||||
- Common/DTS.Common/Converters/HeightConverter.cs
|
||||
- Common/DTS.Common/Converters/ErrorToBooleanConverter.cs
|
||||
- Common/DTS.Common/Converters/WidthConverter.cs
|
||||
- Common/DTS.Common/Converters/StringListToVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/StatusToBorderThicknessConverter.cs
|
||||
- Common/DTS.Common/Converters/ArrayVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/DSPStreamingFilterFrequencyConverter.cs
|
||||
- Common/DTS.Common/Converters/ErrorToColorConverter.cs
|
||||
- Common/DTS.Common/Converters/GreaterThanToBoolConverter.cs
|
||||
- Common/DTS.Common/Converters/BooleanToColorConverter.cs
|
||||
- Common/DTS.Common/Converters/BooleanToItalicFontStyleConverter.cs
|
||||
- Common/DTS.Common/Converters/IntervalToVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/StatusToColorConverter.cs
|
||||
- Common/DTS.Common/Converters/DiagStatusShuntColorConverter.cs
|
||||
- Common/DTS.Common/Converters/DiagStatusOffsetColorConverter.cs
|
||||
- Common/DTS.Common/Converters/InverseBooleanToOpacityConverter.cs
|
||||
- Common/DTS.Common/Converters/ColorToSolidColorBrushConverter .cs
|
||||
- Common/DTS.Common/Converters/BooleanAndToVisibiltyMultiConverter.cs
|
||||
- Common/DTS.Common/Converters/BooleanOrToVisibilityMultiConverter.cs
|
||||
- Common/DTS.Common/Converters/DoubleFromThousandthUnitToBaseUnit.cs
|
||||
- Common/DTS.Common/Converters/BooleanToOpacityConverter.cs
|
||||
- Common/DTS.Common/Converters/DASStatusArmTextConverter.cs
|
||||
- Common/DTS.Common/Converters/RecordingModePreTriggerVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/EnumBooleanConverter.cs
|
||||
- Common/DTS.Common/Converters/InitialOffsetToIEPESensorOffsetConverter.cs
|
||||
- Common/DTS.Common/Converters/DASStatusColorConverter.cs
|
||||
- Common/DTS.Common/Converters/DASStatusArmColorConverter .cs
|
||||
- Common/DTS.Common/Converters/PercentConverter.cs
|
||||
- Common/DTS.Common/Converters/NumericStringFormatConverter.cs
|
||||
- Common/DTS.Common/Converters/VisibilityToRowHeightConverter.cs
|
||||
- Common/DTS.Common/Converters/GroupImportErrorToStringConverter.cs
|
||||
- Common/DTS.Common/Converters/GroupNameToVisibilityConverter.cs
|
||||
- Common/DTS.Common/Converters/FilePathsToShortStringConverter.cs
|
||||
- Common/DTS.Common/Converters/InverseBooleanConverter.cs
|
||||
- Common/DTS.Common/Converters/EnumDescriptionTypeConverter.cs
|
||||
generated_at: "2026-04-16T02:53:33.629685+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e705305552eb4c3f"
|
||||
---
|
||||
|
||||
# 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 (Data Acquisition and Test System) application. These converters enable UI elements to dynamically reflect application state by transforming values (e.g., booleans, enums, numbers, dates, collections) into display-appropriate types such as `Visibility`, `Brush`, `Thickness`, `Opacity`, `FontStyle`, or formatted strings. They serve as a bridge between domain models and XAML views, reducing logic in view models and centralizing UI presentation rules.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
All converters implement `IValueConverter` or `IMultiValueConverter` and reside in the `DTS.Common.Converters` namespace.
|
||||
|
||||
### `BooleanToBorderThicknessConverter`
|
||||
- **Signature**: `public class BooleanToBorderThicknessConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `1`, `false` → `2`. Used to visually distinguish active/inactive states via border thickness.
|
||||
|
||||
### `BooleanToBorderBrushConverter`
|
||||
- **Signature**: `public class BooleanToBorderBrushConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `BrushesAndColors.Brush_Warning`, `false`/`null` → `Brushes.Transparent`.
|
||||
|
||||
### `BooleanToGreenBorderConverter`
|
||||
- **Signature**: `public class BooleanToGreenBorderConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `BrushesAndColors.BrushApplicationStatusPowerGreen`, `false`/`null` → `Brushes.Transparent`.
|
||||
|
||||
### `YesNoRadioButtonsConventer` *(Note: Typo in class name)*
|
||||
- **Signature**: `public class YesNoRadioButtonsConventer : IValueConverter`
|
||||
- **Behavior**:
|
||||
- `Convert`: Returns `true` if `parameter.ToString() == value.ToString()` (used to bind radio buttons to enum/string values).
|
||||
- `ConvertBack`: Returns `parameter` if `value == true`, else `Binding.DoNothing`.
|
||||
|
||||
### `BooleanOrMultiConverter`
|
||||
- **Signature**: `public class BooleanOrMultiConverter : IMultiValueConverter`
|
||||
- **Behavior**: Returns `true` if **any** input boolean in the array is `true`; otherwise `false`. Throws `NotImplementedException` in `ConvertBack`.
|
||||
|
||||
### `DateTimeWithMillisecondsToStringConverter`
|
||||
- **Signature**: `public class DateTimeWithMillisecondsToStringConverter : IValueConverter`
|
||||
- **Behavior**: Converts `DateTime` to string using `Utils.Utils.FormatTimeStamp`. `ConvertBack` returns `null`.
|
||||
|
||||
### `EnumVisibilityConverter`
|
||||
- **Signature**: `public class EnumVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if `value == parameter`, else `Visibility.Hidden`. `ConvertBack` returns `parameter` if `value == Visibility.Visible`, else `Binding.DoNothing`.
|
||||
|
||||
### `InverseEnumVisibilityConverter`
|
||||
- **Signature**: `public class InverseEnumVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Hidden` if `value == parameter`, else `Visibility.Visible`. `ConvertBack` returns `parameter` if `value == Visibility.Hidden`, else `Binding.DoNothing`.
|
||||
|
||||
### `ActiveContentConverter`
|
||||
- **Signature**: `public class ActiveContentConverter : IValueConverter`
|
||||
- **Behavior**: Returns the input `ContentControl` unchanged if it is a `ContentControl`; otherwise `Binding.DoNothing`. Supports both directions.
|
||||
|
||||
### `FaultedTextConverter`
|
||||
- **Signature**: `public class FaultedTextConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `Strings.Strings.Faulted`, `false` → `Strings.Strings.FaultsClear`, `null`/non-bool → `Strings.Strings.FaultsClear`.
|
||||
|
||||
### `TriggerTextConverter`
|
||||
- **Signature**: `public class TriggerTextConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `Strings.Strings.Triggered`, `false` → `Strings.Strings.TriggerClear`, `null`/non-bool → `Strings.Strings.TriggerClear`.
|
||||
|
||||
### `TriggerColorConverter`
|
||||
- **Signature**: `public class TriggerColorConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `BrushesAndColors.Brush_ApplicationStatus_Failed.Color`, `false` → `BrushesAndColors.Brush_ApplicationStatus_Waiting.Color`, `null`/non-bool → `Brushes.Transparent.Color`.
|
||||
|
||||
### `FaultedColorConverter`
|
||||
- **Signature**: `public class FaultedColorConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `BrushesAndColors.Brush_ApplicationStatus_Failed.Color`, `false` → `BrushesAndColors.Brush_ApplicationStatus_Complete.Color`, `null`/non-bool → `Brushes.Transparent.Color`.
|
||||
|
||||
### `DateConverter`
|
||||
- **Signature**: `public class DateConverter : IValueConverter`
|
||||
- **Behavior**: Converts `DateTime` → `DateTime`, `null`/non-`DateTime` → `Strings.Strings.Table_NA`. `ConvertBack` behaves similarly.
|
||||
|
||||
### `NullableFloatConverter`
|
||||
- **Signature**: `public class NullableFloatConverter : IValueConverter`
|
||||
- **Behavior**: Converts `double` → `double`, `float` → `float`, `null`/other → `string.Empty`. `ConvertBack` returns `float` or `string.Empty`.
|
||||
|
||||
### `InverseEnumEnabledConverter`
|
||||
- **Signature**: `public class InverseEnumEnabledConverter : IValueConverter`
|
||||
- **Behavior**: Returns `false` if `value == parameter`, else `true`. Used for `IsEnabled`. `ConvertBack` returns `parameter` if `value == false`, else `Binding.DoNothing`.
|
||||
|
||||
### `IsLessThanConverter`
|
||||
- **Signature**: `public class IsLessThanConverter : IValueConverter`
|
||||
- **Behavior**: Compares `value < parameter` (both parsed as `decimal`). Defaults to `0` if parsing fails. Returns `bool`. `ConvertBack` returns `DependencyProperty.UnsetValue`.
|
||||
|
||||
### `ListToStringConverter`
|
||||
- **Signature**: `public class ListToStringConverter : IValueConverter`
|
||||
- **Behavior**: Converts `List<string>` → comma-separated string. Throws `InvalidOperationException` if `targetType != typeof(string)` or input is `null`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `IsGreaterThanConverter`
|
||||
- **Signature**: `public class IsGreaterThanConverter : IValueConverter`
|
||||
- **Behavior**: Compares `value > parameter` (both parsed as `decimal`). Defaults to `0` if parsing fails. Returns `bool`. `ConvertBack` returns `DependencyProperty.UnsetValue`.
|
||||
|
||||
### `NonZeroToColorConverter`
|
||||
- **Signature**: `public class NonZeroToColorConverter : IValueConverter`
|
||||
- **Behavior**:
|
||||
- `"0"` → `BrushesAndColors.BrushApplicationStatusPowerGreen`
|
||||
- `"---"` → `BrushesAndColors.BrushApplicationStatusPowerClear`
|
||||
- Other → `BrushesAndColors.BrushApplicationStatusPowerRed`
|
||||
|
||||
### `HeightConverter`
|
||||
- **Signature**: `public class HeightConverter : MarkupExtension, IValueConverter`
|
||||
- **Behavior**: Returns `value - parameter` (both parsed as `double`/`int`). Implements `MarkupExtension` for XAML usage (singleton instance). `ConvertBack` returns `null`.
|
||||
|
||||
### `ErrorToBooleanConverter`
|
||||
- **Signature**: `internal class ErrorToBooleanConverter : IValueConverter`
|
||||
- **Behavior**: Returns `true` if `value` is `string.IsNullOrEmpty`, else `null`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `WidthConverter`
|
||||
- **Signature**: `public class WidthConverter : MarkupExtension, IValueConverter`
|
||||
- **Behavior**: Returns `value * parameter` (both parsed as `double`). Implements `MarkupExtension`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `StringListToVisibilityConverter`
|
||||
- **Signature**: `public class StringListToVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if `List<string>` is non-empty, else `Visibility.Collapsed`. Throws `InvalidOperationException` if `targetType != typeof(Visibility)` or input is `null`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `StatusToBorderThicknessConverter`
|
||||
- **Signature**: `public class StatusToBorderThicknessConverter : IValueConverter`
|
||||
- **Behavior**: Maps `UIItemStatus` to border thickness: `None` → `1`, all others (`Success`, `Failed`, `Error`, `Warning`) → `2`. Non-`UIItemStatus` → `1`.
|
||||
|
||||
### `ArrayVisibilityConverter`
|
||||
- **Signature**: `public class ArrayVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Hidden` if `null`, `Visibility.Visible` if `IList.Count > 0` or `Array.Length > 0`, else `Visibility.Visible`.
|
||||
|
||||
### `DSPStreamingFilterFrequencyConverter`
|
||||
- **Signature**: `public class DSPStreamingFilterFrequencyConverter : IValueConverter`
|
||||
- **Behavior**:
|
||||
- `double.NaN` → `string.Empty`
|
||||
- `0.0` (within `EPSILON = 0.00001`) → `Strings.Strings.Table_NA`
|
||||
- Otherwise → formatted as `"F1"` (e.g., `"123.4"`)
|
||||
- `ConvertBack`: Returns `parameter` if `value == true`, else `Binding.DoNothing`.
|
||||
|
||||
### `ErrorToColorConverter`
|
||||
- **Signature**: `public class ErrorToColorConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Brushes.Red` if `value` is non-empty `string`, else `Brushes.Black`. Non-string input → `Brushes.Black`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `GreaterThanToBoolConverter`
|
||||
- **Signature**: `public class GreaterEqualThanToBoolConverter : IValueConverter`
|
||||
- **Behavior**: Returns `true` if `value >= parameter` for `int`, `double`, or `ushort` types. Returns `false` otherwise. `ConvertBack` returns `false`.
|
||||
|
||||
### `BooleanToColorConverter`
|
||||
- **Signature**: `public class BooleanToColorConverter : IValueConverter`
|
||||
- **Behavior**: Configurable via properties:
|
||||
- `Inverted`: Inverts input boolean.
|
||||
- `Background`: If `true`, returns `Brushes.Transparent` for `true`.
|
||||
- `AttentionBrush`: If `true`, returns `BrushesAndColors.Brush_Attention` for `false`.
|
||||
- `WarningBrush`: If `true`, returns `BrushesAndColors.Brush_Warning` for `false`.
|
||||
- Default: `true` → `Brush_NoError`, `false` → `Brush_Error`.
|
||||
|
||||
### `BooleanToItalicFontStyleConverter`
|
||||
- **Signature**: `public class BooleanToItalicFontStyleConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `FontStyles.Italic`, `false`/`null` → `FontStyles.Normal`.
|
||||
|
||||
### `IntervalToVisibilityConverter`
|
||||
- **Signature**: `public class IntervalToVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if `value >= parameter` (for `int`, `double`, `ushort`), else `Visibility.Collapsed`. `ConvertBack` returns `false`.
|
||||
|
||||
### `StatusToColorConverter`
|
||||
- **Signature**: `public class StatusToColorConverter : IValueConverter`
|
||||
- **Behavior**: Maps `UIItemStatus` to color:
|
||||
- `None` → `Brushes.Black`
|
||||
- `Success` → `Brush_ApplicationStatus_Complete`
|
||||
- `Failed`/`Error` → `Brush_ApplicationStatus_Failed`/`Brushes.Red`
|
||||
- `Warning` → `Brushes.OrangeRed`
|
||||
- Default → `Brushes.Transparent`.
|
||||
|
||||
### `DiagStatusShuntColorConverter`
|
||||
- **Signature**: `public class DiagStatusShuntColorConverter : IValueConverter`
|
||||
- **Behavior**: Maps `DiagStatuses`:
|
||||
- `NoResults` → `Brush_ApplicationStatus_Idle`
|
||||
- `FailedShunt` bit set → `Brush_ApplicationStatus_Failed`
|
||||
- Otherwise → `Brush_ApplicationStatus_Complete`
|
||||
- Default → `Brush_ApplicationStatus_Idle`.
|
||||
|
||||
### `DiagStatusOffsetColorConverter`
|
||||
- **Signature**: `public class DiagStatusOffsetColorConverter : IValueConverter`
|
||||
- **Behavior**: Same logic as `DiagStatusShuntColorConverter`, but checks `FailedOffset` bit.
|
||||
|
||||
### `InverseBooleanToOpacityConverter`
|
||||
- **Signature**: `public class InverseBooleanToOpacityConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `1.0`, `false`/`null` → `0.5`.
|
||||
|
||||
### `ColorToSolidColorBrushConverter`
|
||||
- **Signature**: `public class ColorToSolidColorBrushConverter : IValueConverter`
|
||||
- **Behavior**: Converts `Color` → `SolidColorBrush`. Non-`Color` input → `null`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `BooleanAndToVisibilityMultiConverter`
|
||||
- **Signature**: `public class BooleanAndToVisibilityMultiConverter : IMultiValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if **all** inputs are `true`. Supports `parameter` flags:
|
||||
- `"FALSE"`: Invert logic (`false` → visible).
|
||||
- `"HIDE"`: Use `Visibility.Hidden` instead of `Collapsed`.
|
||||
- `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `BooleanOrToVisibilityMultiConverter`
|
||||
- **Signature**: `public class BooleanOrToVisibilityMultiConverter : IMultiValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if **any** input is `true`. Same parameter flags as `BooleanAndToVisibilityMultiConverter`.
|
||||
- `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `DoubleFromThousandthUnitToBaseUnit`
|
||||
- **Signature**: `public class DoubleFromThousandthUnitToBaseUnit : IValueConverter`
|
||||
- **Behavior**: Converts thousandths to base unit (e.g., mV → V): `value / 1000`. `ConvertBack`: `value * 1000`. `double.NaN` → `0D`.
|
||||
|
||||
### `BooleanToOpacityConverter`
|
||||
- **Signature**: `public class BooleanToOpacityConverter : IValueConverter`
|
||||
- **Behavior**: Converts `true` → `0.5`, `false`/`null` → `1.0`. Used for disabled/enabled visual feedback.
|
||||
|
||||
### `DASStatusArmTextConverter`
|
||||
- **Signature**: `public class DASStatusArmTextConverter : IValueConverter`
|
||||
- **Behavior**: Maps `DASStatuses` to text:
|
||||
- `MissingNotBooted`, `BootedNotArmedYet`, `BootedNeverArmed`, `ReadyForDownload` → `Strings.Strings.Table_NA`/`Strings.Strings.NotArmed`
|
||||
- `ArmedReady`, `ArmedButFailedDiag` → `Strings.Strings.Armed`
|
||||
- Default → `Strings.Strings.Table_NA`.
|
||||
|
||||
### `RecordingModePreTriggerVisibilityConverter`
|
||||
- **Signature**: `public class RecordingModePreTriggerVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if pre-trigger should be shown (i.e., `RecordingModes` is active or can program pre-trigger). `parameter = "True"` inverts result.
|
||||
|
||||
### `EnumBooleanConverter`
|
||||
- **Signature**: `public class EnumBooleanConverter : IValueConverter`
|
||||
- **Behavior**: Returns `true` if `value.Equals(parameter)`. `ConvertBack`: Returns `parameter` if `value == true`, else `Binding.DoNothing`.
|
||||
|
||||
### `InitialOffsetToIEPESensorOffsetConverter`
|
||||
- **Signature**: `public class InitialOffsetToIEPESensorOffsetConverter : IValueConverter`
|
||||
- **Behavior**: Converts millivolt offset to IEPE sensor offset (volts): `(milliUnit / 1000) + 12.25`. `ConvertBack`: `(unit - 12.25) * 1000`. `double.NaN` → `0D`.
|
||||
|
||||
### `DASStatusColorConverter`
|
||||
- **Signature**: `public class DASStatusColorConverter : IValueConverter`
|
||||
- **Behavior**: Maps `DASStatuses` to color:
|
||||
- `MissingNotBooted` → `Brush_ApplicationStatus_Idle`
|
||||
- `BootedNotArmedYet` → `Brush_ApplicationStatus_Busy`
|
||||
- `BootedNeverArmed`, `ArmedButFailedDiag` → `Brush_ApplicationStatus_Failed`
|
||||
- `ArmedReady`, `ReadyForDownload` → `Brush_ApplicationStatus_Complete`
|
||||
- Default → `Brush_ApplicationStatus_Idle`.
|
||||
|
||||
### `DASStatusArmColorConverter`
|
||||
- **Signature**: `public class DASStatusArmColorConverter : IValueConverter`
|
||||
- **Behavior**: Maps `DASStatuses` to color:
|
||||
- `MissingNotBooted`, `BootedNotArmedYet`, `BootedNeverArmed` → `Brush_ApplicationStatus_Failed`
|
||||
- `ArmedReady` → `Brush_ApplicationStatus_Complete`
|
||||
- `ArmedButFailedDiag` → `Brush_ApplicationStatus_Busy`
|
||||
- `ReadyForDownload` → `Brush_ApplicationStatus_Idle`
|
||||
- Default → `Brush_ApplicationStatus_Idle`.
|
||||
|
||||
### `PercentConverter`
|
||||
- **Signature**: `public class PercentConverter : IValueConverter`
|
||||
- **Behavior**: Converts `decimal?` → formatted string `"{value:F1}%"`. Defaults to `0` if `null`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `NumericStringFormatConverter`
|
||||
- **Signature**: `public class NumericStringFormatConverter : IMultiValueConverter`
|
||||
- **Behavior**: Converts first value (`int`/`double`/`float`/`decimal`) to string using format string from second value. `NaN` → `Strings.Strings.Table_NA`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `VisibilityToRowHeightConverter`
|
||||
- **Signature**: `public class VisibilityToRowHeightConverter : DependencyObject, IValueConverter`
|
||||
- **Behavior**:
|
||||
- `Visibility.Collapsed` → `0`
|
||||
- Other → `parameter` (default `0` if `null`)
|
||||
- `InvertSource` property inverts `Visible` ↔ `Collapsed` before conversion.
|
||||
|
||||
### `GroupImportErrorToStringConverter`
|
||||
- **Signature**: `public class GroupImportErrorToStringConverter : IValueConverter`
|
||||
- **Behavior**: Returns `GroupImportError.ExtraInfo` if input is non-null `GroupImportError`, else `string.Empty`. `ConvertBack` throws `NotImplementedException`.
|
||||
|
||||
### `GroupNameToVisibilityConverter`
|
||||
- **Signature**: `public class GroupNameToVisibilityConverter : IValueConverter`
|
||||
- **Behavior**: Returns `Visibility.Visible` if `value.ToString().Trim()` starts with `"Graph"`, else `Visibility.Collapsed`.
|
||||
|
||||
### `FilePathsToShortStringConverter`
|
||||
- **Signature**: `public class FilePathsToShortStringConverter : IValueConverter`
|
||||
- **Behavior**:
|
||||
- `null`/empty array → `string.Empty`
|
||||
- Multiple files → `Strings.Strings.MultipleFiles`
|
||||
- Single file → `FileInfo.Name`
|
||||
|
||||
### `InverseBooleanConverter`
|
||||
- **Signature**: `public class InverseBooleanConverter : IValueConverter`
|
||||
- **Behavior**: Inverts boolean (via `bool.TryParse`). `null` → `false`. Supports two-way binding.
|
||||
|
||||
### `EnumDescriptionTypeConverter`
|
||||
- **Signature**: `public class EnumDescriptionTypeConverter : EnumConverter`
|
||||
- **Behavior**: Overrides `ConvertTo` to return localized enum descriptions (via `DescriptionAttribute
|
||||
152
enriched-qwen3-coder-next/Common/DTS.Common/Dialogs.md
Normal file
152
enriched-qwen3-coder-next/Common/DTS.Common/Dialogs.md
Normal file
@@ -0,0 +1,152 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Dialogs/IRegionManagerAware.cs.cs
|
||||
- Common/DTS.Common/Dialogs/IPopupWindowActionAware.cs
|
||||
- Common/DTS.Common/Dialogs/ConfirmationEx.cs
|
||||
- Common/DTS.Common/Dialogs/ConfirmationWindow.xaml.cs
|
||||
- Common/DTS.Common/Dialogs/NotificationWindow.xaml.cs
|
||||
- Common/DTS.Common/Dialogs/PopupWindowAction.cs
|
||||
- Common/DTS.Common/Dialogs/BrowseForFolderDialog.cs
|
||||
generated_at: "2026-04-16T02:55:52.161759+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "af049870a2d42dd7"
|
||||
---
|
||||
|
||||
# Dialogs Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides infrastructure for displaying modal and non-modal dialog windows in a WPF application using Prism's interaction request pattern. It extends standard Prism `Confirmation` and `Notification` types with additional UI customization capabilities (e.g., button types, icons, window positioning) and provides dedicated window implementations (`ConfirmationWindow`, `NotificationWindow`) that suppress the standard close button via Win32 interop. The `PopupWindowAction` class acts as a behavior trigger that responds to interaction requests by creating and displaying popup windows, while `BrowseForFolderDialog` wraps the Win32 `SHBrowseForFolder` API for folder selection. The module supports region management and custom data context wiring through the `IRegionManagerAware` and `IPopupWindowActionAware` interfaces.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces
|
||||
|
||||
- **`IRegionManagerAware`**
|
||||
```csharp
|
||||
public interface IRegionManagerAware
|
||||
{
|
||||
IRegionManager RegionManager { get; set; }
|
||||
}
|
||||
```
|
||||
Allows view models or views to receive a `RegionManager` instance for region-based navigation within a popup window.
|
||||
|
||||
- **`IPopupWindowActionAware`**
|
||||
```csharp
|
||||
public interface IPopupWindowActionAware
|
||||
{
|
||||
Window HostWindow { get; set; }
|
||||
Notification HostNotification { get; set; }
|
||||
}
|
||||
```
|
||||
Enables views or view models to access the host window and the original `Notification`/`Confirmation` context when displayed via `PopupWindowAction`.
|
||||
|
||||
### Classes
|
||||
|
||||
- **`ConfirmationEx`**
|
||||
```csharp
|
||||
public class ConfirmationEx : Confirmation
|
||||
```
|
||||
Extends Prism's `Confirmation` with additional properties:
|
||||
- `Buttons MessageBoxButton { get; set; } = MessageBoxButton.OKCancel`
|
||||
- `Image MessageBoxImage { get; set; } = MessageBoxImage.Question`
|
||||
- `Result MessageBoxResult { get; set; }`
|
||||
|
||||
- **`ConfirmationWindow`**
|
||||
```csharp
|
||||
public partial class ConfirmationWindow
|
||||
```
|
||||
A window for displaying confirmation dialogs. Key members:
|
||||
- `ConfirmationTemplate DataTemplate { get; set; }`
|
||||
- `Connect(int connectionId, object target)` — *throws `NotImplementedException`*
|
||||
- Suppresses the close button via `GetWindowLong`/`SetWindowLong` on `SourceInitialized`.
|
||||
|
||||
- **`NotificationWindow`**
|
||||
```csharp
|
||||
public partial class NotificationWindow : Window
|
||||
```
|
||||
A window for displaying notification dialogs. Key members:
|
||||
- `NotificationTemplate DataTemplate { get; set; }`
|
||||
- `ImageUri Uri { get; set; }` — defaults to `warning_48.png`
|
||||
- `Connect(int connectionId, object target)` — *empty implementation*
|
||||
- `CoppyToClibord_Click(...)` — sets clipboard to `"Hello, clipboard"`
|
||||
- Suppresses the close button via `GetWindowLong`/`SetWindowLong` on `SourceInitialized`.
|
||||
|
||||
- **`PopupWindowAction`**
|
||||
```csharp
|
||||
public class PopupWindowAction : TriggerAction<FrameworkElement>
|
||||
```
|
||||
A Prism behavior that displays popup windows in response to interaction requests. Key properties:
|
||||
- `WindowContent FrameworkElement { get; set; }`
|
||||
- `ContentTemplate DataTemplate { get; set; }`
|
||||
- `IsModal bool { get; set; }`
|
||||
- `StartupPosition WindowPositions { get; set; }` — enum: `CenterOwner`, `CenterScreen`
|
||||
- `AllowMultipleNotificationWindows bool { get; set; }`
|
||||
- `CenterOverAssociatedObject bool { get; set; }` — *commented out in current code*
|
||||
- `TimeoutInterval int` and `TimeoutResult ResultEnum` — *commented out*
|
||||
|
||||
Key methods:
|
||||
- `Invoke(object parameter)` — handles interaction request, positions window, sets up callbacks, and shows window (modal/non-modal).
|
||||
- `PrepareContentForWindow(Notification notification, Window wrapperWindow)` — injects `RegionManager`, sets `HostWindow`/`HostNotification` on `IPopupWindowActionAware` targets.
|
||||
- `GetWindow(Notification notification)` — creates or reuses a window.
|
||||
- `CreateWindow(Notification notification)` — instantiates `ConfirmationWindow` or `NotificationWindow` based on type.
|
||||
- `GetImageUri(PopupWindowImage windowImage)` — resolves image URIs (e.g., `error_48.png`, `warning_48.png`).
|
||||
|
||||
- **`BrowseForFolderDialog`**
|
||||
```csharp
|
||||
public class BrowseForFolderDialog
|
||||
```
|
||||
Wraps Win32 `SHBrowseForFolder` for folder selection. Key properties:
|
||||
- `SelectedFolder string { get; protected set; }`
|
||||
- `Title string { get; set; }`
|
||||
- `InitialFolder string { get; set; }`
|
||||
- `InitialExpandedFolder string { get; set; }`
|
||||
- `OKButtonText string { get; set; }`
|
||||
- `BrowseInfo BROWSEINFOW { get; protected set; }`
|
||||
- `BrowserDialogFlags BrowseInfoFlags { get; set; }`
|
||||
|
||||
Key methods:
|
||||
- `ShowDialog()` / `ShowDialog(Window owner)` — displays dialog and returns `Nullable<bool>`.
|
||||
- `BrowseEventHandler(...)` — callback for dialog events (`BFFM_INITIALIZED`, `BFFM_SELCHANGED`, etc.).
|
||||
|
||||
Win32 interop:
|
||||
- `SHBrowseForFolderW`, `SHGetPathFromIDList`, `SendMessageW`
|
||||
- `BROWSEINFOW`, `BrowseInfoFlags`, `MessageFromBrowser`, `MessageToBrowser` enums/structs.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Window Closing Behavior**: Both `ConfirmationWindow` and `NotificationWindow` unconditionally remove the system menu (and thus the close button) via `GetWindowLong`/`SetWindowLong` during `SourceInitialized`. This is non-negotiable and cannot be overridden.
|
||||
- **RegionManager Injection**: `PopupWindowAction.PrepareContentForWindow` ensures that if `WindowContent` (or its `DataContext`) does not already have a `RegionManager`, a new scoped `RegionManager` is created and assigned. This is always applied when `WindowContent` is non-null.
|
||||
- **IPopupWindowActionAware Wiring**: If `WindowContent` or its `DataContext` implements `IPopupWindowActionAware`, `HostWindow` and `HostNotification` are *always* set to the created window and notification context.
|
||||
- **Window Content Ownership**: `PopupWindowAction.Invoke` returns early if `WindowContent.Parent != null`, preventing reuse of content already in a visual tree.
|
||||
- **Multiple Notifications**: When `AllowMultipleNotificationWindows` is `false`, only one `NotificationWindow` is retained in `_openedNotificationWindow`; subsequent notifications reuse this instance (though the code does not show explicit reuse logic beyond assignment).
|
||||
- **BrowseForFolderDialog State**: `InitialExpandedFolder` overrides `InitialFolder` when set during `BFFM_INITIALIZED`.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies
|
||||
- **Prism.Core** (via `Prism.Regions`, `IRegionManager`, `InteractionRequestedEventArgs`)
|
||||
- **Microsoft.Xaml.Behaviors** (via `TriggerAction<FrameworkElement>`)
|
||||
- **System.Windows** (WPF types: `Window`, `DataTemplate`, `FrameworkElement`, `Uri`, `Clipboard`)
|
||||
- **Win32 APIs** (via `user32.dll`, `shell32.dll`): `SetWindowLong`, `GetWindowLong`, `SHBrowseForFolderW`, `SHGetPathFromIDList`, `SendMessageW`
|
||||
|
||||
### Internal Dependencies
|
||||
- **DTS.Common.Interactivity** (for `Notification`, `NotificationContentEventArgs`, `PopupWindowImage`)
|
||||
- **DTS.Common.Enums** (for `PopupWindowImage`)
|
||||
- **DTS.Common.Events** (referenced but no direct usage in these files)
|
||||
|
||||
### Depended Upon By
|
||||
- Likely used by UI layers (Views) via `PopupWindowAction` behaviors bound to interaction requests.
|
||||
- `BrowseForFolderDialog` is likely consumed by view models or services requiring folder selection.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **`ConfirmationWindow.Connect` throws `NotImplementedException`**: This method is present but non-functional; callers must avoid invoking it.
|
||||
- **`NotificationWindow.CoppyToClibord_Click` is hardcoded**: Sets clipboard to `"Hello, clipboard"` — likely a placeholder or debugging artifact.
|
||||
- **`CenterOverAssociatedObject` is commented out**: The legacy property is defined but unused; developers should use `StartupPosition` instead.
|
||||
- **Timeout behavior is commented out**: `TimeoutInterval` and `TimeoutResult` properties exist only in comments; no auto-cancellation is implemented.
|
||||
- **`BrowseForFolderDialog` requires `OleInitialize()` for `BIF_NEWDIALOGSTYLE`**: The documentation comment for `BIF_NEWDIALOGSTYLE` notes this requirement, but the class does not enforce or perform it.
|
||||
- **`BrowseForFolderDialog` uses `SelectedFolder` as both input and output**: `InitialFolder` and `InitialExpandedFolder` set initial state, but `SelectedFolder` is updated during `BFFM_SELCHANGED` and returned as the final selection.
|
||||
- **`PopupWindowAction.GetWindow` creates a new `Window` when `WindowContent` is set**: This may lead to unexpected window hierarchy if `WindowContent` is reused elsewhere.
|
||||
- **No validation of `PopupWindowImage` values**: `GetImageUri` defaults to `"warning_48.png"` for unknown values — no exception or warning is raised.
|
||||
364
enriched-qwen3-coder-next/Common/DTS.Common/Enums.md
Normal file
364
enriched-qwen3-coder-next/Common/DTS.Common/Enums.md
Normal file
@@ -0,0 +1,364 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/IsoRestrictionLevels.cs
|
||||
- Common/DTS.Common/Enums/GPSSentenceTypes.cs
|
||||
- Common/DTS.Common/Enums/UartDataFormat.cs
|
||||
- Common/DTS.Common/Enums/NetworkSelection.cs
|
||||
- Common/DTS.Common/Enums/ScriptTypes.cs
|
||||
- Common/DTS.Common/Enums/DestructiveTestChoices.cs
|
||||
- Common/DTS.Common/Enums/InitializationTypes.cs
|
||||
- Common/DTS.Common/Enums/Strings.cs
|
||||
- Common/DTS.Common/Enums/MigrationResult.cs
|
||||
- Common/DTS.Common/Enums/SLICE6MulticastProperties.cs
|
||||
- Common/DTS.Common/Enums/RibbonTabNames.cs
|
||||
- Common/DTS.Common/Enums/IsoSupportLevels.cs
|
||||
- Common/DTS.Common/Enums/TabControlOperation.cs
|
||||
- Common/DTS.Common/Enums/IncludeOverwriteName.cs
|
||||
- Common/DTS.Common/Enums/RibbonControlOperation.cs
|
||||
- Common/DTS.Common/Enums/LogLevels.cs
|
||||
- Common/DTS.Common/Enums/ImportFormats.cs
|
||||
- Common/DTS.Common/Enums/UICultures.cs
|
||||
- Common/DTS.Common/Enums/T0Mode.cs
|
||||
- Common/DTS.Common/Enums/VelocityUnit.cs
|
||||
- Common/DTS.Common/Enums/ImportStatus.cs
|
||||
- Common/DTS.Common/Enums/IsoViewMode.cs
|
||||
- Common/DTS.Common/Enums/PopupWindowImage.cs
|
||||
- Common/DTS.Common/Enums/CanArbBaseBitrate.cs
|
||||
- Common/DTS.Common/Enums/UIItemStatus.cs
|
||||
- Common/DTS.Common/Enums/DigitalOutputs.cs
|
||||
- Common/DTS.Common/Enums/DigitalInputs.cs
|
||||
- Common/DTS.Common/Enums/DataFlag.cs
|
||||
- Common/DTS.Common/Enums/Squibs.cs
|
||||
- Common/DTS.Common/Enums/SupportedExportFormatBitFlags.cs
|
||||
- Common/DTS.Common/Enums/UartBaudRate.cs
|
||||
- Common/DTS.Common/Enums/EnumBindingSourceExtension.cs
|
||||
- Common/DTS.Common/Enums/UDPStreamProfile.cs
|
||||
- Common/DTS.Common/Enums/ExcitationVoltageOptions.cs
|
||||
- Common/DTS.Common/Enums/ApplicationStatusTypes.cs
|
||||
- Common/DTS.Common/Enums/ExportHeaderLine.cs
|
||||
- Common/DTS.Common/Enums/RecordingModes.cs
|
||||
- Common/DTS.Common/Enums/CFCFilter.cs
|
||||
- Common/DTS.Common/Enums/ClockSource.cs
|
||||
generated_at: "2026-04-16T02:53:19.296009+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a48c0a293b2d8942"
|
||||
---
|
||||
|
||||
# DTS.Common.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 operational modes. These enums serve as strongly-typed constants for configuration, state management, UI binding, data serialization, and inter-module communication. They enable type safety, improve code readability, and support UI frameworks through custom type converters and WPF markup extensions. The module is foundational to the system’s configuration and runtime behavior, particularly in areas involving data acquisition, export/import, device communication (UART, CAN, UDP), and user interface presentation.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enums (All in `DTS.Common.Enums` namespace unless otherwise noted)
|
||||
|
||||
#### Basic Enums
|
||||
- **`GPSSentenceTypes`**
|
||||
Represents supported GPS NMEA sentence types.
|
||||
Values: `GPGGA`, `GPRMC`.
|
||||
|
||||
- **`UartDataFormat`**
|
||||
Specifies UART data format modes.
|
||||
Values: `Binary`, `PlainText`, `NMEA`.
|
||||
|
||||
- **`NetworkSelection`**
|
||||
Defines how a network is selected.
|
||||
Values: `Default`, `NetworkId`, `NetworkDesc`.
|
||||
|
||||
- **`ScriptTypes`**
|
||||
Indicates script type for execution.
|
||||
Values: `Migration`, `Initialization`.
|
||||
*Uses `EnumDescriptionTypeConverter` for UI display.*
|
||||
|
||||
- **`DestructiveTestChoices`**
|
||||
Represents user selection for destructive test confirmation.
|
||||
Values: `Yes`, `No`, `NotSet`.
|
||||
|
||||
- **`InitializationTypes`**
|
||||
Specifies initialization method type.
|
||||
Values: `Aero`, `Crash`, `TSRAIR`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`StringReplacementMode`**
|
||||
Controls string replacement behavior.
|
||||
Values: `All`, `First`, `Last`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`MigrationResult`**
|
||||
Result status of a migration operation.
|
||||
Values: `OK`, `ExceptionThrown`, `WarningAllowStreamingModesWasNotMigrated`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`SLICE6Properties`**
|
||||
UDP multicast properties for SLICE6 autodiscovery.
|
||||
Values: `SLICE6MulticastAddress`, `SLICE6MulticastCommandPort`, `SLICE6MulticastResponsePort`.
|
||||
|
||||
- **`RibbonTabNames`**
|
||||
*Static class* defining constants for ribbon tab names (currently `"TBD"` for all).
|
||||
Members: `Tab1`, `Tab2`, `Tab3`.
|
||||
|
||||
- **`IsoSupportLevels`**
|
||||
Defines ISO channel support levels.
|
||||
Values: `ISO_ONLY`, `TRANSITORY`, `NO_ISO`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions sourced from `[Description]` attributes.*
|
||||
|
||||
- **`TabControlOperation`**
|
||||
Represents tab control modification operations.
|
||||
Values: `AddedItem`, `RemovedItem`.
|
||||
|
||||
- **`IncludeOverwriteName`**
|
||||
Specifies options for including/overwriting names in UI.
|
||||
Values: `IncludedCheckBox`, `OverwriteCheckBox`, `ImportingTestSetupName`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`ExportChoices`**
|
||||
Defines export configuration options.
|
||||
Values: `ExportType`, `UnfilteredEUCheckBox`, `FilteredEUCheckBox`, `MVCheckBox`, `ADCCheckBox`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`RibbonControlOperation`**
|
||||
Represents ribbon control modification operations.
|
||||
Values: `AddedItem`, `RemovedItem`.
|
||||
|
||||
- **`LogLevels`**
|
||||
Log severity levels.
|
||||
Values: `TRACE=1`, `DEBUG=2`, `INFO=3`, `WARN=4`, `ERROR=5`, `CRITICAL=6`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys (e.g., `"LogLevel_Trace"`).*
|
||||
|
||||
- **`ImportFormats`** *(in `DTS.Common.Import.Enums`)*
|
||||
Supported import file formats.
|
||||
Values: `NOT_SPECIFIED`, `DTS_XML`, `ISF`, `TSF`, `DTS_CSV`, `TTS_XML`, `CrashDesigner_XML`, `E2X`, `TTS_CSV`.
|
||||
|
||||
- **`ImportFileFormat`** *(in `DTS.Common.Import.Enums`)*
|
||||
Classifies import files by test setup count.
|
||||
Values: `NoTestSetup`, `SingleTestSetup`, `MultipleTestSetup`.
|
||||
|
||||
- **`UICultures`**
|
||||
Supported UI languages/cultures.
|
||||
Values: `de_DE`, `en_US`, `es_ES`, `fr_FR`, `it_IT`, `ja_JP`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys (e.g., `"UICultures_de-DE"`).*
|
||||
|
||||
- **`T0Mode`** *(in `DTS.Common` namespace)*
|
||||
T0 trigger mode.
|
||||
Values: `DAS=0`, `Test=1`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
**Also defines**: `T0ModeItemSource : IItemsSource` — returns list of `T0Mode` values.
|
||||
|
||||
- **`VelocityUnit`**
|
||||
Velocity unit options.
|
||||
Values: `KilometerPerHour=0`, `MeterPerSecond=1`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys.*
|
||||
|
||||
- **`ImportExtraStatus`** *(in `DTS.Common.Import.Enums`)*
|
||||
Detailed status during import process.
|
||||
Values: `None`, `NormalizingIds`, `ReadingCalibrations`, ..., `ReadingXML`.
|
||||
|
||||
- **`PossibleStatus`** *(in `DTS.Common.Import.Enums`)*
|
||||
High-level import status.
|
||||
Values: `Waiting`, `Working`, `Done`, `Failed`, `Reading`, `Importing`.
|
||||
|
||||
- **`IsoViewMode`**
|
||||
Controls ISO channel view display mode.
|
||||
Values: `ISOOnly`, `ISOAndUserCode`, `UserCodeOnly`, `ChannelNameOnly`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
**Also defines**: `IsoViewModeStatic` — *abstract class* with static property `ViewMode { get; set; }` to hold current view mode across modules.
|
||||
|
||||
- **`PopupWindowImage`**
|
||||
Specifies icon type for popup windows.
|
||||
Values: `Warning=0`, `Error=1`, `Question=2`, `Information=3`.
|
||||
|
||||
- **`CanArbBaseBitrate`**
|
||||
CAN arbitration base bitrates.
|
||||
Values: `_50000=50000`, `_62000=62000`, ..., `_1000000=1000000`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys.*
|
||||
|
||||
- **`UIItemStatus`**
|
||||
Status of UI items (e.g., validation results).
|
||||
Values: `None`, `Success`, `Failed`, `Error`, `Warning`.
|
||||
|
||||
- **`DigitalOutputModes`**
|
||||
Digital output configuration modes.
|
||||
Values: `NONE=0`, `FVLH=1`, `FVHL=2`, `CCNO=4`, `CCNC=8`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys.*
|
||||
*Note: Values are bit flags (powers of two).*
|
||||
|
||||
- **`DigitalInputModes`**
|
||||
Digital input configuration modes.
|
||||
Values: `NONE=1`, `TLH=2`, `THL=4`, `CCNO=8`, `CCNC=16`.
|
||||
*Uses `EnumDescriptionTypeConverter`; descriptions are resource keys.*
|
||||
*Note: Values are bit flags.*
|
||||
|
||||
- **`DataFlag`** *(in `DTS.Common` namespace)*
|
||||
Data quality flags.
|
||||
Values: `None=0`, `Normal=1`, `Saturated=2`, `ZeroCrossing=3`, `BrokenWire=4`, `Other=-1`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
**Also defines**: `DataFlagItemSource : IItemsSource`.
|
||||
|
||||
- **`SquibMeasurementType`**
|
||||
Squib measurement modes.
|
||||
Values: `NONE=0`, `CURRENT=1`, `INIT_SIGNAL=2`, `VOLTAGE=4`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`SquibFireMode`**
|
||||
Squib firing modes.
|
||||
Values: `NONE=1`, `CAP=2`, `CONSTANT=4`, `AC=8`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
|
||||
- **`SupportedExportFormatBitFlags`**
|
||||
Export format capabilities as bit flags.
|
||||
Values: `none`, `csvunfiltered`, `diademadc`, ..., `Ch10FilteredEU`, `FIATASC`, etc.
|
||||
*Uses `[Flags]` attribute.*
|
||||
|
||||
- **`UartBaudRate`**
|
||||
UART baud rates.
|
||||
Values: `_110=110`, `_300=300`, ..., `_921600=921600`.
|
||||
*Uses `EnumDescriptionTypeConverter`; underlying type is `uint`.*
|
||||
|
||||
- **`EnumBindingSourceExtension`**
|
||||
WPF `MarkupExtension` for binding to enum values in XAML.
|
||||
- `EnumType { get; set; }`: The enum type to bind to.
|
||||
- `ProvideValue(...)`: Returns array of enum values (or array + `null` if nullable enum).
|
||||
*Validates that `EnumType` is an enum type.*
|
||||
|
||||
- **`UDPStreamProfile`**
|
||||
UDP streaming profiles for S6A/CH10/TmNS.
|
||||
Values: `RTCStreaming=0`, `DTS_UDP=1`, `CH10_MANUAL_CONFIG=2`, ..., `UART_STREAM=14`.
|
||||
*Uses `EnumDescriptionTypeConverter`; underlying type is `byte`.*
|
||||
|
||||
- **`ExcitationVoltageOptions`** *(in `DTS.Common.Enums`)*
|
||||
Excitation voltage options.
|
||||
- Nested enum: `ExcitationVoltageOption` with values `Undefined=1`, `Volt2=2`, `Volt2_5=4`, ..., `Volt1=64`.
|
||||
- Nested class: `VoltageMagnitudeAttribute : Attribute` — stores `double Value`.
|
||||
- Nested class: `VoltageMagnitudeAttributeCoder` — helper to extract `double` values from enum fields.
|
||||
|
||||
- **`ApplicationStatusTypes`**
|
||||
Comprehensive list of application status states (e.g., `IDLE`, `Armed`, `Failed`, `Downloading`, `WaitingForTrigger`, etc.).
|
||||
Over 100 values covering DAS states, error conditions, and UI states.
|
||||
|
||||
- **`FtssHeaderLine`**
|
||||
CSV export header line labels.
|
||||
Values: `Headers`, `TestDate`, `SampleRate`, `IsoCode`, ..., `DataStart`, `Labels`.
|
||||
*Uses `[Description]` attributes for display text.*
|
||||
|
||||
- **`UartHeaders`**
|
||||
UART-related header labels.
|
||||
Values: `Latitude`, `Longitude`, `Altitude`, `Velocity`, `Direction`, `Valid?`, `GPRMC`, `GPGGA`.
|
||||
|
||||
- **`XLSXExportHeaderLine`**
|
||||
XLSX export header line labels (subset of `FtssHeaderLine`).
|
||||
Values: `Headers`, `TestDate`, ..., `DataStart`, `Labels`.
|
||||
|
||||
- **`RecordingModes`**
|
||||
Data acquisition recording modes.
|
||||
Values: `CircularBuffer`, `Recorder`, `S6A_DeviceStreamingOnly`, ..., `RecordOnBootPlusUART`, etc.
|
||||
*Uses `[Description]` and `[ProgrammableTriggers(...)]` attributes.*
|
||||
**Also defines**:
|
||||
- `NonStreamingRecordingModeItemsSource : RecordingModeItemsSource` — filters out streaming modes.
|
||||
- `RecordingModeItemsSource : IItemsSource` — base class for UI item sources.
|
||||
|
||||
- **`CFCFilter`** *(in `DTS.Common` namespace)*
|
||||
Software filter CFC (Cumulative Filter Characteristic) classes.
|
||||
Values: `None=0`, `Unfiltered=-2`, `Class10=17`, `Class60=100`, `Class180=300`, `Class600=1000`, `Class1000=1650`.
|
||||
*Uses `EnumDescriptionTypeConverter`.*
|
||||
**Also defines**:
|
||||
- `CFCFilterItemSource : IItemsSource`.
|
||||
- `CFCFilterDTSFileStringConverter` — static class with methods:
|
||||
- `GetFilterFromString(string)`
|
||||
- `GetIsoCodeFromString(string, bool)`
|
||||
- `FilterClassToString(IFilterClass)`
|
||||
- `FilterClassToCFC(IFilterClass, bool)`
|
||||
- `CFCFilterToCFC(CFCFilter, bool)`
|
||||
|
||||
- **`ClockSyncProfile`**
|
||||
Clock synchronization profiles (PTP, IRIG, GPS, PPS, etc.).
|
||||
Values: `None=0`, `Manual`, `Slave_E2E`, ..., `EXT_PPS_Master_E2E_PPS_OUT`.
|
||||
*Uses `EnumDescriptionTypeConverter`; underlying type is `byte`.*
|
||||
**Also defines**:
|
||||
- `MasterClockSyncProfileItemsSource`, `SlaveClockSyncProfileItemsSource` — derived from `ProfileSourceItemsSource`.
|
||||
- `ProfileSourceItemsSource : IItemsSource`.
|
||||
|
||||
- **`InputClockSource`**
|
||||
Input clock source bit flags.
|
||||
Values: `None=0`, `PTP=1`, `IRIG=2`, `GPS=4`, `OnePPS=8`, ..., `GPS_OnePPS=6`.
|
||||
*Uses `EnumDescriptionTypeConverter`; underlying type is `byte`.*
|
||||
|
||||
- **`OutputClockSource`**
|
||||
Output clock source bit flags.
|
||||
Values: `None=0`, `PTP=255`, `PTPMasterE2E=1`, ..., `EXT_PPS_Master_E2E_PPS_OUT`.
|
||||
*Uses `EnumDescriptionTypeConverter`; underlying type is `byte`.*
|
||||
|
||||
### Extension Methods
|
||||
- **`HeaderLineExtension.GetDescription(this Enum genericEnum)`**
|
||||
Returns the `DescriptionAttribute.Description` value if present; otherwise returns `ToString()`.
|
||||
Used by `FtssHeaderLine`, `UartHeaders`, `XLSXExportHeaderLine`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Enum Values Are Bit Flags Where Applicable**:
|
||||
`DigitalOutputModes`, `DigitalInputModes`, `SquibMeasurementType`, `SquibFireMode`, `SupportedExportFormatBitFlags`, `InputClockSource`, and `OutputClockSource` use bit-flag semantics (powers of two or explicit `|` combinations). Consumers must use bitwise operations for combinations.
|
||||
|
||||
- **Description Attributes Are Required for UI Display**:
|
||||
Enums using `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` rely on `[Description]` or `[DescriptionResource]` attributes for UI text. Missing attributes will fall back to `ToString()`.
|
||||
|
||||
- **Resource Keys vs. Literal Descriptions**:
|
||||
- `LogLevels`, `UICultures`, `VelocityUnit`, `CanArbBaseBitrate`, `DigitalOutputModes`, `DigitalInputModes`, `SquibFireMode`, `CFCFilter`, `UDPStreamProfile`, `ClockSyncProfile`, `InputClockSource`, `OutputClockSource` use `[DescriptionResource(...)]` — values are *resource keys*, not literal strings.
|
||||
- `FtssHeaderLine`, `UartHeaders`, `XLSXExportHeaderLine`, `IsoSupportLevels`, `RecordingModes` use `[Description(...)]` — values are *literal strings*.
|
||||
|
||||
- **Underlying Types Are Explicit**:
|
||||
- `UartBaudRate` → `uint`
|
||||
- `UDPStreamProfile` → `byte`
|
||||
- `ClockSyncProfile`, `InputClockSource`, `OutputClockSource` → `byte`
|
||||
|
||||
- **Static State in `IsoViewModeStatic`**:
|
||||
`IsoViewModeStatic.ViewMode` holds current view mode globally but does *not* persist or retrieve from DB — must be set explicitly.
|
||||
|
||||
- **`RibbonTabNames` Constants Are Placeholders**:
|
||||
All constants (`Tab1`, `Tab2`, `Tab3`) are `"TBD"` — not yet finalized.
|
||||
|
||||
- **`EnumBindingSourceExtension` Validation**:
|
||||
Throws `ArgumentException` if `EnumType` is not an enum; throws `InvalidOperationException` if `EnumType` is not set before `ProvideValue`.
|
||||
|
||||
- **`SelectedItemsStatus` Thread Safety**:
|
||||
Uses `lock` on `_ListStatus` dictionary — safe for concurrent access.
|
||||
|
||||
- **`CFCFilterDTSFileStringConverter` Defaults**:
|
||||
`GetFilterFromString` returns `CFCFilter.Unfiltered` for unrecognized input.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Module Dependencies
|
||||
- **`DTS.Common.Converters`**:
|
||||
Used by `EnumDescriptionTypeConverter` (referenced via `[TypeConverter]` attributes).
|
||||
*Implied dependency: `EnumDescriptionTypeConverter` must be implemented in this namespace.*
|
||||
|
||||
- **`DTS.Common.Base.Classes`**:
|
||||
Used by `T0ModeItemSource`, `CFCFilterItemSource`, `DataFlagItemSource`, `RecordingModeItemsSource`, `ProfileSourceItemsSource` via `IItemsSource` interface.
|
||||
|
||||
- **`DTS.Common.Utils`**:
|
||||
Used by `T0ModeItemSource`, `CFCFilterItemSource`, `DataFlagItemSource`, `EnumBindingSourceExtension` via `EnumUtil.GetValuesList<T>()`.
|
||||
|
||||
- **`DTS.Common.Attributes`**:
|
||||
Used by `RecordingModes` via `[ProgrammableTriggers(...)]` attribute.
|
||||
|
||||
- **`DTS.Common.Utilities`**:
|
||||
Used by `ExcitationVoltageOptions` via `VoltageMagnitudeAttribute`.
|
||||
|
||||
- **`Xceed.Wpf.Toolkit.PropertyGrid.Attributes`**:
|
||||
Used by `T0Mode`, `DataFlag`, `CFCFilter`, `RecordingModes` via `IItemsSource` interface.
|
||||
|
||||
- **WPF Framework**:
|
||||
`EnumBindingSourceExtension` inherits `MarkupExtension` — requires WPF.
|
||||
|
||||
- **System.ComponentModel**:
|
||||
Used for `DescriptionAttribute`.
|
||||
|
||||
- **`DTS.Common.Import.Enums`**:
|
||||
Nested namespace for import-related enums (`ImportFormats`, `ImportFileFormat`, `ImportExtraStatus`, `PossibleStatus`).
|
||||
|
||||
### Inferred Consumers
|
||||
- UI layers (WPF) — via `EnumDescriptionTypeConverter`, `EnumBindingSourceExtension`, `[Description]` attributes.
|
||||
- Export/Import modules — `ImportFormats`, `FtssHeaderLine`, `UartHeaders`, `XLSXExportHeaderLine`.
|
||||
- DAS (Data Acquisition System) — `ApplicationStatusTypes`, `RecordingModes`, `ClockSyncProfile`, `DigitalInputModes`, `DigitalOutputModes`, `SquibMeasurementType`,
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Channels/ChannelCodeType.cs
|
||||
generated_at: "2026-04-16T03:21:26.344972+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bc6b8c24b93cadcb"
|
||||
---
|
||||
|
||||
# Channels
|
||||
|
||||
## 1. Purpose
|
||||
This module defines shared enumerations and constants related to channel code types within the DTS system. It serves as a centralized source of truth for identifying and validating channel codes—specifically distinguishing between standardized ISO 13499 codes and custom user-defined codes—ensuring consistency across modules that handle channel identification, serialization, or validation.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes a single nested `enum` and four `public const` fields within the `ChannelEnumsAndConstants` class:
|
||||
|
||||
- **`ChannelCodeType`** (`enum`)
|
||||
A two-valued enumeration indicating the type of channel code:
|
||||
- `ISO` — Represents a channel code conforming to the ISO 13499 standard.
|
||||
- `User` — Represents a user-defined (non-standardized) channel code.
|
||||
|
||||
- **`IsoCodeTypeString`** (`public const string`)
|
||||
Value: `"ISO 13499"`
|
||||
Used as a human-readable identifier for the ISO channel code type.
|
||||
|
||||
- **`UserCodeTypeString`** (`public const string`)
|
||||
Value: `"User"`
|
||||
Used as a human-readable identifier for the user-defined channel code type.
|
||||
|
||||
- **`ISO_CODE_LENGTH`** (`public const int`)
|
||||
Value: `16`
|
||||
Specifies the expected fixed length (in characters) of an ISO channel code.
|
||||
|
||||
- **`USER_CODE_LENGTH`** (`public const int`)
|
||||
Value: `50`
|
||||
Specifies the maximum allowed length (in characters) of a user-defined channel code.
|
||||
|
||||
## 3. Invariants
|
||||
- Any channel code of type `ChannelCodeType.ISO` must be exactly `ISO_CODE_LENGTH` (16) characters long.
|
||||
- Any channel code of type `ChannelCodeType.User` must be no longer than `USER_CODE_LENGTH` (50) characters.
|
||||
- The string values of `IsoCodeTypeString` and `UserCodeTypeString` are immutable and intended for display or serialization purposes only.
|
||||
- The `ChannelCodeType` enum values (`ISO`, `User`) are exhaustive and mutually exclusive; no other code types are defined in this module.
|
||||
|
||||
## 4. Dependencies
|
||||
- **No external dependencies**: The file contains no `using` directives and defines all its members inline.
|
||||
- **Used by**: Based on naming and structure, this module is likely referenced by higher-level components handling channel configuration, data import/export, or validation logic (e.g., in `DTS.Common` or downstream projects), though no explicit consumers are visible in the provided source.
|
||||
|
||||
## 5. Gotchas
|
||||
- The `ChannelCodeType` enum is defined *inside* the `ChannelEnumsAndConstants` class (not as a top-level type), so consumers must reference it as `ChannelEnumsAndConstants.ChannelCodeType`.
|
||||
- `USER_CODE_LENGTH` defines a *maximum* length (≤50), whereas `ISO_CODE_LENGTH` defines an *exact* length (=16); validation logic must respect this distinction.
|
||||
- The constants `IsoCodeTypeString` and `UserCodeTypeString` are string literals—not enum-based—so string comparisons (e.g., `codeTypeString == ChannelEnumsAndConstants.IsoCodeTypeString`) may be error-prone; prefer using the `ChannelCodeType` enum where possible.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Communication/CommunicationConstantsAndEnums.cs
|
||||
generated_at: "2026-04-16T03:21:11.012586+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "009da99cbbcb47bb"
|
||||
---
|
||||
|
||||
# Communication
|
||||
|
||||
### **1. Purpose**
|
||||
This module defines core enumerations and delegates used for representing the outcomes of communication operations and for implementing callback mechanisms in the DTS communication subsystem. It serves as a shared contract between communication implementations and higher-level consumers, ensuring consistent reporting of connection, disconnection, send, receive, and cancellation events across the system.
|
||||
|
||||
---
|
||||
|
||||
### **2. Public Interface**
|
||||
|
||||
- **`CommunicationResult` enum**
|
||||
A strongly-typed enumeration of possible outcomes for communication operations. Each value corresponds to a specific state or result of a communication action:
|
||||
- `ConnectOK`, `ConnectFailed`, `ConnectTimeout` — outcomes of a connection attempt.
|
||||
- `DisconnectOK`, `DisconnectFailed`, `DisconnectTimeout` — outcomes of a disconnection attempt.
|
||||
- `SendOK`, `SendFailed`, `SendTimeout` — outcomes of a send operation.
|
||||
- `ReceiveOK`, `ReceiveFailed`, `ReceiveTimeout` — outcomes of a receive operation.
|
||||
- `Canceled` — indicates the operation was canceled (e.g., by user or timeout).
|
||||
|
||||
- **`CommunicationCallback` delegate**
|
||||
```csharp
|
||||
public delegate bool CommunicationCallback(ICommunicationReport report);
|
||||
```
|
||||
A function pointer type used to register callbacks that process communication reports. It takes an `ICommunicationReport` instance as input and returns a `bool` (typically indicating whether the callback handled the report successfully or whether further processing should continue).
|
||||
|
||||
---
|
||||
|
||||
### **3. Invariants**
|
||||
- The `CommunicationResult` enum values are exhaustive for reporting the status of communication operations; no other result codes are defined in this module.
|
||||
- Callbacks registered via `CommunicationCallback` must accept and process an `ICommunicationReport` instance; the return value semantics (e.g., `true` = handled, `false` = not handled) are implied by usage but not enforced by this module.
|
||||
- No runtime validation or normalization of enum values is performed in this module; consumers are responsible for interpreting results consistently.
|
||||
|
||||
---
|
||||
|
||||
### **4. Dependencies**
|
||||
|
||||
- **Dependencies *of* this module**:
|
||||
- `DTS.Common.Interface.Communication.ICommunicationReport` — referenced by the `CommunicationCallback` delegate. This interface is expected to define the contract for communication reports (e.g., containing result type, timestamp, payload, etc.), but its definition is not included here.
|
||||
|
||||
- **Dependencies *on* this module**:
|
||||
- Any module implementing or consuming communication operations (e.g., network drivers, protocol handlers, UI components) is expected to reference this module to interpret operation outcomes and register callbacks.
|
||||
- The namespace `DTS.Common.Enums.Communication` suggests this is part of a shared common library (`DTS.Common`), implying usage across multiple components in the DTS ecosystem.
|
||||
|
||||
---
|
||||
|
||||
### **5. Gotchas**
|
||||
- **No explicit mapping between `CommunicationResult` and `ICommunicationReport` is defined here** — consumers must infer how report contents (e.g., `ICommunicationReport.Result`) correspond to `CommunicationResult` enum values.
|
||||
- **`Canceled` is a generic result** — it does not specify *which* operation was canceled (e.g., connect vs. send); callers must inspect the report context (e.g., via `ICommunicationReport.OperationType`, if defined) to disambiguate.
|
||||
- **Return value semantics of `CommunicationCallback` are not standardized in this file** — the meaning of `true`/`false` depends on the calling convention (e.g., chain-of-responsibility vs. fire-and-forget).
|
||||
- **No error codes or exception details are included** — the enum only captures high-level outcomes; detailed diagnostics must be embedded in the `ICommunicationReport` instance passed to callbacks.
|
||||
|
||||
None identified beyond the above.
|
||||
131
enriched-qwen3-coder-next/Common/DTS.Common/Enums/DASFactory.md
Normal file
131
enriched-qwen3-coder-next/Common/DTS.Common/Enums/DASFactory.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DASFactory/WakeupTriggers.cs
|
||||
- Common/DTS.Common/Enums/DASFactory/UseCasesTSRAIR.cs
|
||||
- Common/DTS.Common/Enums/DASFactory/S6DBDiagnosticChannelList.cs
|
||||
- Common/DTS.Common/Enums/DASFactory/ConstantsAndEnums.cs
|
||||
generated_at: "2026-04-16T03:21:12.809680+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c58d9167734fa176"
|
||||
---
|
||||
|
||||
# DASFactory
|
||||
|
||||
## Documentation: DASFactory Enumerations Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines core enumerations used throughout the DAS (Data Acquisition System) factory configuration and diagnostics subsystem. It centralizes type-safe representations of device types, wakeup triggers, use cases, and diagnostic channel identifiers for the DAS family (e.g., TSR, G5, SLICE variants), enabling consistent interpretation of device capabilities, operational modes, and health monitoring across the codebase. The enums are designed for serialization, localization (via `EnumDescriptionTypeConverter`), and tight coupling to hardware-specific channel mappings.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `enum WakeupTriggers`
|
||||
- **Namespace**: `DTS.Common.Enums.DASFactory`
|
||||
- **Underlying type**: `int` (default)
|
||||
- **Members**:
|
||||
- `MotionDetect`: Represents a motion-detection-based wakeup trigger.
|
||||
- **Attributes**:
|
||||
- `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` enables localized description extraction via `DescriptionAttribute`.
|
||||
- `MotionDetect` has `[Description("WakeupTriggers_MotionDetect")]`.
|
||||
|
||||
#### `enum UseCasesTSRAIR : byte`
|
||||
- **Namespace**: `DTS.Common.Enums.DASFactory`
|
||||
- **Underlying type**: `byte`
|
||||
- **Members**:
|
||||
- `AEROSPACE`: Standard aerospace use case.
|
||||
- `AEROSPACE_with_motion`: Aerospace use case with motion-triggered acquisition.
|
||||
- `VIBRATION`: Vibration monitoring use case.
|
||||
- `SCHEDULED`: Scheduled periodic acquisition.
|
||||
- `INTERVAL`: Interval-based acquisition.
|
||||
- `STREAMING`: Continuous streaming mode.
|
||||
- `PRETRIGGER_TEST`: Pretrigger diagnostic/test mode.
|
||||
- **Attributes**:
|
||||
- `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`
|
||||
- Each member has a `[Description(...)]` attribute with a string key (e.g., `"Aerospace"`, `"Aerospace with motion"`).
|
||||
|
||||
#### `enum S6DBDiagnosticChannelList`
|
||||
- **Namespace**: `DTS.Common.Enums.DASFactory`
|
||||
- **Underlying type**: `int` (default)
|
||||
- **Members**:
|
||||
- **Base channels** (matching legacy "Base" channels):
|
||||
- `InputVoltage = 0`
|
||||
- `BackupVoltage = 1`
|
||||
- `TemperatureC = 2`
|
||||
- `BatterySoc = 3`
|
||||
- **Extended diagnostic channels**:
|
||||
- `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`
|
||||
- **Notes**:
|
||||
- Commented-out `DiagChargerDischargeCurrent = 104` is superseded by `DiagEnv_1_Temperature = 104`.
|
||||
- `DiagEnv_X_Temperature`/`DiagEnv_X_Humidity` map to 5 environmental sensor zones.
|
||||
|
||||
#### `enum ConstantsAndEnums.DASType`
|
||||
- **Namespace**: `DTS.Common.Enums.DASFactory.ConstantsAndEnums`
|
||||
- **Underlying type**: `int` (default)
|
||||
- **Members**:
|
||||
- `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`
|
||||
- **Purpose**: Identifies the physical/logical device type in the system.
|
||||
|
||||
#### `enum ConstantsAndEnums.VoltageStatusColor`
|
||||
- **Namespace**: `DTS.Common.Enums.DASFactory.ConstantsAndEnums`
|
||||
- **Underlying type**: `int` (default)
|
||||
- **Members**:
|
||||
- `Green`, `Red`, `Yellow`, `Off`
|
||||
- **Purpose**: Represents voltage status indicator colors (likely for UI or status reporting).
|
||||
|
||||
#### Constants (in `ConstantsAndEnums`)
|
||||
- `EVENT_NUMBER_PRETEST_DIAG = -1`: Identifier for pre-test diagnostic events.
|
||||
- `EVENT_NUMBER_POSTTEST_DIAG = -2`: Identifier for post-test diagnostic events.
|
||||
- `EVENT_NUMBER_MEASURE_BRIDGE = -3`: Identifier for bridge measurement events.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **Channel numbering**: `S6DBDiagnosticChannelList` uses disjoint ranges:
|
||||
- Base channels: `[0, 3]`
|
||||
- Extended diagnostic channels: `[100, 119]`
|
||||
- No overlap between ranges.
|
||||
- **Use case enum**: `UseCasesTSRAIR` is explicitly typed as `byte`, implying storage/serialization efficiency (e.g., for protocol payloads).
|
||||
- **Event number constants**: Negative values (`-1`, `-2`, `-3`) are reserved for special diagnostic events, implying positive values are used for standard measurement events.
|
||||
- **Localization contract**: All enums use `EnumDescriptionTypeConverter`, requiring `DescriptionAttribute` on all members for correct behavior. Missing attributes may cause runtime errors during localization/description resolution.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Imports/uses**:
|
||||
- `DTS.Common.Base.Classes` (only referenced in `WakeupTriggers.cs`; purpose unclear from source).
|
||||
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (used by `WakeupTriggers` and `UseCasesTSRAIR`).
|
||||
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverter`).
|
||||
- **Depended on by**:
|
||||
- Other modules in the `DTS.Common` library (e.g., device configuration, diagnostics, and protocol layers) likely consume these enums.
|
||||
- `DASType` is used to distinguish device-specific behavior (e.g., in device drivers or factory test logic).
|
||||
- `S6DBDiagnosticChannelList` is likely used in data logging, telemetry, and health-monitoring components.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Channel ID conflict**: `DiagChargerDischargeCurrent = 104` is commented out but `DiagEnv_1_Temperature = 104` is active. If legacy code references `DiagChargerDischargeCurrent`, it will silently resolve to `DiagEnv_1_Temperature`.
|
||||
- **Missing descriptions**: `ConstantsAndEnums.DASType` and `ConstantsAndEnums.VoltageStatusColor` lack `[Description]` attributes. Using `EnumDescriptionTypeConverter` on these enums may produce empty/incorrect descriptions.
|
||||
- **Ambiguous `WakeupTriggers`**: Only `MotionDetect` is defined. Future triggers may require enum extension, but the current design does not support multiple triggers simultaneously (no `[Flags]` attribute).
|
||||
- **No validation**: No runtime checks enforce valid ranges (e.g., casting arbitrary `int` to `S6DBDiagnosticChannelList` is allowed).
|
||||
- **No documentation for `DASType` members**: Meanings of device types (e.g., `TOM`, `DIM`, `TSR2`) are not explained in source.
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DBExport/TestObjectFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/CustomDirectionFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/CustomFinLoc2Fields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/CustomFinLoc1Fields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/CustomFinLoc3Fields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/CustomFilterFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/PositionFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/MainLocationFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/PhysicalDimensionFields.cs
|
||||
- Common/DTS.Common/Enums/DBExport/TopLevelFields.cs
|
||||
generated_at: "2026-04-16T03:20:09.296204+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "968ad729b3c9621d"
|
||||
---
|
||||
|
||||
# Documentation: DBExport Enumerations (`DTS.Common.Enums.DBExport`)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines a set of strongly-typed enumerations that represent field names used for mapping database records to XML export structures for various domain objects in the DTS (likely *Data Transfer System*) framework. Each enumeration corresponds to a specific type of database entity (e.g., `TestObject`, `FineLocation1`, `FilterClass`, `PhysicalDimension`) and enumerates the XML tag names (as string-equivalent identifiers) that should be used when serializing or deserializing instances of that entity during database export/import operations. These enums act as a contract between the data layer and the XML export pipeline, ensuring consistent field naming across the system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
All types in this module are **public enums**. No classes, methods, or properties are exposed.
|
||||
|
||||
| Enum Name | Field Values (in declaration order) | Notes |
|
||||
|-----------|-------------------------------------|-------|
|
||||
| `TestObjectFields` | `s_GUID`, `TEST_OBJECT`, `TEXT_L1`, `TEXT_L2`, `VERSION`, `DATE`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY` | Used for `ISODll.TestObject`. Note: `s_GUID` uses lowercase `s_` prefix, unlike most others. |
|
||||
| `CustomDirectionFields` | `Direction`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.MMEDirection`. `Direction` maps to the primary identifier. |
|
||||
| `CustomFinLoc1Fields` | `Date`, `Expired`, `Fine_Loc_1`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.FineLocation1`. |
|
||||
| `CustomFinLoc2Fields` | `Date`, `Expired`, `Fine_Loc_2`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.FineLocation2`. |
|
||||
| `CustomFinLoc3Fields` | `Date`, `Expired`, `Fine_Loc_3`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.MMEFineLocation3`. |
|
||||
| `CustomFilterFields` | `Date`, `Expired`, `Filter_Class`, `History`, `Last_Change`, `Last_Change_Text`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.MME_FilterClass`. |
|
||||
| `PositionFields` | `Date`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Position`, `RecordType`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Version` | Used for `ISODll.MMEPositions`. Includes `RecordType`. |
|
||||
| `MainLocationFields` | `Date`, `Expired`, `History`, `Last_Change`, `Last_Change_Text`, `Picture_ShortName`, `Remarks`, `S_GUID`, `SortKey`, `Text_L1`, `Text_L2`, `Trans_Main_Loc`, `Type`, `Version` | Used for `ISODll.MMETransducerMainLocation`. Includes `Picture_ShortName`, `Trans_Main_Loc`, and `Type`. |
|
||||
| `PhysicalDimensionFields` | `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` | Used for `ISODll.MMEPhysicalDimension`. Contains SI base unit exponent fields (e.g., `Length_EXP`, `Time_EXP`). |
|
||||
| `TopLevelFields` | `CustomerDetails`, `TestEngineerDetails`, `LabDetails`, `DASList`, `SensorModels`, `Sensors`, `Calibrations`, `CustomDirections`, `CustomFilterClasses`, `CustomTestObjects`, `CustomFinLoc1s`, `CustomFinLoc2s`, `CustomFinLoc3s`, `CustomMainLocs`, `CustomPhysicalDimensions`, `CustomPositions`, `CustomChannels`, `GroupTemplates`, `Groups`, `TestSetups`, `Users`, `GlobalSettings`, `SensorChangeHistory` | Represents top-level XML container tags. Includes a comment indicating `SensorChangeHistory` was introduced in V7. |
|
||||
|
||||
> **Note**: All enum values are declared in PascalCase (except `TestObjectFields.s_GUID`, which uses `s_` prefix), and use underscores (`_`) to separate words in multi-word identifiers (e.g., `Last_Change_Text`, `Fine_Loc_1`).
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Consistency within each enum**: Each enum’s values represent the *complete set* of field names used for a specific entity type in the XML export schema. No field should be missing or duplicated *within a single enum*.
|
||||
- **Naming convention**: Except for `TestObjectFields.s_GUID`, all field names use `PascalCase` with underscores (`_`) as word separators. `s_GUID` is an exception (lowercase `s_` prefix).
|
||||
- **Common fields across most enums**: Most enums include the following fields: `S_GUID` (or `GUID`), `DATE`, `VERSION`, `REMARKS`, `EXPIRED`, `SORTKEY`, `LAST_CHANGE`, `LAST_CHANGE_TEXT`, `HISTORY`, `TEXT_L1`, `TEXT_L2`. The presence/absence of `RecordType` and domain-specific fields (e.g., `Fine_Loc_1`, `Filter_Class`, `Position`) distinguishes the enums.
|
||||
- **Top-level enum scope**: `TopLevelFields` enumerates *root XML elements* only—not nested fields. It does not overlap with the other domain-specific field enums.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
- **Internal dependencies**:
|
||||
- These enums are defined in the `DTS.Common` assembly (namespace `DTS.Common.Enums.DBExport`).
|
||||
- They are referenced by code that handles XML serialization/deserialization of database entities, likely in modules dealing with `ISODll.*` types (e.g., `ISODll.TestObject`, `ISODll.MME_FilterClass`, etc.).
|
||||
- The `TopLevelFields` enum likely drives the top-level structure of the export XML document.
|
||||
|
||||
- **External dependencies**:
|
||||
- The comments reference `ISODll.*` types (e.g., `ISODll.MMEDirection`, `ISODll.FineLocation1`), implying a dependency on the `ISODll` native or interop library (not included in this module).
|
||||
- No external .NET or third-party dependencies are declared in the source files.
|
||||
|
||||
- **Depended upon by**:
|
||||
- XML export/import logic (not shown here) that maps database records to XML elements using these enum values as tag names.
|
||||
- Possibly validation or schema-checking components that rely on these field names.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Inconsistent `GUID` naming**:
|
||||
- `TestObjectFields` uses `s_GUID`, while all other enums use `S_GUID` (uppercase `S_`). `CustomDirectionFields` uses `GUID` (no `S_` prefix). This inconsistency may cause mismatches if field name mapping is case-sensitive or expects uniform prefixes.
|
||||
|
||||
- **`S_GUID` vs `s_GUID` vs `GUID`**:
|
||||
- The three variants (`s_GUID`, `S_GUID`, `GUID`) across enums suggest possible legacy naming differences or evolving schema conventions. Care must be taken when writing generic export logic to handle these variations.
|
||||
|
||||
- **`TopLevelFields` includes pluralized names**:
|
||||
- E.g., `CustomFinLoc1s`, `CustomMainLocs`, `CustomFilterClasses`. This implies the XML structure uses pluralized root tags for collections, but the corresponding *field* enums (e.g., `CustomFinLoc1Fields`) use singular names for individual record fields. Confusing these could lead to incorrect XML generation.
|
||||
|
||||
- **Missing `CustomChannels` field enum**:
|
||||
- `TopLevelFields` includes `CustomChannels`, but no corresponding `CustomChannelFields` enum is defined in the provided source files. This suggests either:
|
||||
- The enum is defined elsewhere,
|
||||
- It is unused or deprecated, or
|
||||
- It is an oversight in the codebase.
|
||||
→ **Unclear from source alone.**
|
||||
|
||||
- **`PhysicalDimensionFields` has mixed casing in exponent fields**:
|
||||
- `Luminous_Intensity_Exp` uses `Exp` (not `EXP` like others: `Length_EXP`, `Time_EXP`). This may be intentional (e.g., legacy naming) or a typo—requires verification.
|
||||
|
||||
- **No validation or constraints**:
|
||||
- These are plain enums with no runtime validation. It is possible to assign arbitrary integer values or mix enums (e.g., cast `PositionFields.Position` to `TestObjectFields`), which could lead to runtime errors if used incorrectly in XML mapping.
|
||||
|
||||
- **No documentation for field semantics**:
|
||||
- While the enum names are clear, the *meaning* of each field (e.g., what `LAST_CHANGE` vs `LAST_CHANGE_TEXT` represents) is not documented here. This must be inferred from the underlying `ISODll` types or database schema.
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/TimeUnitType.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/FilterOption.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/YRangeScale.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/WakeMethodType.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/ChartUnitType.cs
|
||||
generated_at: "2026-04-16T03:22:06.280473+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "01cac2bfa9823a62"
|
||||
---
|
||||
|
||||
# ChartOptions
|
||||
|
||||
## Documentation: Chart Configuration Enums Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of strongly-typed enumerations and associated `IItemsSource` implementations used to configure chart display and behavior in the DTS Viewer application. These enums standardize user-facing options for time units, filtering, Y-axis scaling, wake methods, and chart units—ensuring consistency across UI components (e.g., property grids) and backend logic that consumes these configuration values. All enums are decorated with `[Description]` attributes for localized display text and use a custom `EnumDescriptionTypeConverter` to support UI binding.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### Enums (all in `DTS.Common.Enums.Viewer` namespace)
|
||||
|
||||
| Enum | Members & Descriptions |
|
||||
|------|------------------------|
|
||||
| `TimeUnitTypeEnum` | `MS = 0` ("ms"), `Seconds = 1` ("Seconds") — Time unit for chart X-axis. |
|
||||
| `FilterOptionEnum` | `Unfiltered = 0` ("Unfiltered"), `TestSetupDefault = 1` ("Test Setup Default"), `Custom = 2` ("Custom") — Filter mode selection for chart data. |
|
||||
| `YRangeScaleEnum` | `AutoRange = 0` ("Auto Range"), `FullScale = 1` ("% Full Scale"), `Fixed = 2` ("Fixed"), `Manual = 3` ("Manual") — Y-axis scaling strategy. |
|
||||
| `WakeMethodTypeEnum` | `None = 0` ("None"), `MotionDetect = 1` ("Motion detect"), `TimeSession = 2` ("Time session"), `Magnet = 3` ("Magnet") — Device wake-up trigger method. |
|
||||
| `ChartUnitTypeEnum` | `EU = 0` ("EU"), `mV = 1` ("mV"), `ADC = 2` ("ADC"), `FFT = 3` ("FFT"), `PSD = 4` ("PSD") — Unit type for chart Y-axis values. |
|
||||
|
||||
#### Item Source Classes (used for UI binding, e.g., property grids)
|
||||
|
||||
| Class | Method | Behavior |
|
||||
|-------|--------|----------|
|
||||
| `TimeUnitTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `TimeUnitTypeEnum` values via `EnumUtil.GetValuesList<TimeUnitTypeEnum>()`. |
|
||||
| `FilterOptionEnumItemSource` | `ItemCollection GetValues()` | Returns a list of all `FilterOptionEnum` values. |
|
||||
| `YRangeScaleItemSource` | `ItemCollection GetValues()` | Returns a list of all `YRangeScaleEnum` values. |
|
||||
| `WakeMethodTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `WakeMethodTypeEnum` values. |
|
||||
| `ChartUnitTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `ChartUnitTypeEnum` values. |
|
||||
|
||||
### 3. Invariants
|
||||
- All enum values are explicitly assigned integer constants starting from `0` and incrementing by `1`.
|
||||
- Each enum member has a `[Description]` attribute with a non-empty string; no member lacks a description.
|
||||
- The `GetValues()` methods in all `IItemsSource` implementations are pure and idempotent—repeated calls return equivalent `ItemCollection` instances.
|
||||
- Enums are strictly for *configuration metadata*; no business logic is embedded in these types.
|
||||
- The `EnumDescriptionTypeConverter` is assumed to map enum values to their `[Description]` attribute values for display (not verified in source, but implied by usage).
|
||||
|
||||
### 4. Dependencies
|
||||
**Dependencies *of* this module:**
|
||||
- `System.ComponentModel` (for `DescriptionAttribute`)
|
||||
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter)
|
||||
- `DTS.Common.Utils.EnumUtil` (provides `GetValuesList<T>()`)
|
||||
- `Xceed.Wpf.Toolkit.PropertyGrid.Attributes.IItemsSource` (WPF Toolkit interface for property grid item sources)
|
||||
|
||||
**Dependencies *on* this module:**
|
||||
- UI components (e.g., WPF property grids) that bind to these enums via `IItemsSource` implementations.
|
||||
- Any code that consumes chart configuration state (e.g., chart rendering logic, session configuration serializers) likely references these enums.
|
||||
- *Inferred*: `EnumDescriptionTypeConverter` and `EnumUtil` are internal to `DTS.Common`; this module is part of the `DTS.Common` library.
|
||||
|
||||
### 5. Gotchas
|
||||
- **No validation or range checks** are present in the enums themselves—consumers must enforce valid combinations (e.g., `FFT`/`PSD` units may only be valid for specific chart types).
|
||||
- **Historical comments** in `ChartUnitTypeEnum` reference issue numbers (`//6402`, `//25554`), indicating incomplete features (FFT live switch, PSD implementation). These may affect runtime behavior if used prematurely.
|
||||
- **Case sensitivity**: The `mV` member uses lowercase `v` (not `MV`), which may conflict with conventions (e.g., SI unit standards).
|
||||
- **No deprecation markers**: Older enum values (e.g., `TimeSession` vs. newer wake methods) lack `[Obsolete]` attributes despite potential obsolescence.
|
||||
- **No documentation on default values**: It is unclear which enum value is used as default in UI or configuration (e.g., `Unfiltered` for `FilterOptionEnum`? `AutoRange` for `YRangeScaleEnum`?).
|
||||
- **No cross-enum constraints**: E.g., `Manual` Y-axis scaling may require additional parameters (not defined here), but the enum alone does not enforce this.
|
||||
- **None identified from source alone.** (Note: The above are *inferred* from code structure and comments, but not explicitly stated in the source.)
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/Filter/SearchEnum.cs
|
||||
generated_at: "2026-04-16T03:21:51.281513+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "50f7f71ba1198362"
|
||||
---
|
||||
|
||||
# Filter
|
||||
|
||||
1. **Purpose**
|
||||
This module defines a simple enumeration (`FilterEnum`) used to represent filter types within the DTS Viewer component of the system. It serves as a type-safe mechanism to distinguish between supported filter categories—specifically `Test` and `Graph`—likely used in UI filtering logic or data processing pipelines related to viewer functionality.
|
||||
|
||||
2. **Public Interface**
|
||||
- **`enum FilterEnum`**
|
||||
A two-member enumeration defined in the `DTS.Common.Enums.Viewer` namespace:
|
||||
- `Test`: Represents a filter type for test-related data or views.
|
||||
- `Graph`: Represents a filter type for graph-based data or views.
|
||||
|
||||
3. **Invariants**
|
||||
- The enumeration contains exactly two values: `Test` (default, value `0`) and `Graph` (value `1`).
|
||||
- No additional values are defined or expected to be added without corresponding updates to consuming code.
|
||||
- The enum is intended for use only in contexts where filter selection between *test* and *graph* views is semantically valid.
|
||||
|
||||
4. **Dependencies**
|
||||
- **Internal dependency**: This enum resides in the `DTS.Common` assembly (likely a shared library), implying it is consumed by other modules in the DTS ecosystem (e.g., viewer UI components, data adapters).
|
||||
- **No external dependencies**: The file imports no external types or libraries beyond implicit .NET runtime support.
|
||||
- **Consumers inferred**: Any module referencing `DTS.Common` and using `FilterEnum` (e.g., to configure filters, route view rendering, or serialize/deserialize filter state) depends on this definition.
|
||||
|
||||
5. **Gotchas**
|
||||
- The enum name is `FilterEnum`, but the file is named `SearchEnum.cs`—this mismatch may cause confusion during code navigation or refactoring.
|
||||
- No XML documentation comments are present on the enum or its members, reducing discoverability for consumers.
|
||||
- The `// ReSharper disable CheckNamespace` directive suggests the namespace may intentionally avoid folder-namespace alignment (e.g., `DTS.Common.Enums.Viewer` does not match the physical path `Common/DTS.Common/Enums/DTS.Viewer`), which could mislead developers expecting convention-based layout.
|
||||
- No validation or parsing logic (e.g., `TryParse`) is included; consumers must handle invalid values (e.g., from deserialization) manually.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowAveragingType.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/Reports/PowerSpectralDensity/PassFilterType.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowWidth.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/Reports/PowerSpectralDensity/WindowType.cs
|
||||
generated_at: "2026-04-16T03:21:08.807677+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e228857d6b62ca1f"
|
||||
---
|
||||
|
||||
# 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 (`WindowAveragingType`, `PassFilterType`, `WindowWidth`, and `WindowType`) provide a standardized, validated set of options for controlling how spectral data is computed and displayed—specifically for windowing, filtering, and averaging strategies—ensuring consistency across UI, serialization, and backend processing layers.
|
||||
|
||||
---
|
||||
|
||||
### 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 (from `System.ComponentModel`) and uses the `EnumDescriptionTypeConverter` for UI/data binding scenarios.
|
||||
|
||||
#### `WindowAveragingType`
|
||||
- **Values**:
|
||||
- `Averaging` → Description: `"Averaging"`
|
||||
- `PeakHoldMax` → Description: `"Peak Hold MAX"`
|
||||
- `PeakHoldMin` → Description: `"Peak Hold MIN"`
|
||||
- **Purpose**: Specifies the method used to average spectral frames over time (e.g., for smoothing or peak tracking).
|
||||
|
||||
#### `PassFilterType`
|
||||
- **Values**:
|
||||
- `Bessel` → Description: `"Bessel"`
|
||||
- `Butterworth` → Description: `"Butterworth"`
|
||||
- `Chebyshev` → Description: `"Chebyshev"`
|
||||
- **Purpose**: Defines the digital filter type applied during signal preprocessing before FFT computation.
|
||||
*Note*: `CriticalDamping` is commented out and not available.
|
||||
|
||||
#### `WindowWidth`
|
||||
- **Values** (with explicit integer values):
|
||||
- `FiveTwelve` = 512 → Description: `"512"`
|
||||
- `TenTwentyFour` = 1024 → Description: `"1024"`
|
||||
- `TwentyFortyEight` = 2048 → Description: `"2048"`
|
||||
- `FortyNinetySix` = 4096 → Description: `"4096"`
|
||||
- `EightyOneNinetyTwo` = 8192 → Description: `"8192"`
|
||||
- **Purpose**: Specifies the FFT window size (in samples) used in PSD computation.
|
||||
|
||||
#### `WindowType`
|
||||
- **Values**:
|
||||
- `Rectangle` → Description: `"Rectangle"`
|
||||
- `Hamming` → Description: `"Hamming"`
|
||||
- `Hanning` → Description: `"Hanning"`
|
||||
- `Blackman` → Description: `"Blackman"`
|
||||
- `BlackmanHarris` → Description: `"Blackman-Harris"`
|
||||
- `FlatTop` → Description: `"Flat Top"`
|
||||
- **Purpose**: Selects the time-domain window function applied to the signal prior to FFT to mitigate spectral leakage.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- All enum values are **exhaustively documented** via `[Description]` attributes; no value lacks a description.
|
||||
- `WindowWidth` values are **strictly powers of two** (512, 1024, ..., 8192), consistent with FFT implementation constraints.
|
||||
- `PassFilterType` is **incomplete**: `CriticalDamping` is commented out and *not* part of the active API.
|
||||
- No runtime validation is performed by the enums themselves—validation (e.g., range checks on `WindowWidth`) must occur in consuming code.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal dependencies**:
|
||||
- `DTS.Common.Converters.EnumDescriptionTypeConverter` — used via `[TypeConverter]` for deserialization/UI binding.
|
||||
- `System.ComponentModel` — for `[Description]` attribute.
|
||||
- **Consumers** (inferred from namespace and naming):
|
||||
- Likely used by reporting/UI components in `DTS.Viewer` (e.g., PSD report configuration models, settings dialogs).
|
||||
- May be referenced by backend signal processing modules (e.g., FFT or filter pipeline classes) that accept these enums as configuration parameters.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **`CriticalDamping` is disabled**: The commented-out `CriticalDamping` entry in `PassFilterType` includes a TODO comment (`// REMOVE THIS HACK / uncomment when implemented in exocortex`), indicating this enum is a placeholder for future functionality. **Do not assume `CriticalDamping` is supported.**
|
||||
- **Case-sensitive enum names**: `BlackmanHarris` (no hyphen) vs. `Blackman-Harris` (hyphen in description). UI or serialization logic may rely on the *description* text, not the name.
|
||||
- **`Hanning` vs. `Hanning`**: The enum uses `Hanning` (double *n*), which is a common misspelling of the correct term *Hann* (though *Hanning* is widely used in signal processing literature). Ensure downstream code matches this spelling.
|
||||
- **No validation on `WindowWidth` values**: While only powers of two are defined, the enum itself does not enforce this—consumers must validate if needed.
|
||||
- **No versioning or deprecation markers**: If enums evolve (e.g., new filter types added), consumers may break if deserializing from external sources (e.g., JSON) without fallback handling.
|
||||
|
||||
None identified beyond these.
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/ChannelGroups.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/TestGraphsFields.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/TestSetupFields.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/TestRunMetadataFields.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/TestModuleFields.cs
|
||||
- Common/DTS.Common/Enums/DTS.Viewer/TestMetadata/TestChannelFields.cs
|
||||
generated_at: "2026-04-16T03:21:56.552310+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d809c3870c3acf47"
|
||||
---
|
||||
|
||||
# Documentation: Test Metadata Enumerations
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of strongly-typed enumerations used to represent field names and groupings within test metadata structures in the DTS Viewer system. These enums serve as standardized keys for accessing, serializing, deserializing, and querying hierarchical test data—such as test runs, modules, channels, graphs, and calculated channels—across the application. They ensure consistency in data contract definitions (e.g., for JSON serialization, UI binding, or database mapping) by decoupling field identifiers from string literals, thereby reducing typos, enabling refactoring safety, and improving code readability.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ChannelGroups`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**:
|
||||
- `Channel`
|
||||
- `Graph`
|
||||
- `CalculatedChannel`
|
||||
- **Purpose**: Represents high-level logical groupings of channel-like entities in test metadata. Used to categorize or filter channels by type.
|
||||
|
||||
### `TestGraphsFields`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**:
|
||||
- `Name`
|
||||
- `HardwareChannelName`
|
||||
- `Channels`
|
||||
- `Channel`
|
||||
- `ChannelId`
|
||||
- **Purpose**: Defines the set of valid field names for objects representing a *graph* in test metadata (e.g., a named aggregation of channels for visualization or analysis).
|
||||
|
||||
### `TestSetupMetadataFields`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**:
|
||||
- `Name`
|
||||
- `DateOfTheTest`
|
||||
- `Graphs`
|
||||
- `Timestamp`
|
||||
- `CalibrationBehavior`
|
||||
- **Purpose**: Specifies top-level metadata fields for a *test setup*, typically describing static configuration or context of a test session.
|
||||
|
||||
### `TestRunMetadataFields`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**:
|
||||
- `Id`, `Description`, `InlineSerializedData`, `Guid`, `FaultFlags`, `Software`, `SoftwareVersion`, `DataType`, `FileDate`, `FilePath`, `Modules`, `Module`, `Channels`, `CalculatedChannels`, `CalculatedChannel`
|
||||
- **Purpose**: Represents the top-level fields of a *test run*—a single execution instance containing modules, channels, and calculated channels.
|
||||
|
||||
### `TestModuleFields`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**: 44 fields including:
|
||||
- `SerialNumber`, `BaseSerialNumber`, `Number`, `SampleRateHz`, `NumberOfChannels`, `RecordingMode`, `RequestedPreTriggerSeconds`, `PostTriggerSeconds`, `TriggerTimestampSec`, `TriggerTimestampNanoSec`, `StartRecordSampleNumber`, `UnsubsampledNumberOfSamples`, `PTPMasterSync`, `TiltSensorAxisXDegreesPre/Post`, `TemperatureLocation1Pre/Post`, `InlineSerializedData`, etc.
|
||||
- **Purpose**: Defines all known fields for a *test module*, representing a physical acquisition device (e.g., a data logger) involved in the test.
|
||||
|
||||
### `TestChannelFields`
|
||||
- **Namespace**: `DTS.Common.Enums.Viewer`
|
||||
- **Values**: 71 fields including:
|
||||
- `SerialNumber`, `ChannelId`, `Description`, `ChannelGroupName`, `ChannelType`, `Number`, `HardwareChannelName`, `Sensitivity`, `ExcitationVoltage`, `ZeroMethod`, `IsSubsampled`, `AbsoluteDisplayOrder`, `LastCalibrationDate`, `CalSignalEnabled`, `ShuntEnabled`, `LinearizationFormula`, `SourceModuleSerialNumber`, `Calculation`, `IsoCode`, `UserCode`, `UserChannelName`, `SensorPolarity`, `HIC`, `UseEUScaler`, `ScaleFactorEU`, `T1`, `T2`, etc.
|
||||
- **Purpose**: Enumerates all possible fields for a *test channel*, representing a single measured or computed signal (e.g., voltage, strain, temperature) during a test.
|
||||
|
||||
> **Note**: All enums are plain `public enum` types with no methods, properties, or attributes defined in the source.
|
||||
|
||||
## 3. Invariants
|
||||
- **No overlap between enum namespaces**: Each enum belongs to a distinct semantic domain (e.g., `TestModuleFields` vs `TestChannelFields`), and field names may be duplicated across enums (e.g., `Channels`, `Module`, `Channel`) but refer to different contexts.
|
||||
- **Field names are case-sensitive**: All enum values use PascalCase (e.g., `HardwareChannelName`, `RequestedPreTriggerSeconds`).
|
||||
- **No validation or runtime enforcement**: These are *metadata keys*, not validators; the enums themselves do not enforce presence, type, or consistency of corresponding data.
|
||||
- **No versioning**: Enums are not versioned; adding/removing values may break downstream consumers expecting specific keys.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**: None (self-contained; no external references in the provided source).
|
||||
- **Used by**:
|
||||
- Likely consumed by serialization/deserialization logic (e.g., JSON converters, DTO mappers) in higher layers (e.g., `DTS.Viewer`, `DTS.Data`).
|
||||
- Likely referenced in UI binding layers (e.g., to populate dropdowns or column headers).
|
||||
- Likely used in query/filter APIs (e.g., `Where(x => x[TestChannelFields.ChannelGroupName] == ChannelGroups.Channel.ToString())`).
|
||||
- **Inferred consumers**: Any module that handles test metadata serialization, UI rendering, or data querying (not visible in source, but implied by naming and usage patterns).
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguous field names across enums**:
|
||||
- `Channels` appears in `TestRunMetadataFields` (plural, likely a collection) and `TestGraphsFields` (singular, possibly a reference or collection).
|
||||
- `Module` and `CalculatedChannel` appear in `TestRunMetadataFields` (singular), while `Modules`, `CalculatedChannels` (plural) also exist—suggesting inconsistent naming for collections vs. references.
|
||||
- **Redundant or overlapping fields**:
|
||||
- `Channel` and `Channels` appear in both `TestRunMetadataFields` and `TestGraphsFields`, but their semantics differ (e.g., one may be a single channel object, the other a list).
|
||||
- `ChannelGroupName` in `TestChannelFields` maps to values in `ChannelGroups`, but no compile-time linkage exists.
|
||||
- **Missing grouping for calculated channels**: While `CalculatedChannel` is a `TestRunMetadataFields` key, `CalculatedChannels` (plural) also exists—suggesting possible inconsistency in how collections are named.
|
||||
- **No documentation comments**: All enums lack XML documentation; field meanings must be inferred from naming alone (e.g., `T1`, `T2` in `TestChannelFields` are undefined).
|
||||
- **Historical field bloat**: `TestChannelFields` has 71 values—indicating possible technical debt from incremental additions without cleanup.
|
||||
- **None identified from source alone** for behavioral quirks (e.g., null handling, default values), as enums are pure identifiers.
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Database/DbType.cs
|
||||
generated_at: "2026-04-16T03:19:26.434083+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b5b4c7897ced9899"
|
||||
---
|
||||
|
||||
# Database
|
||||
|
||||
## 1. Purpose
|
||||
This module defines the `DbType` enumeration, which categorizes database configurations within the DTS system based on their deployment and access patterns—specifically whether a database is accessible only remotely, only locally, or as a hybrid of both. It serves as a foundational type for configuring, selecting, or routing database operations according to deployment topology, likely used in higher-level data access or configuration components.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes a single public type:
|
||||
|
||||
- **`DbType`** (`enum`)
|
||||
- `RemoteOnly = 0`: Indicates the database is accessible *only* via remote connections (e.g., cloud-hosted, on-premises server accessed over network).
|
||||
- `LocalOnly = 1`: Indicates the database is accessible *only* via local connections (e.g., embedded SQLite, local SQL Server Express instance).
|
||||
- `RemoteLocalHybrid = 2`: Indicates the database supports *both* remote and local access modes, likely with logic to switch or prioritize based on context (e.g., offline-first sync scenarios).
|
||||
|
||||
## 3. Invariants
|
||||
- The enum values are explicitly assigned integer constants (`0`, `1`, `2`) and must not be changed without coordinated updates across consumers.
|
||||
- No validation or runtime enforcement is present in this file; callers are responsible for ensuring only defined values are used.
|
||||
- The semantics of “remote” and “local” are implementation-contextual (e.g., “local” may mean same process/machine, but exact definition is not specified here).
|
||||
|
||||
## 4. Dependencies
|
||||
- **No external dependencies** are declared in the source file (no `using` statements, no references to other types).
|
||||
- **Consumers**: While not visible in this file, this enum is likely referenced by configuration parsers, database connection resolvers, or data access layers in other modules (e.g., `DTS.Data`, `DTS.Server`, or `DTS.Client` namespaces).
|
||||
- **Depends on**: Only the .NET runtime (no explicit framework dependencies).
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguity in “Hybrid” semantics**: The meaning of `RemoteLocalHybrid` is not clarified—e.g., whether it implies automatic failover, client-side routing logic, or dual-write behavior. This must be documented elsewhere.
|
||||
- **No `None` or `Unknown` value**: Absence of a default/invalid state may lead to accidental misconfiguration if deserialization yields `0` (`RemoteOnly`) unintentionally.
|
||||
- **Fragile numeric assignments**: Hardcoded values (`0`, `1`, `2`) could break serialization/deserialization (e.g., in JSON, config files, or databases) if reordered or extended.
|
||||
- **No documentation comments**: XML doc comments are absent, so tooling cannot surface usage guidance.
|
||||
- **None identified from source alone.** *(Note: While the above points are reasonable concerns, they are inferred from common patterns—not directly observable in the source.)*
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/GroupTemplates/GroupTemplateChannelFields.cs
|
||||
- Common/DTS.Common/Enums/GroupTemplates/GroupTemplateFields.cs
|
||||
generated_at: "2026-04-16T03:20:41.367109+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4e111d67a04151ac"
|
||||
---
|
||||
|
||||
# GroupTemplates
|
||||
|
||||
## 1. Purpose
|
||||
This module defines two strongly-typed enumerations—`GroupTemplateChannelFields` and `GroupTemplateFields`—that represent the set of valid field names used when working with group templates and their associated channels in the DTS system. These enums serve as standardized identifiers for field-level operations (e.g., serialization, mapping, validation, or UI binding) related to group template data structures, ensuring consistency across layers that consume or produce group template metadata.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `GroupTemplateChannelFields`
|
||||
A `public enum` in namespace `DTS.Common.Enums.GroupTemplates` representing fields specific to a *channel* within a group template.
|
||||
- **Members**:
|
||||
- `Required` (`int`): Indicates whether the channel is mandatory.
|
||||
- `Name` (`int`): The display name of the channel.
|
||||
- `ISOCode` (`int`): The ISO-standardized code associated with the channel (e.g., language or region code).
|
||||
- `Custom` (`int`): A flag or value indicating the channel is user-defined/custom.
|
||||
- `DisplayOrder` (`int`): The numeric order in which the channel should be rendered or processed.
|
||||
|
||||
### `GroupTemplateFields`
|
||||
A `public enum` in namespace `DTS.Common.Enums.GroupTemplates` representing top-level fields of a *group template* entity.
|
||||
- **Members**:
|
||||
- `Name` (`int`): The name of the group template.
|
||||
- `Description` (`int`): A textual description of the group template’s purpose or behavior.
|
||||
- `Channels` (`int`): A collection of channel definitions associated with the template.
|
||||
- `LastModifiedBy` (`int`): Identifier (e.g., user ID or name) of the last modifier.
|
||||
- `LastModified` (`int`): Timestamp of the last modification.
|
||||
- `AssociatedGroups` (`int`): A collection of groups that are linked to this template.
|
||||
|
||||
## 3. Invariants
|
||||
- All enum values are *exhaustive* for their respective domains (i.e., no additional fields are defined beyond those listed).
|
||||
- The `Channels` field in `GroupTemplateFields` is semantically a *container* for `GroupTemplateChannelFields`-defined properties, implying a hierarchical relationship: each channel object in a template’s `Channels` collection is described using keys from `GroupTemplateChannelFields`.
|
||||
- No runtime validation or enforcement logic is present in the source; enums are purely declarative and must be validated/consumed by other components.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Internal**:
|
||||
- No external dependencies are referenced in the source files (no `using` statements, no references to other types).
|
||||
- Both enums reside in the same namespace (`DTS.Common.Enums.GroupTemplates`), suggesting co-location for related functionality.
|
||||
- **Consumers**:
|
||||
- Likely used by higher-level modules handling group template serialization (e.g., JSON/XML mapping), UI form generation, or data persistence layers (e.g., ORM mappings).
|
||||
- Notable absence of direct references to `GroupTemplate` or `GroupTemplateChannel` classes in the source means their definitions (and usage of these enums) must be in other files.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguity in `Custom` and `Required` semantics**: The source does not clarify whether `Custom` is a boolean flag or a string/value field (e.g., custom metadata). Similarly, `Required` may represent a boolean, string, or enum—its meaning is inferred but not defined here.
|
||||
- **No versioning or deprecation markers**: The enums lack attributes (e.g., `[Obsolete]`) or comments indicating field lifecycle status, which could lead to misuse if fields are retired or renamed.
|
||||
- **No explicit mapping to database columns or JSON keys**: While the enum names suggest field identifiers, their actual serialization behavior (e.g., camelCase, underscore naming, or numeric values) is not specified in this module.
|
||||
- **None identified from source alone.**
|
||||
44
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Groups.md
Normal file
44
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Groups.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Groups/GroupImport.cs
|
||||
generated_at: "2026-04-16T03:20:49.578686+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d539759851a4e471"
|
||||
---
|
||||
|
||||
# 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 stages in the import process—specifically `Options`, `Preview`, and `Import`. Its purpose is to ensure consistency across the codebase when referencing or routing through these logical steps, likely used in UI navigation, state management, or workflow orchestration components.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes a single nested enum, `Steps`, defined inside the abstract class `GroupImportEnums`. Since `GroupImportEnums` is `abstract` and contains only the enum, it is not instantiable and serves solely as a namespace-like container.
|
||||
|
||||
- **`GroupImportEnums.Steps`**
|
||||
An enum with three named constants:
|
||||
- `Steps.Options` — Represents the initial configuration step where user-provided options for the import are collected or validated.
|
||||
- `Steps.Preview` — Represents the step where imported data is displayed for user review before final commitment.
|
||||
- `Steps.Import` — Represents the final step where data is persisted or committed.
|
||||
|
||||
No methods, properties, or other public members are defined.
|
||||
|
||||
## 3. Invariants
|
||||
- The `Steps` enum values are ordered: `Options` (0), `Preview` (1), `Import` (2). This implies a strict sequential progression—no step may be skipped or revisited without explicit reset logic elsewhere.
|
||||
- The enum is *exhaustive* for the documented workflow: only these three steps are defined. Any logic assuming additional steps (e.g., `Complete`, `Error`) is not supported by this definition.
|
||||
- The `GroupImportEnums` class is `abstract` and contains no instance members; it is not intended for instantiation or inheritance beyond its current use as a container.
|
||||
|
||||
## 4. Dependencies
|
||||
- **No external dependencies**: The file imports no namespaces beyond the standard `namespace` declaration.
|
||||
- **Consumers**: Based on naming and structure, this enum is likely consumed by:
|
||||
- UI components (e.g., step-by-step wizards or view models)
|
||||
- Workflow/state machines managing group import operations
|
||||
- Serialization/deserialization logic (e.g., mapping step names to/from strings or integers)
|
||||
However, the source file alone does not specify concrete dependents.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No validation or state transition logic**: The enum itself does not enforce valid transitions (e.g., `Preview` → `Options` is syntactically allowed but may be semantically invalid). Consumers must implement their own transition rules.
|
||||
- **`abstract class` as namespace container**: Using an `abstract class` solely to nest the enum is unconventional in modern C# (where `static class` or direct namespace-level enums are preferred). This may indicate legacy design or a pattern to avoid polluting the parent namespace.
|
||||
- **No XML documentation**: The source provides no comments, so semantic intent (e.g., whether `Preview` is read-only or allows edits) is ambiguous.
|
||||
- **No extensibility hooks**: Adding new steps requires modifying this enum, which may ripple across consumers. No versioning or extensibility mechanism is evident.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Groups/GroupList/GroupFields.cs
|
||||
generated_at: "2026-04-16T03:21:38.019315+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "79ab94ade566b7fd"
|
||||
---
|
||||
|
||||
# GroupList
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a strongly-typed enumeration `GroupFields` used to represent the set of standard, queryable fields associated with *Group* entities in the system. It serves as a canonical list of field identifiers—typically for use in filtering, sorting, or projecting group data—while leveraging .NET’s `DescriptionAttribute` and a custom `EnumDescriptionTypeConverter` to support localized or metadata-driven string representations (e.g., for UI labels or API contracts). Its role is to decouple field naming logic from business logic and ensure consistency across data access, serialization, and UI layers.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes a single public type:
|
||||
|
||||
- **`GroupFields`** (`enum`)
|
||||
An enumeration of group entity fields. Each member is annotated with a `DescriptionAttribute` containing a string key (not the literal description text), intended for localization or lookup via `EnumDescriptionTypeConverter`.
|
||||
Members:
|
||||
- `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")`
|
||||
|
||||
*Note:* The actual human-readable descriptions (e.g., `"Name"`, `"Display Name"`) are *not* embedded in this enum; they are resolved externally (e.g., via resource files) using the `EnumDescriptionTypeConverter`.
|
||||
|
||||
## 3. Invariants
|
||||
- All enum values are **exclusively defined** in this file; no dynamic or runtime additions are supported.
|
||||
- The `DescriptionAttribute` on each member **must contain a non-empty string key** (e.g., `"GroupField_Name"`), but the *value* of the key is not validated by this module—it is assumed to be resolvable by the `EnumDescriptionTypeConverter`.
|
||||
- The enum is **not marked `[Flags]`**, implying only one field may be selected at a time in typical usage (e.g., for single-field sorting or filtering).
|
||||
- The `TypeConverter` attribute ensures that when the enum is converted to/from a string (e.g., in UI binding or JSON deserialization), the `EnumDescriptionTypeConverter` is used—*not* the default `Enum.ToString()` behavior.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Imports/References**:
|
||||
- `DTS.Common.Converters` (for `EnumDescriptionTypeConverter`)
|
||||
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverterAttribute`)
|
||||
- **Consumers (inferred)**:
|
||||
- Any module that needs to reference group fields in a type-safe manner (e.g., query builders, DTO mappers, UI view models).
|
||||
- `EnumDescriptionTypeConverter` (in `DTS.Common.Converters`) is required at runtime to interpret `DescriptionAttribute` values.
|
||||
- Likely used in conjunction with group-related data models (e.g., `Group`, `GroupDto`) and data access layers (e.g., LINQ-to-SQL or EF Core projections), though these are not visible in the source.
|
||||
|
||||
## 5. Gotchas
|
||||
- The `DescriptionAttribute` values (e.g., `"GroupField_Name"`) are **keys, not display strings**—they must be resolved externally (e.g., via `ResourceManager` or a dictionary) by `EnumDescriptionTypeConverter`. Assuming the literal string is the display value will cause incorrect behavior.
|
||||
- The enum is **not exhaustive**; if new group fields are added to the underlying data model (e.g., `CreatedDate`), this enum *must* be updated manually—no automatic sync is implied.
|
||||
- The `TypeConverter` behavior is *not* self-contained here: if `EnumDescriptionTypeConverter` is misconfigured or missing, enum-to-string conversions (e.g., in JSON.NET, MVC model binding, or XAML bindings) may fail or produce unexpected keys instead of localized text.
|
||||
- No validation or ordering guarantees are enforced—consumers must independently handle invalid field names or enforce field-specific constraints (e.g., disallowing `ChannelCount` in certain queries).
|
||||
- None identified from source alone.
|
||||
177
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Hardware.md
Normal file
177
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Hardware.md
Normal file
@@ -0,0 +1,177 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Hardware/HardwareListTags.cs
|
||||
- Common/DTS.Common/Enums/Hardware/SLICETCConfigurations.cs
|
||||
- Common/DTS.Common/Enums/Hardware/SLICEConfigurations.cs
|
||||
- Common/DTS.Common/Enums/Hardware/HardwareTypes.cs
|
||||
generated_at: "2026-04-16T03:20:45.506468+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e0d93bab8eaafa95"
|
||||
---
|
||||
|
||||
# Hardware Enums and Constants Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines core enumerations and static utility methods for representing and reasoning about hardware devices in the DTS system. It establishes canonical types for hardware devices (`HardwareTypes`), their configurations (`SLICETCConfigurations`, `SLICEPROSIMConfigurations`), and metadata tags (`HardwareListTags`). The `HardwareConstants` class centralizes hardware-specific business logic—including recording mode support, streaming/clock sync profile validation, embedded sensor detection, and device-specific constants—enabling consistent behavior across the application layer. This module serves as a foundational abstraction layer between low-level hardware protocol details and higher-level UI and control logic.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enumerations
|
||||
|
||||
#### `HardwareListTags`
|
||||
- **Purpose**: Defines metadata field names used to tag hardware inventory or display lists.
|
||||
- **Values**:
|
||||
- `Included`, `SerialNumber`, `HardwareType`, `ChannelCount`, `Firmware`, `MaxSampleRate`, `TestSampleRate`, `DSPStreamingFilter`, `CalDate`, `CalDueDate`, `IPAddress`, `FirstUseDate`
|
||||
|
||||
#### `SLICETCConfigurations`
|
||||
- **Purpose**: Represents hardware configuration variants for SLICETC devices (e.g., channel count).
|
||||
- **Values**:
|
||||
- `TWENTYFOUR` → Description: `"SLICETC_CONFIGURATION_24"`
|
||||
- `SIXTEEN` → Description: `"SLICETC_CONFIGURATION_16"`
|
||||
- `EIGHT` → Description: `"SLICETC_CONFIGURATION_8"`
|
||||
- **Note**: Uses `EnumDescriptionTypeConverter` for UI binding.
|
||||
|
||||
#### `SLICEPROSIMConfigurations`
|
||||
- **Purpose**: Represents hardware configuration variants for SLICEPRO SIM devices.
|
||||
- **Values**:
|
||||
- `MEGA` → Description: `"SLICE_CONFIGURATION_MEGA"`
|
||||
- `EIGHT_HUNDRED` → Description: `"SLICE_CONFIGURATION_800K"`
|
||||
- `SEVEN_HUNDRED` → Description: `"SLICE_CONFIGURATION_700K"`
|
||||
- `SIX_HUNDRED` → Description: `"SLICE_CONFIGURATION_600K"`
|
||||
- **Note**: Uses `EnumDescriptionTypeConverter`.
|
||||
|
||||
#### `HardwareTypes`
|
||||
- **Purpose**: Enumerates all supported hardware device types in the system.
|
||||
- **Values**: Includes base models (e.g., `SLICE_Base`, `SLICE2_Base`), variants (e.g., `SLICE_IEPE`, `SLICE2_Bridge_Hi`), embedded modules (`EMB_*`), racks (`TDAS_Pro_Rack`, `TDAS_LabRack`), and newer platforms (`TSR_AIR`, `DKR`, `DIR`, `SLICE6_AIR_TC`, `SLICE_PRO_CAN_FD`).
|
||||
- **Special Values**:
|
||||
- `UNDEFINED = 38` → Description: `"HardwareType_EMPTY"`
|
||||
- **Note**: Uses `EnumDescriptionTypeConverter`.
|
||||
|
||||
#### `SLICEBridgeTypes`
|
||||
- **Purpose**: Defines channel types supported by SLICE bridge modules.
|
||||
- **Values**:
|
||||
- `Bridge`, `IEPE`, `ARS`, `ACC`, `RTC`, `UART`, `StreamOut`, `Thermocoupler`, `CAN`
|
||||
- **Note**: Uses `EnumDescriptionTypeConverter`.
|
||||
|
||||
#### `RackSizes`
|
||||
- **Purpose**: Represents rack form factor sizes.
|
||||
- **Values**:
|
||||
- `FOUR` → Description: `"RACK_SIZE_4M"`
|
||||
- `EIGHT` → Description: `"RACK_SIZE_8M"`
|
||||
- **Note**: Uses `EnumDescriptionTypeConverter`.
|
||||
|
||||
### Static Methods in `HardwareConstants`
|
||||
|
||||
#### `IsTSRAIRSerialNumber(string serialNumber)`
|
||||
- **Signature**: `public static bool IsTSRAIRSerialNumber(string serialNumber)`
|
||||
- **Behavior**: Returns `true` if `serialNumber` is non-null/empty and starts with `"TA"`.
|
||||
|
||||
#### `GetBrushForVoltageStatus(VoltageStatusColor status)`
|
||||
- **Signature**: `public static SolidColorBrush GetBrushForVoltageStatus(DFConstantsAndEnums.VoltageStatusColor status)`
|
||||
- **Behavior**: Maps voltage status color to a WPF `SolidColorBrush` from `BrushesAndColors`.
|
||||
|
||||
#### `SupportsTriggerInversion(HardwareTypes type, int protocolVersion)`
|
||||
- **Signature**: `public static bool SupportsTriggerInversion(HardwareTypes type, int protocolVersion)`
|
||||
- **Behavior**: Returns `true` for SLICE1, SLICE1.5, SLICE2 base/variant types (explicit list in source). Protocol version is unused in current implementation.
|
||||
|
||||
#### `SupportsStartInversion(HardwareTypes type, int protocolVersion)`
|
||||
- **Signature**: `public static bool SupportsStartInversion(HardwareTypes type, int protocolVersion)`
|
||||
- **Behavior**: Same as `SupportsTriggerInversion`, but also includes `SLICE6_AIR`.
|
||||
|
||||
#### `IsEthernetRecorder(HardwareTypes type)`
|
||||
- **Signature**: `public static bool IsEthernetRecorder(HardwareTypes type)`
|
||||
- **Behavior**: Returns `true` only for `HardwareTypes.S6A_EthernetRecorder`.
|
||||
|
||||
#### `HasEmbeddedSensors(HardwareTypes hardware)`
|
||||
- **Signature**: `public static bool HasEmbeddedSensors(HardwareTypes hardware)`
|
||||
- **Behavior**: Returns `true` for embedded sensor modules (`EMB_*`), `TSR_AIR`, `TSR_AIR_RevB`, `DKR`, `DIR`, `SLICE6_AIR_TC`.
|
||||
|
||||
#### `HasEmbeddedChannelType(HardwareTypes hardware, string channelType)`
|
||||
- **Signature**: `public static bool HasEmbeddedChannelType(HardwareTypes hardware, string channelType)`
|
||||
- **Behavior**: Returns `true`/`false` based on hardware type and `channelType` string (e.g., `"LOWG"`, `"HIGHG"`, `"MIC"`, etc.). Key rules:
|
||||
- `TSR_AIR`/`TSR_AIR_RevB`: All embedded channel types supported.
|
||||
- `DIR`: Supports `"HIGHG"`; others return `false`.
|
||||
- `"MIC"`: Supported unless hardware is `DKR`.
|
||||
- `"ARS"`: Always `false`.
|
||||
- `"RTC..."`: Always `false`.
|
||||
|
||||
#### `IsRecordingModeSupported(...)`
|
||||
- **Signature**: `public static bool IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
|
||||
- **Behavior**: Delegates to per-hardware-type logic (e.g., `SLICE6AIR.IsRecordingModeSupported_S6AIR(...)`, `TSRAIR.IsRecordingModeSupported(...)`, `SLICE6AIRTC.IsRecordingModeSupported(...)`) or falls back to defaults:
|
||||
- Non-TSRAIR devices: `CircularBuffer`, `Recorder`, and UART variants supported.
|
||||
- `SLICE6DB*`, `SLICE6DB3`: `RAMActive` supported.
|
||||
- `DIM`, `G5INDUMMY`, `G5VDS`, `Ribeye`, `SIM`, `TOM`, `TDAS_*`: Only `Recorder`, `CircularBuffer` supported (others return `false`).
|
||||
- `SLICE_PRO_CAN_FD`: Only circular buffer modes supported.
|
||||
|
||||
#### `MaxSampleRateForRecordingMode(...)`
|
||||
- **Signature**: `public static double MaxSampleRateForRecordingMode(IDASHardware h, RecordingModes mode, int protocolVersion = 1, uint baudRate = 0)`
|
||||
- **Behavior**:
|
||||
- For `SLICE6_AIR`: Delegates to `SLICE6AIR.MaxSampleRateHzForRecordingMode(...)`.
|
||||
- For `S6A_EthernetRecorder`: Returns `SLICE6AIR.MaxSampleRateHz_OBRDDR`.
|
||||
- Otherwise: Calls `h.GetMaxSampleRateDouble()`.
|
||||
|
||||
#### `IsStreamingProfileSupported(...)`
|
||||
- **Signature**: `public static bool IsStreamingProfileSupported(UDPStreamProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly = false)`
|
||||
- **Behavior**: Delegates to per-hardware-type logic (`SLICE6`, `SLICE6AIR`, `SLICE6AIRBR`, `TSRAIR`, `SLICE6AIRTC`). All others return `false`.
|
||||
|
||||
#### `IsClockSyncProfileSupported(...)`
|
||||
- **Signature**: `public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, HardwareTypes dasType, int protocolVersion, bool includeNativeSupportOnly, bool master)`
|
||||
- **Behavior**: Delegates to per-hardware-type logic (`SLICE6`, `SLICE6AIR`, `SLICE6AIRTC`, `SLICE6AIRBR`, `SLICE6DB`, `TSRAIR`). All others return `false`. `TSRAIR` uses `master` parameter.
|
||||
|
||||
### Constants in `HardwareConstants`
|
||||
|
||||
| Constant | Value | Description |
|
||||
|---------|-------|-------------|
|
||||
| `TSRAIR_MAXSLICENABLE_VERSION` | `28` | Firmware version threshold for TSRAIR max-slice-enable feature |
|
||||
| `TSRAIR_MAX_MODULES` | `6` | Max modules per TSRAIR (excludes SW-only UART/Streaming modules) |
|
||||
| `TSR_AIR_PREPEND` | `"TA"` | Serial number prefix for TSRAIR devices |
|
||||
| `INVALID_IDASCOMMUNICATION_RECORD_ID` | `-1` | Sentinel for invalid record IDs |
|
||||
| `AllowSoftDisconnects` | `false` (default) | Global toggle for soft disconnects (must be set by app) |
|
||||
| `DEFAULTMEMORYSIZE_PRO` | `16000000` | Default memory size for PRO-class devices |
|
||||
| `DEFAULTMEMORYSIZE_DIM` | `2000000` | Default memory size for DIM |
|
||||
| `DEFAULTMEMORYSIZE_TOM` | `2000000` | Default memory size for TOM |
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **HardwareType Uniqueness**: Each `HardwareTypes` enum value has a unique underlying integer (0–60), with no duplicates.
|
||||
- **TSRAIR Serial Number Format**: Valid TSRAIR serial numbers *must* start with `"TA"` (enforced by `IsTSRAIRSerialNumber`).
|
||||
- **Embedded Sensor Consistency**: `HasEmbeddedSensors` and `HasEmbeddedChannelType` must be consistent: if `HasEmbeddedSensors(h)` is `true`, then `HasEmbeddedChannelType(h, "LOWG")` or similar must be `true` for at least one channel type.
|
||||
- **Recording Mode Support**: `IsRecordingModeSupported` must return `true` for at least `Recorder` and `CircularBuffer` for all non-TSRAIR/non-DIM/TOM/G5/ribeye devices.
|
||||
- **UART Recording Dependency**: `MaxSampleRateForRecordingMode` uses `baudRate` only for `SLICE6_AIR`; other devices ignore it.
|
||||
- **Protocol Version Handling**: Protocol version is passed to many methods but not always used (e.g., `SupportsTriggerInversion`, `SupportsStartInversion` ignore it). Behavior may be incomplete.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies
|
||||
- **`DTS.Common.Converters.EnumDescriptionTypeConverter`**: Used for UI binding of enum descriptions.
|
||||
- **`DTS.Common.Constant.DASSpecific`**: Referenced for `DFConstantsAndEnums` (e.g., serial append constants like `"LOWG_SERIAL_APPEND"`).
|
||||
- **`System.ComponentModel`**: Required for `[Description]` attributes.
|
||||
- **`System.Windows.Media`**: Required for `SolidColorBrush` in `GetBrushForVoltageStatus`.
|
||||
- **`DTS.Common.Interface.DataRecorders`**: Required for `IDASHardware` interface used in `MaxSampleRateForRecordingMode`.
|
||||
- **`RecordingModes` and `RecordingModeExtensions`**: Used in `IsRecordingModeSupported`.
|
||||
- **`UDPStreamProfile`, `ClockSyncProfile`**: Used in streaming/clock sync support checks.
|
||||
|
||||
### External Dependencies
|
||||
- **WPF Framework**: For `SolidColorBrush` and `BrushesAndColors`.
|
||||
- **`DFConstantsAndEnums`**: Defines channel type suffixes and `VoltageStatusColor`.
|
||||
|
||||
### Inferred Consumers
|
||||
- UI layers (binding to `HardwareTypes`, `HardwareListTags`)
|
||||
- Device discovery/validation logic (e.g., `IsTSRAIRSerialNumber`)
|
||||
- Configuration UIs (e.g., `SLICETCConfigurations`, `SLICEPROSIMConfigurations`)
|
||||
- Recording mode selection logic (via `IsRecordingModeSupported`)
|
||||
- Streaming/clock sync configuration UIs
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Protocol Version Ignored in Trigger/Start Inversion**: Methods `SupportsTriggerInversion` and `SupportsStartInversion` accept `protocolVersion` but do not use it. Support is based solely on hardware type, which may be outdated.
|
||||
- **UART Streaming Excluded from Module Count**: `TSRAIR_MAX_MODULES = 6` explicitly excludes UART/Streaming modules (SW-only concepts), but this may be non-intuitive.
|
||||
- **`S6A_EthernetRecorder` Reuses `SLICE6AIR` Logic**: The comment notes this is a workaround to avoid duplication, but may obscure differences in behavior.
|
||||
- **`SLICE6_AIR_TC` Delegation Ambiguity**: `IsRecordingModeSupported` and `IsStreamingProfileSupported` delegate to `SLICE6AIRTC`, but no source for that class is provided—behavior is inferred.
|
||||
- **Hardcoded Serial Number Prefix**: `TSR_AIR_PREPEND = "TA"` is hardcoded; no fallback or configuration.
|
||||
- **`UNDEFINED` Value**: `UNDEFINED = 38` is marked with `"HardwareType_EMPTY"` description, but no usage context is provided.
|
||||
- **`AllowSoftDisconnects` Global State**: A mutable static property—dangerous for multi-tenant or concurrent use unless externally synchronized.
|
||||
- **Missing Hardware Types**: Commented-out values (`G5IPORT=22`, `SLICE6DB_AIR = 35`) suggest historical or future hardware not yet fully integrated.
|
||||
- **`HasEmbeddedChannelType` Logic Complexity**: The method uses string-based channel types (e.g., `"LOWG_SERIAL_APPEND"`) instead of enums, increasing risk of typos and inconsistency.
|
||||
29
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Reports.md
Normal file
29
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Reports.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Reports/ReportConstantsAndEnums.cs
|
||||
generated_at: "2026-04-16T03:21:17.832843+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6744bbd070ffff7d"
|
||||
---
|
||||
|
||||
# Reports
|
||||
|
||||
1. **Purpose**
|
||||
This file (`ReportConstantsAndEnums.cs`) is a placeholder or stub within the `DTS.Common.Enums.Reports` namespace. Based solely on the provided source, it contains no type definitions, constants, or logic—its purpose is likely to serve as a dedicated location for future enumeration and constant declarations related to reporting functionality. As written, it contributes no runtime behavior and exists only as a structural artifact.
|
||||
|
||||
2. **Public Interface**
|
||||
No public types, functions, classes, or constants are defined in this file. The namespace `DTS.Common.Enums.Reports` is declared, but the body is empty.
|
||||
|
||||
3. **Invariants**
|
||||
No invariants apply, as there are no executable statements, state, or constraints defined.
|
||||
|
||||
4. **Dependencies**
|
||||
The file imports standard .NET namespaces (`System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`), indicating it is intended for use in a .NET environment. However, since no actual types are declared, there are no compile-time or runtime dependencies *within* this module. It is unclear what (if any) other modules depend on this file, as no references to it appear in the provided source.
|
||||
|
||||
5. **Gotchas**
|
||||
- **Empty file**: This file currently serves no functional purpose and may be a remnant of scaffolding or an incomplete refactor. Developers should not expect any enums or constants here.
|
||||
- **Namespace naming**: The namespace `DTS.Common.Enums.Reports` suggests future reporting-related enums (e.g., `ReportType`, `ReportFormat`, or constants like `MaxReportRows`), but none are present—using this namespace for reporting logic will yield no results until types are added.
|
||||
- **No versioning or deprecation markers**: Since the file is empty, there is no indication of whether this is a new location for enums or a deprecated one. Historical context (e.g., whether enums were moved here from elsewhere) cannot be inferred.
|
||||
|
||||
*None identified from source alone.*
|
||||
320
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Sensors.md
Normal file
320
enriched-qwen3-coder-next/Common/DTS.Common/Enums/Sensors.md
Normal file
@@ -0,0 +1,320 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Sensors/SensorChangeTypes.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorStatus.cs
|
||||
- Common/DTS.Common/Enums/Sensors/PossibleFilters.cs
|
||||
- Common/DTS.Common/Enums/Sensors/LinearizationFormula.cs
|
||||
- Common/DTS.Common/Enums/Sensors/CalibrationEnforcement.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensitivityInspection.cs
|
||||
- Common/DTS.Common/Enums/Sensors/CalibrationBehaviors.cs
|
||||
- Common/DTS.Common/Enums/Sensors/InitialOffsetTypes.cs
|
||||
- Common/DTS.Common/Enums/Sensors/FilterClassType.cs
|
||||
- Common/DTS.Common/Enums/Sensors/ZeroMethodType.cs
|
||||
- Common/DTS.Common/Enums/Sensors/CSVImportTags.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorConstants.cs
|
||||
generated_at: "2026-04-16T03:20:17.284188+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fb4f3c61e14ed27e"
|
||||
---
|
||||
|
||||
# Sensor Enums and Constants Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines core enumerations and static constants used throughout the DTS system to represent sensor metadata, configuration, calibration behavior, filtering, and import/export semantics. It serves as the canonical source of truth for sensor-related data types, ensuring consistency across data import/export (especially CSV), channel configuration, calibration enforcement, and system behavior validation. The enums and constants support legacy compatibility, versioned CSV schema evolution, and domain-specific requirements (e.g., GM-ISF, TSR AIR, IR-TRACC).
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enumerations
|
||||
|
||||
#### `SensorChangeTypes`
|
||||
- **`OffsetTolerance`**: Represents a change type related to sensor offset tolerance.
|
||||
|
||||
#### `SensorStatus`
|
||||
- **`Available`**: Sensor is available for use.
|
||||
- **`InUse`**: Sensor is currently in use.
|
||||
- **`OutForService`**: Sensor is out for service.
|
||||
- **`OutForCalibration`**: Sensor is out for calibration.
|
||||
- **`Retired`**: Sensor is retired and no longer usable.
|
||||
|
||||
#### `PossibleFilters`
|
||||
- **`All`**: Include all channel/sensor types.
|
||||
- **`Analog`**: Analog channels.
|
||||
- **`Squib`**: Squib channels.
|
||||
- **`DigitalIn`**: Digital input channels.
|
||||
- **`DigitalOut`**: Digital output channels.
|
||||
- **`UART`**: UART channels.
|
||||
- **`StreamOut`**: Stream output channels.
|
||||
- **`StreamIn`**: Stream input channels.
|
||||
- **`CAN`**: CAN channels.
|
||||
|
||||
#### `NonLinearStyles`
|
||||
- **`IRTraccManual`**
|
||||
- **`IRTraccDiagnosticsZero`**
|
||||
- **`IRTraccZeroMMmV`**
|
||||
- **`IRTraccAverageOverTime`**
|
||||
- **`Polynomial`**
|
||||
- **`IRTraccCalFactor`**
|
||||
|
||||
#### `NonLinearSLICEWareStyles`
|
||||
- **`Manual`**
|
||||
- **`DiagnosticZeroMMmV`**
|
||||
- **`ZeroMMmV`**
|
||||
- **`AverageOverTime`**
|
||||
- **`Polynomial`**
|
||||
|
||||
#### `CalibrationEnforcement`
|
||||
- **`None`**: No calibration enforcement.
|
||||
- **`NonLinear`**: Enforce non-linear calibration.
|
||||
- **`Linear`**: Enforce linear calibration.
|
||||
|
||||
#### `SensitivityInspectionType`
|
||||
- **`NotSet`**: Inspection status not set (value `0`).
|
||||
- **`Required`**: Inspection required (value `1`).
|
||||
- **`Cleared`**: Inspection cleared (value `2`).
|
||||
|
||||
#### `CalibrationBehaviors`
|
||||
- **`LinearIfAvailable`**: Prefer linear calibration if available.
|
||||
- **`NonLinearIfAvailable`**: Prefer non-linear calibration if available.
|
||||
- **`UseBothIfAvailable`**: Use both linear and non-linear calibrations if available.
|
||||
|
||||
#### `InitialOffsetTypes`
|
||||
- **`None`**: No initial offset (value `0`).
|
||||
- **`EU`**: Offset specified in engineering units (EU) (value `1`).
|
||||
- **`EUAtMV`**: Offset specified in EU at a specific mV (value `2`).
|
||||
- **`LHS`**: Left-hand side offset (value `3`).
|
||||
- **`RHS`**: Right-hand side offset (value `4`).
|
||||
- **`FRONTAL`**: Frontal offset (value `5`).
|
||||
|
||||
#### `FilterClassType`
|
||||
- **`None`**: No filter (code `P` unless `UseZeroForUnfiltered` is true, then `0`) (value `0`).
|
||||
- **`AdHoc`**: Ad-hoc filter (value `-1`).
|
||||
- **`Unfiltered`**: Unfiltered (code `0`) (value `-2`).
|
||||
- **`CFC10`**: 17 Hz cutoff (code `17`) (value `17`).
|
||||
- **`CFC60`**: 100 Hz cutoff, code `D` (value `100`).
|
||||
- **`CFC180`**: 300 Hz cutoff, code `C` (value `300`).
|
||||
- **`CFC600`**: 1000 Hz cutoff, code `B` (value `1000`).
|
||||
- **`CFC1000`**: 1650 Hz cutoff, code `A` (value `1650`).
|
||||
|
||||
#### `ZeroMethodType`
|
||||
- **`AverageOverTime`**: Calculate zero using average over time (value `0`).
|
||||
- **`UsePreEventDiagnosticsZero`**: Calculate zero using pre-event diagnostics (value `1`).
|
||||
- **`None`**: No software zero (injected value) (value `2`).
|
||||
|
||||
#### `OriginalZeroMethodType`
|
||||
- **`AverageOverTime`**
|
||||
- **`UsePreCalZero`**
|
||||
- **`None`**
|
||||
|
||||
#### `CSVImportTags.Tags`
|
||||
A large set of tags used for CSV import/export, each annotated with `[Display(Name = "...")]` and `[Version(n)]`. Key examples:
|
||||
- **`DatabaseReferenceNumber`** (v0)
|
||||
- **`SensorSN`** (v0)
|
||||
- **`ChannelName`** (v0)
|
||||
- **`FilterClass`** (v0)
|
||||
- **`SoftwareZeroReference`** (v0)
|
||||
- **`Version`** (v1)
|
||||
- **`InitialOffset`** (v2)
|
||||
- **`ZeroMethod`** (v2)
|
||||
- **`DASSerialNumber`** (v4)
|
||||
- **`ClockMasterInputType`** (v5)
|
||||
- **`PTPDomainId`** (v6)
|
||||
|
||||
Static methods:
|
||||
- **`IsSensorTag(int version)`**: Returns `true` if `version` is in `{0, 2, 3, 4}`.
|
||||
- **`GetVersionTags(int version)`**: Returns array of `Tags` valid for given `version`.
|
||||
- **`GetStringForTag(Tags tag)`**: Returns display string for `tag`.
|
||||
- **`GetTagForString(string s)`**: Returns `Tags` for display string `s`; `Tags.Unknown` if not found.
|
||||
- **`GetVersionForTag(Tags t)`**: Returns version `int` for `tag`; `int.MaxValue` if not annotated.
|
||||
|
||||
#### `SensorConstants.SensorSettings`
|
||||
Enum of sensor configuration settings (used internally, not for serialization):
|
||||
- **`Range`, `CFC`, `Polarity`, `Position`, `LimitDuration` (deprecated), `Duration` (deprecated), `Delay` (deprecated), `OutputMode`, `SQMode`, `DIMode`, `DefaultValue`, `ActiveValue`**
|
||||
- **`SquibLimitDuration`, `SquibDuration`, `SquibDelay`, `DigitalOutLimitDuration`, `DigitalOutDuration`, `DigitalOutDelay`, `SquibCurrent`**
|
||||
- **`ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `UserValue1`, `UserValue2`, `UserValue3`, `InitialOffset`, `FilterClass`**
|
||||
- **`UartBaudRate`, `UartDataBits`, `UartStopBits`, `UartParity`, `UartFlowControl`, `UartDataFormat`**
|
||||
- **`StreamOutUDPProfile`, `StreamOutUDPAddress`, `StreamOutUDPTimeChannelId`, `StreamOutUDPDataChannelId`, `StreamOutUDPTmNSConfig`, `StreamOutIRIGTimeDataPacketIntervalMs`**
|
||||
- **`StreamInUDPAddress`, `ACCouplingEnabled`, `BridgeType`**
|
||||
|
||||
#### `SensorConstants.SensorType`
|
||||
- **`Analog`**
|
||||
- **`DigitalIn`**
|
||||
- **`DigitalOut`**
|
||||
- **`Squib`**
|
||||
- **`Clock`**
|
||||
- **`UART`**
|
||||
- **`StreamOut`**
|
||||
- **`StreamIn`**
|
||||
- **`Thermocoupler`**
|
||||
|
||||
#### `SensorConstants.SensUnits`
|
||||
- **`NONE`**: Polynomial sensor (value `0`)
|
||||
- **`mV`**: Sensitivity in mV (value `1`)
|
||||
- **`mVperV`**: Sensitivity in mV/V (value `2`)
|
||||
- **`mVperVperEU`**: Sensitivity in mV/V/EU (value `3`)
|
||||
- **`mVperEU`**: Sensitivity in mV/EU (value `4`)
|
||||
|
||||
#### `SensorConstants.BridgeType`
|
||||
Bitmask enum:
|
||||
- **`IEPE`** (`1 << 0`)
|
||||
- **`QuarterBridge`** (`1 << 1`)
|
||||
- **`HalfBridge`** (`1 << 2`)
|
||||
- **`FullBridge`** (`1 << 3`)
|
||||
- **`DigitalInput`** (`1 << 4`)
|
||||
- **`SQUIB`** (`1 << 5`)
|
||||
- **`TOMDigital`** (`1 << 6`)
|
||||
- **`HalfBridge_SigPlus`** (`1 << 7`)
|
||||
- **`RTC`** (`1 << 8`)
|
||||
- **`UART`** (`1 << 9`)
|
||||
- **`StreamOut`** (`1 << 10`)
|
||||
- **`StreamIn`** (`1 << 11`)
|
||||
- **`Thermocoupler`** (`1 << 12`)
|
||||
- **`CAN`** (`1 << 13`)
|
||||
|
||||
Static helpers:
|
||||
- **`ConvertIntToBridgeType(int bridge)`**: Maps integer to `BridgeType`.
|
||||
- **`ConvertBridgeToInt(BridgeType bridge)`**: Maps `BridgeType` to integer (legacy DB storage).
|
||||
|
||||
#### `SensorConstants.SensorCalPolicy`
|
||||
- **`AllowAlways`**: Allow sensors regardless of calibration status.
|
||||
- **`DONT_ALLOW`**: Reject out-of-cal sensors.
|
||||
|
||||
#### `SensorConstants.CouplingModes`
|
||||
- **`AC`** (`0`)
|
||||
- **`DC`**
|
||||
|
||||
### Constants (Static Fields)
|
||||
|
||||
#### Global Settings (Runtime Cache)
|
||||
- **`UseInitSignalTOM`**: `bool`, default `false`.
|
||||
- **`UseSensorFirstUseDate`**: `bool`, default `false`.
|
||||
- **`DontAllowDataCollectionIfOverused`**: `bool`, default `false`.
|
||||
- **`AllowInspectBeforeUse`**: `bool`, default `false`.
|
||||
- **`UsageRemainingForWarning`**: `int`, default `5`.
|
||||
- **`DefaultMaxUsageAllowed`**: `int`, default `2500`.
|
||||
- **`UseISOCodeFilterMapping`**: `bool`, default `true`.
|
||||
- **`DefaultZeroMethodType`**: `ZeroMethodType`, default `AverageOverTime`.
|
||||
- **`DefaultZeroMethodStart`**: `double`, default `-0.05`.
|
||||
- **`DefaultZeroMethodEnd`**: `double`, default `-0.02`.
|
||||
- **`DefaultRangeHiG`**: `double`, default `400`.
|
||||
- **`DefaultRangeLowG`**: `double`, default `64`.
|
||||
- **`DefaultRangeLowGDisplay`**: `double`, default `50`.
|
||||
- **`DefaultRangeARS`**: `double`, default `2000`.
|
||||
- **`DefaultRangeTemperature`**: `double`, default `85`.
|
||||
- **`DefaultRangeHumidity`**: `double`, default `100`.
|
||||
- **`DefaultRangePressure`**: `double`, default `16`.
|
||||
- **`SensorCalOutOfDateWarningPeriodDays`**: `int`, default `14`.
|
||||
- **`SensorCalPolicyCurrent`**: `SensorCalPolicy`, default `DONT_ALLOW`.
|
||||
- **`DisableAutoSense`**: `bool`, default `false`.
|
||||
- **`DefaultBridgeOffsetMVTolLow/High`**: `-100` / `100`.
|
||||
- **`DefaultIEPEOffsetMVTolLow/High`**: `-2000` / `2000`.
|
||||
|
||||
#### IR-TRACC Constants
|
||||
- **`δThorax`**: `15.65`
|
||||
- **`δAbdomen`**: `0`
|
||||
- **`D0Thorax`**: `141.8`
|
||||
- **`D0Abdomen`**: `150.9`
|
||||
- **`δThoraxLower`**: `-15.65`
|
||||
- **`D0ThoraxLower`**: `141.8`
|
||||
|
||||
#### 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"`
|
||||
- **`POTUnits`**: `new[] { "deg", "deg-ang" }`
|
||||
|
||||
#### Bridge Resistance Limits
|
||||
- **`MIN_BRIDGE_RESISTANCE_OHMS`**: `1`
|
||||
- **`MAX_BRIDGE_RESISTANCE_OHMS`**: `32000`
|
||||
|
||||
#### Sensor Defaults
|
||||
- **`SENSOR_FIRST_USE_DEFAULT`**: `false`
|
||||
- **`ALLOW_INSPECT_BEFORE_USE_DEFAULT`**: `false`
|
||||
- **`SENSOR_OVERUSE_DEFAULT`**: `false`
|
||||
- **`SENSOR_USAGE_REMAINING_FOR_WARNING_DEFAULT`**: `5`
|
||||
- **`SENSOR_DEFAULT_MAX_USAGE_DEFAULT`**: `2500`
|
||||
- **`CAL_SENSOR_POLICY_DEFAULT`**: `DONT_ALLOW`
|
||||
- **`CAL_SENSOR_POLICY_WARNING_DAYS_DEFAULT`**: `14`
|
||||
|
||||
#### Squib Defaults (Legacy)
|
||||
- **`SQUIB_DELAY_CONSTANT`**: `0`
|
||||
- **`SQUIB_LIMIT_DURATION_CONSTANT`**: `true`
|
||||
- **`SQUIB_DURATION_CONSTANT`**: `10`
|
||||
- **`SQUIB_LOW_TOLERANCE_CONSTANT`**: `1`
|
||||
- **`SQUIB_HIGH_TOLERANCE_CONSTANT`**: `10`
|
||||
- **`SQUIB_FIREMODE_CONSTANT`**: `SquibFireMode.CAP`
|
||||
- **`SQUIB_CURRENT_CONSTANT`**: `1.5`
|
||||
|
||||
#### Digital Output Defaults (Legacy)
|
||||
- **`DIGITALOUT_MODE_CONSTANT`**: `DigitalOutputModes.FVLH`
|
||||
- **`DIGITALOUT_DELAY_CONSTANT`**: `0`
|
||||
- **`DIGITALOUT_LIMITDURATION_CONSTANT`**: `true`
|
||||
- **`DIGITALOUT_DURATION_CONSTANT`**: `10`
|
||||
|
||||
#### UART Defaults (Legacy)
|
||||
- **`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 Defaults (Legacy)
|
||||
- **`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_THERMO`**: `"TST_"`
|
||||
- **`TEST_SPECIFIC_EMB_CLK`**: `"TSC_"`
|
||||
- **`TEST_SPECIFIC_UART`**: `"TSU_"`
|
||||
- **`TEST_SPECIFIC_STREAM_OUT`**: `"TSS_"`
|
||||
- **`TEST_SPECIFIC_STREAM_IN`**: `"TSN_"`
|
||||
- **`TEST_SPECIFIC_CAN`**: `"TSF_"`
|
||||
|
||||
Static helper methods:
|
||||
- **`IsTestSpecificDigitalOut(string sn)`**
|
||||
- **`IsTestSpecificSquib(string sn)`**
|
||||
- **`IsTestSpecificDigitalIn(string sn)`**
|
||||
- **`IsTestSpecificEmbedded(string sn)`**
|
||||
- **`IsTestSpecificThermoCouple(string sn)`**
|
||||
- **`IsTestSpecificEmbeddedClock(string sn)`**
|
||||
- **`IsTestSpecificStreamOut(string sn)`**
|
||||
- **`IsTestSpecificStreamIn(string sn)`**
|
||||
- **`IsTestSpecificUart(string sn)`**
|
||||
- **`IsTestSpecificThermocoupler(string sn)`**
|
||||
- **`IsTestSpecificCAN(string sn)`**
|
||||
|
||||
#### Other Constants
|
||||
- **`LinearValuesSeparator`**: `"||"` (used for encoding added linear calibration with non-linear sensor)
|
||||
- **`EditObjectSensorChannelDragFormat`**: `"EditObjectSensorsChannelTable.UserData []"`
|
||||
- **`TSRAirTemperatureChannel`**: `9`
|
||||
- **`TSRAirHumidityChannel`**: `10`
|
||||
- **`TSRAirPressureChannel`**: `11`
|
||||
- **`ARS2000`**, **`LowG64`**: `2000`, `64`
|
||||
- **`HighG`**, **`LowG`**, **`ARS`**, **`Atm`**: `"-High g"`, `"-Low g"`, `"-ARS"`, `"-Atm"`
|
||||
- **`IsTSRAirHighGChannel`, `IsTSRAirLowGChannel`, `IsTSRAirARSChannel`, `IsTSRAirAtmChannel`, `IsTSRAirHumidityChannel`**: Helper methods.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **CSV Import Versions**: Valid versions are `0` through `6`. Only versions `{0, 2, 3, 4}` are considered sensor tag versions (`IsSensorTag`).
|
||||
- **`ZeroMethodType` ordering**: The values `0`, `1`, `2` are critical for legacy compatibility (e.g., GM-ISF import).
|
||||
- **`BridgeType` bitmask**: Values are powers of two; `ConvertBridgeToInt` maps to legacy integer storage (e.g., `FullBridge` → `3`).
|
||||
- **`SensitivityInspectionType` values**: `NotSet=0`, `Required=1`, `Cleared=2`.
|
||||
- **`FilterClassType` codes**: Values map to SAE filter class codes (e.g., `CFC60` → `100` → code `D`).
|
||||
- **`CalibrationEnforcement` and `CalibrationBehaviors`**: Must be used consistently with `NonLinearStyles` and `NonLinearSLICEWareStyles`.
|
||||
- **`InitialOffsetTypes`**: Values `EU`, `EUAtMV`, `LHS`, `RHS`, `FRONTAL` are mutually exclusive and context-dependent.
|
||||
- **`
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/DigitalInputFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/CanSettingFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/DigitalOutFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/SensorListTabs.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/UartSettingFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/SquibFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/StreamInSettingFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/StreamOutSettingFields.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/CACOption.cs
|
||||
- Common/DTS.Common/Enums/Sensors/SensorsList/AnalogSensorFields.cs
|
||||
generated_at: "2026-04-16T03:21:45.048133+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "86047a70fdfac4c0"
|
||||
---
|
||||
|
||||
# SensorsList
|
||||
|
||||
## Documentation: Sensor Field Enumerations (`DTS.Common.Enums.Sensors.SensorsList`)
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module defines a set of strongly-typed enumerations that specify the *valid field names* for various sensor configuration types within the DTS system. Each enumeration corresponds to a specific sensor category (e.g., `AnalogSensorFields`, `DigitalInputFields`, `SquibFields`) and enumerates the fields that may be used for operations such as data binding, serialization/deserialization, UI display, or configuration editing. These enums serve as metadata contracts—ensuring consistency across layers (e.g., UI, persistence, validation) when referring to sensor properties by name.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
All types are `public enum`s in the `DTS.Common.Enums.Sensors.SensorsList` namespace.
|
||||
|
||||
| Enum | Fields | Description |
|
||||
|------|--------|-------------|
|
||||
| `DigitalInputFields` | `Included`, `SerialNumber`, `Description`, `Mode`, `ModifiedBy`, `LastModified` | Fields applicable to digital input sensors. |
|
||||
| `CanSettingFields` | `CanIsFD`, `CanArbBaseBitrate`, `CanArbBaseSJW`, `CanDataBitrate`, `CanDataSJW`, `CanFileType` | Fields for configuring CAN bus settings (including CAN FD parameters). |
|
||||
| `DigitalOutFields` | `Included`, `SerialNumber`, `Description`, `Delay`, `Duration`, `ModifiedBy`, `LastModified` | Fields applicable to 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 the sensor list UI; maps to sensor categories. |
|
||||
| `UartSettingFields` | `Included`, `SerialNumber`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, `DataFormat`, `LastModifiedBy`, `LastModified` | Fields for UART configuration. |
|
||||
| `SquibFields` | `Included`, `SerialNumber`, `Description`, `ResistanceLow`, `ResistanceHigh`, `Id`, `Mode`, `Delay`, `Current`, `Duration`, `ModifiedBy`, `LastModified` | Fields for squib (explosive device) sensor configuration. |
|
||||
| `StreamInSettingFields` | `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPAddress` | Fields for stream-in (e.g., UDP-based input) configuration. |
|
||||
| `StreamOutSettingFields` | `Included`, `SerialNumber`, `Description`, `LastModifiedBy`, `LastModified`, `UDPProfile`, `UDPAddress`, `UDPTimeChannelId`, `UDPDataChannelId`, `UDPTmNSConfig`, `IRIGTimeDataPacketIntervalMs`, `TMATSIntervalMs` | Fields for stream-out (e.g., UDP-based output) configuration. |
|
||||
| `CACOption` | `Manual`, `Capacity`, `RangeHigh`, `RangeMedium`, `RangeLow` | Options for CAC (likely Calibration/Auto-Calibration) mode. Each value is annotated with `[DescriptionResourceAttribute]` referencing a resource key (e.g., `"CAC_Manual"`). |
|
||||
| `AnalogSensorFields` | `Included`, `SerialNumber`, `Description`, `Manufacturer`, `Model`, `Capacity`, `CalInterval`, `Sensitivity`, `LinearSensitivity`, `Resistance`, `Excitation`, `Units`, `Id`, `CalDate`, `CalDueDate`, `ModifiedBy`, `LastModified`, `IEPE`, `OutOfDate`, `InWarningPeriod`, `UsageMaximized`, `InUsageWarningPeriod`, `NonLinearCalucationType`, `ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `FirstUseDate`, `UserValue1`, `UserValue2`, `UserValue3`, `Assembly`, `UsageCount`, `MaximumUsage` | Fields for analog sensor configuration. Includes calibration, usage tracking, and nonlinear calibration parameters. |
|
||||
|
||||
> **Note**: `CACOption` is the only enum in this module that references an external attribute (`DescriptionResourceAttribute` from `DTS.Common.Base.Classes`). Its behavior depends on the presence and implementation of that attribute and associated resource files.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Field Name Consistency**: Each enum value name is intended to map directly to a *property or field name* in a corresponding sensor configuration class (e.g., a `DigitalInputSensor` class would have a `Mode` property). The enum values are *not* arbitrary strings—they are compile-time constants representing known keys.
|
||||
- **`Included` is universal**: Every sensor-specific field enum (`DigitalInputFields`, `DigitalOutFields`, `UartSettingFields`, etc.) includes an `Included` field. This likely indicates whether the sensor instance is active/enabled in the current configuration.
|
||||
- **`LastModified` / `LastModifiedBy` / `ModifiedBy`**: Most enums include at least one of these metadata fields, suggesting auditability is required across sensor types. Note the inconsistency: `DigitalInputFields` and `DigitalOutFields` use `ModifiedBy`, while `UartSettingFields`, `StreamInSettingFields`, and `StreamOutSettingFields` use `LastModifiedBy`.
|
||||
- **`SensorListTabs` is zero-indexed and ordered**: The enum values are assigned explicit integer values starting at `0`, implying they may be used for array indexing or tab ordering in UI components.
|
||||
- **`CACOption` values are mutually exclusive**: As a standard enum, only one `CACOption` value can be selected at a time (unless bitwise flags are applied elsewhere, but no `[Flags]` attribute is present).
|
||||
- **Typo in `AnalogSensorFields`**: `NonLinearCalucationType` is misspelled (`Calucation` instead of `Calculation`). This is preserved as-is per source.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Internal Dependencies**:
|
||||
- `CACOption` depends on `DTS.Common.Base.Classes.DescriptionResourceAttribute`. This attribute is assumed to be defined in `DTS.Common.Base.Classes` and used for localization/resource-based description lookup.
|
||||
- All enums reside in the `DTS.Common` assembly (specifically, the `DTS.Common` project under `Common/DTS.Common/`).
|
||||
- **Consumers (inferred)**:
|
||||
- UI layers (e.g., WPF/WinForms) likely use `SensorListTabs` to manage tab ordering.
|
||||
- Data binding or serialization frameworks likely use the `*Fields` enums to map UI controls or JSON/XML properties to sensor configuration objects.
|
||||
- Validation or persistence logic likely uses the `*Fields` enums to determine which fields to include/exclude during save/load operations.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Inconsistent naming for modifier fields**:
|
||||
- `DigitalInputFields` and `DigitalOutFields` use `ModifiedBy`.
|
||||
- `UartSettingFields`, `StreamInSettingFields`, and `StreamOutSettingFields` use `LastModifiedBy`.
|
||||
- `AnalogSensorFields`, `SquibFields` use `ModifiedBy`.
|
||||
This inconsistency may cause bugs if code assumes uniform naming (e.g., in reflection-based logic or generic UI scaffolding).
|
||||
|
||||
- **`CACOption` requires resource infrastructure**:
|
||||
The enum values rely on `DescriptionResourceAttribute`, which is not defined in the provided source. Without the corresponding resource files (e.g., `.resx`) and runtime support for `DescriptionResourceAttribute`, the enum values will not display user-friendly descriptions.
|
||||
|
||||
- **`FirstUseDate` comment is inline**:
|
||||
In `AnalogSensorFields`, the comment `//13065 Sensor "First Use" Date` suggests a legacy requirement or ticket reference. Its presence implies special handling may be needed for this field (e.g., initialization logic, audit logging), but no further context is available.
|
||||
|
||||
- **`NonLinearCalucationType` is misspelled**:
|
||||
The typo (`Calucation` instead of `Calculation`) is preserved in the enum. Any code referencing this field must use the exact misspelled name to avoid runtime errors.
|
||||
|
||||
- **No `Included` in `CACOption`**:
|
||||
Unlike all other sensor field enums, `CACOption` does *not* include an `Included` field. This suggests `CACOption` is not a sensor configuration set but rather a *setting*—likely used within another configuration object (e.g., a CAN or analog sensor config).
|
||||
|
||||
- **`StreamInSettingFields` and `StreamOutSettingFields` share `UDPAddress`**:
|
||||
Both enums include `UDPAddress`, but `StreamOutSettingFields` has additional UDP-specific fields (`UDPProfile`, `UDPTimeChannelId`, etc.). Ensure consumers do not assume `UDPAddress` alone is sufficient for stream-out configuration.
|
||||
|
||||
- **No `Included` in `CanSettingFields`**:
|
||||
This enum lacks an `Included` field, implying CAN settings may be enabled/disabled elsewhere (e.g., at a higher level in the configuration hierarchy).
|
||||
|
||||
- **No `Included` in `SensorListTabs`**:
|
||||
This enum represents *tabs*, not sensor instances, so `Included` is not applicable—but developers might mistakenly expect it.
|
||||
|
||||
- **None identified from source alone.**
|
||||
*(Note: The above gotchas are inferred from patterns and inconsistencies in the provided source.)*
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/SettingsExport/TopLevelFields.cs
|
||||
generated_at: "2026-04-16T03:19:43.404409+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "342aa68e489c8962"
|
||||
---
|
||||
|
||||
# SettingsExport
|
||||
|
||||
### 1. **Purpose**
|
||||
This module defines a strongly-typed enumeration (`TopLevelFields`) that enumerates the valid top-level XML element names used in settings export/serialization contexts within the DTS system. It serves as a canonical source of truth for root-level XML tags, ensuring consistency across components that generate, parse, or validate settings export XML documents.
|
||||
|
||||
### 2. **Public Interface**
|
||||
The module exposes only one public type:
|
||||
|
||||
- **`TopLevelFields`** (`enum`)
|
||||
Represents the set of allowed root-level XML element names in settings export files.
|
||||
Members:
|
||||
- `GlobalSettings`
|
||||
- `TestSetupDefaultSettings`
|
||||
- `SensorSettings`
|
||||
- `TestHistorySettings`
|
||||
|
||||
Each member corresponds to a specific logical section of configuration data in the exported XML.
|
||||
|
||||
### 3. **Invariants**
|
||||
- The enum values are exhaustive and fixed; no new members may be added without updating all consumers that rely on this set (e.g., XML serializers/deserializers, schema validators).
|
||||
- The underlying type is `int` (default for C# enums), but values are not explicitly assigned and thus default to `0`, `1`, `2`, `3` respectively.
|
||||
- Only these four values are considered valid root tags; any other XML root element name is invalid per this specification.
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **No external dependencies**: This file contains only a self-contained enum definition with no `using` directives or references to other types.
|
||||
- **Consumers**: Based on naming and documentation, this enum is likely used by modules responsible for XML serialization/deserialization of settings (e.g., in `DTS.Common` or downstream projects like `DTS.Export`, `DTS.Settings`). Exact consumers are not visible in this file but would typically be in XML processing or configuration modules.
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **No explicit values assigned**: The enum relies on default sequential integer values (`0`–`3`). If serialization/deserialization logic depends on specific numeric values (e.g., for backward compatibility or binary formats), this could be fragile.
|
||||
- **No documentation for semantics**: While the XML tag names are listed, the *meaning* or *schema* of each settings section (e.g., what fields belong under `SensorSettings`) is not defined here and must be found elsewhere.
|
||||
- **Namespace is specific**: The `DTS.Common.Enums.SettingsExport` namespace suggests this enum is part of a larger settings export domain model; using it outside that context may be inappropriate.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/SliceSimpleArm/SSACommands.cs
|
||||
generated_at: "2026-04-16T03:20:30.657524+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c8e9763507d9b807"
|
||||
---
|
||||
|
||||
# SliceSimpleArm
|
||||
|
||||
## 1. Purpose
|
||||
This module defines the core command and response enumerations used for communication with a *SliceSimpleArm* (SSA) subsystem—likely a hardware control interface for a data acquisition or sensor system. It establishes a standardized protocol vocabulary: `SSACommand` enumerates the set of actionable operations that can be sent to the device (e.g., arming, starting recording, diagnostics), while `SSAResponse` enumerates the structured responses the device may return, including success/failure states and specific error conditions (e.g., `NoSensorsFound`, `DiagnosticsFailedOffsetTolerance`). This enables type-safe, consistent messaging between software layers interacting with the SSA hardware.
|
||||
|
||||
## 2. Public Interface
|
||||
The module exposes only two public enums; no classes, methods, or properties are defined.
|
||||
|
||||
- **`SSACommand`**
|
||||
*Type:* `enum`
|
||||
*Values:*
|
||||
- `ConfigureDevice` – Request device configuration.
|
||||
- `Diagnostics` – Trigger internal self-diagnostics.
|
||||
- `Arm` – Prepare the device for data acquisition (e.g., enable sensors, set state to armed).
|
||||
- `StartRecord` – Begin recording data.
|
||||
- `CheckForArmed` – Query whether the device is currently armed.
|
||||
- `Disarm` – Deactivate the armed state (e.g., disable sensors, reset state).
|
||||
- `Download` – Request data or logs from the device.
|
||||
- `SetLowPowerMode` – Transition the device into a low-power state.
|
||||
- `Trigger` – Initiate an external or software-triggered event.
|
||||
|
||||
- **`SSAResponse`**
|
||||
*Type:* `enum`
|
||||
*Values:*
|
||||
- `Unknown` – Default/uninitialized response.
|
||||
- `Status` – General status update (non-specific).
|
||||
- `Pass` – Command executed successfully.
|
||||
- `Fail` – Command failed for an unspecified reason.
|
||||
- `SystemNotArmed` – Operation requires the system to be armed (e.g., `StartRecord`), but it is not.
|
||||
- `NoSensorsFound` – No sensors detected during configuration/diagnostics.
|
||||
- `NoEIDsFound` – No Event Identifiers (EIDs) found—likely in configuration or metadata.
|
||||
- `UnknownEIDFound` – An unrecognized EID was encountered.
|
||||
- `NoDASConnected` – Data Acquisition System (DAS) is not connected or detected.
|
||||
- `ExceptionThrown` – An unexpected exception occurred during command processing.
|
||||
- `DiagnosticsFailedOffsetTolerance` – Diagnostics failed due to sensor offset exceeding tolerance.
|
||||
- `DiagnosticsFailedShuntCheck` – Diagnostics failed during shunt calibration check.
|
||||
|
||||
## 3. Invariants
|
||||
- `SSACommand` and `SSAResponse` are *mutually independent* enums; no implicit mapping between command and response values is defined here (e.g., `Arm` does not imply a specific response value).
|
||||
- All enum values are explicitly named and non-numeric; no implicit integer values are relied upon in this file.
|
||||
- No runtime validation or enforcement of command/response semantics is present in this module—validation logic (if any) resides elsewhere.
|
||||
- The `Unknown` value in both enums likely serves as a sentinel for uninitialized or unparseable states.
|
||||
|
||||
## 4. Dependencies
|
||||
- **No external dependencies** are declared in this file (no `using` statements beyond `namespace` scope).
|
||||
- This module is part of `DTS.Common.Enums.SliceSimpleArm`, implying it is consumed by higher-level modules (e.g., communication layers, device drivers, UI) in the `DTS.Common` assembly or dependent projects.
|
||||
- Likely consumers include:
|
||||
- Device communication handlers (e.g., serial/USB/I²C drivers) that serialize/deserialize `SSACommand`/`SSAResponse` values.
|
||||
- State machines or controllers managing the armed/disarmed lifecycle.
|
||||
- Diagnostic or logging utilities that interpret `SSAResponse` codes.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguity in command semantics**: The enum names (e.g., `Trigger`, `Download`) do not specify *how* or *when* they should be used (e.g., is `Trigger` synchronous? Does `Download` require prior `CheckForArmed`?). These rules are not defined here.
|
||||
- **No versioning or extensibility guidance**: Adding new commands/responses may break backward compatibility if serialized representations (e.g., over a wire protocol) are assumed fixed.
|
||||
- **`Status` vs. `Pass`**: The distinction between `Status` (generic update) and `Pass` (explicit success) is unclear—consumers may conflate them.
|
||||
- **`UnknownEIDFound` vs. `NoEIDsFound`**: The difference between these two responses is not documented—consumers must infer whether `NoEIDsFound` implies *zero* EIDs were expected/required, while `UnknownEIDFound` implies *unexpected* EIDs were present.
|
||||
- **No error hierarchy**: All failures are flat; no grouping (e.g., "configuration errors", "hardware errors") is provided, potentially complicating error handling.
|
||||
- *None identified from source alone.*
|
||||
120
enriched-qwen3-coder-next/Common/DTS.Common/Enums/TSRAIRGo.md
Normal file
120
enriched-qwen3-coder-next/Common/DTS.Common/Enums/TSRAIRGo.md
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/TSRAIRGo/NavigationButtonId.cs
|
||||
- Common/DTS.Common/Enums/TSRAIRGo/ArmStateMachineStates.cs
|
||||
generated_at: "2026-04-16T03:19:36.720501+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "59ccdc367292f870"
|
||||
---
|
||||
|
||||
# TSRAIRGo
|
||||
|
||||
## Documentation Page: TSRAIRGo Navigation & Arm State Machine Enums
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module defines core enumerations used in the TSRAIRGo application to represent navigation button identifiers and discrete states of the arm subsystem’s finite state machine (FSM). It serves as a shared contract between UI components (e.g., button handlers, status displays) and the arm control logic, ensuring consistent state and action semantics across the system. The `NavigationButtonId` enum maps UI interactions to logical actions, while `ArmStateMachineStates` provides the canonical set of states governing arming, disarming, data acquisition, and download workflows.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `NavigationButtonId` Enum
|
||||
Defined in: `DTS.Common.Enums.TSRAIRGo.NavigationButtonId`
|
||||
|
||||
- **Members** (all `public`):
|
||||
- `TestId` → Represents a test/debug button.
|
||||
- `ArmDisarm` → Toggles arming/disarming state.
|
||||
- `Trigger` → Manually initiates a test trigger.
|
||||
- `Download` → Initiates or manages data download.
|
||||
- `ViewData` → Opens data view interface.
|
||||
- `ExportData` → Exports collected data.
|
||||
- `Help` → Opens help documentation or UI.
|
||||
- `Dashboard` → Navigates to the main dashboard view.
|
||||
|
||||
#### `ArmStateMachineStates.States` Nested Enum
|
||||
Defined in: `DTS.Common.Enums.TSRAIRGo.ArmStateMachineStates`
|
||||
|
||||
- **Members** (all `public`, with `[Description]` attributes):
|
||||
- `CheckingArmState`
|
||||
- `CheckingForDAS`
|
||||
- `CheckingForData`
|
||||
- `ClearingFlash`
|
||||
- `Disarmed`
|
||||
- `Downloading`
|
||||
- `DownloadCleaningUp`
|
||||
- `DownloadFinished`
|
||||
- `Failed`
|
||||
- `Faulted`
|
||||
- `GettingEventInfo`
|
||||
- `IDLE` *(note: uppercase)*
|
||||
- `PostTestProcessing`
|
||||
- `PreparingForArming`
|
||||
- `ReadyForDownload`
|
||||
- `Rearming`
|
||||
- `Recording`
|
||||
- `WaitingForInterval`
|
||||
- `WaitingForSchedule`
|
||||
- `WaitingForTrigger`
|
||||
- `Streaming`
|
||||
|
||||
> **Note**: The enum is nested inside a non-generic container class `ArmStateMachineStates`. The actual type used in code is `ArmStateMachineStates.States`.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **`NavigationButtonId`**:
|
||||
- All members are compile-time constants; no runtime mutation is possible.
|
||||
- Values are implicitly assigned starting from `0` (`TestId = 0`, `ArmDisarm = 1`, ..., `Dashboard = 7`).
|
||||
- No validation is performed on usage; callers must ensure button IDs map to valid UI elements.
|
||||
|
||||
- **`ArmStateMachineStates.States`**:
|
||||
- The set of states is exhaustive for the arm subsystem’s lifecycle.
|
||||
- Each state has a human-readable description via `[Description]` (from `System.ComponentModel`), but **no runtime enforcement** ensures descriptions match expected UI text.
|
||||
- The `IDLE` state is intentionally capitalized (unlike PascalCase convention), suggesting legacy or external convention adherence.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Imports/Usings**:
|
||||
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`, `System.ComponentModel`
|
||||
→ Indicates usage of standard .NET types (e.g., `DescriptionAttribute`).
|
||||
|
||||
- **Module Dependencies**:
|
||||
- `DTS.Common` namespace suggests this is part of a shared common library (`DTS.Common.dll`).
|
||||
- Likely consumed by:
|
||||
- UI layer (e.g., WPF/WinForms/Xamarin projects referencing `DTS.Common`)
|
||||
- Arm control logic (e.g., `DTS.TSRAIRGo.Core` or similar)
|
||||
- No direct dependencies on other *TSRAIRGo*-specific enums or classes in the provided files.
|
||||
|
||||
- **Consumers**:
|
||||
- Not inferable from source alone, but given the enum names, consumers are expected to include:
|
||||
- View models or UI controllers handling button clicks.
|
||||
- State machine implementations managing the arm subsystem.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Capitalization Inconsistency**:
|
||||
`IDLE` is uppercase while all other `ArmStateMachineStates.States` members follow PascalCase (`CheckingArmState`, `Downloading`, etc.). This may cause issues in string comparisons, serialization, or UI binding if case-sensitive logic is used.
|
||||
|
||||
- **No Explicit Values Assigned**:
|
||||
Both enums rely on implicit integer values. If new members are inserted (e.g., between `ArmDisarm` and `Trigger`), existing serialized data or persisted state may become misaligned.
|
||||
|
||||
- **`ArmStateMachineStates` is a Container Class**:
|
||||
The enum is nested inside a class (`ArmStateMachineStates`) rather than being a top-level enum. This adds verbosity (`ArmStateMachineStates.States.CheckingArmState`) and may indicate legacy design or namespace organization constraints.
|
||||
|
||||
- **`Description` Attributes Not Auto-Used**:
|
||||
While `[Description]` attributes are present, the source provides no evidence of helper methods (e.g., `GetDescription()`) to extract them. Consumers must implement reflection-based extraction if needed.
|
||||
|
||||
- **No Validation or Guard Clauses**:
|
||||
Neither enum includes validation logic (e.g., `TryParse`, range checks). Invalid values (e.g., `(NavigationButtonId)99`) will be accepted at runtime.
|
||||
|
||||
- **None identified from source alone.**
|
||||
*(No other non-obvious behavior, tech debt, or quirks are evident from the provided files.)*
|
||||
87
enriched-qwen3-coder-next/Common/DTS.Common/Enums/TTS.md
Normal file
87
enriched-qwen3-coder-next/Common/DTS.Common/Enums/TTS.md
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/TTS/TTSEnums.cs
|
||||
generated_at: "2026-04-16T03:21:01.092126+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d044aea8e131ba46"
|
||||
---
|
||||
|
||||
# Documentation: `DTS.Common.Enums.TTS.TTSEnums`
|
||||
|
||||
## 1. Purpose
|
||||
This module defines enumerations and a custom attribute used to manage field-level metadata for TTS (likely *Test & Test System* or *Twin-Tee Sensor*) import configurations, specifically in the context of Toyota-specific sensor channel definitions. It addresses issue #18396, where TTS import files contain a large number of columns, leading to confusion about which fields are actively used. The `FieldSupportLevel` enum and `FieldSupportAttribute` allow developers to declaratively mark enum fields as `RequiredParameter`, `RemainedButNotUsed`, or `RemovedParameter`, enabling runtime introspection to filter or validate fields during import processing.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `FieldSupportLevel`
|
||||
**Type**: `enum`
|
||||
**Values**:
|
||||
- `RequiredParameter`: Field is actively required and used.
|
||||
- `RemainedButNotUsed`: Field exists in the data model/import but is not currently used.
|
||||
- `RemovedParameter`: Field has been deprecated and should be ignored.
|
||||
|
||||
### `FieldSupportAttribute`
|
||||
**Type**: `class` (custom attribute)
|
||||
**Namespace**: `DTS.Common.Enums.TTS`
|
||||
**Usage**: `[FieldSupport(FieldSupportLevel)]` applied to enum fields.
|
||||
**Properties**:
|
||||
- `SupportLevel` (`FieldSupportLevel`): Gets or sets the support level assigned to the attributed field.
|
||||
**Methods**:
|
||||
- `FieldSupportAttribute(FieldSupportLevel value)`: Constructor.
|
||||
- `static FieldSupportLevel GetSupportLevel(Enum genericEnum)`: Returns the `FieldSupportLevel` for a given enum value by reflecting on its `FieldSupportAttribute`. If no attribute is present, defaults to `FieldSupportLevel.RemovedParameter`.
|
||||
|
||||
### `ToyotaFieldOrder`
|
||||
**Type**: `enum`
|
||||
**Purpose**: Defines the column order (0-based index) for fields in Toyota TTS import files. Each field is annotated with a `FieldSupportAttribute` indicating its current support status.
|
||||
**Key Fields (selected)**:
|
||||
- `ChannelNumber` (0) → `RequiredParameter`
|
||||
- `SensorID` (5) → `RemainedButNotUsed`
|
||||
- `InitialOffsetVoltageTolerance` (17) → `RemovedParameter`
|
||||
- `KyowaSpecificField_1` (32) → `RemovedParameter` (with FogBugz reference)
|
||||
|
||||
### `ToyotaBridgeType`
|
||||
**Type**: `enum`
|
||||
**Purpose**: Represents supported bridge configurations for sensors.
|
||||
**Values**:
|
||||
- `FullBridge`, `HalfBridge`, `Voltage`, `PotentionmeterFullBridge`, `PotentionmeterHalfBridge`, `IRTRACC`, `LinearChestPot`
|
||||
**Note**: Values use `[Description]` attributes (from `System.ComponentModel`) but no `FieldSupportAttribute`; support level is not explicitly declared here.
|
||||
|
||||
### `ToyotaZeroMethods`
|
||||
**Type**: `enum`
|
||||
**Purpose**: Defines zeroing methods for sensor calibration.
|
||||
**Values**:
|
||||
- `None` (0)
|
||||
- `AverageOverTime` (1)
|
||||
- `UsePreEventDiagnosticsZero` (2)
|
||||
**Note**: Values use `[Description]` attributes (e.g., `"0"`, `"1"`) but no `FieldSupportAttribute`; support level is not explicitly declared here.
|
||||
|
||||
## 3. Invariants
|
||||
- **`FieldSupportAttribute.GetSupportLevel(Enum)` behavior**:
|
||||
- Always returns a valid `FieldSupportLevel`.
|
||||
- If the provided enum value has no `FieldSupportAttribute` applied, returns `FieldSupportLevel.RemovedParameter` as a safe default.
|
||||
- **`ToyotaFieldOrder` fields**:
|
||||
- Each field must have exactly one `FieldSupportAttribute` (enforced by design, though not compile-time validated).
|
||||
- The integer values are fixed and correspond to column indices in the TTS import file (0–32).
|
||||
- **`ToyotaBridgeType` and `ToyotaZeroMethods`**:
|
||||
- No `FieldSupportAttribute` is applied to any of their fields. Their support status is *not* managed by this module and must be handled elsewhere (e.g., in documentation or other attributes).
|
||||
|
||||
## 4. Dependencies
|
||||
**Dependencies *of* this module**:
|
||||
- `System` (core runtime)
|
||||
- `System.ComponentModel` (for `[Description]` attribute used in `ToyotaBridgeType` and `ToyotaZeroMethods`)
|
||||
- `System.Linq` (used in `FieldSupportAttribute.GetSupportLevel` via `.Any()` and `.ElementAt()`)
|
||||
|
||||
**Dependencies *on* this module**:
|
||||
- Not specified in source, but implied usage:
|
||||
- TTS import logic (e.g., a parser or validator) likely consumes `FieldSupportAttribute.GetSupportLevel()` to filter columns.
|
||||
- UI or configuration tools may use `ToyotaFieldOrder` to map UI controls to import columns.
|
||||
- `ToyotaBridgeType` and `ToyotaZeroMethods` are likely used in sensor configuration classes (not shown here).
|
||||
|
||||
## 5. Gotchas
|
||||
- **Default support level**: `FieldSupportAttribute.GetSupportLevel(Enum)` silently defaults to `RemovedParameter` for enums *without* the attribute—this may mask missing annotations.
|
||||
- **Reflection overhead**: `GetSupportLevel` uses reflection (`GetMember`, `GetCustomAttributes`) on every call. Not suitable for high-frequency use without caching.
|
||||
- **`ToyotaBridgeType`/`ToyotaZeroMethods` lack `FieldSupportAttribute`**: Their support status is undefined in this module. Developers must infer or document separately.
|
||||
- **Typos in enum names**: `PotentionmeterFullBridge` and `PotentionmeterHalfBridge` are misspelled (should be *Potentiometer*).
|
||||
- **Historical references**: `KyowaSpecificField_1` includes a FogBugz URL (`http://fogbugz/fogbugz/default.asp?5433`), which may be internal-only and inaccessible externally.
|
||||
- **No validation of `FieldSupportAttribute` placement**: The attribute is only valid on fields (`AttributeTargets.Field`), but misuse (e.g., on properties) will compile but fail at runtime in `GetSupportLevel`.
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/TestSetups/RealtimeGraphsEnum.cs
|
||||
generated_at: "2026-04-16T03:21:20.643645+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "53144cdff253078c"
|
||||
---
|
||||
|
||||
# TestSetups
|
||||
|
||||
### 1. Purpose
|
||||
This module defines the `RealtimeGraphsEnum` enumeration, which specifies the supported configurations for the number of real-time graphs displayed in the user interface—specifically, one, three, or six graphs. It serves as a strongly-typed, descriptively annotated constant set used throughout the system to ensure consistency in UI layout and backend graph management logic. The enum is decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`, enabling localized or custom string representation via the `DescriptionAttribute` values during UI binding or serialization.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`RealtimeGraphsEnum`**
|
||||
An enumeration with three named values:
|
||||
- `RealtimeGraphsEnum.One` (value `1`) — Represents a single real-time graph layout.
|
||||
- `RealtimeGraphsEnum.Three` (value `3`) — Represents a three-graph layout (e.g., 1×3 or 3×1 grid).
|
||||
- `RealtimeGraphsEnum.Six` (value `6`) — Represents a six-graph layout (e.g., 2×3 or 3×2 grid).
|
||||
Each member is annotated with a `[Description(...)]` attribute containing a string key (e.g., `"RealtimeGraphs_One"`) intended for localization or lookup by the `EnumDescriptionTypeConverter`.
|
||||
|
||||
### 3. Invariants
|
||||
- The enum values are strictly `1`, `3`, and `6`; no other integer values are defined or intended.
|
||||
- The `DescriptionAttribute` values are fixed string keys (not raw display strings) and must be resolved externally (e.g., via resource files) using the `EnumDescriptionTypeConverter`.
|
||||
- The enum is not extensible at runtime; new values require source code changes and recompilation.
|
||||
- The `[TypeConverter]` attribute is required for proper deserialization/binding in XAML or UI frameworks that rely on `TypeConverter` for enum-to-string conversion.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverter`)
|
||||
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter for resolving descriptions)
|
||||
- **Used by**:
|
||||
- UI layers (e.g., WPF/XAML bindings) that consume this enum to configure graph panel layouts.
|
||||
- Backend services or view models that validate or route logic based on graph count (e.g., initializing the correct number of chart instances).
|
||||
*(Exact consumers are not visible in this file alone but are implied by the enum’s purpose.)*
|
||||
|
||||
### 5. Gotchas
|
||||
- The `DescriptionAttribute` values (e.g., `"RealtimeGraphs_One"`) are *keys*, not human-readable labels. The actual display text must be resolved via the `EnumDescriptionTypeConverter`, likely by looking up these keys in a resource manager. Assuming the description string is the literal display text (e.g., "RealtimeGraphs_One") will cause incorrect UI output.
|
||||
- The enum values (`1`, `3`, `6`) are non-sequential and non-power-of-two; avoid bitwise operations or assuming arithmetic relationships.
|
||||
- The `EnumDescriptionTypeConverter` must be registered or available in the target framework context (e.g., WPF); otherwise, binding or serialization may fall back to the enum’s name (`"One"`, `"Three"`, `"Six"`) instead of the description key.
|
||||
- No validation is enforced at the enum level—calling code must ensure only valid values are used (e.g., `6` is valid, but `2` is not defined and would require explicit handling).
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Enums/TestSetups/TestSetupsList/TestSetupFields.cs
|
||||
generated_at: "2026-04-16T03:22:07.305062+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d9c52bce6858a67a"
|
||||
---
|
||||
|
||||
# TestSetupsList
|
||||
|
||||
### 1. **Purpose**
|
||||
This module defines a strongly-typed enumeration `TestSetupFields` used to represent the set of canonical field names associated with a test setup record in the DTS (presumably *Device Test System*) platform. It serves as a centralized, compile-time-safe reference for field identifiers—enabling consistent referencing across data access, UI binding, serialization, and validation layers—without relying on magic strings or hardcoded field names.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
The module exports a single public type:
|
||||
|
||||
- **`TestSetupFields`** (`enum`)
|
||||
A fixed set of named constants representing metadata fields of a test setup. Each member corresponds to a logical column or property in a test setup entity:
|
||||
- `Name`: Identifier for the test setup.
|
||||
- `Description`: Human-readable description of the test setup.
|
||||
- `RecordingMode`: Specifies how data is recorded (e.g., continuous, triggered).
|
||||
- `PreTriggerSeconds`: Duration (in seconds) of data captured *before* a trigger event.
|
||||
- `PostTriggerSeconds`: Duration (in seconds) of data captured *after* a trigger event.
|
||||
- `LastModified`: Timestamp of the last modification.
|
||||
- `LastModifiedBy`: Identity (e.g., user ID or name) of the modifier.
|
||||
- `IsComplete`: Boolean flag indicating whether the test setup is finalized and ready for use.
|
||||
|
||||
No methods, properties, or constructors are defined on the enum.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
- The set of enum values is **immutable**—no fields may be added, removed, or renamed without updating all consumers.
|
||||
- Each value maps to a *semantic field* of a test setup; the enum itself does not enforce data types or nullability (e.g., `PreTriggerSeconds` is expected to be numeric, `IsComplete` boolean), but consumers must interpret values according to their documented semantics.
|
||||
- The enum values are **case-sensitive** and must match exactly (e.g., `"Name"` ≠ `"name"`) when used in string-based contexts (e.g., JSON property names, database column names).
|
||||
- The ordering of enum values is *not* semantically significant—iteration order should not be relied upon for correctness.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Depends on**: None (no external assemblies or types are referenced in the source).
|
||||
- **Used by**: Implicitly, any module that handles test setup metadata (e.g., data mappers, UI view models, API request/response models, database schemas). While not visible in this file, typical consumers would include:
|
||||
- Data access layers (e.g., ORM mappings, query builders)
|
||||
- REST API controllers (e.g., for filtering, sorting, or field selection)
|
||||
- Frontend components (e.g., form fields, column headers)
|
||||
- Serialization/deserialization logic (e.g., JSON converters)
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **No validation or default values**: The enum itself does not enforce constraints (e.g., `PreTriggerSeconds` ≥ 0, `IsComplete` only valid when `IsComplete == true`). Validation must be handled separately.
|
||||
- **String interoperability risk**: When used in JSON or database contexts, the enum’s underlying string representation (`"Name"`, `"RecordingMode"`, etc.) must be explicitly serialized (e.g., via `[JsonProperty("Name")]` or custom converters); otherwise, numeric values (0, 1, …) may be used, breaking compatibility.
|
||||
- **No extensibility**: Adding a new field requires recompiling *all* consumers—no backward-compatible extension mechanism is provided.
|
||||
- **Ambiguity in semantics**: The meaning of `RecordingMode` and `IsComplete` is not self-evident from the enum alone (e.g., what values does `RecordingMode` accept? What state does `IsComplete` reflect?). These require cross-referencing with related types (e.g., `RecordingMode` enum, test setup domain logic).
|
||||
|
||||
*None identified beyond the above.*
|
||||
138
enriched-qwen3-coder-next/Common/DTS.Common/Events.md
Normal file
138
enriched-qwen3-coder-next/Common/DTS.Common/Events.md
Normal file
@@ -0,0 +1,138 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/LoadViewList.cs
|
||||
- Common/DTS.Common/Events/LoadExportList.cs
|
||||
- Common/DTS.Common/Events/ClearSelectedExportsEvent.cs
|
||||
- Common/DTS.Common/Events/LoginUserEvent.cs
|
||||
- Common/DTS.Common/Events/TextPastedEvent.cs
|
||||
- Common/DTS.Common/Events/BusyIndicatorChangeNotification.cs
|
||||
- Common/DTS.Common/Events/ComActiveEvent.cs
|
||||
- Common/DTS.Common/Events/CloseApplicationRequested.cs
|
||||
- Common/DTS.Common/Events/TabControlSelectionChanged.cs
|
||||
- Common/DTS.Common/Events/RaiseNotification.cs
|
||||
- Common/DTS.Common/Events/PageSetActiveEvent.cs
|
||||
- Common/DTS.Common/Events/GroupTemplateChangeNotification.cs
|
||||
- Common/DTS.Common/Events/DatabaseVersionChangedEvent.cs
|
||||
- Common/DTS.Common/Events/SetSaveButton.cs
|
||||
- Common/DTS.Common/Events/DBConnectionEvent.cs
|
||||
- Common/DTS.Common/Events/AutomaticModeStatusEvent.cs
|
||||
- Common/DTS.Common/Events/SetPageVisibilityEvent.cs
|
||||
- Common/DTS.Common/Events/LogoutUserEvent.cs
|
||||
- Common/DTS.Common/Events/TestEvent.cs
|
||||
- Common/DTS.Common/Events/PageSelectionChanged.cs
|
||||
- Common/DTS.Common/Events/PageNameEvent.cs
|
||||
- Common/DTS.Common/Events/UserEvent.cs
|
||||
- Common/DTS.Common/Events/ListViewStatusEvent.cs
|
||||
- Common/DTS.Common/Events/HelpTextEvent.cs
|
||||
- Common/DTS.Common/Events/PageModifiedEvent.cs
|
||||
- Common/DTS.Common/Events/AssemblyListNotification.cs
|
||||
- Common/DTS.Common/Events/FeedbackEvent.cs
|
||||
- Common/DTS.Common/Events/CancelProcess.cs
|
||||
- Common/DTS.Common/Events/TabControlSelectionEventArgs.cs
|
||||
- Common/DTS.Common/Events/SLICE6MulticastPropertyEvent.cs
|
||||
- Common/DTS.Common/Events/AppStatusEvent.cs
|
||||
- Common/DTS.Common/Events/PageErrorEvent.cs
|
||||
- Common/DTS.Common/Events/PageNavigationRequestEvent.cs
|
||||
- Common/DTS.Common/Events/ProgressBarEvent.cs
|
||||
- Common/DTS.Common/Events/NotificationContentEventArgs.cs
|
||||
- Common/DTS.Common/Events/ShowStatus.cs
|
||||
generated_at: "2026-04-16T02:56:22.448304+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5962f3d1e4d996fb"
|
||||
---
|
||||
|
||||
# DTS.Common.Events Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a centralized set of Prism `PubSubEvent`-based events used for cross-module communication within the DTS application. It serves as the canonical event bus contract, enabling decoupled communication between UI components, services, and modules. Events cover application lifecycle (login/logout, shutdown), state changes (busy/available, database connection, automatic mode), UI interactions (tab selection, page navigation, page modification), and domain-specific operations (COM status, SLICE6 multicast configuration, export management). The module ensures consistent event naming, argument structures, and semantics across the application.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Event Classes (All inherit from `PubSubEvent<T>` unless noted)
|
||||
|
||||
| Event Name | Payload Type | Description |
|
||||
|------------|--------------|-------------|
|
||||
| `LoadViewModulEvent` | `LoadViewModulArg` | Requests loading of a view module. *(Note: Typo in class name — likely intended `LoadViewModuleEvent`)* |
|
||||
| `LoadExportModuleEvent` | `LoadExportModuleArg` | Requests loading of an export module. *(Note: Typo in class name — likely intended `LoadExportModuleEvent`)* |
|
||||
| `ClearSelectedExportsEvent` | `ClearSelectedExportsArg` | Clears currently selected exports. |
|
||||
| `LoginUserEvent` | `LoginUserArg` | Signals user login; includes `UserName`. |
|
||||
| `TextPastedEvent` | `ITextPastedEventArgs` | Notifies of text paste operation; includes `Text`, `Sender`, `Id`, `Tag`. |
|
||||
| `BusyIndicatorChangeNotification` | `bool` | Toggles busy indicator state (`true` = busy, `false` = available). |
|
||||
| `CommActiveEvent` | `ComStatusArg` | Indicates COM status change (`CommandStart`, `ResponseStart`). |
|
||||
| `CloseApplicationRequested` | `object` | Requests application shutdown. |
|
||||
| `TabControlSelectionChanged` | `TabControlSelectionEventArgs` | Notifies of tab selection change; includes `Operation` (`TabControlOperation`) and `Item`. |
|
||||
| `RaiseNotification` | `NotificationContentEventArgs` | Triggers a notification popup with `Message`, `MessageDetails`, `Image` (`PopupWindowImage`), and `Title`. |
|
||||
| `PageSetActiveEvent` | `PageSetActiveEventArg` | Notifies a page has been set active; includes `Page` (`IDataPROPage`). |
|
||||
| `GroupTemplateChangeNotification` | `IBaseModel` | Notifies of selected group template change. |
|
||||
| `DatabaseVersionChangedEvent` | `DatabaseVersionChangedEventArgs` | Notifies of database version change; includes `Version`. |
|
||||
| `SetSaveButton` | `SaveButtonUsability` | Enables/disables the Save button via `IsUsable`. |
|
||||
| `DBConnectionEvent` | `DBConnectionArg` | Notifies of database connection status; includes `Connected`, `DBName`, `Server`. |
|
||||
| `AutomaticModeStatusEvent` | `AutomaticModeStatusEventArgs` | Notifies automatic mode status; includes `TextSet`, `Text`. |
|
||||
| `SetPageHeaderVisibilityEvent` | `SetPageHeaderVisibilityEventArgs` | Sets visibility of page header; includes `SetVisiblity`, `Visibility` (`System.Windows.Visibility`). *(Note: Typo in property name `SetVisiblity`)* |
|
||||
| `LogoutUserEvent` | `LogoutUserArg` | Notifies user logout; includes `Reason` (`DatabaseSwitch`). |
|
||||
| `TestEvent` | `TestEventArg` | Notifies test status (`TestStarted`, `TestEnded`). |
|
||||
| `PageSelectionChanged` | `PageSelectionChangedArg` | Notifies page selection change; includes `Page`, `Count`. |
|
||||
| `PageNameEvent` | `PageNameEventArg` | Notifies page name update; uses `CompositePresentationEvent` (Prism’s base for multi-subscriber events). |
|
||||
| `UserEvent` | `UserEventArg` | Notifies user-related events (e.g., `ViewingUserChanged`); includes `EventType`, `Argument`. |
|
||||
| `ListViewStatusEvent` | `ListViewStatusArg` | Notifies ListView status (`Unloaded`, `ScrollToBottom`); includes `Status`, `Id`. |
|
||||
| `HelpTextEvent` | `HelpTextEventArg` | Notifies help text tooltip request; includes `Sender`, `E` (`ToolTipEventArgs`). |
|
||||
| `PageModifiedEvent` | `PageModifiedArg` | Notifies page modification state (`Clear`, `Modified`, `Saved`); includes `PageStatus`, `Page`, `Handled`. |
|
||||
| `AssemblyListNotification` / `AssemblyListNotificationViewer` | `AssemblyListInfo` | Notifies assembly list changes; includes `AssemblyList` (`List<Assembly>`). |
|
||||
| `FeedbackEvent` | `FeedbackArg` | Notifies feedback with `Severity` (`Information`, `Warning`, `Error`, `ResponseStarting`, `CommandStarting`) and `Message`. |
|
||||
| `CancelProcessEvent` | `CancelProcess` | Requests cancellation of a process; includes `IsBusy`, `ProcessId`. |
|
||||
| `SLICE6MulticastPropertyEventChanged` | `SLICE6MulticastPropertyEventArgs` | Notifies SLICE6 multicast property changes; includes `SLICE6Property`, `SLICE6MulticastAddress`, `SLICE6MulticastCommandPort`, `SLICE6MulticastResponsePort`. |
|
||||
| `AppStatusEvent` | `AppStatusArg` | Notifies app status (`Busy`, `Available`, `Shutdown`, `Close`, `UserLogout`). |
|
||||
| `AppStatusExEvent` | `AppStatusExArg` | Extended app status; includes `Status` (`AppStatusArg`) and `Name` (source process name). |
|
||||
| `PageErrorEvent` | `PageErrorArg` | Surfaces errors to the application; includes `Errors` (`string[]`), `Page`, `Handled`. Provides static helper `SurfaceApplicationError(string)`. |
|
||||
| `PageNavigationRequestEvent` | `PageNavigationRequest` | Requests navigation to `Destination` (`Sensor`, `TestSetups`) with `DestinationArg` and `Caller`. |
|
||||
| `ProgressBarEvent` | `ProgressBarEventArg` | Updates progress bar state; includes `ProgressBarName`, `ProgressBarColor`, `ProgressBarPercentage`, `ProgressBarText`, `ProgressBarVisibility`. |
|
||||
|
||||
### Helper Methods
|
||||
- `PageErrorEvent.SurfaceApplicationError(string)`: Static method to publish a `PageErrorEvent` with a single error message.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Event Naming Consistency**: Event class names follow `PascalCase` + `Event` suffix (e.g., `LoginUserEvent`). Payload argument classes follow `PascalCase` + `Arg`/`EventArgs` suffix (e.g., `LoginUserArg`, `NotificationContentEventArgs`).
|
||||
- **Payload Immutability**: Most payload properties are read-only (`get;` only) or initialized via constructor to prevent mutation after publication.
|
||||
- **Prism Dependency**: All events derive from `Prism.Events.PubSubEvent<T>` (except `PageNameEvent`, which uses `CompositePresentationEvent<T>`).
|
||||
- **Null Safety**: Payloads like `DatabaseVersionChangedEventArgs.Version`, `AutomaticModeStatusEventArgs.Text`, `ProgressBarEventArg.ProgressBarName` default to `string.Empty` or `null` where appropriate.
|
||||
- **Enum Encapsulation**: Domain-specific enums (`ComStatusArg`, `Severity`, `AppStatusArg`, etc.) are strongly typed and defined within the same file as their associated event args.
|
||||
- **Event Aggregator Usage**: Events are intended to be published via Prism’s `IEventAggregator`. `PageErrorEvent` explicitly demonstrates this pattern.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *on* this module
|
||||
- **Prism Library**: All events rely on `Prism.Events.PubSubEvent<T>` and `Prism.Ioc.IContainerLocator` (for `PageErrorEvent.SurfaceApplicationError`).
|
||||
- **DTS.Common.Base**: `GroupTemplateChangeNotification` uses `IBaseModel`; `BusyIndicatorChangeNotification` references `DTS.Common.Base` namespace.
|
||||
- **DTS.Common.Interface**: `PageSetActiveEvent` uses `IDataPROPage`.
|
||||
- **System.Windows**: `ProgressBarEvent`, `SetPageHeaderVisibilityEvent`, `HelpTextEvent` use WPF types (`Color`, `Visibility`, `ToolTipEventArgs`).
|
||||
- **System.Reflection**: `AssemblyListNotification` uses `Assembly`.
|
||||
- **DTS.Common.Enums**: Multiple events use enums like `TabControlOperation`, `PopupWindowImage`, `SLICE6Properties`.
|
||||
- **DTS.Common.Utilities.Logging**: `PageErrorEvent` references `APILogger`.
|
||||
|
||||
### Dependencies *of* this module
|
||||
- None (this is a foundational module).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Typo in Event Names**: `LoadViewModulEvent` and `LoadExportModuleEvent` are likely misspellings of `LoadViewModuleEvent` and `LoadExportModuleEvent`.
|
||||
- **Inconsistent Naming for Event Args**: Some use `Arg` (e.g., `LoginUserArg`), others `EventArgs` (e.g., `NotificationContentEventArgs`).
|
||||
- **Redundant Events**: `AppStatusEvent` and `AppStatusExEvent` overlap in purpose; `AppStatusExEvent` adds source process name.
|
||||
- **Misleading Comments**: Several events (e.g., `LogoutUserEvent`, `PageSelectionChanged`, `UserEvent`) have comments stating "mark itself busy or available" despite having domain-specific payloads unrelated to busy state.
|
||||
- **Property Name Typos**: `SetPageHeaderVisibilityEventArgs.SetVisiblity` (missing 'i').
|
||||
- **`PageNameEvent` Uses `CompositePresentationEvent`**: Unlike all other events, `PageNameEvent` inherits from `CompositePresentationEvent<T>`, implying different subscription semantics (e.g., multiple subscribers may be expected).
|
||||
- **`ITextPastedEventArgs` Interface**: The event payload is an interface, requiring implementers to define concrete types.
|
||||
- **`SaveButtonUsability` vs `SetSaveButton`**: The event name `SetSaveButton` is a verb phrase, while other events use noun phrases (e.g., `PageModifiedEvent`).
|
||||
- **`ProgressBarEventArg` Default Values**: Default constructor sets `ProgressBarName = "Footer"`; other properties default to `false`/`double.NaN`/`null`.
|
||||
- **`StatusInfo.Text` Auto-Initialization**: If `text` is `null`, `StatusInfo` attempts to fetch localized text via `Strings.Strings.ResourceManager`. Consumers must ensure resource keys exist.
|
||||
- **`PageErrorEvent.SurfaceApplicationError`**: Uses `ContainerLocator.Container` directly — tightly couples to Prism’s container resolution mechanism.
|
||||
- **`DBConnectionEvent` Payload**: `DBName` and `Server` are included even when `Connected = false`, which may be misleading.
|
||||
- **`FeedbackEvent.Severity` Values**: Includes `ResponseStarting` and `CommandStarting`, which are not standard severity levels (typically `Information`, `Warning`, `Error` are used).
|
||||
- **`TestEventArg.Status` is `private set`**: Cannot be modified after construction, but `TestEventArg` is not sealed — subclasses could override.
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/ChannelCodes/ChannelCodesViewChangedEvent.cs
|
||||
- Common/DTS.Common/Events/ChannelCodes/ChannelCodeCommittedEvent.cs
|
||||
generated_at: "2026-04-16T03:25:06.865522+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6fb84d209aefd419"
|
||||
---
|
||||
|
||||
# ChannelCodes
|
||||
|
||||
## Documentation: Channel Codes Event Definitions
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to communicate channel code state changes across the application—specifically, when the user switches the view mode for channel codes (`ChannelCodesViewChangedEvent`) and when one or more channel codes are committed (saved) by the user (`ChannelCodeCommittedEvent`). These events decouple UI components (e.g., views, viewmodels) that trigger or react to channel code operations, enabling modular and testable interaction without tight coupling.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ChannelCodesViewChangedEvent`
|
||||
- **Type**: `class` (inherits `PubSubEvent<DTS.Common.Enums.IsoViewMode>`)
|
||||
- **Payload**: `DTS.Common.Enums.IsoViewMode`
|
||||
- **Behavior**: A singleton event used to notify subscribers when the active view mode for channel codes has changed. The payload indicates the new view mode (e.g., `IsoViewMode.List`, `IsoViewMode.Tree`). Subscribers should update their UI or internal state accordingly.
|
||||
|
||||
#### `ChannelCodeCommittedEvent`
|
||||
- **Type**: `class` (inherits `PubSubEvent<ChannelCodeCommittedEventArgs[]>`)
|
||||
- **Payload**: `ChannelCodeCommittedEventArgs[]` (array of committed channel codes)
|
||||
- **Behavior**: A singleton event used to publish one or more channel codes that have been successfully committed (e.g., saved or persisted). Subscribers may refresh caches, update related UI, or audit the action.
|
||||
|
||||
##### `ChannelCodeCommittedEventArgs`
|
||||
- **Type**: `class`
|
||||
- **Properties**:
|
||||
- `ChannelCodeType`: `ChannelEnumsAndConstants.ChannelCodeType` — the semantic type of the channel code (e.g., `ChannelCodeType.Network`, `ChannelCodeType.Service`).
|
||||
- `Code`: `string` — the canonical identifier string for the channel code (e.g., `"NBC"`).
|
||||
- `Name`: `string` — the human-readable display name (e.g., `"National Broadcasting Company"`).
|
||||
- `CanUserCommitChannelCodes`: `bool` — indicates whether the user who triggered the commit has write privileges for channel codes.
|
||||
- **Behavior**: Encapsulates metadata about a single committed channel code. Instances are created and published as part of the `ChannelCodeCommittedEvent` payload.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `ChannelCodeCommittedEventArgs.Code` and `ChannelCodeCommittedEventArgs.Name` are non-null (enforced by constructor; no validation is performed in the class itself, but nulls would likely cause downstream failures).
|
||||
- `ChannelCodeCommittedEventArgs.ChannelCodeType` must be a valid member of `ChannelEnumsAndConstants.ChannelCodeType` (enforced by caller; no runtime check in the class).
|
||||
- `ChannelCodeCommittedEvent` payload is always an array (possibly empty or with one or more elements); no ordering guarantee is specified.
|
||||
- `CanUserCommitChannelCodes` reflects the *submitting user’s* privileges at the time of commit, not necessarily the current user’s privileges.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Dependencies on other modules**:
|
||||
- `Prism.Events` (external library for event aggregation).
|
||||
- `DTS.Common.Enums` (for `IsoViewMode` used in `ChannelCodesViewChangedEvent`).
|
||||
- `DTS.Common.Enums.Channels` (for `ChannelEnumsAndConstants.ChannelCodeType` used in `ChannelCodeCommittedEventArgs`).
|
||||
- **Depended upon by**:
|
||||
- UI components (e.g., views/viewmodels handling channel code display or editing) that subscribe to these events to synchronize state.
|
||||
- Likely consumed by modules in `DTS.Common` and higher layers (e.g., `DTS.Client` or `DTS.Application`) that manage channel code workflows.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Namespace inconsistency**: `ChannelCodesViewChangedEvent` resides in `DTS.Common.Events`, while `ChannelCodeCommittedEvent` resides in `DTS.Common.Events.ChannelCodes`. This may cause confusion when discovering or subscribing to events.
|
||||
- **No validation in `ChannelCodeCommittedEventArgs`**: The constructor accepts any `string` values for `Code`/`Name` and does not enforce non-empty or format constraints. Callers must ensure validity.
|
||||
- **Privilege flag is static at commit time**: `CanUserCommitChannelCodes` is captured at the moment of commit and does not reflect potential privilege changes afterward. Subscribers should treat it as a historical snapshot.
|
||||
- **No documentation of `IsoViewMode` values**: The meaning of each `IsoViewMode` enum member is not included here; refer to `DTS.Common.Enums.IsoViewMode` definition.
|
||||
- **Array payload may be empty**: `ChannelCodeCommittedEvent` may be published with an empty array (e.g., in batch operations where no codes were actually modified). Subscribers should handle this case.
|
||||
- **None identified from source alone** for `ChannelCodesViewChangedEvent` beyond namespace inconsistency.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DASFactory/DASConfigurationEvent.cs
|
||||
generated_at: "2026-04-16T03:25:13.824064+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e69018b59746b653"
|
||||
---
|
||||
|
||||
# DASFactory
|
||||
|
||||
### 1. **Purpose**
|
||||
This module defines the `DASConfigurationEvent`, a Prism-based pub/sub event used to notify subscribers about DAS (Device Abstraction Service) configuration state changes—specifically, to signal when configuration data is blank or missing. It supports emergency download scenarios (per issue #17872) where DAS must fall back to XML configuration files on disk when filestore entries are blank, ensuring robustness during recovery operations.
|
||||
|
||||
### 2. **Public Interface**
|
||||
- **`DASConfigurationEvent`**
|
||||
- *Type*: `class` (inherits from `PubSubEvent<IDASConfigurationArg>`)
|
||||
- *Behavior*: A Prism `PubSubEvent` payload for publishing and subscribing to configuration-related notifications. The event carries an argument of type `IDASConfigurationArg`, which encapsulates the configuration state (e.g., blank/missing indicators). Subscribers receive this event when DAS configuration issues occur.
|
||||
|
||||
### 3. **Invariants**
|
||||
- The event **only publishes** when configuration data is blank or missing; it is not used for normal (valid) configuration updates.
|
||||
- The payload type is strictly `IDASConfigurationArg`; no other argument types are supported.
|
||||
- The event inherits Prism’s `PubSubEvent<TPayload>` semantics:
|
||||
- Subscriptions are weak-referenced by default (to prevent memory leaks).
|
||||
- Events are published asynchronously unless explicitly configured otherwise via Prism’s `ThreadOption`.
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Depends on**:
|
||||
- `Prism.Events` (for `PubSubEvent<T>` base class).
|
||||
- `DTS.Common.Interface.DASFactory.IDASConfigurationArg` (the payload interface defining the contract for configuration arguments).
|
||||
- **Used by**:
|
||||
- Components in the DAS factory or configuration subsystem that detect blank/missing configurations (e.g., during emergency download workflows).
|
||||
- Subscribers (e.g., UI or service layers) that need to react to configuration failures (e.g., by prompting user action or switching to fallback XML files).
|
||||
|
||||
### 5. **Gotchas**
|
||||
- The event is **not intended for general configuration changes**—only for *blank/missing* states. Publishing it for valid configurations would violate its semantic contract.
|
||||
- The actual structure and contents of `IDASConfigurationArg` are defined externally (in `DTS.Common.Interface.DASFactory`); this file does not specify them, so behavior details (e.g., which properties indicate "blank/missing") are not inferable here.
|
||||
- No explicit error codes or metadata are included in the event itself; subscribers must rely on `IDASConfigurationArg`’s implementation for diagnostic details.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/Reports/SaveReportToCSVRequestedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/Reports/SaveReportToPDFRequestedEvent.cs
|
||||
generated_at: "2026-04-16T03:27:02.713322+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c23355273750380a"
|
||||
---
|
||||
|
||||
# Reports
|
||||
|
||||
## Documentation: Report Export Request Events
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to signal user-initiated requests to export report data to external formats—specifically CSV and PDF. These events decouple the UI layer (e.g., a report viewer control or dialog) from the export implementation logic, enabling loose coupling and testability in the MVVM pattern. When a user selects "Save as CSV" or "Save as PDF", the UI publishes the corresponding event, and a dedicated handler (e.g., in a service or view model) subscribes to perform the actual file I/O and export processing.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`SaveReportToCSVRequestedEvent`**
|
||||
*Type:* `class` inheriting from `PubSubEvent<SaveReportToCSVRequestedEventArgs>`
|
||||
*Behavior:* A Prism event used to publish requests to save a report to CSV format. Subscribers receive an instance of `SaveReportToCSVRequestedEventArgs` containing the target directory and parent view model context.
|
||||
|
||||
- **`SaveReportToCSVRequestedEventArgs`**
|
||||
*Type:* `class`
|
||||
*Properties:*
|
||||
- `Directory` (`string`): The file system directory where the CSV file should be saved.
|
||||
- `ParentVM` (`IBaseViewModel`): The view model that initiated or owns the report context (e.g., the active report view model). Used for context-aware operations (e.g., resolving data sources or parent window handles).
|
||||
|
||||
- **`SaveReportToPDFRequestedEvent`**
|
||||
*Type:* `class` inheriting from `PubSubEvent<SaveReportToPDFRequestedEventArgs>`
|
||||
*Behavior:* A Prism event used to publish requests to save a report to PDF format. Subscribers receive an instance of `SaveReportToPDFRequestedEventArgs` with the same payload structure as the CSV variant.
|
||||
|
||||
- **`SaveReportToPDFRequestedEventArgs`**
|
||||
*Type:* `class`
|
||||
*Properties:*
|
||||
- `Directory` (`string`): The file system directory where the PDF file should be saved.
|
||||
- `ParentVM` (`IBaseViewModel`): The view model that initiated or owns the report context.
|
||||
|
||||
> **Note:** Both event argument classes are *mutable* (public setters on properties) and lack validation or immutability guarantees.
|
||||
|
||||
### 3. Invariants
|
||||
- The `Directory` property in both argument types is expected to be a valid, writable file system path at the time of event publication.
|
||||
- The `ParentVM` property is expected to be non-null at event publication; however, no explicit null-checking or enforcement is present in the event argument classes themselves.
|
||||
- Events are published *before* export logic executes (i.e., they are request triggers, not completion notifications).
|
||||
- No ordering guarantees exist between multiple subscribers—concurrent or conflicting writes to the same path are possible if not handled by subscribers.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal Dependencies:**
|
||||
- `DTS.Common.Base.IBaseViewModel`: Defines the contract for view models used in the parent context.
|
||||
- `Prism.Events.PubSubEvent<T>`: Prism’s event aggregation infrastructure.
|
||||
- **External Dependencies:**
|
||||
- `System` and `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`: Standard .NET libraries.
|
||||
- **Consumers (inferred):**
|
||||
- UI components (e.g., report viewer controls) that publish these events on user action.
|
||||
- Export service classes or view models that subscribe to these events to handle file generation.
|
||||
- Likely used in conjunction with `IBaseViewModel` implementations that expose report data and coordinate with export services.
|
||||
|
||||
### 5. Gotchas
|
||||
- **No filename specification:** The event arguments only provide a *directory*, not a filename. Subscribers must derive filenames (e.g., via timestamp, report name from `ParentVM`, or user input), which may lead to inconsistent naming or overwrites if not handled carefully.
|
||||
- **No cancellation support:** Events lack a mechanism to signal cancellation (e.g., via `CancellationToken`) or to abort the operation mid-process.
|
||||
- **No error propagation:** Exceptions thrown by subscribers are not captured or propagated back to the publisher; error handling must be implemented entirely within subscribers.
|
||||
- **No format-specific metadata:** Arguments do not include export options (e.g., CSV delimiter, PDF page size, inclusion of headers). Subscribers must hardcode or infer such settings.
|
||||
- **Mutable payload:** Since `Directory` and `ParentVM` have public setters, subscribers could inadvertently modify the event args—though this is unlikely to be intentional.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportSettingsChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportGRMSValuesUpdatedEvent.cs
|
||||
generated_at: "2026-04-16T03:27:06.629572+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bc3a14258ff7c95a"
|
||||
---
|
||||
|
||||
# PowerSpectralDensity
|
||||
|
||||
## Documentation: Power Spectral Density (PSD) Report Events
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
This module defines Prism-based pub/sub events used to communicate state changes and data updates within the Power Spectral Density (PSD) report generation and display subsystem. Specifically, it enables decoupled notification of changes to PSD report configuration settings (`PSDReportSettingsChangedEvent`) and updates to GRMS (Root Mean Square of acceleration) summary values per channel (`PSDReportGRMSValuesUpdatedEvent`). These events facilitate reactive UI updates and model synchronization without tight coupling between view models and data models in the DTS Viewer application.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `PSDReportSettingsChangedEvent`
|
||||
- **Type**: `class` inheriting from `PubSubEvent<PSDReportSettingsChangedEventArg>`
|
||||
- **Behavior**: A Prism event used to publish notifications when PSD report settings have been modified. Subscribers receive an instance of `PSDReportSettingsChangedEventArg` containing the updated settings model and the originating view model.
|
||||
|
||||
#### `PSDReportSettingsChangedEventArg`
|
||||
- **Type**: `class`
|
||||
- **Properties**:
|
||||
- `Model`: `IPSDReportSettingsModel` — The updated PSD report settings model.
|
||||
- `ParentVM`: `IBaseViewModel` — The view model that triggered or owns the settings change.
|
||||
|
||||
#### `PSDReportGRMSValuesUpdatedEvent`
|
||||
- **Type**: `class` inheriting from `PubSubEvent<PSDReportGRMSValuesUpdatedEventArg>`
|
||||
- **Behavior**: A Prism event used to publish notifications when GRMS summary values (per channel) have been recalculated or updated. Subscribers receive an instance of `PSDReportGRMSValuesUpdatedEventArg` containing the new GRMS values and the originating view model.
|
||||
|
||||
#### `PSDReportGRMSValuesUpdatedEventArg`
|
||||
- **Type**: `class`
|
||||
- **Properties**:
|
||||
- `Values`: `IChannelGRMSSummary[]` — Array of GRMS summary values, one per channel.
|
||||
- `ParentVM`: `IBaseViewModel` — The view model responsible for the update.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Event argument nullability**: Neither `Model` (in `PSDReportSettingsChangedEventArg`) nor `Values` (in `PSDReportGRMSValuesUpdatedEventArg`) is explicitly guaranteed to be non-null in the source. However, since they are public setters on reference types, callers are expected to provide valid instances when raising the events.
|
||||
- **ParentVM requirement**: `ParentVM` is present in both argument types but is not validated for null. It is assumed that the publisher always sets `ParentVM` to the relevant view model context.
|
||||
- **Ordering**: No ordering guarantees are specified or implied for event delivery; subscribers must not rely on event sequence unless enforced externally.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- `DTS.Common.Base` — Provides `IBaseViewModel`.
|
||||
- `DTS.Common.Interface` — Provides:
|
||||
- `IPSDReportSettingsModel`
|
||||
- `IChannelGRMSSummary`
|
||||
- `Prism.Events` — Provides `PubSubEvent<T>` base class.
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Any module/view model involved in PSD report configuration or GRMS calculation (e.g., report view models, data processing services) likely subscribes to or publishes these events. However, no explicit consumers are visible in the provided source.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **No validation or immutability**: The argument classes expose public setters for all properties, meaning subscribers could inadvertently mutate the event args. There is no indication of immutability or defensive copying.
|
||||
- **Ambiguous scope of `ParentVM`**: While `ParentVM` is included, its semantics (e.g., whether it is the *originator*, *owner*, or *context* of the change) are not documented in this file. Consumers must infer usage from surrounding code.
|
||||
- **Array mutability risk**: `Values` is exposed as `IChannelGRMSSummary[]`, a mutable array. Subscribers may modify the array contents, potentially causing side effects if the same instance is reused.
|
||||
- **Missing documentation of event semantics**: The source does not clarify whether events are *synchronous*, *thread-affine*, or *throttled*. Behavior depends on Prism’s default `PubSubEvent` behavior (synchronous, UI-thread aware if subscribed on UI thread), but this is not explicit here.
|
||||
- **None identified from source alone.** *(Note: The above are inferred based on common pitfalls with Prism events and public mutable properties, not explicit warnings in the source.)*
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/RefreshTestRequestEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/ShowT0CursorEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/TestModificationChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/SetUseZeroForUnfilteredEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/TestModificationEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/TestModification/ShiftT0Event.cs
|
||||
generated_at: "2026-04-16T03:26:33.870349+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "74b84eb90ba5f23e"
|
||||
---
|
||||
|
||||
# TestModification
|
||||
|
||||
## Documentation: Test Modification Event Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of Prism-based pub/sub events used to coordinate test modification operations within the DTS Viewer component. It enables decoupled communication between UI components (e.g., viewers, controllers) and backend services (e.g., data processors, ROI generators) when tests are modified, T0 cursor state changes, or related configuration (e.g., `UseZeroForUnfiltered`) is updated. The events serve as a contract for propagating state changes and user actions related to test metadata, cursor positioning, and filtering behavior.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`RefreshTestRequestEvent`**
|
||||
```csharp
|
||||
public class RefreshTestRequestEvent : PubSubEvent<string> { }
|
||||
```
|
||||
Publishes a request to refresh a specific test, identified by its `string` test ID. Payload is the test ID.
|
||||
|
||||
- **`ShowT0CursorEvent`**
|
||||
```csharp
|
||||
public class ShowT0CursorEvent : PubSubEvent<bool> { }
|
||||
```
|
||||
Publishes a request to show or hide the T0 cursor. Payload is a `bool`: `true` to show, `false` to hide.
|
||||
|
||||
- **`TestModificationChangedEvent`**
|
||||
```csharp
|
||||
public class TestModificationChangedEvent : PubSubEvent<ITestModificationModel> { }
|
||||
```
|
||||
Publishes when the test modification model has changed. Payload is an `ITestModificationModel` instance representing the new/updated state.
|
||||
|
||||
- **`SetUseZeroForUnfilteredEvent`**
|
||||
```csharp
|
||||
public class SetUseZeroForUnfilteredEvent : PubSubEvent<bool> { }
|
||||
```
|
||||
Publishes a request to set the `UseZeroForUnfiltered` property. Payload is a `bool`: `true` means `0` is used in the isocode filter field for unfiltered cases; `false` means `P` is used.
|
||||
|
||||
- **`TestModificationEvent`**
|
||||
```csharp
|
||||
public class TestModificationEvent : PubSubEvent<TestModificationArgs> { }
|
||||
public class TestModificationArgs
|
||||
{
|
||||
public string DataSetDirectory { get; }
|
||||
public string TestId { get; }
|
||||
public TestModificationArgs(string dtsFilePath, string testId)
|
||||
}
|
||||
```
|
||||
Publishes whenever a test is modified by the viewer. Payload is a `TestModificationArgs` object containing:
|
||||
- `DataSetDirectory`: The path to the data set directory (originally passed as `dtsFilePath`).
|
||||
- `TestId`: The ID of the modified test.
|
||||
|
||||
- **`ShiftT0Event`**
|
||||
```csharp
|
||||
public class ShiftT0Event : PubSubEvent<ShiftT0EventArguments> { }
|
||||
public class ShiftT0EventArguments
|
||||
{
|
||||
public double T0Time { get; }
|
||||
public bool IsInitialization { get; }
|
||||
public int T0Steps { get; }
|
||||
public bool IsKeyPress { get; }
|
||||
public ShiftT0EventArguments(double t0, bool isInitialization)
|
||||
public ShiftT0EventArguments(int steps, bool isInitialization, bool isKeyPress)
|
||||
}
|
||||
```
|
||||
Publishes a request to shift the T0 time. Payload is a `ShiftT0EventArguments` object, constructed via one of two constructors:
|
||||
- `ShiftT0EventArguments(double t0, bool isInitialization)`: For absolute T0 time shifts. Sets `T0Time = t0`, `T0Steps = 0`, `IsKeyPress = false`.
|
||||
- `ShiftT0EventArguments(int steps, bool isInitialization, bool isKeyPress)`: For relative shifts (e.g., arrow key navigation). Sets `T0Time = 0`, `T0Steps = steps`, `IsKeyPress = isKeyPress`.
|
||||
|
||||
### 3. Invariants
|
||||
- All events derive from `Prism.Events.PubSubEvent<T>`, implying they are published/subscribed using Prism’s event aggregation mechanism.
|
||||
- `TestModificationArgs.TestId` and `TestModificationArgs.DataSetDirectory` are immutable after construction (`private set`).
|
||||
- `ShiftT0EventArguments` has two mutually exclusive modes of operation:
|
||||
- Absolute shift: `T0Time != 0`, `T0Steps == 0`, `IsKeyPress == false`.
|
||||
- Relative shift: `T0Time == 0`, `T0Steps != 0`, `IsKeyPress` reflects whether triggered by keyboard.
|
||||
- `ShowT0CursorEvent` payload is strictly interpreted as a boolean toggle (no undefined or null values).
|
||||
- `RefreshTestRequestEvent` payload is expected to be a valid test ID string (no validation is performed in this module).
|
||||
|
||||
### 4. Dependencies
|
||||
- **Dependencies on other modules**:
|
||||
- `Prism.Events` (external library for event aggregation).
|
||||
- `DTS.Common.Interface` (for `ITestModificationModel` used in `TestModificationChangedEvent`).
|
||||
- **Dependencies on this module**:
|
||||
- Inferred consumers include components that handle test modification (e.g., `DataPro` per `TestModificationEvent` summary), UI viewers managing T0 cursor visibility/position, and modules handling isocode filter configuration.
|
||||
- The module is part of `DTS.Common.Events`, suggesting it is consumed by viewer and data processing layers (e.g., `DTS.Viewer`, `DTS.DataPro`).
|
||||
|
||||
### 5. Gotchas
|
||||
- **Ambiguous naming**: `TestModificationChangedEvent`’s summary says “The Data Folder changed event”, but its payload is `ITestModificationModel`, not a folder path. This appears to be a documentation error.
|
||||
- **Constructor overloading ambiguity**: `ShiftT0EventArguments` has two constructors that set different fields; callers must ensure correct constructor is used. Mixing usage (e.g., passing `T0Time` in the steps-based constructor) is prevented by design but may cause confusion if not documented externally.
|
||||
- **No validation on payloads**: Events carry raw data (e.g., `string` test IDs, `double` T0 times) without built-in validation—consumers must validate inputs.
|
||||
- **`IsKeyPress` in `ShiftT0EventArguments` is only set in the relative-shift constructor**: In the absolute-shift constructor, it is always `false`, which may be non-obvious.
|
||||
- **Namespace consistency**: `// ReSharper disable CheckNamespace` is present in some files but not others—suggests possible inconsistency in namespace usage across the codebase (though all events reside in `DTS.Common.Events`).
|
||||
- **No versioning or deprecation markers**: Events may evolve without explicit signaling (e.g., adding fields to `TestModificationArgs` could break subscribers).
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ResetZoomChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorShowChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorsClearChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorShowMinMaxChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorsAlailableChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/SaveToPDFRequestedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ChartAxisChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ChartOptionsChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:50.843144+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "31b0212fbe1dea4d"
|
||||
---
|
||||
|
||||
# ViewerChartOptions
|
||||
|
||||
## Documentation: Viewer Chart Options Events
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of Prism `PubSubEvent`-based events used to communicate state changes and user requests related to chart visualization options in the DTS Viewer component. These events decouple chart UI controls (e.g., zoom, cursor, axis, export) from the underlying view models and chart rendering logic, enabling loose coupling and event-driven updates across the application. All events reside in the `DTS.Common.Events` namespace and are part of the shared `DTS.Common` library.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
| Event Class | Payload Type | Behavior |
|
||||
|-------------|--------------|----------|
|
||||
| `ResetZoomChangedEvent` | `bool` | Published when the reset-zoom option state changes (e.g., enabled/disabled). *Note: XML comment incorrectly states “The Data Folder changed event.”* |
|
||||
| `CursorShowChangedEvent` | `bool` | Published when the visibility state of the primary cursor changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
|
||||
| `CursorsClearChangedEvent` | `bool` | Published when the state of the “clear cursors” option changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
|
||||
| `CursorShowMinMaxChangedEvent` | `bool` | Published when the option to show min/max values for cursors changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
|
||||
| `CursorsAlailableChangedEvent` | `bool` | Published when the availability (e.g., enabled/disabled) of cursor functionality changes. *Note: Typo in class name (`Alailable` instead of `Available`); XML comment incorrectly states “The Data Folder changed event.”* |
|
||||
| `SaveToPDFRequestedEvent` | `string` | Published when the user requests saving the current chart to PDF. The payload is a string—likely a suggested file path or filename. |
|
||||
| `ChartAxisChangedEvent` | `ChartAxisChangedEventArg` | Published when chart axis ranges are modified. Payload contains the parent view model, axis identifier, and min/max values. |
|
||||
| `ChartOptionsChangedEvent` | `ChartOptionsChangedEventArg` | Published when general chart options change (e.g., chart type, model settings). Payload contains the parent view model, the updated chart options model, and chart type. |
|
||||
|
||||
**Helper Types**
|
||||
- `ChartAxisChangedEventArg`
|
||||
- `ParentVM`: `IBaseViewModel` – The view model associated with the chart.
|
||||
- `Axis`: `string` – Identifier for the axis (e.g., `"X"`, `"Y"`, `"Primary"`, `"Secondary"`).
|
||||
- `MinValue`: `double` – New minimum value for the axis.
|
||||
- `MaxValue`: `double` – New maximum value for the axis.
|
||||
|
||||
- `ChartOptionsChangedEventArg`
|
||||
- `ParentVM`: `IBaseViewModel` – The view model associated with the chart.
|
||||
- `Model`: `IChartOptionsModel` – The updated chart options model instance.
|
||||
- `ChartType`: `string` – The chart type (e.g., `"Line"`, `"Bar"`, `"Scatter"`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- All events inherit from `Prism.Events.PubSubEvent<T>`, meaning they use Prism’s event aggregation pattern for thread-safe, decoupled publish/subscribe communication.
|
||||
- Boolean events (`ResetZoomChangedEvent`, `CursorShowChangedEvent`, `CursorsClearChangedEvent`, `CursorShowMinMaxChangedEvent`, `CursorsAlailableChangedEvent`) use `bool` payloads to represent *state changes* (e.g., toggled on/off), not necessarily *current values*—subscribers must interpret the payload as the new state.
|
||||
- `SaveToPDFRequestedEvent`’s `string` payload is not validated in this file; its semantics (e.g., path vs. filename) are implementation-dependent.
|
||||
- `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg` both require a `ParentVM` of type `IBaseViewModel`, implying the event originator must be a view model implementing that interface.
|
||||
- `ChartOptionsChangedEventArg.Model` must implement `IChartOptionsModel`, but no validation is enforced at the event level.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
**Dependencies *of* this module:**
|
||||
- `Prism.Events` – Core dependency for `PubSubEvent<T>`.
|
||||
- `DTS.Common.Base` – Required for `IBaseViewModel` (used in `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg`).
|
||||
- `DTS.Common.Interface` – Required for `IChartOptionsModel` (used in `ChartOptionsChangedEventArg`).
|
||||
|
||||
**Dependencies *on* this module:**
|
||||
- Any component that manages chart UI state (e.g., view models, chart controls) likely subscribes to these events to react to user actions or model changes.
|
||||
- The `SaveToPDFRequestedEvent` suggests integration with a PDF export service (not visible here).
|
||||
- The `ChartAxisChangedEvent` and `ChartOptionsChangedEvent` imply coupling with chart rendering logic and data binding systems (e.g., MVVM framework).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Misleading XML comments**: All events (except `SaveToPDFRequestedEvent`) have XML comments stating “The Data Folder changed event.” This is clearly incorrect and likely copy-paste error—do not rely on comments for semantics.
|
||||
- **Typo in class name**: `CursorsAlailableChangedEvent` uses `Alailable` instead of `Available`. This may cause confusion and should be corrected in future refactoring.
|
||||
- **Ambiguous payload semantics**: Boolean events use `bool` payloads, but it is unclear whether `true` means *enabled*, *visible*, *requested*, or *changed to true*. Subscribers must infer meaning from context or external documentation.
|
||||
- **No validation on `ChartAxisChangedEventArg`**: No checks ensure `MinValue < MaxValue` or that `Axis` is a recognized identifier. Invalid values may propagate silently.
|
||||
- **No documentation for `ChartType` values**: The `ChartType` string in `ChartOptionsChangedEventArg` has no documented set of valid values (e.g., `"Line"`, `"Bar"`), risking runtime errors if unexpected values are used.
|
||||
- **No versioning or deprecation markers**: Events may evolve (e.g., payload changes), but no attributes or comments indicate stability or obsolescence.
|
||||
|
||||
*None of the above are explicitly enforced in the source—these are inferred from inconsistencies and omissions.*
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerFilter/FilterParameterChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:16.445122+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f65dc87a2ce033e4"
|
||||
---
|
||||
|
||||
# ViewerFilter
|
||||
|
||||
### **Purpose**
|
||||
This module defines a Prism-based event mechanism for propagating changes to filter parameters within the DTS Viewer component. It enables decoupled communication between view models (implementing `IBaseViewModel`) that request or respond to filter updates—specifically when a filter parameter value changes—by publishing `FilterParameterChangedEvent` instances carrying the parameter name and the originating view model.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
|
||||
#### `FilterParameterArgs`
|
||||
- **`IBaseViewModel Requester { get; set; }`**
|
||||
The view model instance that initiated or is associated with the filter parameter change. Used to identify the source of the event.
|
||||
- **`string Param { get; set; }`**
|
||||
The name (key) of the filter parameter that has changed. Represents the specific filter field being updated (e.g., `"DateRange"`, `"Status"`).
|
||||
|
||||
#### `FilterParameterChangedEvent`
|
||||
- **Inherits from `PubSubEvent<FilterParameterArgs>`**
|
||||
A Prism `PubSubEvent` that carries `FilterParameterArgs` payloads. Subscribers can register handlers to react when a filter parameter changes.
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- `Param` must be a non-null, non-empty string representing a valid filter parameter identifier (enforced by convention/consumer logic, not by this class).
|
||||
- `Requester` must be non-null when the event is published (enforced by publisher; this class does not validate).
|
||||
- The event is *publish-only*—no built-in subscription validation or filtering logic is present in this file.
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
- **Imports/References**:
|
||||
- `DTS.Common.Base` (provides `IBaseViewModel`)
|
||||
- `Prism.Events` (provides `PubSubEvent<T>`)
|
||||
- **Depended on by**:
|
||||
- Any module/view model in the DTS Viewer that needs to publish or subscribe to filter parameter changes (e.g., filter controls, data grids, or search components).
|
||||
- No direct consumers are visible in this file; dependencies are inferred from usage of `PubSubEvent<T>` and `IBaseViewModel`.
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **No validation**: The class does not enforce non-null/non-empty constraints on `Param` or `Requester`; invalid values may propagate silently.
|
||||
- **No payload for new value**: The event only carries the *parameter name* (`Param`), not its new value. Subscribers must infer or retrieve the updated value from the `Requester` (e.g., via a property like `Requester.FilterParams[Param]`).
|
||||
- **Namespace quirk**: The `// ReSharper disable CheckNamespace` directive suggests intentional namespace flattening (`DTS.Common.Events` instead of `DTS.Common.Events.DTS.Viewer.FilterParameter`), which may affect discoverability or tooling.
|
||||
- **No backward/forward compatibility guarantees**: As a proprietary module, changes to `Param` naming conventions or `Requester` semantics may break consumers without warning.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerSettings/CalibrationBehaviorSettableInViewerChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerSettings/ViewerSettingsVisibilityChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:29.245992+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "aa456ba674677929"
|
||||
---
|
||||
|
||||
# ViewerSettings
|
||||
|
||||
### 1. Purpose
|
||||
This module defines two Prism-based pub/sub events used for broadcasting changes to viewer settings in the DTS system: one signaling whether calibration behavior is settable in the viewer (`CalibrationBehaviorSettableInViewerChangedEvent`), and another signaling changes to the visibility state of the viewer settings UI (`ViewerSettingsVisibilityChangedEvent`). These events enable decoupled communication between components—e.g., view models or services—responsible for managing viewer configuration and UI state, allowing subscribers to react to runtime updates without tight coupling.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`CalibrationBehaviorSettableInViewerChangedEvent`**
|
||||
- *Inherits from:* `PubSubEvent<bool>`
|
||||
- *Behavior:* A Prism event used to publish and subscribe to changes in whether the calibration behavior settings are editable within the viewer. The payload is a `bool`: `true` indicates calibration behavior *is* settable in the viewer; `false` indicates it is not.
|
||||
|
||||
- **`ViewerSettingsVisibilityChangedEvent`**
|
||||
- *Inherits from:* `PubSubEvent<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`), reflecting the current UI state of the settings panel.
|
||||
|
||||
### 3. Invariants
|
||||
- `CalibrationBehaviorSettableInViewerChangedEvent` payloads must be strictly `true` or `false`; no null or intermediate values are possible (since `bool` is non-nullable).
|
||||
- `ViewerSettingsVisibilityChangedEvent` payloads must be one of the three `Visibility` enum values defined in `System.Windows`: `Visible`, `Collapsed`, or `Hidden`.
|
||||
- Events are published *only* when the respective state actually changes; no redundant or duplicate publications are implied by the source (though enforcement of this is outside the scope of the event definitions themselves).
|
||||
- No ordering guarantees are specified or implied between these two events; they are independent.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Dependencies *of* this module:**
|
||||
- `Prism.Events` (specifically `PubSubEvent<T>`), indicating reliance on the Prism library for event aggregation.
|
||||
- `System.Windows` (only for `ViewerSettingsVisibilityChangedEvent`, via `Visibility`).
|
||||
- **Dependencies *on* this module:**
|
||||
- Not inferable from the provided source files alone. However, any consumer (e.g., view models, services) that needs to react to viewer settings changes or calibration behavior availability must subscribe to these events via the Prism `IEventAggregator`.
|
||||
- These events are likely published by components managing viewer configuration state (e.g., a viewer settings view model or calibration service), but such publishers are not visible in this source.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Namespace flattening:** The `// ReSharper disable CheckNamespace` directive suggests the namespace is intentionally `DTS.Common.Events` (not nested under a more specific sub-namespace), possibly to avoid deep nesting in legacy or tooling-constrained contexts.
|
||||
- **No validation in event definition:** The events themselves do not enforce semantics (e.g., that `Visibility.Collapsed` and `Visibility.Hidden` are treated differently); interpretation of payload values is deferred to subscribers.
|
||||
- **No documentation comments:** The source lacks XML documentation comments, so semantic meaning (e.g., *why* calibration behavior might be settable or not) is not embedded here—consumers must infer intent from usage.
|
||||
- **No versioning or deprecation markers:** No indication of whether these events are stable, experimental, or scheduled for change.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,104 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/ChannelSelectionCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/ChannelsModificationNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/ChannelSelectionChangeNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphChannelReadCalcProgressChangedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphChannelsReadCompletedNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/DataFileSelectedEvent.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/TestLoadedCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphLoadedCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/TestSummaryCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphClearNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedEventCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedChannelCountNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedChannelsNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/GraphSelectedEventsNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/ChannelsModificationLineFitNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/TestSummaryChangeNotification.cs
|
||||
- Common/DTS.Common/Events/DTS.Viewer/ViewerTestSummary/DataFolderChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:54.981028+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "efa128df50cbdb70"
|
||||
---
|
||||
|
||||
# ViewerTestSummary Events Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a suite of Prism `PubSubEvent<T>`-based notification events used within the DTS Viewer (specifically for the *ViewerTestSummary* component) to decouple state changes in test channel, event, graph, and summary selection from UI components and view models. These events enable loose coupling between data-loading, selection, and UI-update logic—particularly important given the module’s role in supporting both standard test viewers and reuse for PSD reports (as indicated by issue #24417 comments). Events cover changes in data file/folder selection, counts of loaded/selected items, progress updates during data reading/calculation, and modifications to channel selections (including line-fit operations).
|
||||
|
||||
## 2. Public Interface
|
||||
All types are `public` and reside in `DTS.Common.Events`. Each inherits from `PubSubEvent<T>` (Prism.Events), meaning they are intended for subscription/publishing via an `IEventAggregator`.
|
||||
|
||||
### Event Classes & Payload Types
|
||||
|
||||
| Event Class | Payload Type | Description |
|
||||
|-------------|--------------|-------------|
|
||||
| `ChannelSelectionCountNotification` | `int` | Notifies when the count of selected test channels changes. |
|
||||
| `ChannelsModificationNotification` | `List<ITestChannel>` | Notifies when the set of selected test channels is modified (e.g., added/removed). |
|
||||
| `ChannelSelectionChangeNotification` | `List<ITestChannel>` | Notifies when the selected test channel list changes (semantically similar to `ChannelsModificationNotification`, but distinct event). |
|
||||
| `GraphChannelReadCalcProgressChangedEvent` | `GraphChannelReadCalcProgressChangedEventArgs` | Reports progress during graph channel read/calculation. |
|
||||
| `GraphChannelsReadCompletedNotification` | `GraphChannelsReadCompletedNotificationArgs` | Signals completion of reading graph channels. |
|
||||
| `DataFileSelectedEvent` | `DataFileSelectionArg` | Signals selection of a specific data file (avoids triggering `DataFolderChangedEvent` subscribers). |
|
||||
| `TestLoadedCountNotification` | `TestLoadedCountNotificationArg` | Notifies when the count of loaded tests changes. |
|
||||
| `GraphLoadedCountNotification` | `GraphLoadedCountNotificationArg` | Notifies when the count of loaded graphs changes. |
|
||||
| `TestSummaryCountNotification` | `TestSummaryCountNotificationArg` | Notifies when the count of test summaries changes. |
|
||||
| `GraphClearNotification` | `GraphClearNotificationArg` | Signals that a graph has been cleared. |
|
||||
| `GraphSelectedEventCountNotification` | `GraphSelectedEventCountNotificationArg` | Notifies when the count of selected events in a graph changes. |
|
||||
| `GraphSelectedChannelCountNotification` | `GraphSelectedChannelCountNotificationArg` | Notifies when the count of selected channels in a graph changes. |
|
||||
| `GraphSelectedChannelsNotification` | `GraphSelectedChannelsNotificationArg` | Notifies when the set of selected channels in a graph changes. |
|
||||
| `GraphSelectedEventsNotification` | `GraphSelectedEventsNotificationArg` | Notifies when the set of selected events in a graph changes. |
|
||||
| `ChannelsModificationLineFitNotification` | `LineFitArgs` | Notifies that a line-fit operation is requested on a specific channel over a range of indices. |
|
||||
| `TestSummaryChangeNotification` | `TestSummaryChangeNotificationArg` | Notifies when the list of selected test summaries changes. |
|
||||
| `DataFolderChangedEvent` | `DataFolderSelectionArg` | Signals a change in the selected data folder (triggers broader updates). |
|
||||
|
||||
### Payload Class Definitions
|
||||
|
||||
| Payload Class | Key Properties | Notes |
|
||||
|---------------|----------------|-------|
|
||||
| `GraphChannelReadCalcProgressChangedEventArgs` | `string ProgressMessage`, `double ProgressPercent`, `IBaseViewModel GraphVM` | Used for progress reporting; `GraphVM` identifies the associated graph view model. |
|
||||
| `GraphChannelsReadCompletedNotificationArgs` | `bool IsReadCompleted`, `IBaseViewModel GraphVM` | `IsReadCompleted` indicates success/failure of read operation. |
|
||||
| `DataFileSelectionArg` | `string File`, `IBaseViewModel ParentVM` | `File` is the selected file path; `ParentVM` supports reuse for PSD reports. |
|
||||
| `TestLoadedCountNotificationArg` | `int LoadedCount`, `IBaseViewModel ParentVM` | `LoadedCount` reflects number of loaded tests; `ParentVM` enables scoping. |
|
||||
| `GraphLoadedCountNotificationArg` | `int LoadedCount`, `IBaseViewModel ParentVM` | `LoadedCount` reflects number of loaded graphs. |
|
||||
| `TestSummaryCountNotificationArg` | `int SummaryCount`, `IBaseViewModel ParentVM` | `SummaryCount` reflects number of summaries. |
|
||||
| `GraphClearNotificationArg` | `bool GraphClear`, `IBaseViewModel ParentVM` | `GraphClear` likely indicates whether the graph is now empty. |
|
||||
| `GraphSelectedEventCountNotificationArg` | `int SelectedEventCount`, `IBaseViewModel ParentVM` | `SelectedEventCount` reflects number of selected events. |
|
||||
| `GraphSelectedChannelCountNotificationArg` | `int SelectedChannelCount`, `IBaseViewModel ParentVM` | `SelectedChannelCount` reflects number of selected channels. |
|
||||
| `GraphSelectedChannelsNotificationArg` | `List<ITestChannel> SelectedChannels`, `IBaseViewModel ParentVM` | `SelectedChannels` is the current set of selected channels. |
|
||||
| `GraphSelectedEventsNotificationArg` | `BindingList<ITestEvent> SelectedEvents`, `IBaseViewModel ParentVM` | `SelectedEvents` uses `BindingList<T>` (supports UI binding). |
|
||||
| `LineFitArgs` | `ITestChannel Channel`, `ulong StartIndex`, `ulong EndIndex` | Immutable; constructor enforces non-null `Channel`. |
|
||||
| `TestSummaryChangeNotificationArg` | `List<ITestSummary> SummaryList`, `IBaseViewModel ParentVM`, `int TotalSummaryCount` | `SummaryList` is the new selection; `TotalSummaryCount` may include unselected summaries. |
|
||||
| `DataFolderSelectionArg` | `string Path`, `string File`, `bool SetSelected`, `bool SelectAll`, `IBaseViewModel ParentVM` | `SetSelected` controls UI selection; `SelectAll` controls whether to auto-select all tests (e.g., for export). |
|
||||
|
||||
## 3. Invariants
|
||||
- All events are *notifications* (i.e., fire-and-forget); no return value or cancellation is expected.
|
||||
- `GraphSelectedEventsNotificationArg.SelectedEvents` is a `System.ComponentModel.BindingList<ITestEvent>`; subscribers may rely on its change notification capabilities.
|
||||
- `LineFitArgs` is immutable: its properties are read-only and set only via constructor.
|
||||
- `DataFileSelectedEvent` is *distinct* from `DataFolderChangedEvent`—publishing one does not imply publishing the other (see comment in `DataFileSelectedEvent.cs`).
|
||||
- All payload classes with `ParentVM` properties use `IBaseViewModel` to support scoping for reuse (e.g., PSD reports), implying that event handlers should respect `ParentVM` to avoid cross-view interference.
|
||||
- `DataFolderSelectionArg.SetSelected` defaults to `false`; `SelectAll` defaults to `false`.
|
||||
- `ChannelsModificationNotification` and `ChannelSelectionChangeNotification` both carry `List<ITestChannel>` but are separate events—subscribers must distinguish them intentionally.
|
||||
|
||||
## 4. Dependencies
|
||||
### Dependencies *of* this module:
|
||||
- **Prism.Events**: All events inherit from `PubSubEvent<T>`.
|
||||
- **DTS.Common.Interface**:
|
||||
- `ITestChannel`, `ITestEvent`, `ITestSummary` (from `DTS.Common.Interface`)
|
||||
- `IBaseViewModel` (from `DTS.Common.Base`)
|
||||
- **DTS.Common.Base**: Provides `IBaseViewModel` and `GraphChannelReadCalcProgressChangedEventArgs`.
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- Any module/view model that needs to react to viewer state changes (e.g., UI updates, data loading, graph rendering) will subscribe to these events.
|
||||
- Specifically, components handling test summary views, graph rendering, and data file/folder navigation likely depend on this module.
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguous naming**: `ChannelsModificationNotification` and `ChannelSelectionChangeNotification` both carry `List<ITestChannel>` and have near-identical summaries ("The selected Test Summary list changed event" / "The number of selected Graphs changed event"). Their distinct existence suggests semantic differences (e.g., one for *additions/removals*, one for *reordering*), but this is not documented in the source.
|
||||
- **Inconsistent summaries**: Several event summaries incorrectly describe the event (e.g., `GraphLoadedCountNotification` says "The number of selected Tests changed event" instead of graphs). This may mislead developers.
|
||||
- **`DataFileSelectedEvent` vs `DataFolderChangedEvent`**: The comment in `DataFileSelectedEvent.cs` explicitly warns against triggering `DataFolderChangedEvent` subscribers—subscribers must not assume these events are interchangeable.
|
||||
- **`TestSummaryChangeNotificationArg.TotalSummaryCount`**: Not clarified whether this includes only summaries in `SummaryList` or all available summaries.
|
||||
- **`GraphClearNotificationArg.GraphClear`**: The boolean name suggests a flag, but its meaning (e.g., `true` = cleared vs. `true` = *not* cleared) is ambiguous without implementation context.
|
||||
- **No validation on payloads**: Payload classes have no validation (e.g., `ProgressPercent` could be outside [0,100], `SelectedChannels` could be null). Subscribers must defensively handle invalid values.
|
||||
- **No ordering guarantees**: Events may be published in any order (e.g., `GraphChannelsReadCompletedNotification` may fire before `GraphChannelReadCalcProgressChangedEvent` completes).
|
||||
- **None identified from source alone** for: thread-safety, lifecycle management, or disposal requirements.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Database/DbStatusEvent.cs
|
||||
generated_at: "2026-04-16T03:24:36.502234+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "907205cba2ff43f9"
|
||||
---
|
||||
|
||||
# Database
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a Prism-based event (`DbStatusEvent`) used to communicate database operation status changes throughout the application—specifically for signaling failures or completion of database-related operations such as remote connection, local backup, file copy, and restore. It enables decoupled notification of database state transitions, allowing UI components or background services to react appropriately (e.g., display error messages, update status indicators) when database operations succeed or fail.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`DbStatusEvent`**
|
||||
- *Type*: `class` inheriting from `PubSubEvent<DbStatusArg>`
|
||||
- *Behavior*: A Prism event used to publish and subscribe to database status updates. Payload is a `DbStatusArg` instance.
|
||||
|
||||
- **`DbStatusArg`**
|
||||
- *Type*: `class`
|
||||
- *Properties*:
|
||||
- `EventTypes Status { get; }` – The type of database status event (see `EventTypes` enum below).
|
||||
- `Exception Exception { get; }` – The exception associated with the event (if any); may be `null` for non-error statuses (e.g., `Complete`).
|
||||
- *Constructor*:
|
||||
- `DbStatusArg(EventTypes error, Exception exception)` – Initializes a new instance with the given status and exception.
|
||||
- **Nested `EventTypes` enum**:
|
||||
- `FailedToConnectToRemote`
|
||||
- `FailedToBackupLocal`
|
||||
- `FailedToCopy`
|
||||
- `FailedToRestoreLocal`
|
||||
- `FailedToBackupLocalFileNotFound`
|
||||
- `Complete`
|
||||
- `LegacyStatus`
|
||||
|
||||
## 3. Invariants
|
||||
- `Status` is immutable after construction (only set via constructor).
|
||||
- `Exception` is immutable after construction (only set via constructor).
|
||||
- `Exception` may be `null` (e.g., for `Complete` or `LegacyStatus` events), but the constructor does not enforce non-nullability—consumers must handle null cases.
|
||||
- `EventTypes` values represent *discrete, exhaustive* status categories; no validation is performed on the enum value passed to the constructor (e.g., invalid or future enum values are accepted silently).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `Prism.Events` (specifically `PubSubEvent<T>`)
|
||||
- `System` (for `Exception`)
|
||||
- **Depends on nothing else in the provided source**.
|
||||
- **Used by**:
|
||||
- Any part of the application that needs to publish or subscribe to database status updates (e.g., database service, UI status bar, logging module).
|
||||
- Inferred from naming (`DTS.Common.Events.Database` namespace), this is part of a shared/common library (`DTS.Common`), so it is likely consumed by multiple downstream modules (e.g., UI, data access layer).
|
||||
|
||||
## 5. Gotchas
|
||||
- The `Exception` property may be `null` for certain statuses (e.g., `Complete`, `LegacyStatus`), but the constructor signature does not enforce non-nullability—subscribers must defensively check for null before accessing `Exception.Message` or stack trace.
|
||||
- `LegacyStatus` is included but not documented; its semantics are unclear from source alone (e.g., whether it indicates a deprecated status, a fallback, or historical artifact).
|
||||
- No validation is performed on the `EventTypes` value passed to the constructor—invalid or mistyped enum values (e.g., due to refactoring) will be silently accepted.
|
||||
- The `<remarks>` section in `DbStatusEvent` is empty, suggesting incomplete documentation.
|
||||
- No guidance is provided on expected usage patterns (e.g., whether `FailedToBackupLocalFileNotFound` should *always* be accompanied by a `FileNotFoundException` in `Exception`).
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Diagnostics/CheckDataToDownloadEvent.cs
|
||||
generated_at: "2026-04-16T03:24:51.174525+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "99f81a50a8d987c0"
|
||||
---
|
||||
|
||||
# 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—typically a producer (e.g., a service or view model) initiating a download readiness check—and subscribers (e.g., a download manager or UI component) responsible for evaluating and acting on whether a download is necessary. The event supports bypassing the check (e.g., for forced or manual downloads) via the `BypassCheck` flag, and carries a reference to the originating producer for context or audit purposes.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
- **`CheckDataToDownloadEvent`**
|
||||
- *Type*: `class` inheriting from `PubSubEvent<CheckDataToDownloadEventArgs>`
|
||||
- *Behavior*: A Prism `PubSubEvent` used to publish and subscribe to download-check requests. Subscribers receive an instance of `CheckDataToDownloadEventArgs` when the event is published.
|
||||
|
||||
- **`CheckDataToDownloadEventArgs`**
|
||||
- *Type*: `class`
|
||||
- *Properties*:
|
||||
- `bool BypassCheck { get; }` — Indicates whether the caller requests skipping the normal data existence/validity check (e.g., proceed directly to download).
|
||||
- `object Producer { get; }` — The object that triggered the event (e.g., a view model, service, or UI element). Used for identification or logging.
|
||||
- *Constructor*:
|
||||
- `CheckDataToDownloadEventArgs(bool bypassCheck, object o)` — Initializes the args with the bypass flag and producer reference. Both values are immutable after construction.
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
- `BypassCheck` is set at construction and **never modified** afterward (due to `private set`).
|
||||
- `Producer` is set at construction and **never modified** afterward (due to `private set`).
|
||||
- The `Producer` reference may be `null` (no validation is performed in the constructor), so consumers must handle null cases.
|
||||
- The event is strictly for *initiating* a check—not for reporting results. The event itself does not carry download status or payload; subscribers are expected to handle side effects (e.g., triggering downloads) based on their own logic.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Depends on**:
|
||||
- `Prism.Events` (specifically `PubSubEvent<T>` from the Prism library).
|
||||
- **Used by**:
|
||||
- Any component needing to request a data-downloads check (e.g., `DownloadService`, `MainViewModel`, or UI controls).
|
||||
- Subscribers (e.g., `DownloadManager`) that react to this event to determine whether to proceed with downloading data.
|
||||
- **No other internal dependencies** are evident from this file alone.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **No validation on `Producer`**: The constructor accepts any `object`, including `null`. Consumers must defensively check `Producer` before use (e.g., for logging or routing).
|
||||
- **Event semantics are ambiguous**: The name `CheckDataToDownloadEvent` implies a *request*, but the event does not provide a way to *return* a result (e.g., whether download is needed). Subscribers must act asynchronously or via side effects (e.g., publishing a follow-up event).
|
||||
- **No cancellation support**: There is no mechanism for subscribers to cancel or delay the check (e.g., via a token).
|
||||
- **No versioning or schema evolution**: If `BypassCheck` or `Producer` semantics change in the future, this event type offers no backward/forward compatibility.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/GroupTemplates/CustomChannels/CustomChannelExportFileSetEvent.cs
|
||||
- Common/DTS.Common/Events/GroupTemplates/CustomChannels/CustomChannelImportEvent.cs
|
||||
generated_at: "2026-04-16T03:25:48.906062+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7dcb7f08a2b119d1"
|
||||
---
|
||||
|
||||
# CustomChannels
|
||||
|
||||
## Documentation: Custom Channel Events Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to coordinate custom channel import and export operations within the application. Specifically, `CustomChannelExportFileSetEvent` signals that a custom channel export file set has been prepared (and the application should update its busy/available state accordingly), while `CustomChannelImportEvent` communicates the completion status of a custom channel import operation. These events decouple the UI and business logic layers during asynchronous custom channel workflows.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`CustomChannelExportFileSetEvent`**
|
||||
- *Type*: `class` inheriting from `PubSubEvent<string>`
|
||||
- *Behavior*: A Prism event used to notify subscribers that a custom channel export file set has been generated. Despite inheriting `PubSubEvent<string>`, the event payload type is not actively used in the current implementation (see *Gotchas*). Subscribers should interpret publication of this event as a signal to mark the application as available (e.g., disable busy indicators).
|
||||
|
||||
- **`CustomChannelImportEvent`**
|
||||
- *Type*: `class` inheriting from `PubSubEvent<CustomChannelImportEventArgs>`
|
||||
- *Behavior*: A Prism event used to notify subscribers of the completion status of a custom channel import operation. Currently only supports a single status (`Done`).
|
||||
|
||||
- **`CustomChannelImportEventArgs`**
|
||||
- *Type*: `class`
|
||||
- *Properties*:
|
||||
- `Status ImportStatus { get; }` – The completion status of the import operation.
|
||||
- *Constructors*:
|
||||
- `CustomChannelImportEventArgs(Status status)` – Initializes the args with the given `Status`.
|
||||
- *Nested Enum*:
|
||||
- `enum Status { Done }` – Represents possible import outcomes. Only `Done` is defined.
|
||||
|
||||
### 3. Invariants
|
||||
- `CustomChannelImportEventArgs.ImportStatus` is immutable after construction (read-only property).
|
||||
- `CustomChannelImportEventArgs.Status` currently supports only one value (`Done`). No other statuses (e.g., `Failed`, `Cancelled`) are defined or used in the source.
|
||||
- `CustomChannelExportFileSetEvent` inherits from `PubSubEvent<string>`, but no payload is expected or used (see *Gotchas*).
|
||||
|
||||
### 4. Dependencies
|
||||
- **Dependencies *of* this module**:
|
||||
- `Prism.Events` (specifically `PubSubEvent<T>`).
|
||||
- No other internal modules or types are referenced in the source files.
|
||||
|
||||
- **Dependencies *on* this module**:
|
||||
- Not specified in the provided source, but by convention, modules handling custom channel import/export workflows (e.g., UI view models, service layers) are expected to subscribe to these events.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Payload type mismatch in `CustomChannelExportFileSetEvent`**:
|
||||
The class inherits from `PubSubEvent<string>`, implying a `string` payload, but the XML documentation and naming suggest it is used as a *signal* (not a data carrier). There is no evidence in the source that any subscriber expects or receives a `string` argument. This may indicate legacy or incomplete refactoring. Subscribers should treat this event as a *unit signal* (i.e., ignore the payload).
|
||||
|
||||
- **Extensibility limitation in `CustomChannelImportEventArgs.Status`**:
|
||||
The `Status` enum currently contains only `Done`. If future workflows require additional statuses (e.g., `Error`, `Cancelled`), this enum must be extended—but doing so without updating all subscribers could lead to unhandled cases.
|
||||
|
||||
- **No error reporting mechanism**:
|
||||
`CustomChannelImportEvent` only signals completion (`Done`). There is no provision for conveying error details, partial success, or cancellation. If import failures need to be communicated, a new event or extension of `CustomChannelImportEventArgs` would be required.
|
||||
|
||||
- **Empty `<remarks>` sections**:
|
||||
Neither event includes meaningful remarks in its XML documentation, suggesting minimal initial documentation effort or reliance on external design documents.
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/GroupTemplates/GroupTemplateList/GroupTemplateListGroupDoubleClickEvent.cs
|
||||
- Common/DTS.Common/Events/GroupTemplates/GroupTemplateList/GroupTemplateListGroupTemplateSelectedEvent.cs
|
||||
generated_at: "2026-04-16T03:25:57.698700+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fe288275e1339690"
|
||||
---
|
||||
|
||||
# GroupTemplateList
|
||||
|
||||
## Documentation: GroupTemplateList Events
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to communicate user interactions with the group template list UI component—specifically, when a template is *selected* (potentially multiple templates) or when a template is *double-clicked*. These events decouple the UI layer (e.g., a list control) from downstream logic (e.g., template loading or editing), enabling modular and testable event-driven behavior in the application.
|
||||
|
||||
### 2. Public Interface
|
||||
All types reside in the `DTS.Common.Events.GroupTemplates.GroupTemplateList` namespace.
|
||||
|
||||
- **`GroupTemplateListGroupDoubleClickEvent`**
|
||||
```csharp
|
||||
public class GroupTemplateListGroupDoubleClickEvent : PubSubEvent<string> { }
|
||||
```
|
||||
A Prism `PubSubEvent` carrying a single `string` payload. Published when a user double-clicks a *single* group template in the list. The payload is the identifier (e.g., name or GUID) of the selected template.
|
||||
|
||||
- **`GroupTemplateListGroupTemplateSelectedEvent`**
|
||||
```csharp
|
||||
public class GroupTemplateListGroupTemplateSelectedEvent : PubSubEvent<string[]> { }
|
||||
```
|
||||
A Prism `PubSubEvent` carrying a `string[]` payload. Published when one or more templates are *selected* (e.g., via click or keyboard selection). The payload is an array of template identifiers.
|
||||
|
||||
### 3. Invariants
|
||||
- `GroupTemplateListGroupDoubleClickEvent` always carries exactly one template identifier (i.e., the array length is implicitly 1), though the type system does not enforce this—consumers must assume a single-element array or handle accordingly.
|
||||
- `GroupTemplateListGroupTemplateSelectedEvent` may carry zero, one, or multiple template identifiers (i.e., the array may be empty or have length ≥ 1).
|
||||
- The string identifiers used in both events are assumed to be stable and meaningful to downstream consumers (e.g., database keys or file paths), but their exact format is not defined in this module.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**: `Prism.Events` (specifically `PubSubEvent<T>`).
|
||||
- **Used by**: UI components (e.g., a list view control) that raise these events on user interaction, and consumers (e.g., view models or services) that subscribe to them to trigger actions like opening a template editor or loading configuration.
|
||||
- **No other modules in this codebase are referenced** in the source files, indicating this is a self-contained event definition layer.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Ambiguity in "selected" vs. "double-clicked" semantics**: The documentation comments for both events say “called when a template is selected,” but the event names and payload types (`string` vs `string[]`) imply different user actions (single double-click vs. multi-select). Consumers must distinguish based on event type, not comment text.
|
||||
- **No validation on payload contents**: Neither event validates or constrains the template identifiers (e.g., null checks, format). Subscribers must handle invalid or unexpected values.
|
||||
- **Potential confusion from naming**: `GroupTemplateListGroupDoubleClickEvent` is documented as `GroupTemplateListGroupTemplateSelectedEvent` in its XML comment (a copy-paste error in the source). This may cause confusion during code review or debugging.
|
||||
- **No ordering guarantee**: The Prism `PubSubEvent` implementation does not guarantee delivery order to subscribers if multiple handlers exist.
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/GroupTemplates/TemplateChannelList/TemplateChannelListOrderChangedEvent.cs
|
||||
- Common/DTS.Common/Events/GroupTemplates/TemplateChannelList/TemplateChannelListSelectionChangedEvent.cs
|
||||
- Common/DTS.Common/Events/GroupTemplates/TemplateChannelList/TemplateChannelListRequiredChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:02.944009+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0971a3dcff5effca"
|
||||
---
|
||||
|
||||
# TemplateChannelList
|
||||
|
||||
## Documentation: TemplateChannelList Events Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to signal changes in the state of a *template channel list*—a UI or business construct representing ordered, configurable channels associated with a group template. Specifically, it enables decoupled communication between components that manage or consume channel lists (e.g., UI views, view models, or services), notifying them when the *order*, *selection*, or *required-ness* of channels changes. Though the XML documentation comments are misleading (referring to “template selection” instead of channel list state), the actual event types and payloads indicate they are concerned with channel-level state transitions.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TemplateChannelListOrderChangedEvent`
|
||||
- **Type**: `class`
|
||||
- **Inherits**: `PubSubEvent<IGroupTemplateChannel>`
|
||||
- **Behavior**: Published when the *ordering* of channels in a template channel list changes. The payload is the *single channel* whose position has changed (e.g., moved up/down in the list). Subscribers can use this to reorder internal structures or update UI bindings accordingly.
|
||||
|
||||
#### `TemplateChannelListSelectionChangedEvent`
|
||||
- **Type**: `class`
|
||||
- **Inherits**: `PubSubEvent<IGroupTemplateChannel>`
|
||||
- **Behavior**: Published when the *selection state* of a channel in the list changes (e.g., user selects/deselects a channel). The payload is the *channel* whose selection status changed.
|
||||
|
||||
#### `TemplateChannelListRequiredChangedEvent`
|
||||
- **Type**: `class`
|
||||
- **Inherits**: `PubSubEvent<TemplateChannelListRequiredChangeEventArgs>`
|
||||
- **Behavior**: Published when the *required status* of one or more channels changes (e.g., a channel becomes mandatory or optional). The payload is a `TemplateChannelListRequiredChangeEventArgs` object containing:
|
||||
- `Consumer`: The object (e.g., view model or service) triggering the change.
|
||||
- `Channels`: An array of `IGroupTemplateChannel` instances whose required status has changed.
|
||||
|
||||
#### `TemplateChannelListRequiredChangeEventArgs`
|
||||
- **Type**: `class`
|
||||
- **Properties**:
|
||||
- `public object Consumer { get; }` — The entity initiating the required-status change.
|
||||
- `public IGroupTemplateChannel[] Channels { get; }` — The channels affected by the required-status change.
|
||||
- **Constructor**:
|
||||
```csharp
|
||||
public TemplateChannelListRequiredChangeEventArgs(object o, IGroupTemplateChannel[] channels)
|
||||
```
|
||||
Initializes the args with the specified consumer and channel array.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- All events are **asynchronous** (via Prism’s `PubSubEvent`), so ordering of delivery to subscribers is *not guaranteed*.
|
||||
- The `IGroupTemplateChannel` type is assumed to represent a single channel with identity, name, and state (e.g., selection, required flag), but its exact contract is defined externally (see *Dependencies*).
|
||||
- For `TemplateChannelListOrderChangedEvent` and `TemplateChannelListSelectionChangedEvent`, only *one* channel is emitted per event—no batch semantics are implied.
|
||||
- For `TemplateChannelListRequiredChangedEvent`, the `Channels` array may contain *zero or more* channels, but the event is only published when at least one channel’s required status changes.
|
||||
- The `Consumer` field in `TemplateChannelListRequiredChangeEventArgs` is *not validated*—it may be `null`, though this is discouraged.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of this module*:
|
||||
- `Prism.Events` — Provides the base `PubSubEvent<T>` class.
|
||||
- `DTS.Common.Interface.GroupTemplate.IGroupTemplateChannel` — Defines the interface for channel objects. Its contract is assumed to include properties like `IsSelected`, `IsRequired`, and identity (e.g., `Id`), but this is not visible in the source.
|
||||
|
||||
#### Dependencies *on this module*:
|
||||
- Any component managing or reacting to channel list state (e.g., UI views, view models, or services in the `DTS.Common` or higher layers) will subscribe to these events.
|
||||
- The `TemplateChannelListRequiredChangedEvent` suggests integration with a consumer registration pattern (via the `Consumer` property), implying downstream systems track which entities are responsible for channel requirements.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Misleading documentation**: All three events’ XML comments incorrectly state *“called when a template is selected”*—this is inconsistent with their actual payloads and naming. This may cause confusion during debugging or onboarding.
|
||||
- **Ambiguous semantics of `Consumer`**: The `Consumer` field in `TemplateChannelListRequiredChangeEventArgs` is typed as `object`, offering no compile-time safety or clarity about expected types. This increases the risk of runtime errors if consumers misidentify the source of the change.
|
||||
- **No distinction between *initiator* and *affected channels***: In `TemplateChannelListRequiredChangedEvent`, the `Consumer` and `Channels` are bundled together, but it is unclear whether *all* channels in the array changed *because of* the consumer or *for* the consumer. This could lead to incorrect assumptions about causality.
|
||||
- **No event for bulk operations**: If multiple channels’ order or selection changes simultaneously (e.g., drag-and-drop reordering of several items), this module provides no event to signal the full set—only per-channel events. Subscribers must deduce batch changes by correlating events, which is error-prone.
|
||||
- **No cancellation or rollback mechanism**: These are *notification-only* events (fire-and-forget). There is no way for subscribers to veto a change (e.g., prevent an invalid reordering).
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Groups/GroupChannelList/GroupChannelDeleteRequestEvent.cs
|
||||
- Common/DTS.Common/Events/Groups/GroupChannelList/GroupChannelsChangedEvent.cs
|
||||
- Common/DTS.Common/Events/Groups/GroupChannelList/GroupUpdatedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:19.461930+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a198b0938e9f2ac1"
|
||||
---
|
||||
|
||||
# GroupChannelList
|
||||
|
||||
## Documentation: GroupChannelList Events Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to coordinate group channel list state changes across loosely coupled components in the application. Specifically, it enables decoupled communication for three distinct scenarios: (1) a request to delete a channel from a group (`GroupChannelDeleteRequestEvent`), (2) notification that the set of channels in a group has changed (`GroupChannelsChangedEvent`), and (3) notification that a group’s state has been updated via channel insertion or assignment (`GroupUpdatedEvent`). These events facilitate UI-layer and service-layer synchronization without tight coupling, particularly around group template selection and channel management workflows.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `GroupChannelDeleteRequestEvent`
|
||||
- **Type**: `class` inheriting from `PubSubEvent<GroupChannelDeleteRequestEventArgs>`
|
||||
- **Behavior**: A Prism event used to signal that a channel deletion is requested. Subscribers receive a `GroupChannelDeleteRequestEventArgs` payload containing the page context and the channel to be deleted.
|
||||
|
||||
#### `GroupChannelDeleteRequestEventArgs`
|
||||
- **Constructor**: `GroupChannelDeleteRequestEventArgs(object page, IGroupChannel channel)`
|
||||
- **Properties**:
|
||||
- `object Page` — The UI page (e.g., view model or control) initiating or associated with the deletion request.
|
||||
- `IGroupChannel Channel` — The channel instance targeted for deletion.
|
||||
|
||||
#### `GroupChannelsChangedEvent`
|
||||
- **Type**: `class` inheriting from `PubSubEvent<GroupChannelsChangedEventArgs>`
|
||||
- **Behavior**: A Prism event used to notify subscribers that the number of channels in a group has changed (e.g., after adding/removing channels).
|
||||
- **Note**: Despite the summary comment referencing “The GroupUpdated event”, the actual event name is `GroupChannelsChangedEvent`.
|
||||
|
||||
#### `GroupChannelsChangedEventArgs`
|
||||
- **Constructor**: `GroupChannelsChangedEventArgs(object group, int channelCount)`
|
||||
- **Properties**:
|
||||
- `object Group` — The group whose channel count has changed.
|
||||
- `int ChannelCount` — The new total number of channels in the group.
|
||||
|
||||
#### `GroupUpdatedEvent`
|
||||
- **Type**: `class` inheriting from `PubSubEvent<GroupUpdatedEventArgs>`
|
||||
- **Behavior**: A Prism event used to signal that a group’s state has been updated in a specific way (channel insertion or assignment).
|
||||
- **Note**: The XML summary incorrectly labels this as “The GroupUpdated event” but the class name is `GroupUpdatedEvent`.
|
||||
|
||||
#### `GroupUpdatedEventArgs`
|
||||
- **Constructor**: `GroupUpdatedEventArgs(object page, Status status)`
|
||||
- **Properties**:
|
||||
- `object Page` — The UI page (e.g., view model or control) where the update occurred.
|
||||
- `Status UpdateStatus` — The type of update performed (see `Status` enum below).
|
||||
- **Nested Enum `Status`**:
|
||||
- `ChannelsInserted` — Indicates channels were inserted into the group.
|
||||
- `AssignmentsMade` — Indicates channel assignments were modified (e.g., user/group assignments).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **Event Payload Immutability**: All `EventArgs` classes expose only read-only properties (`get;`), and their constructors enforce non-null assignment of all fields at construction time.
|
||||
- **Page Context Consistency**: In both `GroupChannelDeleteRequestEventArgs` and `GroupUpdatedEventArgs`, the `Page` property is expected to represent the originating UI context (e.g., a view model or control instance), though the type is `object`, allowing flexibility but requiring callers to ensure consistency.
|
||||
- **Channel Count Validity**: In `GroupChannelsChangedEventArgs`, `ChannelCount` is expected to reflect the *current* number of channels in the group after the change, not a delta.
|
||||
- **Status Exhaustiveness**: `GroupUpdatedEventArgs.Status` is a closed enum with exactly two values; no other statuses are defined.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **Prism.Events**: All event types derive from `PubSubEvent<T>` (from the Prism library), indicating a dependency on Prism’s event aggregation framework.
|
||||
- **DTS.Common.Interface.Channels**: `GroupChannelDeleteRequestEventArgs` depends on the `IGroupChannel` interface (imported via `using DTS.Common.Interface.Channels;`).
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- Any module or component that needs to coordinate group channel list changes (e.g., UI pages, channel management services) will subscribe to or publish these events.
|
||||
- Specifically, components managing group templates (as suggested by the `<remarks>` in `GroupChannelsChangedEvent` and `GroupUpdatedEvent`) likely depend on this module.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Ambiguous `object` Types**: The `Page` and `Group` properties are typed as `object`, not a specific interface or base class. This introduces ambiguity: consumers must know the expected concrete types (e.g., likely view models or controls) to safely cast or use them.
|
||||
- **Misleading XML Comments**:
|
||||
- `GroupChannelsChangedEvent`’s summary says “The GroupUpdated event” — this appears to be a copy-paste error.
|
||||
- Both `GroupChannelsChangedEvent` and `GroupUpdatedEvent` have `<remarks>` stating “called when a template is selected,” but `GroupChannelDeleteRequestEvent` has no such comment. This may imply inconsistent documentation or that the remarks apply only to certain events.
|
||||
- **No Validation on `ChannelCount`**: `GroupChannelsChangedEventArgs` accepts any `int` for `channelCount`, including negative values. While unlikely, there is no runtime enforcement that `channelCount ≥ 0`.
|
||||
- **No Cancellation Mechanism**: `GroupChannelDeleteRequestEvent` is a *request* event, but there is no built-in cancellation or confirmation mechanism (e.g., via `CancelableEventArgs`). Subscribers must handle deletion logic themselves, and callers cannot abort the operation based on subscriber responses.
|
||||
- **Enum Naming vs. Semantics**: `GroupUpdatedEventArgs.Status.AssignmentsMade` is vague — it could mean assignment of users to channels, channels to groups, or other relationships. The interface `IGroupChannel` is not defined here, so the exact semantics of “assignments” cannot be inferred.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Groups/GroupsList/GroupListEditGroupEvent.cs
|
||||
- Common/DTS.Common/Events/Groups/GroupsList/GroupListGroupSelectedEvent.cs
|
||||
generated_at: "2026-04-16T03:26:07.948442+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bca3088a7f9f7005"
|
||||
---
|
||||
|
||||
# GroupsList
|
||||
|
||||
## Documentation: Group List Events Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines two Prism-based pub/sub events used to communicate group selection and editing actions within the group list UI layer. Specifically, `GroupListEditGroupEvent` signals that a single group should be edited (via its numeric ID), while `GroupListGroupSelectedEvent` signals that a set of groups has been selected (via an array of IDs). These events decouple UI components (e.g., a group list view) from handlers (e.g., a view model or controller responsible for launching an edit dialog or performing bulk operations), enabling flexible event-driven interactions in the application’s MVVM architecture.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `GroupListEditGroupEvent`
|
||||
- **Signature**: `public class GroupListEditGroupEvent : PubSubEvent<int> { }`
|
||||
- **Behavior**: A Prism `PubSubEvent<int>` used to publish when a single group is selected for editing. The payload is the group’s integer ID. Subscribers receive this ID to initiate editing logic (e.g., opening an edit dialog for the group with that ID).
|
||||
|
||||
#### `GroupListGroupSelectedEvent`
|
||||
- **Signature**: `public class GroupListGroupSelectedEvent : PubSubEvent<int[]> { }`
|
||||
- **Behavior**: A Prism `PubSubEvent<int[]>` used to publish when multiple groups are selected (e.g., via multi-select UI). The payload is an array of group IDs (`int[]`) representing the currently selected groups. Subscribers may use this to enable bulk operations (e.g., delete, assign) or update selection state.
|
||||
|
||||
> **Note**: Both event classes have no public methods, properties, or constructors beyond the inherited `PubSubEvent<TPayload>` behavior (e.g., `Subscribe`, `Publish`). Their sole purpose is to define strongly-typed event payloads.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `GroupListEditGroupEvent` **always** carries a single non-null `int` payload representing a valid group identifier.
|
||||
- `GroupListGroupSelectedEvent` **always** carries a non-null `int[]` payload. The array may be empty (indicating deselection of all groups) but must not be `null`.
|
||||
- IDs in both events are expected to correspond to existing groups in the system’s data model (though validation is not enforced by the event classes themselves).
|
||||
- No ordering guarantee is provided for `int[]` payloads in `GroupListGroupSelectedEvent`; the order of IDs is implementation-dependent (e.g., reflects UI selection order or internal storage order).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `Prism.Events.PubSubEvent<T>` (from the Prism library) — base class for both events.
|
||||
- `DTS.Common` namespace — shared common library (implied by `DTS.Common.Events` namespace).
|
||||
- **Depended on by**:
|
||||
- UI components (e.g., group list views) that publish these events on user interaction.
|
||||
- View models or services that subscribe to these events to handle group editing or selection logic.
|
||||
- *Inferred*: Any module handling group lifecycle operations (e.g., editing, bulk actions) will likely reference these events.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Misleading XML documentation**: Both events’ `<summary>` and `<remarks>` incorrectly reference `"GroupTemplateListGroupTemplateSelectedEvent"` and `"called when a template is selected"`. This appears to be copy-paste error or outdated documentation; the actual purpose relates to *groups*, not templates.
|
||||
- **Ambiguous selection semantics**: `GroupListGroupSelectedEvent`’s payload (`int[]`) does not distinguish between user-initiated selection changes (e.g., adding/removing items) and explicit "apply" actions. Subscribers must infer intent from context or additional state.
|
||||
- **No validation in event**: Neither event validates that IDs exist or are non-negative. Invalid IDs may propagate to subscribers, requiring defensive handling.
|
||||
- **Thread-safety**: As Prism `PubSubEvent` instances, events are published on the UI thread by default (unless configured otherwise), but subscribers must ensure thread-safe operations if they perform non-UI work.
|
||||
- **None identified from source alone** for behavioral quirks beyond the above.
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListShowCompactEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListEditHardwareEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareSelectedEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareReplaceEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareSavedEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareIncludedEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareTestPTPDomainIDEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareTestSampleRateEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareTestClockMasterEvent.cs
|
||||
- Common/DTS.Common/Events/Hardware/HardwareList/HardwareListHardwareTestAAFilterRateEvent.cs
|
||||
generated_at: "2026-04-16T03:25:48.611478+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "37867324a1f6116a"
|
||||
---
|
||||
|
||||
# Hardware List Events Module Documentation
|
||||
|
||||
---
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines a set of Prism-based pub/sub events used to communicate state changes and user actions related to hardware configuration and testing within the DTS (DAS Test System) application. These events facilitate decoupled communication between UI components (e.g., hardware list views) and backend logic, enabling reactive updates when hardware selection, inclusion status, or test-specific parameters (e.g., sample rate, PTP domain ID, clock master status) are modified. The events are grouped under the `DTS.Common.Events.Hardware.HardwareList` namespace and are intended for use in MVVM-based WPF applications leveraging Prism’s event aggregation framework.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
All classes are event types derived from `Prism.Events.PubSubEvent<TPayload>`. They are published/subscribed via Prism’s `IEventAggregator`.
|
||||
|
||||
| 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. *(Note: Class XML comment incorrectly says “HardwareListHardwareSelectedEvent” — actual class name is `HardwareListEditHardwareEvent`.)* |
|
||||
| `HardwareListHardwareSelectedEvent` | `string[]` | Indicates hardware(s) have been selected; payload is an array of **serial numbers** of selected hardware items. |
|
||||
| `HardwareReplaceEvent` | `Tuple<IHardware, IHardware>` | Indicates a hardware replacement request; payload is a tuple where `Item1` is the *old* hardware and `Item2` is the *new* hardware. *(Requires `IHardware` interface from `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`.)* |
|
||||
| `HardwareSavedEvent` | `Tuple<int, string>` | Indicates hardware was added or updated; payload is a tuple where `Item1` is the **database ID** (int) and `Item2` is the **serial number** (string). |
|
||||
| `HardwareListHardwareIncludedEvent` | `HardwareListHardwareIncludedEventArgs` | Indicates inclusion status of a hardware item changed; payload contains `SerialNumber`, `DASId`, and `Included` (bool). |
|
||||
| `HardwareListHardwareTestPTPDomainIDEvent` | `HardwareListHardwareTestPTPDomainIDEventArgs` | Indicates the PTP domain ID for a hardware item in the current test changed; payload contains `SerialNumber`, `DASId`, and `PTPDomainId` (byte). |
|
||||
| `HardwareListHardwareTestSampleRateEvent` | `HardwareListHardwareTestSampleRateEventArgs` | Indicates the sample rate for a hardware item in the current test changed; payload contains `SerialNumber`, `DASId`, and `TestSampleRate` (double). |
|
||||
| `HardwareListHardwareTestClockMasterEvent` | `HardwareListHardwareTestClockMasterEventArgs` | Indicates the clock master status for a hardware item in the current test changed; payload contains `SerialNumber`, `DASId`, and `IsClockMaster` (bool). |
|
||||
| `HardwareListHardwareTestAAFilterRateEvent` | `HardwareListHardwareTestAAFilterRateEventArgs` | Indicates the anti-aliasing filter rate for a hardware item in the current test changed; payload contains `SerialNumber`, `DASId`, and `TestAAFilterRate` (float). |
|
||||
|
||||
### Event Argument Classes (Nested)
|
||||
|
||||
| Class | Properties | Notes |
|
||||
|------|------------|-------|
|
||||
| `HardwareListHardwareIncludedEventArgs` | `string SerialNumber`, `int DASId`, `bool Included` | Constructor: `HardwareListHardwareIncludedEventArgs(string serial, bool included, int dasId)` |
|
||||
| `HardwareListHardwareTestPTPDomainIDEventArgs` | `string SerialNumber`, `int DASId`, `byte PTPDomainId` | Constructor: `HardwareListHardwareTestPTPDomainIDEventArgs(string serial, int dasId, byte ptpDomainId)` |
|
||||
| `HardwareListHardwareTestSampleRateEventArgs` | `string SerialNumber`, `int DASId`, `double TestSampleRate` | Constructor: `HardwareListHardwareTestSampleRateEventArgs(string serial, double testSampleRate, int dasId)` |
|
||||
| `HardwareListHardwareTestClockMasterEventArgs` | `string SerialNumber`, `int DASId`, `bool IsClockMaster` | Constructor: `HardwareListHardwareTestClockMasterEventArgs(string serial, bool isClockMaster, int dasId)` |
|
||||
| `HardwareListHardwareTestAAFilterRateEventArgs` | `string SerialNumber`, `int DASId`, `float TestAAFilterRate` | Constructor: `HardwareListHardwareTestAAFilterRateEventArgs(string serial, float testAAFilterRate, int dasId)` |
|
||||
|
||||
> **Note**: All event argument classes have *read-only* properties (set only via constructor). All properties are `public` but setters are `private`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- All events inherit from `PubSubEvent<T>`, meaning they follow Prism’s default pub/sub semantics: **one-to-many**, **asynchronous** (on the UI thread by default), and **no guaranteed ordering** of subscribers.
|
||||
- Payload types are strictly typed and non-nullable (e.g., `bool`, `string`, `int`, `byte`, `double`, `float`, `Tuple<...>`, or custom `EventArgs`).
|
||||
- For events carrying `SerialNumber`, the value is expected to be a non-null, non-empty string identifying a hardware unit.
|
||||
- For events carrying `DASId`, the value is expected to be a valid database identifier for a DAS (Data Acquisition System) instance.
|
||||
- `HardwareReplaceEvent`’s payload tuple must contain two non-null `IHardware` instances (though nullability is not enforced by the event type itself).
|
||||
- `HardwareSavedEvent`’s `int` payload (database ID) is expected to be `> 0` for existing hardware, but may be `0` or negative for new hardware (not specified in source — *inferred from typical patterns*).
|
||||
- All `HardwareListHardwareTest*` events are test-scoped: the `DASId` in the payload identifies the *test context* (not necessarily the hardware’s persistent DAS assignment).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **Prism.Events** (`Prism` library) — required for `PubSubEvent<T>` base class.
|
||||
- **DTS.Common.Interface.DASFactory.Diagnostics.HardwareList** — referenced in `HardwareListEditHardwareEvent`, `HardwareListHardwareSelectedEvent`, `HardwareReplaceEvent`, and `HardwareSavedEvent` via `IHardware` (used only in `HardwareReplaceEvent` payload).
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- Any module/UI component that needs to react to hardware list state changes (e.g., view models, services, test runners) will subscribe to one or more of these events.
|
||||
- Likely consumers include:
|
||||
- `HardwareListViewModel` (or similar)
|
||||
- Test configuration UIs (for test-specific events like `*TestSampleRateEvent`)
|
||||
- Persistence services (e.g., `HardwareSavedEvent` subscribers may update DB or cache)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Misleading XML comment**: `HardwareListEditHardwareEvent`’s class-level XML says “The HardwareListHardwareSelectedEvent event” — this is a copy-paste error; the actual class name is `HardwareListEditHardwareEvent`.
|
||||
- **Ambiguous naming**: `HardwareListHardwareSelectedEvent` vs. `HardwareListHardwareIncludedEvent` — both relate to selection/inclusion but serve different purposes:
|
||||
- `HardwareListHardwareSelectedEvent`: user *selection* (multi-select, UI-level).
|
||||
- `HardwareListHardwareIncludedEvent`: user toggled *inclusion* in the test configuration (logical inclusion/exclusion).
|
||||
- **`HardwareSavedEvent` name mismatch**: Class is named `HardwareSavedEvent`, but XML comment says “The HardwareAddedEvent event” — likely historical artifact.
|
||||
- **No validation on payload values**: Events do not enforce constraints (e.g., `PTPDomainId` range, `TestSampleRate` > 0). Consumers must validate.
|
||||
- **`HardwareReplaceEvent` uses `Tuple<IHardware, IHardware>`**: Requires `IHardware` interface from an external assembly (`DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`). Ensure this interface is stable and versioned appropriately.
|
||||
- **`HardwareListHardwareIncludedEvent` payload includes `DASId`**: This suggests inclusion status may be *per-DAS*, but the event name does not reflect this nuance — could cause confusion if inclusion is assumed global.
|
||||
- **No cancellation or async support**: Events are fire-and-forget; subscribers cannot cancel or signal failure via the event payload.
|
||||
|
||||
> **None identified from source alone** for additional gotchas beyond those explicitly noted above.
|
||||
58
enriched-qwen3-coder-next/Common/DTS.Common/Events/ISO.md
Normal file
58
enriched-qwen3-coder-next/Common/DTS.Common/Events/ISO.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/ISO/ExtraPropertiesChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:25:01.894095+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "61eef1209c66c784"
|
||||
---
|
||||
|
||||
# ISO
|
||||
|
||||
### 1. Purpose
|
||||
This module defines event infrastructure for propagating changes to *extra properties* within the ISO domain layer of the DTS system. Specifically, it provides a Prism-based pub/sub event (`ExtraPropertiesChangedEvent`) and its associated argument container (`ExtraPropertiesChangedEventArgs`) to decouple producers and consumers of property updates—enabling reactive UI or business logic components to respond when a collection of `IExtraProperty` instances is modified, while preserving provenance via `Producer` and `Consumer` references.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
- **`ExtraPropertiesChangedEvent`**
|
||||
- *Type:* `class` inheriting from `PubSubEvent<ExtraPropertiesChangedEventArgs>`
|
||||
- *Behavior:* A Prism `PubSubEvent` used to publish and subscribe to notifications about changes to extra properties. Subscribers receive an `ExtraPropertiesChangedEventArgs` payload.
|
||||
|
||||
- **`ExtraPropertiesChangedEventArgs`**
|
||||
- *Type:* `class`
|
||||
- *Constructor:* `ExtraPropertiesChangedEventArgs(IList<IExtraProperty> extraProperties, object producer, object consumer)`
|
||||
- *Properties:*
|
||||
- `IList<IExtraProperty> ExtraProperties { get; }` — The updated collection of extra properties.
|
||||
- `object Producer { get; }` — The object instance that initiated or caused the change.
|
||||
- `object Consumer { get; }` — The object instance that is the intended recipient or target of the change.
|
||||
- *Behavior:* Encapsulates the data for an `ExtraPropertiesChangedEvent` payload. All properties are read-only after construction.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `ExtraProperties` is non-null (enforced by constructor assignment; no null-check is present, so passing `null` will result in a `NullReferenceException` at runtime).
|
||||
- `Producer` and `Consumer` may be `null` (no validation is enforced in the constructor).
|
||||
- The `ExtraProperties` list reference is immutable in terms of property exposure (only a getter), but the *contents* of the list are not defensively copied—consumers must treat the list as potentially mutable if the producer retains a reference.
|
||||
- The event is strictly *publish-once-per-change*; no batching or deduplication semantics are implied.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Dependencies *on* this module:**
|
||||
- `DTS.Common.Interface.ISO.ExtraProperties` — Provides the `IExtraProperty` interface used in `ExtraPropertiesChangedEventArgs.ExtraProperties`.
|
||||
- `Prism.Events` — Provides the `PubSubEvent<T>` base class.
|
||||
- `System.Collections.Generic` — Provides `IList<T>`.
|
||||
- **Dependencies *of* this module:**
|
||||
- This module is consumed by components that use Prism event aggregation (e.g., view models, services) to react to extra property changes in the ISO domain.
|
||||
- No other modules in this file depend on it—this is a leaf event definition.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **No defensive copying:** The `ExtraProperties` list is assigned directly from the constructor argument; if the caller mutates the list *after* constructing the args object, subscribers may observe unexpected changes.
|
||||
- **No validation on `Producer`/`Consumer`:** These may be `null`, and subscribers must handle this case explicitly.
|
||||
- **No versioning or metadata:** The event carries no timestamp, correlation ID, or change type (e.g., add/remove/replace), limiting traceability or differential processing.
|
||||
- **Assumes Prism event aggregator usage:** The class is tightly coupled to Prism’s `PubSubEvent<T>`—not usable in isolation without Prism infrastructure.
|
||||
- **No documentation on semantics of `Producer` vs `Consumer`:** The distinction between the two is not clarified in the source—consumers must infer intent (e.g., `Producer` = source of change, `Consumer` = target component).
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Realtime/RealtimeChannelSelectedEvent.cs
|
||||
generated_at: "2026-04-16T03:24:41.583856+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f8835260c1874944"
|
||||
---
|
||||
|
||||
# Realtime
|
||||
|
||||
## 1. Purpose
|
||||
This module defines the `RealtimeChannelSelectedEvent` class, a Prism `PubSubEvent` used to broadcast notifications across the application whenever a realtime communication channel is selected. Its role is to decouple the selection logic (e.g., UI interaction or configuration change) from downstream components (e.g., data handlers, UI panels, or connection managers) that need to react to channel changes—such as updating active subscriptions, switching data streams, or refreshing UI elements tied to the selected channel.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`RealtimeChannelSelectedEvent`**
|
||||
- *Inherits from*: `PubSubEvent<IRealtimeChannel>`
|
||||
- *Behavior*: A concrete event type that carries an `IRealtimeChannel` payload. When published (via `EventAggregator.Publish()`), it notifies all subscribers that a new realtime channel has been selected. Subscribers receive the selected channel instance as the event argument.
|
||||
|
||||
## 3. Invariants
|
||||
- The event payload is guaranteed to be non-null *at the time of publication*, assuming callers follow the intended usage pattern (publishing only when a valid channel is selected).
|
||||
- The event is strictly *asynchronous* and *loosely coupled*—publishing does not block, and subscribers execute independently.
|
||||
- The event type is immutable by design (no custom logic beyond inheritance); behavior is defined entirely by Prism’s `PubSubEvent` infrastructure.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `Prism.Events` (for `PubSubEvent<TPayload>`)
|
||||
- `DTS.Common.Interface.Realtime` (for `IRealtimeChannel` interface)
|
||||
- **Depended upon by**:
|
||||
- Any component that needs to react to realtime channel selection changes (e.g., UI views, service layers managing subscriptions). Specific dependents are not visible in this file but would typically subscribe via `EventAggregator.GetEvent<RealtimeChannelSelectedEvent>().Subscribe(...)`.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No null-safety enforcement**: While the event payload is expected to be non-null, Prism’s `PubSubEvent` does not enforce this. Callers must ensure only valid `IRealtimeChannel` instances are published.
|
||||
- **Lifetime management**: Subscribers must manually unsubscribe (e.g., in `Dispose` or view cleanup) to avoid memory leaks—especially for long-lived subscribers (e.g., services) subscribing to this short-lived event.
|
||||
- **No ordering guarantees**: Multiple subscribers execute in an undefined order; if sequential logic is required (e.g., cleanup before setup), explicit coordination is needed.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/RegionOfInterest/RegionOfInterestChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:24:29.831249+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b57954f8953ae512"
|
||||
---
|
||||
|
||||
# RegionOfInterest
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a Prism-based event (`RegionOfInterestChangedEvent`) used to publish notifications when the current region of interest (ROI) changes in the application. It serves as a decoupling mechanism in the MVVM pattern, allowing view models or services to subscribe to ROI changes without direct references, enabling reactive UI updates or downstream processing (e.g., image analysis, rendering, or logging) in response to ROI modifications.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`RegionOfInterestChangedEvent`**
|
||||
- *Type*: `class` (inherits from `Prism.Events.PubSubEvent<IRegionOfInterest>`)
|
||||
- *Behavior*: A Prism `PubSubEvent` that carries an `IRegionOfInterest` payload. When published (via `Publish`), all subscribers receive the new ROI instance. This event is *not* thread-safe by default (Prism’s `PubSubEvent` uses the synchronization context of the publisher unless configured otherwise).
|
||||
|
||||
### 3. Invariants
|
||||
- The event payload is always of type `IRegionOfInterest` (from `DTS.Common.Interface.RegionOfInterest`).
|
||||
- The event is *publish-only* in this file—no custom logic is defined for subscription, filtering, or persistence.
|
||||
- No validation or normalization of the `IRegionOfInterest` instance is performed by this class; validity of the payload is assumed to be enforced by publishers.
|
||||
|
||||
### 4. Dependencies
|
||||
- **External**:
|
||||
- `Prism.Events` (specifically `PubSubEvent<TPayload>`)
|
||||
- `DTS.Common.Interface.RegionOfInterest` (for the `IRegionOfInterest` interface)
|
||||
- **Internal**:
|
||||
- *Consumers*: Any module/service/view model that needs to react to ROI changes (e.g., via `IEventAggregator.GetEvent<RegionOfInterestChangedEvent>().Subscribe(...)`).
|
||||
- *Producers*: Code that calls `eventAggregator.GetEvent<RegionOfInterestChangedEvent>().Publish(roi)`, where `roi` implements `IRegionOfInterest`.
|
||||
|
||||
### 5. Gotchas
|
||||
- **No default thread-safety**: Subscribers may execute on the publisher’s thread context; if the publisher is on a background thread, subscribers must handle cross-thread access (e.g., via `Subscribe(..., ThreadOption.PublisherThread)` or UI dispatcher invocation).
|
||||
- **Lifetime management**: Subscribers must manually unsubscribe (e.g., in `Dispose` or view model cleanup) to avoid memory leaks, as Prism’s `PubSubEvent` holds strong references by default.
|
||||
- **No null-safety guarantee**: The event does not enforce non-null payloads; publishers must ensure `IRegionOfInterest` instances are valid (though `null` may be used intentionally to signal "clear ROI" if documented elsewhere).
|
||||
- **Interface dependency**: Behavior relies entirely on the contract of `IRegionOfInterest`; changes to that interface may silently break subscribers.
|
||||
- *None identified from source alone* regarding ordering guarantees, deduplication, or historical quirks—these would require inspection of publishers/subscribers.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/RegionOfInterest/RegionOfInterestChannels/RegionOfInterestChannelsSelectedEvent.cs
|
||||
generated_at: "2026-04-16T03:25:26.350849+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "708a3abe68702000"
|
||||
---
|
||||
|
||||
# RegionOfInterestChannels
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a Prism-based event for propagating region-of-interest (ROI) channel selection changes across the application. Specifically, `RegionOfInterestChannelsSelectedEvent` is a `PubSubEvent` used to broadcast when a user or system component selects a set of channels (by name and ID) for a given ROI—identified by its suffix—along with the consumer responsible for the selection. It enables decoupled communication between ROI management UI components (e.g., channel selectors) and downstream consumers (e.g., visualization or processing modules) without tight coupling.
|
||||
|
||||
## 2. Public Interface
|
||||
- **`RegionOfInterestChannelsSelectedEvent`**
|
||||
*Type:* `class` (inherits from `Prism.Events.PubSubEvent<RegionOfInterestChannelsSelectedEventArgs>`)
|
||||
*Behavior:* A Prism event used to publish and subscribe to ROI channel selection changes. Subscribers receive an instance of `RegionOfInterestChannelsSelectedEventArgs` containing the selection details.
|
||||
|
||||
- **`RegionOfInterestChannelsSelectedEventArgs`**
|
||||
*Type:* `class`
|
||||
*Behavior:* Encapsulates the payload of a channel selection event.
|
||||
- **Constructor:**
|
||||
`RegionOfInterestChannelsSelectedEventArgs(string roiSuffix, string[] selectedChannelNames, long[] selectedChannelIds, object o)`
|
||||
Initializes the event args with the ROI suffix, selected channel names, selected channel IDs, and the consumer object. All properties are set once and immutable after construction.
|
||||
- **Properties:**
|
||||
- `string RegionOfInterestSuffix { get; }` — The suffix identifying the ROI (e.g., `"Brain"`, `"Tumor"`), used to correlate the selection with a specific ROI context.
|
||||
- `string[] ChannelNames { get; }` — Ordered array of selected channel *names* (e.g., `["Red", "Green"]`). May be empty.
|
||||
- `long[] ChannelIds { get; }` — Ordered array of corresponding selected channel *IDs* (e.g., `[101L, 102L]`). Must be same length as `ChannelNames`.
|
||||
- `object Consumer { get; }` — The object (typically a view model or service) that triggered or is responsible for the selection. Used to avoid re-processing events originating from the same consumer.
|
||||
|
||||
## 3. Invariants
|
||||
- `ChannelNames.Length == ChannelIds.Length` must hold for all valid instances (enforced by caller; no runtime validation is present in the class).
|
||||
- `RegionOfInterestSuffix` is non-null and non-empty (implied by usage context; not validated in the constructor).
|
||||
- `ChannelNames` and `ChannelIds` arrays are never `null` (constructor assigns them directly; caller must provide non-null arrays).
|
||||
- `Consumer` may be `null`, but typically represents a unique consumer instance to prevent echo loops.
|
||||
- The order of elements in `ChannelNames` and `ChannelIds` is semantically meaningful (i.e., index `i` in `ChannelNames` corresponds to index `i` in `ChannelIds`).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Dependencies *on* this module:**
|
||||
- `Prism.Events` (via `PubSubEvent<T>`) — Required for event publication/subscription.
|
||||
- `Prism.Regions` — Imported but *not used* in this file (likely a remnant or for future extension).
|
||||
- **Dependencies *of* this module:**
|
||||
- Consumers of `RegionOfInterestChannelsSelectedEvent` (e.g., view models, services) must subscribe to it using Prism’s event aggregator.
|
||||
- Publishers must provide valid `RegionOfInterestChannelsSelectedEventArgs` instances.
|
||||
- **Inferred consumers:**
|
||||
- Any module handling ROI-specific channel logic (e.g., rendering, analysis pipelines) likely subscribes to this event.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No validation of array lengths or nulls in the constructor** — Callers must ensure `selectedChannelNames` and `selectedChannelIds` are non-null and of equal length; otherwise, downstream consumers may encounter `IndexOutOfRangeException` or inconsistent state.
|
||||
- **`Consumer` is an `object`** — No type safety or interface contract is enforced. Subscribers must cast or check the type themselves (e.g., `is IRegionOfInterestConsumer`), risking runtime errors if misused.
|
||||
- **`Prism.Regions` is imported but unused** — Suggests possible historical or future use (e.g., region-scoped events), but currently adds no value and may confuse readers.
|
||||
- **No documentation of expected ROI suffix format** — The meaning of `RegionOfInterestSuffix` (e.g., casing, allowed characters) is application-specific and not defined here.
|
||||
- **No mechanism to distinguish initial selection vs. subsequent updates** — Subscribers must track state themselves to avoid redundant processing.
|
||||
- **No cancellation or error handling support** — The event is fire-and-forget; subscribers cannot signal failure or abort propagation.
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Sensors/CalibrationBehaviorSettingChangedEvent.cs
|
||||
- Common/DTS.Common/Events/Sensors/ExportCalibrationBehaviorSettingChangedEvent.cs
|
||||
- Common/DTS.Common/Events/Sensors/SensorFilterTypeChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:24:51.949729+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0b8580fe5a59ce51"
|
||||
---
|
||||
|
||||
# Sensors
|
||||
|
||||
## Documentation: Sensor Configuration Event Definitions
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
This module defines event types used to propagate changes in sensor configuration settings across the application, leveraging the Prism EventAggregator pattern for decoupled communication. Specifically, it publishes notifications when calibration behavior settings change (for both general and export contexts) and when the filter type applied to a sensor changes—enabling UI components and business logic modules to react to these changes without tight coupling. These events are part of the shared `DTS.Common` library and are intended for use across modules that manage sensor data acquisition, filtering, and calibration.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `CalibrationBehaviorSettingChangedEvent`
|
||||
- **Signature**:
|
||||
`public class CalibrationBehaviorSettingChangedEvent : PubSubEvent<DTS.Common.Enums.Sensors.CalibrationBehaviors> { }`
|
||||
- **Behavior**:
|
||||
Publishes a change in the *general* calibration behavior setting. Payload is a value of the `CalibrationBehaviors` enum, representing the new behavior.
|
||||
|
||||
#### `ExportCalibrationBehaviorSettingChangedEvent`
|
||||
- **Signature**:
|
||||
`public class ExportCalibrationBehaviorSettingChangedEvent : PubSubEvent<DTS.Common.Enums.Sensors.CalibrationBehaviors> { }`
|
||||
- **Behavior**:
|
||||
Publishes a change in the *export-specific* calibration behavior setting. Payload is a value of the `CalibrationBehaviors` enum, representing the new behavior for export operations.
|
||||
|
||||
#### `SensorFilterTypeChangedEvent`
|
||||
- **Signature**:
|
||||
`public class SensorFilterTypeChangedEvent : PubSubEvent<SensorFilterTypeChangedEventArgs> { }`
|
||||
- **Behavior**:
|
||||
Publishes a change in the filter type applied to a sensor. Payload is a `SensorFilterTypeChangedEventArgs` object containing details about the change (e.g., ISO code character, filter class, associated sensor/calibration objects, and configuration flags).
|
||||
|
||||
#### `SensorFilterTypeChangedEventArgs`
|
||||
- **Properties**:
|
||||
- `char ISOCodeChar` — The ISO code character used when `EventType == EventTypes.ISOCodeChar`.
|
||||
- `EventTypes EventType` — Indicates whether the change was triggered by an ISO code character (`ISOCodeChar`) or a filter class (`FilterClass`).
|
||||
- `FilterClassType FilterClass` — The new filter class type used when `EventType == EventTypes.FilterClass`.
|
||||
- `ISensorCalibration Calibration` — The calibration object associated with the sensor at the time of change.
|
||||
- `ISensorData Sensor` — The sensor instance whose filter type changed.
|
||||
- `bool UseISOCodeFilterMapping` — Flag indicating whether ISO code filtering is enabled/mapped.
|
||||
- `bool UseZeroForUnfiltered` — Flag indicating whether zero should be used for unfiltered values.
|
||||
- **Constructors**:
|
||||
- `SensorFilterTypeChangedEventArgs(char code, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
|
||||
Initializes for ISO code–based filter changes (`EventType = EventTypes.ISOCodeChar`).
|
||||
- `SensorFilterTypeChangedEventArgs(FilterClassType filterClassType, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
|
||||
Initializes for filter class–based changes (`EventType = EventTypes.FilterClass`).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
- `SensorFilterTypeChangedEventArgs` must be constructed with **exactly one** of `ISOCodeChar` or `FilterClass` populated, depending on `EventType`. The other field remains default (`\0` or `default(FilterClassType)`).
|
||||
- `EventType` is immutable after construction and is set based on which constructor overload is used.
|
||||
- All `SensorFilterTypeChangedEventArgs` instances must include non-null `Sensor` and `Calibration` references (no null checks are performed in the source, implying callers are expected to ensure validity).
|
||||
- `UseISOCodeFilterMapping` and `UseZeroForUnfiltered` are boolean flags passed directly from the caller and are not validated or normalized.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
- **Depends on**:
|
||||
- `Prism.Events` (for `PubSubEvent<T>` base class).
|
||||
- `DTS.Common.Enums.Sensors` (for `CalibrationBehaviors`, `SensorFilterTypeChangedEventArgs.EventTypes`, and `FilterClassType`).
|
||||
- `DTS.Common.Interface.Sensors` (for `ISensorCalibration` and `ISensorData` interfaces).
|
||||
- **Used by**:
|
||||
- Modules consuming sensor configuration changes (e.g., UI views, data processing pipelines, export services).
|
||||
- Likely subscribed to by components that update filter UI, reconfigure sensor pipelines, or regenerate filtered data exports.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
- **Namespace inconsistency**:
|
||||
`CalibrationBehaviorSettingChangedEvent` and `ExportCalibrationBehaviorSettingChangedEvent` reside in `DTS.Common.Events`, while `SensorFilterTypeChangedEvent` resides in `DTS.Common.Events.Sensors`. This may cause confusion when registering/subscribing (e.g., `eventAggregator.GetEvent<SensorFilterTypeChangedEvent>()` vs `GetEvent<CalibrationBehaviorSettingChangedEvent>()`).
|
||||
- **No validation in constructor**:
|
||||
The constructors do not enforce that `sensor` or `sensorCalibration` are non-null. Callers must ensure this, or risk `NullReferenceException` at event handling time.
|
||||
- **Ambiguous `FilterClassType` usage**:
|
||||
The type `FilterClassType` is referenced but not defined in the provided source—its possible values and semantics are unknown here.
|
||||
- **Dual constructor overloads**:
|
||||
The two `SensorFilterTypeChangedEventArgs` constructors are not symmetric in naming or parameter order (e.g., `code` vs `filterClassType` first), increasing risk of misuse.
|
||||
- **No documentation on `CalibrationBehaviors` enum**:
|
||||
The meaning of specific `CalibrationBehaviors` values is not included in this module and must be inferred from elsewhere.
|
||||
|
||||
---
|
||||
|
||||
*Documentation generated from provided source files only.*
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/Sensors/SensorsList/SensorsListSensorSelectedEvent.cs
|
||||
- Common/DTS.Common/Events/Sensors/SensorsList/SensorChangedEvent.cs
|
||||
generated_at: "2026-04-16T03:25:38.832250+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "58207bf6cc93d33a"
|
||||
---
|
||||
|
||||
# SensorsList
|
||||
|
||||
## Documentation Page: `DTS.Common.Events.Sensors.SensorsList`
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of Prism-based pub/sub events used to coordinate sensor-related state changes and user actions across the UI and business logic layers in the DTS application. Specifically, it enables decoupled communication for sensor selection, saving, updating, and modification of sensor properties (e.g., sensitivity, excitation, nonlinearity). These events allow view models and services to react to sensor lifecycle events without tight coupling—e.g., updating filter lists when a sensor is added/deleted, or refreshing sensitivity controls when a user modifies a sensor’s properties.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `SensorsListSensorSelectedEvent`
|
||||
- **Type**: `class SensorsListSensorSelectedEvent : PubSubEvent<string[]>`
|
||||
- **Behavior**: Publishes an array of strings (likely serial numbers or identifiers) when a sensor is selected in the sensors list UI. Subscribers receive the selected sensor identifiers via the payload.
|
||||
- **Note**: Despite the XML comment referencing `TTSImportSummaryImportEvent` and “Import button was clicked,” the class name, namespace, and inheritance clearly indicate it is for *sensor selection*, not import. This appears to be a documentation error.
|
||||
|
||||
#### `SensorSavedEvent`
|
||||
- **Type**: `class SensorSavedEvent : PubSubEvent<double>`
|
||||
- **Behavior**: Published after a new sensor is saved (e.g., added via the settings menu). The `double` payload likely represents the database ID of the newly saved sensor (as suggested by the comment referencing “FB 13120” and “save function”).
|
||||
|
||||
#### `SensorUpdatedEvent`
|
||||
- **Type**: `class SensorUpdatedEvent : PubSubEvent<bool>`
|
||||
- **Behavior**: Published when a sensor is added or deleted to signal that the default filter selection in the filter list should be refreshed. The `bool` payload likely indicates whether the change was an *addition* (`true`) or *deletion* (`false`), though the source does not explicitly define the semantics of the boolean.
|
||||
|
||||
#### `SensorChangedEvent`
|
||||
- **Type**: `class SensorChangedEvent : PubSubEvent<SensorChangedArgs>`
|
||||
- **Behavior**: Published when one or more sensor properties are modified by the user. Carries a `SensorChangedArgs` object detailing *which* properties changed.
|
||||
|
||||
##### `SensorChangedArgs`
|
||||
- **Type**: `class SensorChangedArgs`
|
||||
- **Properties**:
|
||||
- `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 (e.g., on startup or restore).
|
||||
- `NonLinearChanged` (`bool`) – `true` if the nonlinearity setting changed.
|
||||
- `SensitivityChanged` (`bool`) – `true` if the sensitivity value changed.
|
||||
- `IsProportionalChanged` (`bool`) – `true` if the proportionality setting changed.
|
||||
- `ExcitationChanged` (`bool`) – `true` if an excitation setting changed.
|
||||
- **Constructor**:
|
||||
```csharp
|
||||
public SensorChangedArgs(string serialNumber, int databaseId, bool currentModelLoading,
|
||||
bool nonLinearChanged, bool sensitivityChanged,
|
||||
bool isProportionalChanged, bool excitationChanged)
|
||||
```
|
||||
All parameters are required and stored immutably.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- All events inherit from `Prism.Events.PubSubEvent<T>`, meaning they follow Prism’s pub/sub semantics:
|
||||
- Events are published asynchronously (on the UI thread by default in Prism WPF).
|
||||
- Subscribers must explicitly subscribe/unsubscribe to avoid memory leaks.
|
||||
- `SensorChangedArgs` is immutable: all properties are `get`-only and initialized via constructor.
|
||||
- The `SerialNumber` and `DatabaseId` fields in `SensorChangedArgs` are *not currently used* (per comments), so consumers should not rely on them for identification.
|
||||
- The boolean flags in `SensorChangedArgs` are *independent*—multiple may be `true` in a single event (e.g., both `SensitivityChanged` and `ExcitationChanged` if both were modified in one operation).
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal Dependencies**:
|
||||
- `Prism.Events` (via `using Prism.Events;`) — required for `PubSubEvent<T>`.
|
||||
- Namespace `DTS.Common.Events.Sensors.SensorsList` — all events are co-located here.
|
||||
- **External Dependencies (inferred)**:
|
||||
- Likely consumed by UI components (e.g., view models for sensor list, filter controls, settings panels) and services managing sensor persistence.
|
||||
- `SensorSavedEvent`’s `double` payload suggests integration with a database layer (e.g., returning a new sensor’s ID).
|
||||
- `SensorChangedEvent` implies integration with sensor configuration UI (e.g., sensitivity/excitation controls).
|
||||
- **No external libraries beyond Prism** are referenced in the source.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **Misleading XML comment**: `SensorsListSensorSelectedEvent`’s summary incorrectly describes `TTSImportSummaryImportEvent` and import behavior. This is likely a copy-paste error and should be corrected to reflect sensor *selection*.
|
||||
- **Ambiguous boolean semantics**: The meaning of the `bool` payload in `SensorUpdatedEvent` is not documented beyond “used in selecting the default filter.” Consumers must infer or verify whether `true` = add, `false` = delete.
|
||||
- **Unused fields**: `SerialNumber` and `DatabaseId` in `SensorChangedArgs` are explicitly marked as unused. Do not depend on them—future use is planned but not implemented.
|
||||
- **No validation or error handling**: Events carry no error state or validation context. Subscribers must handle invalid states or errors independently.
|
||||
- **No ordering guarantees**: As Prism events are asynchronous, there is no guarantee about the order in which subscribers receive events (e.g., `SensorSavedEvent` vs. `SensorUpdatedEvent` after a save operation).
|
||||
|
||||
None identified beyond the above.
|
||||
111
enriched-qwen3-coder-next/Common/DTS.Common/Events/TSRAIRGo.md
Normal file
111
enriched-qwen3-coder-next/Common/DTS.Common/Events/TSRAIRGo.md
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/TSRAIRGo/StartStopDASScan.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/StartStopOverallStatusStateMachine.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/Trigger.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/Download.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/RemoveDAS.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/NavigateToDashboard.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/Arm.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/NavigateFromTSRAIRGoToDataPRO.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/ClearIpAddress.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/IpAddressToPing.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/RecordingModeChanged.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/SystemStatus.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/DASSampleRateChanged.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/SystemSettingsSampleRateChanged.cs
|
||||
- Common/DTS.Common/Events/TSRAIRGo/LevelTrigger.cs
|
||||
generated_at: "2026-04-16T03:24:54.024483+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "60eefa60bead6fb1"
|
||||
---
|
||||
|
||||
# TSRAIRGo Event Definitions
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of Prism `PubSubEvent<T>`-based events used for inter-component communication within the TSRAIRGo subsystem. These events coordinate high-level system operations such as starting/stopping DAS scans, managing system status and errors, handling DAS device lifecycle (add/remove), configuring sampling rates and recording modes, triggering downloads, managing IP address pinging, and navigating between UI views (e.g., dashboard, DataPRO). The events serve as a decoupled messaging mechanism to synchronize state and actions across loosely coupled modules without direct dependencies.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Event Classes (all inherit from `Prism.Events.PubSubEvent<T>`)
|
||||
|
||||
| Event Name | Payload Type | Payload Description |
|
||||
|------------|--------------|---------------------|
|
||||
| `StartStopDASScanEvent` | `bool` | `true` to start DAS scan, `false` to stop. |
|
||||
| `StartStopOverallStatusStateMachineEvent` | `bool` | `true` to start the overall status state machine, `false` to stop. |
|
||||
| `TriggerEvent` | `TriggerArg` | Generic trigger event; `TriggerArg` is currently empty. |
|
||||
| `DownloadEvent` | `DownloadArg` | Request to initiate a download; `DownloadArg` is currently empty. |
|
||||
| `RemoveDASEvent` | `string` | Identifier (e.g., serial number or name) of the DAS device to remove. |
|
||||
| `AddDASEvent` | `string` | Identifier of the DAS device to add. |
|
||||
| `NavigateToDashboardEvent` | `NavigateToDashboardArg` | Request to navigate to the dashboard view; `NavigateToDashboardArg` is currently empty. |
|
||||
| `ArmEvent` | `ArmArg` | Arm/disarm command. `Arm` property: `true` to arm, `false` to disarm. |
|
||||
| `ClearIpAddressEvent` | `ClearIpAddressArg` | Request to clear an IP address. `Clear` property: `true` to clear, `false` otherwise. |
|
||||
| `IpAddressToPingEvent` | `IpAddressToPingArg` | IP address to ping. `IpAddress` property: non-null string. |
|
||||
| `SystemSettingsRecordingModeChangedEvent` | `RecordingModeArg` | Recording mode has changed. `RecordingModeDisplayString` property: human-readable mode string. |
|
||||
| `SystemStatusEvent` | `SystemStatusArg` | General system status update. `Message` property: status message. |
|
||||
| `SystemErrorEvent` | `SystemErrorArg` | System error notification. `Error` property: error message. |
|
||||
| `DASSampleRateChangedEvent` | `DASSampleRateArg` | DAS sample rate changed. `SampleRate` property: integer (e.g., Hz). |
|
||||
| `DASListChangedEvent` | `bool` | DAS device list has changed. Payload indicates presence/absence of devices (e.g., `true` if at least one DAS is present). |
|
||||
| `SystemSettingsSampleRateChangedEvent` | `SystemSettingsSampleRateArg` | System settings sample rate changed. `SampleRate` property: integer. |
|
||||
| `SystemSettingsDurationChangedEvent` | `SystemSettingsDurationChangedArg` | System settings duration changed. `Duration` property: `double` (e.g., seconds). |
|
||||
| `SystemSettingsLevelTriggerChangedEvent` | `LevelTriggerArg` | Level trigger configuration changed in system settings. |
|
||||
| `DASLevelTriggerChangedEvent` | `LevelTriggerArg` | Level trigger configuration changed for DAS. |
|
||||
|
||||
> **Note**: `NavigateToDashboardEvent` and `NavigateFromTSRAIRGoToDataPROEvent` (see below) reside in `DTS.Common.Events` (not `DTS.Common.Events.TSRAIRGo`), indicating cross-subsystem navigation.
|
||||
|
||||
| Event Name | Payload Type | Payload Description |
|
||||
|------------|--------------|---------------------|
|
||||
| `NavigateFromTSRAIRGoToDataPROEvent` | `NavigateFromTSRAIRGoToDataPROArg` | Request to navigate from TSRAIRGo to DataPRO view; `NavigateFromTSRAIRGoToDataPROArg` is currently empty. |
|
||||
|
||||
### Argument Classes
|
||||
|
||||
| Class | Properties | Notes |
|
||||
|-------|------------|-------|
|
||||
| `TriggerArg` | *(none)* | Placeholder; may be extended in future. |
|
||||
| `DownloadArg` | *(none)* | Placeholder; may be extended in future. |
|
||||
| `ArmArg` | `public bool Arm { get; set; }` | Controls arming state. |
|
||||
| `ClearIpAddressArg` | `public bool Clear { get; set; }` | Controls whether to clear IP address. |
|
||||
| `IpAddressToPingArg` | `public string IpAddress { get; set; }` | IP address to ping; must be non-null. |
|
||||
| `RecordingModeArg` | `public string RecordingModeDisplayString { get; set; }` | Human-readable display string for recording mode. |
|
||||
| `SystemStatusArg` | `public string Message { get; set; }` | Status message (e.g., "Ready", "Recording"). |
|
||||
| `SystemErrorArg` | `public string Error { get; set; }` | Error message (e.g., exception text). |
|
||||
| `DASSampleRateArg` | `public int SampleRate { get; set; }` | Sample rate in Hz. |
|
||||
| `SystemSettingsSampleRateArg` | `public int SampleRate { get; set; }` | Sample rate in Hz. |
|
||||
| `SystemSettingsDurationChangedArg` | `public double Duration { get; set; }` | Duration in seconds. |
|
||||
| `LevelTriggerArg` | `string LevelTriggerText`, `bool? LevelTriggerAxis1`, `bool? LevelTriggerAxis2`, `bool? LevelTriggerAxis3` | Level trigger configuration. Implements custom `Equals()` logic for comparison. |
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- All events derive from `Prism.Events.PubSubEvent<T>` and are intended for use with Prism’s event aggregation pattern.
|
||||
- Payload types are strictly typed (`bool`, `string`, `int`, `double`, or custom argument classes).
|
||||
- `LevelTriggerArg.Equals()` implements *partial equivalence*: two instances are equal if **any one** of the following matches:
|
||||
- Both `LevelTriggerAxis1` are `true` (and non-null),
|
||||
- Both `LevelTriggerAxis2` are `true`,
|
||||
- Both `LevelTriggerAxis3` are `true`,
|
||||
- Both `LevelTriggerText` are non-empty and equal.
|
||||
- Otherwise, `false`.
|
||||
- `DASLevelTriggerChangedEvent` has a `SuppressMessage` attribute for naming convention (`S101`), indicating intentional deviation from PascalCase naming for compatibility with DAS domain terminology.
|
||||
- Navigation events (`NavigateToDashboardEvent`, `NavigateFromTSRAIRGoToDataPROEvent`) reside in the top-level `DTS.Common.Events` namespace, implying broader system scope beyond TSRAIRGo.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **Prism.Events**: All events rely on `Prism.Events.PubSubEvent<T>`, indicating a dependency on the Prism library (likely Prism.Core).
|
||||
- **System**: Minimal usage (`System`, `System.Collections.Generic`, etc.) only in `DASSampleRateChanged.cs` (likely auto-generated using `using` directives).
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- Any module requiring TSRAIRGo coordination (e.g., UI modules, DAS service modules, status managers) will subscribe to these events.
|
||||
- Specifically:
|
||||
- `StartStopDASScanEvent`, `StartStopOverallStatusStateMachineEvent`: Likely consumed by DAS control and state machine modules.
|
||||
- `AddDASEvent`/`RemoveDASEvent`: Consumed by device management modules.
|
||||
- `SystemStatusEvent`/`SystemErrorEvent`: Likely consumed by status display/UI modules.
|
||||
- Navigation events: Consumed by shell/navigation modules.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Empty argument classes**: Several argument types (`TriggerArg`, `DownloadArg`, `NavigateToDashboardArg`, `NavigateFromTSRAIRGoToDataPROArg`) are currently empty. This may indicate incomplete design or future extensibility—consumers should not assume payload semantics beyond the event name.
|
||||
- **`LevelTriggerArg.Equals()` semantics**: The custom equality logic is non-standard (only checks for *true* values in axis flags or text match). This may cause unexpected behavior if used in collections (e.g., `HashSet`, `Dictionary`) or comparisons expecting full structural equality.
|
||||
- **Namespace inconsistency**: `NavigateToDashboardEvent` and `NavigateFromTSRAIRGoToDataPROEvent` are in `DTS.Common.Events`, while most others are in `DTS.Common.Events.TSRAIRGo`. This may reflect legacy or cross-module design decisions—verify intended scope.
|
||||
- **No validation on payload values**: Events accept raw payloads (e.g., `IpAddress` may be invalid, `SampleRate` may be negative). Validation (if any) must occur at subscriber/consumer level.
|
||||
- **`bool?` in `LevelTriggerArg`**: The use of nullable booleans (`bool?`) for axis flags suggests three-state logic (e.g., `true`/`false`/not applicable), but the `Equals()` implementation only considers `true` values—this may be a source of confusion or bugs.
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportSavedChangesStatusEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/StatusAndProgressBarEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportSummaryRunTestEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportTestSetupChangedEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/AssignedChannelsChangedEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportHardwareScanRunEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportSummaryImportEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportArmedRunTestEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportReadFileFinishedEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportHardwareScanFinishedEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/EIDMappingEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportReadFileStatusEvent.cs
|
||||
- Common/DTS.Common/Events/TTSImport/TTSImportReadXMLFileEvent.cs
|
||||
generated_at: "2026-04-16T03:25:22.937764+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6b29eb45ebade668"
|
||||
---
|
||||
|
||||
# TTS Import Event Documentation
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of Prism-based events used to coordinate state and workflow across the TTS (Time-to-Sync) import process in the DTS system. These events facilitate loose coupling between UI views, view models, and business logic layers during file reading, hardware scanning, test setup configuration, and import execution. They enable asynchronous communication for steps such as file parsing, hardware channel assignment, test execution triggers, and status reporting, ensuring separation of concerns and testability.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Event Classes (all inherit from `PubSubEvent<TPayload>` unless otherwise noted):
|
||||
|
||||
| Event Name | Payload Type | Description |
|
||||
|------------|--------------|-------------|
|
||||
| `TTSImportSavedChangesStatusEvent` | `bool` | Indicates whether changes to the current TTS import setup have been saved (`true`) or not (`false`). |
|
||||
| `StatusAndProgressBarEvent` | `StatusAndProgressBarEventArgs` | Updates status text and/or progress bar UI elements. *(Note: `StatusAndProgressBarEventArgs` is referenced but not defined in the provided source; its structure must be inferred from usage or defined elsewhere.)* |
|
||||
| `TTSImportSummaryRunTestEvent` | `ITTSSetup` | Triggered by the Summary step to instruct the page to execute a test. |
|
||||
| `TTSImportTestSetupChangedEvent` | `ITTSSetup` | Published whenever the current TTS test setup object is modified. |
|
||||
| `AssignedChannelsChangedEvent` | `ITTSSetup` | Published when the set of hardware channels assigned to sensors changes. |
|
||||
| `TTSImportHardwareScanRunEvent` | `ITTSSetup` | Triggered by the Hardware Scan step to initiate hardware pinging. |
|
||||
| `TTSImportSummaryImportEvent` | `ITTSSetup` | Published when the user clicks the Import button in the Summary step. |
|
||||
| `TTSImportArmedRunTestEvent` | `ITTSSetup` | Triggered by the Hardware Scan step to advance the workflow to the Arm step in Run Test. |
|
||||
| `TTSImportReadFileFinishedEvent` | `ITTSSetup` | Published by the Read File step to signal completion of file reading. *(Note: Inherits from `CompositePresentationEvent<T>` instead of `PubSubEvent<T>`.)* |
|
||||
| `TTSImportHardwareScanFinishedEvent` | `List<IDASHardware>` | Published by the page to notify the Hardware Scan view model that hardware scanning is complete, carrying the updated list of DAS hardware. |
|
||||
| `EIDMappingEvent` | `IDictionary<string, string>` | Published when sensor ID to hardware channel ID mapping is determined. Key = sensor ID, Value = hardware channel ID. |
|
||||
| `TTSImportReadFileStatusEvent` | `ReadFileStatusArg` | Reports success/failure of file reading. Payload contains `Status`, `TTSSetup`, and `ErrorMessage`. |
|
||||
| `TTSImportReadXMLFileRequestEvent` | `TTSImportReadXMLFileRequestArg` | Request to read an XML file. Payload includes `FilePath` and `TestSetup`. |
|
||||
| `TTSImportReadXMLFileResponseEvent` | `TTSImportReadXMLFileResponseEventArg` | Response to an XML read request. Payload includes `TestSetup`, `Errors`, `TTSSetup`, and `LevelTriggers`. |
|
||||
|
||||
### Supporting Argument Classes (defined in source):
|
||||
|
||||
| Class | Fields | Description |
|
||||
|-------|--------|-------------|
|
||||
| `ReadFileStatusArg` | `bool Status`, `ITTSSetup TTSSetup`, `string ErrorMessage` | Payload for `TTSImportReadFileStatusEvent`. `Status` indicates success; `ErrorMessage` is only meaningful when `Status == false`. |
|
||||
| `TTSImportReadXMLFileRequestArg` | `string FilePath`, `ITTSSetup TestSetup` | Payload for `TTSImportReadXMLFileRequestEvent`. Used to request XML file parsing. |
|
||||
| `TTSImportReadXMLLevelTrigger` | `double Threshold`, `string SensorSerialNumber` | Represents a level trigger configuration parsed from XML. |
|
||||
| `TTSImportReadXMLFileResponseEventArg` | `ITestSetup TestSetup`, `string[] Errors`, `ITTSSetup TTSSetup`, `TTSImportReadXMLLevelTrigger[] LevelTriggers` | Payload for `TTSImportReadXMLFileResponseEvent`. Contains parsed data and any errors encountered. |
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- All events use Prism’s event aggregation pattern (`PubSubEvent<T>` or `CompositePresentationEvent<T>`), implying publish-subscribe semantics: events are published once and may be subscribed to by multiple handlers.
|
||||
- Events are **asynchronous** and **decoupled**; publishers do not block waiting for subscribers.
|
||||
- For `TTSImportReadFileStatusEvent`, the `Status` field is the authoritative indicator of success/failure; `ErrorMessage` is only valid when `Status == false`.
|
||||
- For `TTSImportReadXMLFileResponseEventArg`, `Errors` may be non-empty even if `TTSSetup` is populated (partial success).
|
||||
- `EIDMappingEvent` payload is a mapping **from sensor ID to hardware channel ID**, not the reverse.
|
||||
- `TTSImportReadFileFinishedEvent` uses `CompositePresentationEvent<T>` instead of `PubSubEvent<T>`, which may imply different threading or subscription behavior (e.g., thread-safe delivery, multiple subscriptions handled differently). This distinction must be respected in subscribers.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Dependencies *of* this module:
|
||||
- **Prism.Events**: Core dependency for `PubSubEvent<T>` and `CompositePresentationEvent<T>`.
|
||||
- **DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile**: Provides `ITTSSetup`, `ITestSetup`, and related interfaces.
|
||||
- **DTS.Common.Interface.DataRecorders**: Provides `IDASHardware` and `IDAS` interfaces.
|
||||
- **System.Collections.Generic**: For `IDictionary<string, string>` and `List<T>`.
|
||||
|
||||
### Dependencies *on* this module:
|
||||
- UI layers (views/view models) involved in TTS import workflow (e.g., Read File, Hardware Scan, Summary steps).
|
||||
- Business logic components that process XML configuration files or manage hardware scanning.
|
||||
- Any module that needs to react to test setup changes, file read results, or import progress.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Inconsistent namespace usage**:
|
||||
- `TTSImportTestSetupChangedEvent` and `AssignedChannelsChangedEvent` are in `DTS.Common.Events.TTSImport` namespace, while most others are in `DTS.Common.Events`. This may cause confusion during event subscription (e.g., `eventAggregator.GetEvent<TTSImportTestSetupChangedEvent>().Subscribe(...)` vs. `GetEvent<TTSImportSavedChangesStatusEvent>()`).
|
||||
- **Missing definition for `StatusAndProgressBarEventArgs`**:
|
||||
- Referenced in `StatusAndProgressBarEvent` but not defined in the provided source. Its structure (e.g., properties like `StatusText`, `ProgressValue`, `IsIndeterminate`) must be found elsewhere.
|
||||
- **`TTSImportReadFileFinishedEvent` uses `CompositePresentationEvent<T>`**:
|
||||
- This may have different semantics than `PubSubEvent<T>` (e.g., thread affinity, subscription lifetime). Subscribers must be aware of this distinction.
|
||||
- **Ambiguity in `ITTSSetup` vs `ITestSetup`**:
|
||||
- `TTSImportReadXMLFileResponseEventArg` contains both `ITestSetup` and `ITTSSetup`. It is unclear whether `ITTSSetup` is a specialized subtype of `ITestSetup` or a separate interface. Misunderstanding this could lead to incorrect casting or null dereferences.
|
||||
- **No validation rules documented**:
|
||||
- While `ReadFileStatusArg` includes `ErrorMessage`, the source does not specify what constitutes a valid `ITTSSetup` or what error conditions are expected. Validation logic (e.g., required fields in XML) is not visible here.
|
||||
- **No ordering guarantees**:
|
||||
- Events are published asynchronously. Consumers must not assume a specific order of delivery (e.g., `TTSImportTestSetupChangedEvent` may arrive before or after `AssignedChannelsChangedEvent` after a setup change).
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Events/TestSetups/TestSetupsList/CurrentTestIdChangedEvent.cs
|
||||
- Common/DTS.Common/Events/TestSetups/TestSetupsList/CurrentTestChangedEvent.cs
|
||||
- Common/DTS.Common/Events/TestSetups/TestSetupsList/TestSetupsListEditTestSetupEvent.cs
|
||||
- Common/DTS.Common/Events/TestSetups/TestSetupsList/TestSetupsListTestSetupSelectedEvent.cs
|
||||
generated_at: "2026-04-16T03:27:18.056477+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "147ad5f06ebe2c02"
|
||||
---
|
||||
|
||||
# TestSetupsList
|
||||
|
||||
## Documentation: TestSetupsList Events Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of Prism-based pub/sub events used to coordinate state changes and user interactions within the *Test Setups List* UI component. Specifically, it enables decoupled communication between view models or services involved in managing test setups—such as tracking the currently selected test, signaling edits, or handling selection changes—by publishing strongly-typed events through the `Prism.Events.EventAggregator`. These events facilitate reactive UI updates and state synchronization without tight coupling.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
All classes are `public` and inherit from `Prism.Events.PubSubEvent<TPayload>`, making them suitable for subscription and publication via `IEventAggregator`.
|
||||
|
||||
| Event Class | Payload Type | Signature & Behavior |
|
||||
|-------------|--------------|----------------------|
|
||||
| `CurrentTestIdChangedEvent` | `string` | `public class CurrentTestIdChangedEvent : PubSubEvent<string>`<br>• Published when the *ID* of the current test changes (e.g., user navigates to a different test).<br>• Payload is the **new test ID** (a `string`). |
|
||||
| `CurrentTestChangedEvent` | `string` | `public class CurrentTestChangedEvent : PubSubEvent<string>`<br>• Published when the *entire current test setup* changes (not just its ID).<br>• Payload is the **new test ID** (a `string`).<br>• *Note:* Despite the semantic difference implied by the names, both events carry the same payload type and likely the same value (the test ID). |
|
||||
| `TestSetupsListEditTestSetupEvent` | `string` | `public class TestSetupsListEditTestSetupEvent : PubSubEvent<string>`<br>• Published when the user initiates editing of a test setup.<br>• Payload is the **ID of the test setup to be edited** (a `string`). |
|
||||
| `TestSetupsListTestSetupSelectedEvent` | `string[]` | `public class TestSetupsListTestSetupSelectedEvent : PubSubEvent<string[]>`<br>• Published when one or more test setups are selected (e.g., via checkbox or multi-select UI).<br>• Payload is an array of **test setup IDs** (a `string[]`).<br>• *Note:* XML comment incorrectly refers to this as `TTSImportSummaryImportEvent`—this is likely a copy-paste error. |
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **Payload semantics**:
|
||||
- For `CurrentTestIdChangedEvent`, `CurrentTestChangedEvent`, and `TestSetupsListEditTestSetupEvent`, the payload is a single test ID (`string`).
|
||||
- For `TestSetupsListTestSetupSelectedEvent`, the payload is an array of test IDs (`string[]`).
|
||||
- **Event naming consistency**: All events reside in the `DTS.Common.Events.TestSetups.TestSetupsList` namespace and follow the `*Event` suffix convention.
|
||||
- **No validation**: Events carry raw IDs; no validation (e.g., null-check, format validation) is performed *within the event class itself*. Consumers are responsible for handling invalid payloads.
|
||||
- **Ordering**: No ordering guarantees are implied—events may be published/subscribed asynchronously via Prism’s `PubSubEvent`.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **Dependencies *of* this module**:
|
||||
- `Prism.Events` (via `using Prism.Events;`) — required for `PubSubEvent<T>`.
|
||||
- .NET runtime (standard for Prism-based projects).
|
||||
|
||||
- **Dependencies *on* this module**:
|
||||
- Any module/view model interacting with the *Test Setups List* UI (e.g., a test list view model, a test editor, or a test selection handler) will likely subscribe to these events.
|
||||
- Specifically, components handling test selection, navigation, or editing workflows depend on these events for state propagation.
|
||||
|
||||
- **Inferred consumers** (not visible in source, but typical for Prism patterns):
|
||||
- View models bound to the test setups list UI.
|
||||
- Navigation or routing services that respond to `CurrentTestChangedEvent`.
|
||||
- Editor launchers that handle `TestSetupsListEditTestSetupEvent`.
|
||||
- Multi-select action handlers (e.g., bulk operations) that react to `TestSetupsListTestSetupSelectedEvent`.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Ambiguous semantics between `CurrentTestIdChangedEvent` and `CurrentTestChangedEvent`**:
|
||||
Both events carry `string` payloads (test IDs) and have nearly identical documentation. It is unclear whether:
|
||||
- `CurrentTestIdChangedEvent` is intended for *ID-only* changes (e.g., renaming a test without reloading its full setup),
|
||||
- or if one is legacy/unused.
|
||||
**Recommendation**: Clarify with domain experts or inspect subscribers to confirm intended usage.
|
||||
|
||||
- **Misleading XML comment for `TestSetupsListTestSetupSelectedEvent`**:
|
||||
The `<summary>` and `<remarks>` incorrectly reference `TTSImportSummaryImportEvent` and "Import button was clicked", which contradicts the class name and payload (`string[]` vs. likely a single import action). This is likely a copy-paste artifact and may mislead developers.
|
||||
|
||||
- **No null-safety guarantees**:
|
||||
Payloads may be `null` (e.g., if a test is deselected or cleared). Subscribers must handle `null` or empty strings/arrays.
|
||||
|
||||
- **No event grouping or cancellation**:
|
||||
Events are fire-and-forget; no mechanism is provided for throttling, debouncing, or canceling propagation.
|
||||
|
||||
- **No versioning or schema evolution**:
|
||||
Payloads are unstructured (`string`/`string[]`). If test ID format changes (e.g., GUID → composite key), all subscribers must be updated manually.
|
||||
|
||||
None identified beyond the above.
|
||||
35
enriched-qwen3-coder-next/Common/DTS.Common/Exceptions.md
Normal file
35
enriched-qwen3-coder-next/Common/DTS.Common/Exceptions.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Exceptions/OutOfDataException.cs
|
||||
generated_at: "2026-04-16T02:53:40.077798+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a7ee94ab1b1410cf"
|
||||
---
|
||||
|
||||
# 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 or indexed data source exceeds the available data bounds. It extends `System.Exception` to include contextual information—the `Index` at which the shortage occurred—enabling callers to programmatically determine the position of failure during data processing, such as parsing, deserialization, or streaming operations.
|
||||
|
||||
### 2. Public Interface
|
||||
- **`OutOfDataException(string ex, long index)`**
|
||||
Constructor that initializes the exception with a message (`ex`) and the zero-based `index` (of type `long`) where the data shortage occurred. The `Index` property is set to the provided value.
|
||||
|
||||
- **`Index` (read-only property of type `long`)**
|
||||
Gets the position (index) in the data stream or buffer where the exception was thrown due to insufficient data.
|
||||
|
||||
### 3. Invariants
|
||||
- `Index` is immutable after construction (`private set` on the property).
|
||||
- The `Index` value is non-negative in intended usage (though not enforced by the class itself); negative values would be semantically invalid for typical indexing.
|
||||
- The exception message (`Message` inherited from `Exception`) is provided at construction and remains unchanged.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**: `System` namespace (specifically `System.Exception`).
|
||||
- **Used by**: Other modules in the `DTS.Common` namespace (or external consumers referencing `DTS.Common`) that require precise error reporting for data-read failures. No other internal dependencies are evident from this file.
|
||||
|
||||
### 5. Gotchas
|
||||
- The `Index` property is not validated for non-negativity or bounds; callers must ensure logical consistency (e.g., `Index` should not exceed the data source’s length).
|
||||
- The exception does not include the total data length or expected length, so callers must track or infer those separately if needed for diagnostics.
|
||||
- No custom serialization support is defined (e.g., `GetObjectData`), so cross-appdomain or remoting scenarios may rely on default `Exception` serialization behavior.
|
||||
- None identified from source alone.
|
||||
137
enriched-qwen3-coder-next/Common/DTS.Common/Interactivity.md
Normal file
137
enriched-qwen3-coder-next/Common/DTS.Common/Interactivity.md
Normal file
@@ -0,0 +1,137 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interactivity/IConfirmation.cs
|
||||
- Common/DTS.Common/Interactivity/IInteractionRequest.cs
|
||||
- Common/DTS.Common/Interactivity/Notification.cs
|
||||
- Common/DTS.Common/Interactivity/Confirmation.cs
|
||||
- Common/DTS.Common/Interactivity/INotification.cs
|
||||
- Common/DTS.Common/Interactivity/IInteractionRequestAware.cs
|
||||
- Common/DTS.Common/Interactivity/InteractionRequestTrigger.cs
|
||||
- Common/DTS.Common/Interactivity/InteractionRequestedEventArgs.cs
|
||||
- Common/DTS.Common/Interactivity/InteractionRequest.cs
|
||||
generated_at: "2026-04-16T02:54:00.278627+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0ff9757e59948461"
|
||||
---
|
||||
|
||||
# Interactivity
|
||||
|
||||
## Documentation: DTS.Common.Interactivity Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module provides a standardized, event-driven pattern for handling user interactions (e.g., confirmations, alerts, dialogs) in a decoupled manner—primarily intended for use with XAML-based UI frameworks (e.g., WPF, UWP) via the `Microsoft.Xaml.Behaviors` library. It defines core abstractions (`IInteractionRequest`, `INotification`, `IConfirmation`) and concrete implementations (`InteractionRequest<T>`, `Confirmation`, `Notification`) to enable view models to *request* interactions without direct coupling to the UI layer, while allowing views to respond to those requests using triggers and behaviors. The pattern supports both simple notifications and confirmations with user input (e.g., Yes/No), and ensures proper completion signaling via callbacks.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### Interfaces
|
||||
|
||||
- **`INotification`**
|
||||
```csharp
|
||||
string Title { get; set; }
|
||||
object Content { get; set; }
|
||||
```
|
||||
Represents a generic notification with a title and arbitrary content (e.g., message, view model). Serves as the base interface for all notification types.
|
||||
|
||||
- **`IConfirmation : INotification`**
|
||||
```csharp
|
||||
bool Confirmed { get; set; }
|
||||
```
|
||||
Extends `INotification` to represent a confirmation request (e.g., "Are you sure?"). The `Confirmed` property indicates whether the user accepted the action.
|
||||
|
||||
- **`IInteractionRequest`**
|
||||
```csharp
|
||||
event EventHandler<InteractionRequestedEventArgs> Raised;
|
||||
```
|
||||
Represents a request for user interaction. The `Raised` event is fired when an interaction is needed.
|
||||
|
||||
- **`IInteractionRequestAware`**
|
||||
```csharp
|
||||
INotification Notification { get; set; }
|
||||
Action FinishInteraction { get; set; }
|
||||
```
|
||||
Implemented by UI elements (e.g., views, user controls) that need to be aware of and respond to an interaction request. `Notification` provides the context; `FinishInteraction` must be invoked to signal completion.
|
||||
|
||||
#### Classes
|
||||
|
||||
- **`Notification`**
|
||||
```csharp
|
||||
public class Notification : INotification
|
||||
```
|
||||
Concrete implementation of `INotification`. Provides `Title` and `Content` properties.
|
||||
|
||||
- **`Confirmation : Notification, IConfirmation`**
|
||||
```csharp
|
||||
public class Confirmation : Notification, IConfirmation
|
||||
```
|
||||
Extends `Notification` to support confirmation semantics. Includes the `Confirmed` property (default `false`), set by the UI to reflect user choice.
|
||||
|
||||
#### Event Arguments
|
||||
|
||||
- **`InteractionRequestedEventArgs : EventArgs`**
|
||||
```csharp
|
||||
public INotification Context { get; }
|
||||
public Action Callback { get; }
|
||||
```
|
||||
Passed to event handlers when `IInteractionRequest.Raised` fires. `Context` contains the notification (e.g., `Confirmation`). `Callback` must be invoked (typically after user action) to signal interaction completion.
|
||||
|
||||
#### Interaction Request Implementation
|
||||
|
||||
- **`InteractionRequest<T> : IInteractionRequest`**
|
||||
```csharp
|
||||
public event EventHandler<InteractionRequestedEventArgs> Raised;
|
||||
public void Raise(T context) where T : INotification
|
||||
public void Raise(T context, Action<T> callback) where T : INotification
|
||||
```
|
||||
Generic implementation of `IInteractionRequest`. `Raise(context)` fires the `Raised` event with a no-op callback. `Raise(context, callback)` wraps the provided callback in an `Action` and passes it via `InteractionRequestedEventArgs`. *Note:* The `callback` parameter in the second `Raise` overload is of type `Action<T>`, but the `InteractionRequestedEventArgs.Callback` is `Action` (non-generic). The wrapper discards the `T` argument and invokes `callback(context)`.
|
||||
|
||||
#### Trigger
|
||||
|
||||
- **`InteractionRequestTrigger : EventTrigger`**
|
||||
```csharp
|
||||
protected override string GetEventName() => "Raised";
|
||||
```
|
||||
A behavior trigger designed to bind to `IInteractionRequest.Raised`. Overrides `GetEventName()` to always return `"Raised"`, simplifying XAML configuration (e.g., `<i:Interaction.Triggers><dts:InteractionRequestTrigger ... /></i:Interaction.Triggers>`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **`INotification` contract**: Every `INotification` (and its derivatives) must provide non-null `Title` and `Content` *after* initialization if they are to be meaningfully displayed. However, the interface itself does not enforce non-nullability—views must handle `null` gracefully.
|
||||
- **`IConfirmation.Confirmed`**: Must be set by the UI *before* invoking `FinishInteraction`. Its value reflects the user’s choice (e.g., `true` for "Yes", `false` for "No").
|
||||
- **Callback invocation**: The `Callback` in `InteractionRequestedEventArgs` *must* be invoked exactly once per interaction request to avoid blocking the UI or leaking resources. The `InteractionRequest<T>.Raise` method ensures the callback is wrapped and passed correctly.
|
||||
- **Generic constraint**: `InteractionRequest<T>` requires `T : INotification`. This ensures only valid notification types can be used as interaction context.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Dependencies *on* this module:
|
||||
- **`Microsoft.Xaml.Behaviors`**: Required for `EventTrigger` base class used by `InteractionRequestTrigger`.
|
||||
- **`System`**: For `EventArgs`, `Action`, and `EventHandler`.
|
||||
|
||||
#### Dependencies *of* this module:
|
||||
- **UI Layer**: Views (e.g., XAML pages/user controls) must implement `IInteractionRequestAware` or use triggers (e.g., `InteractionRequestTrigger`) to handle interactions.
|
||||
- **Consuming modules**: Any module requiring user interaction (e.g., view models) will reference and instantiate `InteractionRequest<T>` (typically `InteractionRequest<Confirmation>`).
|
||||
|
||||
#### Inferred usage:
|
||||
- `InteractionRequest<Confirmation>` is the most common concrete instantiation (based on `Confirmation` class).
|
||||
- Views likely bind `InteractionRequestAware.Notification` to the event args’ `Context` and invoke `InteractionRequestAware.FinishInteraction` after user action.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Callback signature mismatch**: The `InteractionRequest<T>.Raise(T context, Action<T> callback)` overload accepts `Action<T>`, but the `InteractionRequestedEventArgs.Callback` is `Action`. The wrapper `() => { if (callback != null) callback(context); }` discards the `T` argument—so the callback *cannot* inspect the `context` *as a parameter* (only via closure). This is non-intuitive; developers may expect the callback to receive the context as an argument.
|
||||
- **No built-in validation**: `InteractionRequestedEventArgs` provides no mechanism to validate or reject the interaction. Views must handle invalid states internally (e.g., by not invoking `FinishInteraction`).
|
||||
- **Thread-safety**: `InteractionRequest<T>` does not guarantee thread-safety for `Raised` event invocation. If raised from a non-UI thread, views must marshal to the UI thread themselves.
|
||||
- **`FinishInteraction` must be called**: If a view fails to invoke `FinishInteraction`, the interaction remains "open," potentially blocking further interactions or leaving UI in an inconsistent state. This is a common source of bugs.
|
||||
- **`Confirmed` default value**: `Confirmation.Confirmed` defaults to `false`. If a view does not explicitly set it (e.g., for a "Cancel" button), the interaction will be treated as unconfirmed.
|
||||
- **No cancellation support**: There is no explicit cancellation token or mechanism to abort an interaction mid-process. Cancellation must be handled via custom logic (e.g., checking `CancellationRequested` on `Content`).
|
||||
|
||||
None identified from source alone.
|
||||
217
enriched-qwen3-coder-next/Common/DTS.Common/Interface.md
Normal file
217
enriched-qwen3-coder-next/Common/DTS.Common/Interface.md
Normal file
@@ -0,0 +1,217 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/ITabView.cs
|
||||
- Common/DTS.Common/Interface/IMainView.cs
|
||||
- Common/DTS.Common/Interface/IMenuView.cs
|
||||
- Common/DTS.Common/Interface/IShellView.cs
|
||||
- Common/DTS.Common/Interface/INavigationView.cs
|
||||
- Common/DTS.Common/Interface/IViewerShellView.cs
|
||||
- Common/DTS.Common/Interface/ITabViewModel.cs
|
||||
- Common/DTS.Common/Interface/IMenuViewModel.cs
|
||||
- Common/DTS.Common/Interface/INavigationViewModel.cs
|
||||
- Common/DTS.Common/Interface/IPluginComponent.cs
|
||||
- Common/DTS.Common/Interface/IShellViewModel.cs
|
||||
- Common/DTS.Common/Interface/IViewerShellViewModel.cs
|
||||
- Common/DTS.Common/Interface/IMainViewModel.cs
|
||||
- Common/DTS.Common/Interface/IAssemblyInfo.cs
|
||||
- Common/DTS.Common/Interface/IDataPROPage.cs
|
||||
generated_at: "2026-04-16T02:52:16.683380+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "66a737bed57053a7"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Interface Module
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of core interfaces that establish the contract for the application’s view and view model layer within a modular, region-based UI architecture—likely built on WPF given the use of `FrameworkElement`, `ContentControl`, and `ImageSource`. It enforces separation of concerns between UI presentation (`*View` interfaces) and business logic/state management (`*ViewModel` interfaces), while supporting plugin extensibility via `IPluginComponent`. The interfaces collectively enable a structured shell-based UI with distinct regions (e.g., navigation, graph, diagnostics), tabbed content (`ITabView`), menu interaction (`IMenuView`), and specialized viewer contexts (`IViewerShellView`). It serves as the foundational abstraction layer for UI composition and region binding in the DTS system.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces (No implementation details—only signatures and documented behavior from source)
|
||||
|
||||
#### View Interfaces
|
||||
- **`ITabView : IBaseView`**
|
||||
Marker interface for tab-specific views. No additional members beyond base view contract.
|
||||
|
||||
- **`IMainView : IBaseView`**
|
||||
Marker interface for the main application view. No additional members beyond base view contract.
|
||||
|
||||
- **`IMenuView : IBaseView`**
|
||||
Marker interface for menu-specific views. No additional members beyond base view contract.
|
||||
|
||||
- **`IShellView : IBaseWindow`**
|
||||
Marker interface for the main application shell window. Inherits from `IBaseWindow`, implying window-level responsibilities.
|
||||
|
||||
- **`INavigationView : IBaseView`**
|
||||
Marker interface for navigation UI components. No additional members beyond base view contract.
|
||||
|
||||
- **`IViewerShellView : IBaseView`**
|
||||
Marker interface for a dedicated viewer shell view. Inherits from `IBaseView`, not `IBaseWindow`, suggesting it may be hosted within another window.
|
||||
|
||||
#### ViewModel 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 navigation view instance (note: property name differs from `View` used in other view models).
|
||||
|
||||
- **`IShellViewModel : IBaseWindowModel`**
|
||||
- `IShellView View { get; }`
|
||||
Returns the shell view instance.
|
||||
- `List<FrameworkElement> GetRegions();`
|
||||
Returns a list of `FrameworkElement` instances representing named UI regions (e.g., for region injection).
|
||||
- `object ContextMainRegion { get; set; }`
|
||||
Gets/sets the data context bound to the main shell region.
|
||||
|
||||
- **`IViewerShellViewModel : IBaseViewModel`**
|
||||
- `IViewerShellView View { get; }`
|
||||
Returns the viewer shell view instance.
|
||||
- `List<FrameworkElement> GetRegions();`
|
||||
Returns a list of `FrameworkElement` instances representing viewer-specific UI regions.
|
||||
- `object ContextMainRegion { get; set; }`
|
||||
Gets/sets the data context for the viewer’s main region.
|
||||
|
||||
- **`IMainViewModel : IBaseViewModel`**
|
||||
- `IBaseView View { get; }`
|
||||
Returns the main view instance.
|
||||
- `object ContextNavigationRegion { get; set; }`
|
||||
- `object ContextGraphRegion { get; set; }`
|
||||
- `object ContextTestsRegion { get; set; }`
|
||||
- `object ContextGraphsRegion { get; set; }`
|
||||
- `object ContextLegendRegion { get; set; }`
|
||||
- `object ContextDiagRegion { get; set; }`
|
||||
- `object ContextStatsRegion { get; set; }`
|
||||
- `object ContextCursorRegion { get; set; }`
|
||||
- `object ContextPropertyRegion { get; set; }`
|
||||
Gets/sets data contexts for multiple named regions.
|
||||
- `List<FrameworkElement> GetRegions();`
|
||||
Returns a list of `FrameworkElement` instances representing all main view regions.
|
||||
|
||||
#### Plugin & Assembly Interfaces
|
||||
- **`IPluginComponent`**
|
||||
- `string ProgId { get; }`
|
||||
Unique programmatic identifier used to instantiate the plugin component.
|
||||
|
||||
- **`IAssemblyImageAttribute`**
|
||||
Interface for assembly-level metadata about images:
|
||||
- `string AssemblyName { get; }`
|
||||
- `BitmapImage AssemblyImage { get; }`
|
||||
- `eAssemblyRegion AssemblyRegion { get; }`
|
||||
- `Type GetType();`
|
||||
- `BitmapImage GetAssemblyImage();`
|
||||
- `string GetAssemblyName();`
|
||||
- `eAssemblyRegion GetAssemblyRegion();`
|
||||
|
||||
- **`ImageAttribute : Attribute, IAssemblyImageAttribute`**
|
||||
Abstract base class for assembly-level image attributes. Defines contract for `[assembly: Image(...)]` usage.
|
||||
|
||||
- **`IAssemblyNameAttribute`**
|
||||
Interface for assembly-level name metadata:
|
||||
- `string AssemblyName { get; }`
|
||||
- `Type GetType();`
|
||||
- `string GetAssemblyName();`
|
||||
|
||||
- **`TextAttribute : Attribute, IAssemblyNameAttribute`**
|
||||
Abstract base class for assembly-level text/name attributes.
|
||||
|
||||
#### DataPRO Page Interface
|
||||
- **`IDataPROPage : INotifyPropertyChanged`**
|
||||
Defines contract for a UI page in the DataPRO workflow. Includes:
|
||||
- **Properties**:
|
||||
- `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; }` *(read-only)*
|
||||
- `bool UsesNAVControl { get; set; }`
|
||||
- `bool UsesSearchControl { get; set; }`
|
||||
- `bool UsesSelectControl { get; set; }`
|
||||
- `bool HasBackButton { get; set; }`
|
||||
- `bool HasRefreshButton { get; set; }`
|
||||
- `bool HasCancelButton { get; set; }`
|
||||
- `bool HasSaveButton { get; set; }`
|
||||
- `bool HasNextButton { get; set; }`
|
||||
- `Color TileColor { get; }` *(read-only)*
|
||||
- `Color ContentBackgroundColor { get; set; }`
|
||||
- `object MainContent { get; set; }`
|
||||
- `bool ControlInOnSetActive { get; set; }`
|
||||
- **Methods**:
|
||||
- `string GetName();`
|
||||
- `long GetID();`
|
||||
- `void SetID(long id);`
|
||||
- `void SetTileColor(Color c);`
|
||||
- `void SavePage(object obj);`
|
||||
- `void ClearSearchTerm();`
|
||||
- `void SetEnabled(bool bEnable);`
|
||||
- `void VerifyProgress(object o);`
|
||||
- `void SaveAndExit();`
|
||||
- `void RefreshButtonPressed();`
|
||||
- `void SetDoneButtonIsEnabled(bool bEnabled);`
|
||||
- `void SetBackButtonIsEnabled(bool bEnabled);`
|
||||
- `void DoneButtonPress();`
|
||||
- `void SetCancelEnabled(bool bEnabled);`
|
||||
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow);`
|
||||
- `bool OKToProceed();`
|
||||
- `void FormClosing(Action OnComplete = null);`
|
||||
- `void OnSetActive();`
|
||||
- `void UnSet();`
|
||||
- `void SetCurrentItem(object o);`
|
||||
- `void SetupPageAvailable();`
|
||||
- `ContentControl GetMainContentControl();`
|
||||
- `void SetReturning();`
|
||||
|
||||
- **`DataProPageProperties`**
|
||||
Enum listing properties on `IDataPROPage` that may change and require observation or reaction. 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 `*ViewModel` interface exposes a strongly-typed `View` (or `NavigationView` in `INavigationViewModel`) property, implying a 1:1 pairing between view models and their corresponding views.
|
||||
- **Region Contract**: `GetRegions()` methods in `IShellViewModel`, `IViewerShellViewModel`, and `IMainViewModel` must return a list of `FrameworkElement` instances that correspond to named UI regions (e.g., for Prism-style region injection or custom region management).
|
||||
- **Context Region Binding**: All shell/view model interfaces expose `ContextMainRegion` (or multiple `Context*Region` properties in `IMainViewModel`) to bind data contexts to regions. These are `object`-typed, allowing arbitrary data contexts.
|
||||
- **Plugin Identity**: `IPluginComponent.ProgId` must be unique per plugin instance and used for instantiation.
|
||||
- **Assembly Metadata**: `ImageAttribute` and `TextAttribute` are assembly-level attributes (via `[AttributeUsage(AttributeTargets.Assembly)]`), meaning they apply to the entire assembly, not individual types.
|
||||
- **DataPRO Page Lifecycle**: `IDataPROPage` implements `INotifyPropertyChanged`, indicating reactive updates to its properties. Methods like `OnSetActive`, `UnSet`, `FormClosing`, and `Validate` suggest a managed page lifecycle (e.g., activation/deactivation, validation before proceeding).
|
||||
- **Read-Only Properties**: `UniqueId` (in `IDataPROPage`) and `TileColor` (read-only via getter only) are not settable externally, implying they are determined internally or at construction.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Internal Dependencies
|
||||
- **`DTS.Common.Base` namespace**: All interfaces inherit from `IBaseView`, `IBaseWindow`, `IBaseViewModel`, or `IBaseWindowModel`. The concrete implementations of these base contracts are not provided here, but their existence is required.
|
||||
- **WPF Types**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Media`, `System.Windows.Media.Imaging` — used in `IViewerShellView`, `IShellViewModel`, `IViewerShellViewModel`, `IMainViewModel`, and `IDataPROPage`.
|
||||
- **System.Collections.Generic, System.ComponentModel, System**: Used for `List<T>`, `INotifyPropertyChanged`, `Attribute`, etc.
|
||||
|
||||
### External Dependencies
|
||||
- **WPF Framework**: Required for `FrameworkElement`, `ContentControl`, `ImageSource`, `Color`, `BitmapImage`, and `Visibility`.
|
||||
- **.NET Standard/CLR**: Standard libraries (`System`, `System.Collections.Generic`, `System.ComponentModel`, `System.Windows`, etc.).
|
||||
|
||||
### Inferred Consumers
|
||||
- UI framework code (e.g., Prism or custom region manager) likely consumes `GetRegions()` and `Context*Region` properties to bind views to regions.
|
||||
- Plugin loader/manager likely consumes `IPluginComponent.ProgId` to instantiate plugins.
|
||||
- Assembly loader or metadata processor consumes `ImageAttribute`/`TextAttribute` via reflection.
|
||||
- DataPRO page host (e.g., a wizard or workflow engine) consumes `IDataPROPage` for page lifecycle and validation.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Inconsistent Property Naming**: `INavigationViewModel` exposes `NavigationView` instead of `View`, unlike other view models (`ITabViewModel`, `IMenuViewModel`, etc.). This may cause confusion in generic view model consumers.
|
||||
- **`IViewerShellView` Inheritance**: `IViewerShellView` inherits from `IBaseView`, not `IBaseWindow`, while `IShellView` inherits from `IBaseWindow`. This suggests `IViewerShellView` is *not* a top-level window, but a hosted control—despite its name implying "shell".
|
||||
- **`GetRegions()` Return Type**: All `GetRegions()` methods return `List<FrameworkElement>`, but no contract specifies how these elements map to named regions (e.g., by name, index, or metadata). Consumers must infer region identity externally.
|
||||
- **`Context*Region` Types**: All context properties are `object`, offering flexibility but no compile-time safety. Mis-typing a context value could cause runtime binding failures.
|
||||
- **`IDataPROPage` Property Count**: 20+ properties and 20+ methods suggest a highly stateful, complex interface. This may indicate tight coupling and difficulty in testing or mocking.
|
||||
- **`GenerateReportsVisible` in `DataProPageProperties`**: This enum value is listed in `DataProPageProperties`, but no corresponding property exists in `IDataPROPage`. This mismatch suggests incomplete synchronization or a documentation error.
|
||||
- **No Default Implementations**: All interfaces are pure contracts with no default behavior. Consumers must implement all members, including `FormClosing` with optional parameter—requiring careful handling in languages or tools that do not support optional parameters in interfaces.
|
||||
- **`GetType()` in Attribute Interfaces**: `IAssemblyImageAttribute` and `IAssemblyNameAttribute` both declare `Type GetType();`, which is redundant with `object.GetType()` and may conflict with the inherited `System.Object.GetType()`—potentially causing ambiguity or requiring explicit interface implementation.
|
||||
@@ -0,0 +1,216 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/BuildTestSetup/IBuildTestSetup.cs
|
||||
generated_at: "2026-04-16T03:02:19.876663+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f641e5d3258e537a"
|
||||
---
|
||||
|
||||
# BuildTestSetup
|
||||
|
||||
## Documentation Page: `IBuildTestSetup`
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
`IBuildTestSetup` defines the contract for a configuration object used to capture and manage user-defined settings for a build/test setup in the DTS (Data Transfer System) framework. It serves as the central data model for test configuration—encompassing hardware setup parameters (e.g., serial number, diagnostics checks), acquisition settings (e.g., sampling rate, trigger timing), export/download preferences (e.g., file formats, folders), and operational behavior (e.g., automatic mode, arm checklist enforcement). As an `INotifyPropertyChanged` interface, it supports data binding and reactive updates in UI or orchestration layers. This interface decouples configuration storage (e.g., XML, database) from the logic that consumes it, enabling modular and testable test setup workflows.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
All members are read-write properties of type `string`, except `Groups`, which is a `List<GroupXMLClass>`.
|
||||
|
||||
#### Core Identification & Metadata
|
||||
- `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 configuration.
|
||||
- `string SetupDescription { get; set; }`
|
||||
Free-text description of the setup.
|
||||
- `string LastModified { get; set; }`
|
||||
Timestamp (as string) of last modification.
|
||||
- `string LastModifiedBy { get; set; }`
|
||||
Identifier (e.g., username) of last modifier.
|
||||
|
||||
#### Operational Mode & Behavior
|
||||
- `string AutomaticMode { get; set; }`
|
||||
Enables/disables automatic test execution mode (likely `"True"`/`"False"`).
|
||||
- `string AutomaticModeDelay { get; set; }`
|
||||
Delay (in seconds or ms, as string) before automatic mode proceeds.
|
||||
- `string QuitTestWithoutWarning { get; set; }`
|
||||
If `"True"`, skip confirmation prompts when quitting test.
|
||||
- `string AutoArm { get; set; }`
|
||||
Enables/disables automatic arming of the test.
|
||||
- `string Streaming { get; set; }`
|
||||
Enables/disables real-time streaming mode.
|
||||
|
||||
#### Diagnostics & Safety Checks
|
||||
- `string StrictDiagnostics { get; set; }`
|
||||
Enforces strict diagnostic requirements (e.g., fail on minor deviations).
|
||||
- `string RequireConfirmationOnErrors { get; set; }`
|
||||
Requires user confirmation before proceeding after an error.
|
||||
- `string RequireAllUnitsPassArmCheckList { get; set; }`
|
||||
If `"True"`, all units must pass the arm checklist before proceeding.
|
||||
- `string SuppressMissingSensorsWarning { get; set; }`
|
||||
Suppresses warnings for missing sensors.
|
||||
- `string AllowMissingSensors { get; set; }`
|
||||
Permits proceeding with missing sensors (likely `"True"`/`"False"`).
|
||||
- `string AllowSensorIdToBlankChannel { get; set; }`
|
||||
Allows mapping a sensor ID to an empty/blank channel.
|
||||
|
||||
#### Pre-Arm Checklist Items (each `"True"`/`"False"` or similar)
|
||||
- `string PerformArmChecklist { get; set; }`
|
||||
Enables the arm checklist.
|
||||
- `string CheckInputVoltage { get; set; }`
|
||||
- `string CheckBatteryVoltage { get; set; }`
|
||||
- `string CheckSquibResistance { get; set; }`
|
||||
- `string CheckSensorIds { get; set; }`
|
||||
- `string CheckStartEventLines { get; set; }`
|
||||
- `string CheckTiltSensor { get; set; }`
|
||||
- `string CheckTemperature { get; set; }`
|
||||
- `string MeasureSquibResistances { get; set; }`
|
||||
|
||||
#### Trigger & Acquisition Settings
|
||||
- `string TriggerCheckStep { get; set; }`
|
||||
Enables/disables a dedicated trigger verification step.
|
||||
- `string ViewRealtime { get; set; }`
|
||||
Enables/disables real-time view of data during test.
|
||||
- `string RecordingMode { get; set; }`
|
||||
Recording mode (e.g., `"Continuous"`, `"EventTriggered"`).
|
||||
- `string SamplesPerSecond { get; set; }`
|
||||
Sampling rate (as string, likely numeric).
|
||||
- `string PreTriggerSeconds { get; set; }`
|
||||
Duration (in seconds) of pre-trigger buffer.
|
||||
- `string PostTriggerSeconds { get; set; }`
|
||||
Duration (in seconds) of post-trigger recording.
|
||||
- `string NumberOfEvents { get; set; }`
|
||||
Max number of events to record (as string).
|
||||
- `string WakeUpMotionTimeout { get; set; }`
|
||||
Timeout (as string) for wake-up motion detection.
|
||||
|
||||
#### ROI (Region of Interest) & Download
|
||||
- `string ROIDownload { get; set; }`
|
||||
Enables ROI-based download.
|
||||
- `string ViewROIDownload { get; set; }`
|
||||
Enables viewing ROI download progress.
|
||||
- `string ROIStart { get; set; }`
|
||||
Start time/index of ROI (as string).
|
||||
- `string ROIEnd { get; set; }`
|
||||
End time/index of ROI (as string).
|
||||
- `string DownloadAll { get; set; }`
|
||||
Enables downloading all data.
|
||||
- `string ViewDownloadAll { get; set; }`
|
||||
Enables viewing full download progress.
|
||||
- `string DownloadFolder { get; set; }`
|
||||
Target folder for downloads.
|
||||
|
||||
#### Export Configuration
|
||||
- `string Export { get; set; }`
|
||||
Enables/disables export.
|
||||
- `string ExportFolder { get; set; }`
|
||||
Output directory for exported files.
|
||||
- `string ExportCh10FilteredEUDesired { get; set; }`
|
||||
Flag indicating desire to export filtered EU data in CH10 format.
|
||||
- `string ExportChryslerDDASDesired { get; set; }`
|
||||
Flag for Chrysler DDAS export.
|
||||
- `string ExportCSVADCDesired { get; set; }`
|
||||
- `string ExportCSVFilteredDesired { get; set; }`
|
||||
- `string ExportCSVMVDesired { get; set; }`
|
||||
- `string ExportCSVUnfilteredDesired { get; set; }`
|
||||
- `string ExportDiademADCDesired { get; set; }`
|
||||
- `string ExportHDFADCDesired { get; set; }`
|
||||
- `string ExportHDFMVDesired { get; set; }`
|
||||
- `string ExportHDFUnfilteredDesired { get; set; }`
|
||||
- `string ExportISOFilteredDesired { get; set; }`
|
||||
- `string ExportISOUnfilteredDesired { get; set; }`
|
||||
- `string ExportRDFADCDesired { get; set; }`
|
||||
- `string ExportTDASADCDesired { get; set; }`
|
||||
- `string ExportTDMSADCDesired { get; set; }`
|
||||
- `string ExportToyotaUnfilteredDesired { get; set; }`
|
||||
- `string ExportTSVFilteredDesired { get; set; }`
|
||||
- `string ExportTSVUnfilteredDesired { get; set; }`
|
||||
- `string ExportXLSXFilteredDesired { get; set; }`
|
||||
- `string ExportXLSXUnfilteredDesired { get; set; }`
|
||||
- `string ExportASCDesired { get; set; }`
|
||||
Flag for ASCII export.
|
||||
|
||||
> **Note**: Several export-related properties are commented out in the source (e.g., `ExportFormat`, `ExportCh10UnfilteredEUDesired`, `ExportHDFFilteredDesired`, etc.). These are *not* part of the interface and must not be assumed to exist.
|
||||
|
||||
#### Reporting & Metadata
|
||||
- `string UseLabDetails { get; set; }`
|
||||
Enables inclusion of lab-specific metadata in reports.
|
||||
- `string UseCustomerDetails { get; set; }`
|
||||
Enables inclusion of customer-specific metadata.
|
||||
- `string UseTestEngineerDetails { get; set; }`
|
||||
Enables inclusion of test engineer details.
|
||||
- `string UserTags { get; set; }`
|
||||
Free-form tags for categorization/search.
|
||||
- `string CalibrationBehavior { get; set; }`
|
||||
Controls calibration handling (e.g., `"Apply"`, `"Ignore"`, `"Prompt"`).
|
||||
- `string PostTestDiagnostics { get; set; }`
|
||||
Enables post-test diagnostic reporting.
|
||||
|
||||
#### UI/Display State
|
||||
- `string CommonStatusLine { get; set; }`
|
||||
Status text displayed in a common UI status bar.
|
||||
- `string RealtimeCharts { get; set; }`
|
||||
Enables/disables real-time chart rendering.
|
||||
- `string UploadData { get; set; }`
|
||||
Enables data upload after test.
|
||||
- `string UploadDataFolder { get; set; }`
|
||||
Target folder for uploaded data.
|
||||
- `string NotAllChannelsRealTime { get; set; }`
|
||||
Indicates not all channels are available in real-time view.
|
||||
- `string NotAllChannelsViewer { get; set; }`
|
||||
Indicates not all channels are available in post-test viewer.
|
||||
|
||||
#### Groups
|
||||
- `List<GroupXMLClass> Groups { get; set; }`
|
||||
Collection of channel/group definitions (type `GroupXMLClass`, defined in `DTS.Common.XMLUtils`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **All properties are strings**: Even logically boolean or numeric values (e.g., `AutomaticMode`, `SamplesPerSecond`) are stored as `string`. Consumers must parse or interpret these values.
|
||||
- **`INotifyPropertyChanged` compliance**: Implementations must raise `PropertyChanged` events for all property changes to support binding.
|
||||
- **`Groups` may be null or empty**: No invariant enforces non-nullity or non-emptiness of `Groups`.
|
||||
- **No validation on property values**: The interface itself does not enforce format, range, or allowed values for any property (e.g., `SamplesPerSecond` could be `"abc"`). Validation is deferred to consumers.
|
||||
- **Export flags are independent**: Each `*Desired` export flag is independent; no mutual exclusivity or dependency is declared.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **Direct Dependencies**:
|
||||
- `System.ComponentModel` (for `INotifyPropertyChanged`)
|
||||
- `System.Collections.Generic` (for `List<T>`)
|
||||
- `DTS.Common.XMLUtils.GroupXMLClass` (type used in `Groups` property)
|
||||
|
||||
- **Inferred Consumers**:
|
||||
- UI layers (e.g., WPF, WinForms) binding to this interface.
|
||||
- Serialization/deserialization modules (e.g., XML/JSON converters) that read/write `IBuildTestSetup` instances.
|
||||
- Test orchestration logic that consumes configuration to drive test execution.
|
||||
- Export/download modules that inspect `*Desired` flags and `ExportFolder`/`DownloadFolder`.
|
||||
|
||||
- **Inferred Dependents**:
|
||||
- Any class implementing `IBuildTestSetup` (e.g., `BuildTestSetupImpl`, `ConfigManager`).
|
||||
- XML persistence modules (e.g., classes in `DTS.Common.XMLUtils` that serialize/deserialize `GroupXMLClass`).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **All properties are strings**: Consumers must handle parsing and validation (e.g., `int.Parse(SamplesPerSecond)`), risking `FormatException` or `OverflowException` if values are malformed.
|
||||
- **Missing export properties**: Several export-related properties are commented out (e.g., `ExportFormat`, `ExportCh10UnfilteredEUDesired`). Do *not* assume they exist or are accessible.
|
||||
- **Ambiguous boolean representation**: Boolean flags (e.g., `AutomaticMode`) are strings—likely `"True"`/`"False"`, but could be `"1"`/`"0"` or `"Yes"`/`"No"`. Implementation-specific interpretation is required.
|
||||
- **No grouping semantics defined**: While `Groups` is exposed, the interface provides no guidance on how `GroupXMLClass` objects map to channels, sensors, or logical groupings. Interpretation depends on `GroupXMLClass`’s definition (not provided).
|
||||
- **No mutability guarantees**: As an interface, it does not specify whether implementations are mutable or thread-safe. Consumers should assume mutable unless documented otherwise.
|
||||
- **`CommonStatusLine` is UI-specific**: This property suggests tight coupling to UI state; its use in non-UI contexts may be inappropriate or require special handling.
|
||||
- **Historical artifacts**: The presence of commented-out properties (`ExportFormat`, `ExportSomat*`, etc.) suggests evolving requirements or legacy cleanup in progress—review implementation history for context.
|
||||
|
||||
> **None identified from source alone.**
|
||||
> *(Note: The above "Gotchas" are derived from observed patterns and omissions in the interface definition.)*
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Channels/IChannelSettingRecord.cs
|
||||
- Common/DTS.Common/Interface/Channels/IGroupChannelSettingRecord.cs
|
||||
- Common/DTS.Common/Interface/Channels/IChannelCode.cs
|
||||
- Common/DTS.Common/Interface/Channels/IChannelSetting.cs
|
||||
- Common/DTS.Common/Interface/Channels/IChannelDbRecord.cs
|
||||
- Common/DTS.Common/Interface/Channels/IGroupChannel.cs
|
||||
generated_at: "2026-04-16T03:04:46.817731+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "84120b73a95d6917"
|
||||
---
|
||||
|
||||
# Documentation: Channel Interfaces Module (`DTS.Common.Interface.Channels`)
|
||||
|
||||
## 1. Purpose
|
||||
This module defines a set of interfaces that model channels in a data acquisition system (DAS), including their database representation (`IChannelDbRecord`), configuration settings (`IChannelSetting`, `IChannelSettingRecord`, `IGroupChannelSettingRecord`), and logical grouping within test setups (`IGroupChannel`). It serves as the foundational abstraction layer for channel management across UI, business logic, and data persistence layers—enabling consistent handling of physical measurement channels (analog, digital, CAN, UART, etc.), sensor assignments, hardware mapping, and channel-specific settings like range, polarity, filters, and protocol-specific parameters (e.g., CAN bitrates, UART config). The interfaces support both data transfer (e.g., records) and runtime behavior (e.g., `IGroupChannel` with UI state and validation).
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `IChannelSettingRecord`
|
||||
- **`int Id { get; set; }`** – Unique identifier for the setting type.
|
||||
- **`string SettingName { get; set; }`** – Human-readable name of the setting (e.g., "Range", "Polarity").
|
||||
- **`string DefaultValue { get; set; }`** – Default value for the setting as a string.
|
||||
|
||||
> *Represents a static, reusable channel setting definition (e.g., a setting template).*
|
||||
|
||||
### `IGroupChannelSettingRecord`
|
||||
- **`long ChannelId { get; set; }`** – Foreign key to the channel (`IChannelDbRecord.Id`).
|
||||
- **`int SettingId { get; set; }`** – Foreign key to `IChannelSettingRecord.Id`.
|
||||
- **`string SettingValue { get; set; }`** – Actual value assigned to the setting for this channel.
|
||||
|
||||
> *Represents a specific assignment of a setting to a channel instance.*
|
||||
|
||||
### `IChannelCode`
|
||||
- **`int Id { get; }`** – Unique identifier for the channel code.
|
||||
- **`string Code { get; }`** – Short code string (e.g., "A1", "CH1").
|
||||
- **`string Name { get; }`** – Descriptive name (e.g., "Accelerometer Front Left").
|
||||
- **`ChannelEnumsAndConstants.ChannelCodeType CodeType { get; }`** – Enumerated type of the code (e.g., ISO, User, DAS).
|
||||
|
||||
> *Encapsulates metadata about a channel’s identifying codes (used for labeling/organization).*
|
||||
|
||||
### `IChannelSetting`
|
||||
- **`long ChannelId { get; set; }`** – ID of the channel this setting belongs to.
|
||||
- **`int SettingTypeId { get; }`** – ID of the setting type (links to `IChannelSettingRecord.Id`).
|
||||
- **`string SettingName { get; }`** – Name of the setting (mirrors `IChannelSettingRecord.SettingName`).
|
||||
- **`string DefaultValue { get; }`** – Default value (mirrors `IChannelSettingRecord.DefaultValue`).
|
||||
- **`string Value { get; set; }`** – Current value as string (generic fallback).
|
||||
- **`int IntValue { get; set; }`** – Current value as integer (for numeric settings).
|
||||
- **`double DoubleValue { get; set; }`** – Current value as double (for numeric settings).
|
||||
- **`bool BoolValue { get; set; }`** – Current value as boolean (for toggle settings).
|
||||
- **`IChannelSetting Clone()`** – Deep copy of the setting instance.
|
||||
|
||||
> *Represents a *runtime* setting instance attached to a channel, supporting type-specific accessors.*
|
||||
|
||||
### `IChannelDbRecord`
|
||||
- **`long Id { get; set; }`** – Primary key (DB record ID).
|
||||
- **`int GroupId { get; set; }`** – Foreign key to group.
|
||||
- **`string IsoCode { get; set; }`** – ISO-standard channel code.
|
||||
- **`string IsoChannelName { get; set; }`** – ISO-standard channel name.
|
||||
- **`string UserCode { get; set; }`** – User-defined channel code.
|
||||
- **`string UserChannelName { get; set; }`** – User-defined channel name.
|
||||
- **`int DASId { get; set; }`** – ID of the DAS device.
|
||||
- **`int DASChannelIndex { get; set; }`** – Physical channel index on the DAS.
|
||||
- **`int GroupChannelOrder { get; set; }`** – Order within the group.
|
||||
- **`int TestSetupOrder { get; set; }`** – Order in the test setup.
|
||||
- **`int SensorId { get; set; }`** – Foreign key to sensor.
|
||||
- **`bool Disabled { get; set; }`** – Whether the channel is disabled.
|
||||
- **`DateTime LastModified { get; set; }`** – Timestamp of last DB modification.
|
||||
- **`string LastModifiedBy { get; set; }`** – User who last modified the record.
|
||||
|
||||
> *Database mapping interface for channel records (EF Core style).*
|
||||
|
||||
### `IGroupChannel`
|
||||
- **Extends `IChannelDbRecord`** (inherits all DB record properties).
|
||||
- **`SensorConstants.AvailableRangesLowG RangeLowG { get; set; }`** – Low-G sensor range enum.
|
||||
- **`bool VoltageInsertionSensor { get; }`** – Whether channel has a voltage-insertion sensor.
|
||||
- **`bool RangeModifiableSensorLowG { get; }`** – Whether channel has a low-G sensor with modifiable range.
|
||||
- **`bool RangeModifiableSensorARS { get; }`** – Whether channel has an ARS sensor with modifiable range.
|
||||
- **`InitialOffset[] AvailableInitialOffsets { get; set; }`** – Available initial offset options.
|
||||
- **`string IEPESupport { get; }`** – IEPE support status (e.g., "Supported", "N/A").
|
||||
- **`IGroup Group { get; set; }`** – Parent group.
|
||||
- **`string GroupName { get; set; }`** – Display name of parent group.
|
||||
- **`bool GroupNameValid { get; set; }`** – Whether `GroupName` is set.
|
||||
- **`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 is assigned.
|
||||
- **`string HardwareId { get; set; }`** – Legacy hardware identifier (`[das serial]:[channel index]`).
|
||||
- **`double TestSampleRate { get; set; }`** – Sample rate of associated DAS.
|
||||
- **`bool SensorValid { get; }`** – Whether a sensor is assigned.
|
||||
- **`bool IsDisabled { get; set; }`** – Whether channel is disabled for data collection.
|
||||
- **`long ChannelId { get; set; }`** – Channel instance ID (distinct from `IChannelDbRecord.Id`? See *Gotchas*).
|
||||
- **`void SetHardwareChannel(IHardwareChannel hardwareChannel)`** – Assigns hardware channel.
|
||||
- **`void SetSensor(IDragAndDropItem sensor, IChannelSetting[] channelDefaults, bool applySensorDataToBlankChannels)`** – Assigns sensor and optionally applies defaults.
|
||||
- **`bool CompareValue(string property)`** – Compares current value of `property` to a reference (e.g., for diff detection).
|
||||
- **`bool SetDifferent(string property)`** / **`void SetNotDifferent()`** – Marks/unmarks property as "different" (UI state).
|
||||
- **`void SetRange(CACOption option)`** – Sets range based on CAC option enum.
|
||||
- **`bool CanMoveUp { get; set; }`** / **`bool CanMoveDown { get; set; }`** – UI state for reordering.
|
||||
- **`bool DeleteShouldBeEnabled { get; set; }`** – UI state for delete button.
|
||||
- **`System.Windows.Visibility RemoveSensorVisibility { get; set; }`** – UI visibility for sensor removal control.
|
||||
- **`bool IsBlank()`** – Whether channel is unconfigured (no hardware/sensor).
|
||||
- **`void Clear()`** – Clears hardware and sensor assignments.
|
||||
- **`bool Filter(string term)`** – Whether channel matches search term.
|
||||
- **`ICommand PasteCommand { get; set; }`** – Command for paste operations.
|
||||
- **`IChannelSetting[] ChannelSettings { get; set; }`** – Collection of channel settings.
|
||||
- **`void AdjustCANSettings(bool canIsFD)`** / **`void AdjustCANSources(bool canIsFD, int canArbBaseBitrate, int canDataBitrate)`** – Adjusts CAN settings for FD vs classic.
|
||||
- **`string GetChannelName(IsoViewMode isoViewMode)`** / **`string GetChannelCode(IsoViewMode isoViewMode)`** – Returns name/code based on 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.
|
||||
- **`IHardwareChannel HardwareChannel { get; }`** – Hardware channel object.
|
||||
- **`IDragAndDropItem DragAndDropItem { get; }`** – Drag-and-drop source item.
|
||||
- **`ISensorCalibration SensorCalibration { get; }`** – Sensor calibration data.
|
||||
- **`void SetSensorCalibration(ISensorCalibration calibration)`** / **`void SetSensorData(...)`** – Assigns sensor data/calibration.
|
||||
- **`bool HasEID { get; }`** – Whether channel has EID (Event ID) support.
|
||||
- **`bool IsAnalog { get; }`** / **`bool IsSquib { get; }`** / **`bool IsDigitalIn { get; }`** / **`bool IsDigitalOut { get; }`** / **`bool IsClock { get; }`** / **`bool IsUart { get; }`** / **`bool IsStreamIn { get; }`** / **`bool IsStreamOut { get; }`** / **`bool IsCan { get; }`** – Sensor type flags.
|
||||
- **`double Range { get; set; }`** – Current range setting.
|
||||
- **`double Capacity { get; }`** – Sensor capacity.
|
||||
- **`IFilterClass FilterClass { get; set; }`** – Filter class (e.g., FB 13120).
|
||||
- **`string Polarity { get; set; }`** – Polarity setting.
|
||||
- **`string Units { get; }`** – Sensor units.
|
||||
- **`ZeroMethodType ZeroMethod { get; set; }`** – Zeroing method.
|
||||
- **`double ZeroMethodStart { get; set; }`** / **`double ZeroMethodEnd { get; set; }`** – Zeroing window.
|
||||
- **`string Sensitivity { get; }`** – Sensor sensitivity.
|
||||
- **`InitialOffset InitialOffset { get; set; }`** – Initial offset value.
|
||||
- **`bool SquibLimitDuration { get; set; }`** / **`double SquibDuration { get; set; }`** / **`double? SquibDelay { get; set; }`** / **`double SquibCurrent { get; set; }`** – Squib-specific settings.
|
||||
- **`bool DigitalOutLimitDuration { get; set; }`** / **`double DigitalOutDuration { get; set; }`** / **`double DigitalOutDurationMax { get; set; }`** / **`double DigitalOutDelay { get; set; }`** – Digital output settings.
|
||||
- **`DigitalOutputModes DigitalOutputMode { get; set; }`** / **`SquibFireMode SquibFireMode { get; set; }`** / **`DigitalInputModes DigitalInputMode { get; set; }`** – Mode enums.
|
||||
- **`string ActiveValue { get; set; }`** / **`string DefaultValue { get; set; }`** – Digital output values.
|
||||
- **`uint UartBaudRate { get; set; }`** / **`uint UartDataBits { get; set; }`** / **`StopBits UartStopBits { get; set; }`** / **`Parity UartParity { get; set; }`** / **`Handshake UartFlowControl { get; }`** / **`UartDataFormat UartDataFormat { get; set; }`** – UART settings.
|
||||
- **`string StreamInUDPAddress { get; set; }`** / **`UDPStreamProfile StreamOutUDPProfile { get; set; }`** / **`string StreamOutUDPAddress { get; set; }`** / **`ushort StreamOutUDPTimeChannelId { get; set; }`** / **`ushort StreamOutUDPDataChannelId { get; set; }`** / **`string StreamOutUDPTmNSConfig { get; set; }`** / **`ushort StreamOutIRIGTimeDataPacketIntervalMs { get; set; }`** / **`ushort StreamOutTMATSIntervalMs { get; set; }`** – Stream settings.
|
||||
- **`bool CanIsFD { get; set; }`** / **`int CanArbBaseBitrate { get; set; }`** / **`int CanArbBaseSJW { get; set; }`** / **`int CanDataBitrate { get; set; }`** / **`int CanDataSJW { get; set; }`** / **`string CanFileType { get; set; }`** – CAN settings.
|
||||
- **`IFilterClass GetFilterClassFromISOCode(ISoftwareFilter[] filters, string isoCode)`** – Retrieves filter class from ISO code.
|
||||
- **`CoerceISOCodeDelegate CoerceISOCodeFunc { get; }`** – Function to coerce/normalize ISO codes.
|
||||
- **`UIItemStatus ChannelStatus { get; }`** – Combined status (e.g., "Complete", "Missing Sensor").
|
||||
- **`void SetSettingsFromSensor(ISensorData sd)`** – Applies sensor defaults to channel settings.
|
||||
- **`string GetChangeList(ISensorData sensor)`** – Returns list of differences between sensor and channel settings.
|
||||
- **`bool IsRangeDifferent { get; set; }`** / **`bool IsFilterClassDifferent { get; set; }`** / ... (many `Is...Different` properties) – UI state flags for setting changes.
|
||||
|
||||
> *Core runtime interface for a channel in a group. Combines DB record data, hardware/sensor state, settings, and UI metadata.*
|
||||
|
||||
## 3. Invariants
|
||||
- **`IChannelDbRecord`**:
|
||||
- `Id`, `GroupId`, `DASId`, `DASChannelIndex`, `GroupChannelOrder`, `TestSetupOrder`, and `SensorId` must be non-null and valid (e.g., `SensorId > 0` if a sensor is assigned).
|
||||
- `Disabled` implies the channel should not be used for data collection.
|
||||
- `LastModified` and `LastModifiedBy` must be set on every update.
|
||||
- **`IGroupChannel`**:
|
||||
- `IsBlank()` returns `true` only if both hardware and sensor are unassigned.
|
||||
- `SensorValid`, `HardwareValid`, `IsAnalog`, `IsSquib`, etc., are mutually exclusive and consistent with assigned sensor/hardware types.
|
||||
- `ChannelStatus` reflects `IsComplete` and sensor calibration validity.
|
||||
- `Is...Different` properties are UI state flags and do not affect data integrity.
|
||||
- `ChannelId` (from `IGroupChannel`) is distinct from `Id` (from `IChannelDbRecord`)—see *Gotchas*.
|
||||
- **`IChannelSetting`**:
|
||||
- Only one of `Value`, `IntValue`, `DoubleValue`, or `BoolValue` should be actively used per setting instance (type-specific).
|
||||
- `Clone()` must produce a deep copy (no shared mutable references).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Enums.Channels` (`ChannelCodeType`)
|
||||
- `System.ComponentModel.DataAnnotations` (`Key`, `Column`)
|
||||
- `System` (`DateTime`)
|
||||
- `DTS.Common.Interface.DataRecorders` (`IHardwareChannel`)
|
||||
- `DTS.Common.Interface.Sensors.SensorsList` (`IDragAndDropItem`)
|
||||
- `DTS.Common.Interface.Sensors` (`ISensorData`, `ISensorCalibration`)
|
||||
- `DTS.Common.Interface.Groups.GroupList` (`IGroup`)
|
||||
- `DTS.Common.Enums` (e.g., `InitialOffset`, `ZeroMethodType`, `DigitalOutputModes`, `SquibFireMode`, `DigitalInputModes`)
|
||||
- `DTS.Common.Classes.ChannelCodes` (`CoerceISOCodeDelegate`)
|
||||
- `DTS.Common.Interface.Sensors.SoftwareFilters` (`IFilterClass`, `ISoftwareFilter`)
|
||||
- `System.IO.Ports` (`StopBits`, `Parity`, `Handshake`)
|
||||
- `System.Windows.Input` (`ICommand`)
|
||||
- `System.Windows` (`Visibility`)
|
||||
|
||||
- **Depended on by**:
|
||||
- UI layers (WPF) for channel configuration, validation, and binding.
|
||||
- Data persistence layers (e.g., EF Core) for `IChannelDbRecord` mapping.
|
||||
- Sensor/hardware assignment logic (e.g., `SetSensor`, `SetHardwareChannel`).
|
||||
- Test setup and data collection orchestration (e.g., `IsDisabled`, `ChannelStatus`).
|
||||
|
||||
## 5. Gotchas
|
||||
- **`ChannelId` vs `Id`**: `IGroupChannel` inherits `IChannelDbRecord.Id` (DB primary key) but *also* declares its own `long ChannelId { get; set; }`. The purpose of `ChannelId` is unclear from the source—comments suggest it may be a legacy identifier or used for UI grouping. **Do not assume `ChannelId == Id`.**
|
||||
- **`HardwareId` is deprecated**: The comment explicitly states this is an old identifier (`[das serial]:[channel index]`) and questions why it coexists with `HardwareChannel`. Prefer `Hardware
|
||||
@@ -0,0 +1,117 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Channels/ChannelCodes/IChannelCodesListView.cs
|
||||
- Common/DTS.Common/Interface/Channels/ChannelCodes/IChannelCodesListViewModel.cs
|
||||
- Common/DTS.Common/Interface/Channels/ChannelCodes/IChannelCode.cs
|
||||
generated_at: "2026-04-16T03:13:50.172717+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8f7a27f97cbd53de"
|
||||
---
|
||||
|
||||
# ChannelCodes
|
||||
|
||||
## Documentation: Channel Codes List Module
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
This module defines the core interfaces for a UI component that manages and displays channel codes—specifically distinguishing between ISO-standardized codes and user-defined codes. It provides a structured contract for a list-based view (`IChannelCodesListView`) and its associated view model (`IChannelCodesListViewModel`), enabling data binding, editing, validation, and manipulation (copy, delete, filter, sort) of channel code entries. The module exists to decouple UI presentation logic from data persistence while enforcing consistent behavior across implementations for channel code management in the DTS system.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `IChannelCodesListView`
|
||||
- **Inherits**: `IBaseView`
|
||||
- **Description**: A marker interface representing the view layer for the channel codes list. It has no additional members beyond inheritance, implying it relies on conventions or base view infrastructure for implementation.
|
||||
|
||||
#### `IChannelCodesListViewModel`
|
||||
- **Inherits**: `IBaseViewModel`
|
||||
- **Properties**:
|
||||
- `IChannelCodesListView View { get; set; }`
|
||||
Gets or sets the associated view instance (MVVM pattern).
|
||||
- `ObservableCollection<IChannelCode> ISOChannelCodes { get; set; }`
|
||||
Collection of ISO-standard channel codes displayed in the list.
|
||||
- `ObservableCollection<IChannelCode> UserChannelCodes { get; set; }`
|
||||
Collection of user-defined channel codes displayed in the list.
|
||||
- `Func<IList<IChannelCode>> ChannelCodesFunc { get; }`
|
||||
A delegate returning the *complete* list of channel codes (both ISO and user) for external use (e.g., saving, validation).
|
||||
- `IChannelCode[] SelectedCodes { get; }`
|
||||
Returns the currently selected `IChannelCode` items in the UI.
|
||||
- `bool ShowISOStringBuilder { get; set; }`
|
||||
Controls visibility of the ISO code builder UI component.
|
||||
- `bool UniqueISOCodesRequired { get; set; }`
|
||||
Enables/disables validation requiring ISO codes to be unique.
|
||||
- `bool ShowChannelCodeLookupHelper { get; set; }`
|
||||
Controls visibility of a helper UI for looking up channel codes.
|
||||
- `bool IsReadOnly { get; set; }`
|
||||
If `true`, disables editing operations (e.g., paste, delete, copy).
|
||||
|
||||
- **Methods**:
|
||||
- `void Unset()`
|
||||
Releases resources or clears state associated with the current view (e.g., detaching event handlers).
|
||||
- `void SetPage(object page)`
|
||||
Associates the view model with a specific page instance (likely for navigation or context).
|
||||
- `void OnSetActive()`
|
||||
Invoked when the view becomes active (e.g., on navigation to the page); likely triggers data refresh or initialization.
|
||||
- `bool Save()`
|
||||
Persists changes to the channel codes; returns `true` on success, `false` otherwise.
|
||||
- `bool Validate(bool bDisplayWindow)`
|
||||
Validates the current state of channel codes (e.g., uniqueness, required fields); if `bDisplayWindow` is `true`, shows validation errors in a UI dialog.
|
||||
- `void CopySelected()`
|
||||
Copies the selected `IChannelCode` items to the clipboard (likely in a structured format).
|
||||
- `void DeleteSelected()`
|
||||
Deletes the selected `IChannelCode` items from their respective collections.
|
||||
- `void Filter(object columnTag, string searchTerm)`
|
||||
Filters the displayed list based on `searchTerm` in the column identified by `columnTag`.
|
||||
- `void Sort(object columnTag, bool bColumnClick)`
|
||||
Sorts the displayed list by the column identified by `columnTag`; `bColumnClick` indicates if the sort was triggered by a user clicking the column header (likely toggles sort direction).
|
||||
|
||||
#### `IChannelCode`
|
||||
- **Properties**:
|
||||
- `int Id { get; }`
|
||||
Database identifier for the channel code.
|
||||
- `string Code { get; set; }`
|
||||
The code value (e.g., `"ISO-8601"` or `"CUSTOM-A"`).
|
||||
- `string Name { get; set; }`
|
||||
Human-readable name associated with the code (e.g., `"Date Format"` or `"Custom Input"`).
|
||||
- `ChannelEnumsAndConstants.ChannelCodeType CodeType { get; }`
|
||||
Enum value indicating whether the code is `ISO` or `USER`-defined (from `DTS.Common.Enums.Channels`).
|
||||
- `ICommand PasteCommand { get; set; }`
|
||||
Command handler for pasting multi-row or CSV data into a single field (e.g., pasting multiple codes into the `Code` or `Name` field).
|
||||
- `UIItemStatus ItemStatus { get; set; }`
|
||||
Current UI validation status (e.g., `Success`, `Warning`, `Error`) for the item (from `DTS.Common.Enums`).
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- `ISOChannelCodes` and `UserChannelCodes` collections are mutually exclusive in type (`IChannelCode.CodeType` must match the collection’s semantic purpose).
|
||||
- `ChannelCodesFunc` must return a *complete* list containing all items from both `ISOChannelCodes` and `UserChannelCodes` (order unspecified).
|
||||
- `SelectedCodes` must reflect the *current* selection state at the time of access (no caching delay).
|
||||
- `IsReadOnly = true` must prevent all mutation operations (`DeleteSelected`, `CopySelected`, `PasteCommand`, and edits to `Code`/`Name`).
|
||||
- `Validate` with `bDisplayWindow = true` must display errors to the user; with `false`, it must only perform validation silently (e.g., for pre-save checks).
|
||||
- `UniqueISOCodesRequired = true` implies `Validate` must enforce uniqueness of `Code` values *only* among `ISOChannelCodes`.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`).
|
||||
- `System.Collections.ObjectModel` (for `ObservableCollection<T>`).
|
||||
- `DTS.Common.Enums` (for `UIItemStatus`, `ChannelCodeType`).
|
||||
- `System.Windows.Input` (for `ICommand`).
|
||||
- **Depended on by**:
|
||||
- Concrete implementations of `IChannelCodesListView` (e.g., WPF `UserControl` or `Window`), `IChannelCodesListViewModel` (e.g., `ChannelCodesListViewModel`), and `IChannelCode` (e.g., `ISOChannelCode`, `UserChannelCode`).
|
||||
- Likely consumed by higher-level modules managing channel configuration or system setup (inferred from namespace `DTS.Common.Interface.Channels`).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- `PasteCommand` is defined on `IChannelCode`, but its behavior (e.g., parsing CSV, splitting rows) is not specified—implementation must handle multi-row pasting consistently.
|
||||
- `ChannelCodesFunc` is a delegate, not a property returning a collection directly; callers must invoke it to get the latest list (risk of stale data if cached).
|
||||
- `SelectedCodes` is an array (`IChannelCode[]`), not a collection—consumers must not modify the array (it is likely a snapshot).
|
||||
- `SetPage(object page)` uses `object` instead of a typed interface (e.g., `IPage`), suggesting tight coupling to a specific UI framework (e.g., WPF `Page`).
|
||||
- `Filter` and `Sort` use `object columnTag` without defining expected values—implementation must rely on conventions (e.g., string column names or enum values).
|
||||
- No explicit thread-safety guarantees; `ObservableCollection` updates are likely expected on the UI thread.
|
||||
- **Critical ambiguity**: `Validate`’s behavior when `UniqueISOCodesRequired = true` is *not* enforced in the interface—implementation must ensure uniqueness *only* for ISO codes, but the interface does not clarify if user codes must also be unique or if they may overlap with ISO codes.
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/CheckChannels/ICheckChannelsView.cs
|
||||
- Common/DTS.Common/Interface/CheckChannels/ICheckChannelsViewModel.cs
|
||||
- Common/DTS.Common/Interface/CheckChannels/ICheckChannelsMenuView.cs
|
||||
- Common/DTS.Common/Interface/CheckChannels/ICheckChannelsMenuViewModel.cs
|
||||
generated_at: "2026-04-16T03:00:25.192558+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "427d509ed8cfa579"
|
||||
---
|
||||
|
||||
# CheckChannels
|
||||
|
||||
## Documentation: CheckChannels Module Interfaces
|
||||
|
||||
### 1. Purpose
|
||||
This module defines the interface contracts for the *CheckChannels* feature within the DTS UI framework. It establishes a clean separation of concerns between view and view model layers for both the main CheckChannels UI and its associated ribbon menu component. The interfaces `ICheckChannelsView`, `ICheckChannelsViewModel`, `ICheckChannelsMenuView`, and `ICheckChannelsMenuViewModel` collectively enable dependency inversion and testability for the feature’s UI components, allowing concrete implementations to be injected and swapped without tight coupling.
|
||||
|
||||
### 2. Public Interface
|
||||
All interfaces are *marker interfaces*—they inherit from base interfaces but declare no additional members.
|
||||
|
||||
- **`ICheckChannelsView : IBaseView`**
|
||||
Marker interface for the view component of the CheckChannels feature. Indicates that a class serves as the UI layer (e.g., a WPF `UserControl` or `Window`) for the core CheckChannels functionality.
|
||||
|
||||
- **`ICheckChannelsViewModel : IBaseViewModel`**
|
||||
Marker interface for the view model of the CheckChannels feature. Indicates that a class encapsulates the UI state and behavior for the core CheckChannels functionality.
|
||||
|
||||
- **`ICheckChannelsMenuView : IRibbonView`**
|
||||
Marker interface for the ribbon menu view associated with the CheckChannels feature. Indicates that a class provides the UI for ribbon-based menu items (e.g., buttons, dropdowns) related to CheckChannels.
|
||||
|
||||
- **`ICheckChannelsMenuViewModel : IRibbonViewModel`**
|
||||
Marker interface for the ribbon menu view model. Indicates that a class manages the state and logic for ribbon menu items in the CheckChannels context.
|
||||
|
||||
> **Note**: No methods, properties, or events are declared in any of these interfaces. Behavior and data contracts are inherited from `IBaseView`, `IBaseViewModel`, `IRibbonView`, and `IRibbonViewModel`.
|
||||
|
||||
### 3. Invariants
|
||||
- All four interfaces are *pure marker interfaces* with no additional contract beyond their base interface inheritance.
|
||||
- Implementations of `ICheckChannelsView` and `ICheckChannelsMenuView` must be compatible with their respective base view interfaces (`IBaseView`, `IRibbonView`)—e.g., supporting view lifecycle, data binding, or ribbon-specific behaviors as defined by those bases.
|
||||
- Implementations of `ICheckChannelsViewModel` and `ICheckChannelsMenuViewModel` must conform to the semantics of `IBaseViewModel` and `IRibbonViewModel`, respectively (e.g., property change notification, command exposure).
|
||||
- No ordering, initialization, or dependency guarantees are specified *within this module*—these are determined by the base interfaces and consumer code.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Base` (for `IBaseView`, `IBaseViewModel`)
|
||||
- `DTS.Common.RibbonControl` (for `IRibbonView`, `IRibbonViewModel`)
|
||||
- **Used by**:
|
||||
- UI framework code that resolves or injects view/view model implementations via these interfaces (e.g., DI containers, view-first navigation logic).
|
||||
- Concrete implementations of the CheckChannels feature (e.g., `CheckChannelsView : ICheckChannelsView`) and its ribbon menu counterpart.
|
||||
- **No direct dependencies on other DTS modules** beyond the base and ribbon control layers.
|
||||
|
||||
### 5. Gotchas
|
||||
- **No behavior defined here**: These interfaces convey *no operational semantics*—developers must inspect `IBaseView`, `IBaseViewModel`, `IRibbonView`, and `IRibbonViewModel` to understand expected behavior (e.g., property change patterns, command wiring).
|
||||
- **Risk of over-abstraction**: The use of marker interfaces may obscure intent; ensure naming (`CheckChannels` vs. `CheckChannelsMenu`) is consistently applied across implementations to avoid confusion.
|
||||
- **Ribbon-specific semantics**: `ICheckChannelsMenuView` inherits from `IRibbonView`, implying integration with a ribbon UI framework (e.g., DevExpress, Fluent.Ribbon). Consumers must ensure ribbon-specific requirements (e.g., `RibbonControl` initialization order) are respected.
|
||||
- **No versioning or extensibility signals**: Changes to the underlying base interfaces (`IBaseView`, `IRibbonViewModel`, etc.) may silently affect implementations—tight coupling to base contracts is implicit.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/CheckTrigger/ICheckTriggerView.cs
|
||||
- Common/DTS.Common/Interface/CheckTrigger/ICheckTriggerViewModel.cs
|
||||
generated_at: "2026-04-16T02:57:41.131738+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9192aec54cd8b7fd"
|
||||
---
|
||||
|
||||
# CheckTrigger
|
||||
|
||||
## 1. Purpose
|
||||
This module defines the view and view model interfaces for a *Check Trigger* feature within the DTS (likely *Data Tracking System* or similar domain) architecture. It serves as a contract layer in a MVVM (Model-View-ViewModel) pattern, enabling decoupled UI implementation for components that present or manage trigger-checking logic—such as validating whether certain conditions or events have been met. The interfaces inherit from base abstractions (`IBaseView`, `IBaseViewModel`), indicating adherence to a standardized UI layer hierarchy.
|
||||
|
||||
## 2. Public Interface
|
||||
No public *implementations* are provided in the source, only interface declarations. The interfaces themselves are:
|
||||
|
||||
- **`ICheckTriggerView`**
|
||||
```csharp
|
||||
public interface ICheckTriggerView : IBaseView
|
||||
```
|
||||
Represents the view layer for the Check Trigger feature. As it inherits `IBaseView`, it is expected to support standard view behaviors (e.g., lifecycle management, data binding context) defined in the base interface—though the exact members of `IBaseView` are not included here and must be referenced separately.
|
||||
|
||||
- **`ICheckTriggerViewModel`**
|
||||
```csharp
|
||||
public interface ICheckTriggerViewModel : IBaseViewModel
|
||||
```
|
||||
Represents the view model layer for the Check Trigger feature. As it inherits `IBaseViewModel`, it is expected to expose properties and commands for UI binding and state management—again, with specifics defined in `IBaseViewModel`, which is external to this source.
|
||||
|
||||
## 3. Invariants
|
||||
- `ICheckTriggerView` and `ICheckTriggerViewModel` are *pure interface declarations* with no method, property, or event members defined in this file.
|
||||
- Both interfaces are part of the `DTS.Common.Interface` namespace and inherit from their respective base interfaces (`IBaseView`, `IBaseViewModel`), implying that all implementations must satisfy the contracts of those base interfaces.
|
||||
- No additional validation rules, ordering guarantees, or state constraints are specified in the provided source.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Internal dependencies**:
|
||||
- `DTS.Common.Base` — provides `IBaseView` and `IBaseViewModel`.
|
||||
- **No external dependencies** (e.g., no third-party libraries or other DTS modules) are imported in the provided files.
|
||||
- **Consumers**: Likely used by UI modules (e.g., WPF, MAUI, or other XAML-based clients) that implement the `ICheckTriggerView` and bind to `ICheckTriggerViewModel` instances. The actual usage would be in higher-level modules (not included here).
|
||||
|
||||
## 5. Gotchas
|
||||
- **Ambiguity in base interfaces**: The behavior and contract of `ICheckTriggerView` and `ICheckTriggerViewModel` are entirely dependent on the definitions of `IBaseView` and `IBaseViewModel`, which are not included. Without those, the interfaces are effectively empty placeholders.
|
||||
- **No feature-specific API surface**: Despite the module name *CheckTrigger*, the interfaces contain *no* methods or properties related to checking triggers (e.g., no `CheckAsync()`, `TriggerStatus`, etc.). This suggests either:
|
||||
- The feature logic resides entirely in the view model’s implementation (not declared in the interface),
|
||||
- Or this is a placeholder for future expansion,
|
||||
- Or the actual trigger-checking logic is handled elsewhere (e.g., in a service or domain model).
|
||||
- **No documentation comments**: Neither interface includes XML documentation, making intent and usage unclear beyond naming.
|
||||
- **None identified from source alone.**
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Communication/ICommunicationReport.cs
|
||||
- Common/DTS.Common/Interface/Communication/IDASConnectedDevice.cs
|
||||
- Common/DTS.Common/Interface/Communication/ICommunication_DASInfo.cs
|
||||
generated_at: "2026-04-16T03:03:06.051623+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d690cf8a777399d3"
|
||||
---
|
||||
|
||||
# Communication
|
||||
|
||||
### **Purpose**
|
||||
This module defines core interfaces for representing communication state and device metadata within the DTS (Data Acquisition System) framework. Specifically, it standardizes how communication results, data payloads, and device information (including device topology, identity, and capabilities) are exposed across the system—particularly for auto-discovery and status monitoring of DAS-connected hardware (e.g., S6 devices on an S6DB). These interfaces serve as contracts for implementations handling device communication, status reporting, and metadata management.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
|
||||
#### `ICommunicationReport`
|
||||
Represents the outcome and associated data of a communication operation.
|
||||
- **`object UserState { get; set; }`**
|
||||
Arbitrary user-defined state object, typically used to correlate asynchronous operations or pass context through callbacks.
|
||||
- **`CommunicationConstantsAndEnums.CommunicationResult Result { get; set; }`**
|
||||
The result status of the communication operation (e.g., success, timeout, error). *Note: `CommunicationResult` is defined in an external enum namespace.*
|
||||
- **`byte[] Data { get; set; }`**
|
||||
Raw byte payload returned or sent during the communication. May be `null` if no data is applicable (e.g., for command-only operations or failures).
|
||||
|
||||
#### `IDASConnectedDevice`
|
||||
Describes a single device physically connected to a DAS (e.g., S6 on S6DB), including its location, identity, and network properties.
|
||||
- **`HardwareTypes DeviceType { get; }`**
|
||||
The enumerated type of the device (e.g., `S6`, `S6DB`). *Defined in `DTS.Common.Enums.Hardware`.*
|
||||
- **`int Port { get; }`**
|
||||
Zero-based port index on the DAS to which the device is connected.
|
||||
- **`int SpotOnPort { get; }`**
|
||||
Zero-based position of the device along the chain or daisy chain on the given port.
|
||||
- **`PhysicalAddress PhysicalAddress { get; }`**
|
||||
MAC address of the device (from `System.Net.NetworkInformation`).
|
||||
- **`string IPAddress { get; }`**
|
||||
IPv4/IPv6 address string assigned to the device.
|
||||
- **`string SerialNumber { get; }`**
|
||||
Unique hardware serial number.
|
||||
- **`string Location { get; }`**
|
||||
Human-readable location identifier (e.g., "Lab A, Rack 2").
|
||||
- **`string Version { get; }`**
|
||||
Firmware or software version string.
|
||||
|
||||
#### `ICommunication_DASInfo`
|
||||
Encapsulates metadata about a DAS unit and its connected devices.
|
||||
- **`IDASConnectedDevice[] ConnectedDevices { get; }`**
|
||||
Immutable array of devices currently connected to this DAS. *Currently only populated for SLICE6DB.*
|
||||
- **`void SetConnectedDevices(IDASConnectedDevice[] devices)`**
|
||||
Mutator to populate `ConnectedDevices`. Intended for internal use during device enumeration/discovery.
|
||||
- **`string[] SerialNumbers { get; set; }`**
|
||||
Parallel array of serial numbers for connected devices (index-aligned with `ConnectedDevices`).
|
||||
- **`string[] FirmwareVersions { get; set; }`**
|
||||
Parallel array of firmware versions for connected devices (index-aligned with `ConnectedDevices`).
|
||||
- **`string StackSerialNumber(int devid)`**
|
||||
Returns the serial number of the device at the specified `devid` index (0-based). *Assumes `devid` is valid for the current `ConnectedDevices` array.*
|
||||
- **`DateTime? FirstUseDate { get; set; }`**
|
||||
Date of first operational use. `null` indicates the device has not been used since last calibration (or calibration is unsupported). Valid only when `IsFirstUseDateSupported` is `true`.
|
||||
- **`bool IsFirstUseDateSupported { get; set; }`**
|
||||
Indicates whether the hardware supports tracking first-use date (requires firmware/user-attribute storage and calibration support per issue #15524).
|
||||
- **`bool IsStreamingSupported { get; set; }`**
|
||||
Indicates whether the hardware supports streaming data (e.g., via system attribute `DISABLE_STREAMING_FEATURE` per issue #30429).
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- **`ConnectedDevices` alignment**: `SerialNumbers[i]` and `FirmwareVersions[i]` must correspond to `ConnectedDevices[i]` for all valid indices `i`.
|
||||
- **`StackSerialNumber` contract**: Must return the serial number at index `devid` in `ConnectedDevices`; behavior is undefined if `devid` is out of bounds.
|
||||
- **`FirstUseDate` validity**: `FirstUseDate.HasValue` is only meaningful when `IsFirstUseDateSupported == true`; otherwise, it should be ignored.
|
||||
- **`Result` semantics**: The `Result` field in `ICommunicationReport` must accurately reflect the outcome of the operation; `Data` may be non-null only for successful or partial-success results (implementation-dependent).
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Enums.Communication.CommunicationResult` (external enum)
|
||||
- `DTS.Common.Enums.Hardware.HardwareTypes` (external enum)
|
||||
- `System.Net.NetworkInformation.PhysicalAddress` (BCL type)
|
||||
- **Depended on by**:
|
||||
- Components implementing auto-discovery and device monitoring (e.g., DAS status monitors, network scanners).
|
||||
- Code handling device metadata aggregation (e.g., configuration managers, diagnostic tools).
|
||||
- Likely consumed by higher-level communication layers (e.g., `ICommunicationService`, `DASController`).
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **`ConnectedDevices` is currently only populated for SLICE6DB**: Other DAS types may return an empty or uninitialized array. Do not assume it is universally populated.
|
||||
- **`SetConnectedDevices` is a setter, not an adder**: It replaces the entire array; incremental updates require manual reconstruction.
|
||||
- **`StackSerialNumber` uses `devid` as an array index**: No bounds checking is specified; callers must ensure `0 ≤ devid < ConnectedDevices.Length`.
|
||||
- **`FirstUseDate` semantics are conditional**: A `null` value does *not* necessarily mean "never used"—it may also indicate lack of hardware support.
|
||||
- **`IsStreamingSupported` is hardware- and firmware-dependent**: Support may be toggled via system attributes (e.g., `DISABLE_STREAMING_FEATURE`), so runtime checks may be necessary beyond this flag.
|
||||
- **No validation rules specified**: Interfaces do not enforce non-null constraints (e.g., `IPAddress` or `SerialNumber` could be `null` or empty strings). Consumers must handle missing data defensively.
|
||||
- **No thread-safety guarantees**: Interfaces are passive data contracts; thread-safety must be handled by implementations.
|
||||
|
||||
*None of the interfaces define event handlers, async methods, or lifecycle management—these are handled elsewhere.*
|
||||
@@ -0,0 +1,184 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Components/IAssemblyView.cs
|
||||
- Common/DTS.Common/Interface/Components/IAssemblyListView.cs
|
||||
- Common/DTS.Common/Interface/Components/ITileView.cs
|
||||
- Common/DTS.Common/Interface/Components/IGroupView.cs
|
||||
- Common/DTS.Common/Interface/Components/ITileListView.cs
|
||||
- Common/DTS.Common/Interface/Components/IGroupListView.cs
|
||||
- Common/DTS.Common/Interface/Components/IAssemblyViewModel.cs
|
||||
- Common/DTS.Common/Interface/Components/IAssemblyListViewModel.cs
|
||||
- Common/DTS.Common/Interface/Components/ITileViewModel.cs
|
||||
- Common/DTS.Common/Interface/Components/IGroupViewModel.cs
|
||||
- Common/DTS.Common/Interface/Components/ITileListViewModel.cs
|
||||
- Common/DTS.Common/Interface/Components/IGroupListViewModel.cs
|
||||
generated_at: "2026-04-16T03:01:46.484728+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e01b1b94fbb8ea7a"
|
||||
---
|
||||
|
||||
# Components
|
||||
|
||||
## Documentation: View and ViewModel Interfaces for Assembly/Tile/Group UI Components
|
||||
|
||||
---
|
||||
|
||||
### 1. Purpose
|
||||
|
||||
This module defines a set of interfaces that establish the contract between UI views and their corresponding view models for hierarchical presentation of assembly, tile, and group data. It supports two distinct UI presentation patterns—*single-item views* (e.g., `IAssemblyView`, `ITileView`, `IGroupView`) and *list-of-items views* (e.g., `IAssemblyListView`, `ITileListView`, `IGroupListView`)—each paired with a matching view model (`*ViewModel`). These interfaces are part of a layered architecture where views are UI-layer abstractions (likely bound to XAML or similar), and view models mediate data and commands. The module enables consistent composition of UI hierarchies: a *list view* contains a list of *item views*, each backed by its own *item view model*.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### View Interfaces (UI Layer Abstractions)
|
||||
|
||||
- **`IAssemblyView`**
|
||||
*Namespace:* `DTS.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a single assembly UI view (e.g., a control or panel displaying one assembly).
|
||||
|
||||
- **`IAssemblyListView`**
|
||||
*Namespace:* `DTS.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a container view for a list of `IAssemblyView` instances (e.g., a scrollable list of assembly panels).
|
||||
|
||||
- **`ITileView`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a single tile UI view (e.g., a card or grid cell for a tile).
|
||||
|
||||
- **`IGroupView`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a single group UI view (e.g., a section header or container for grouped items).
|
||||
|
||||
- **`ITileListView`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a container view for a list of `ITileView` instances.
|
||||
|
||||
- **`IGroupListView`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseView`
|
||||
Represents a container view for a list of `IGroupView` instances.
|
||||
|
||||
#### ViewModel Interfaces (Data/Logic Layer Abstractions)
|
||||
|
||||
- **`IAssemblyViewModel`**
|
||||
*Namespace:* `DTS.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `IAssemblyView View { get; set; }` – The view instance bound to this model.
|
||||
- `string GroupName { get; set; }` – The group name associated with this assembly.
|
||||
- `List<AssemblyNameImage> AssemblyList { get; set; }` – List of assemblies (type `AssemblyNameImage` defined elsewhere) to display.
|
||||
*Behavior:* Manages data for a single assembly view.
|
||||
|
||||
- **`IAssemblyListViewModel`**
|
||||
*Namespace:* `DTS.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `IMainViewModel Parent { get; set; }` – Reference to the top-level view model.
|
||||
- `IAssemblyListView View { get; set; }` – The list view instance.
|
||||
- `List<IAssemblyView> GroupList { get; set; }` – List of *views* (not view models) representing individual assembly groups.
|
||||
*Behavior:* Manages a list of assembly views; note that `GroupList` holds *views*, not `IAssemblyViewModel`s.
|
||||
|
||||
- **`ITileViewModel`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `ITileView View { get; set; }`
|
||||
- `string GroupName { get; set; }`
|
||||
- `List<AssemblyNameImage> AssemblyList { get; set; }`
|
||||
*Behavior:* Manages data for a single tile view.
|
||||
|
||||
- **`IGroupViewModel`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `IGroupView View { get; set; }`
|
||||
- `string GroupName { get; set; }`
|
||||
- `List<AssemblyNameImage> AssemblyList { get; set; }`
|
||||
*Behavior:* Manages data for a single group view.
|
||||
|
||||
- **`ITileListViewModel`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `IMainViewModel Parent { get; set; }`
|
||||
- `ITileListView View { get; set; }`
|
||||
- `List<ITileView> GroupList { get; set; }`
|
||||
*Behavior:* Manages a list of tile views; `GroupList` holds *views*, not `ITileViewModel`s.
|
||||
|
||||
- **`IGroupListViewModel`**
|
||||
*Namespace:* `DataPro.Common.Interface`
|
||||
*Inherits:* `IBaseViewModel`
|
||||
- `IMainViewModel Parent { get; set; }`
|
||||
- `IGroupListView View { get; set; }`
|
||||
- `List<IGroupView> GroupList { get; set; }`
|
||||
*Behavior:* Manages a list of group views; `GroupList` holds *views*, not `IGroupViewModel`s.
|
||||
|
||||
> **Note on naming consistency**:
|
||||
> - `DTS.Common.Interface` namespace is used for *assembly*-centric interfaces.
|
||||
> - `DataPro.Common.Interface` namespace is used for *tile* and *group*-centric interfaces.
|
||||
> This suggests a historical split between two subsystems (DTS and DataPro) that share similar UI patterns.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **View–ViewModel Pairing**: Each `*ViewModel` interface declares a `View` property typed to its corresponding `*View` interface (e.g., `IAssemblyViewModel` ↔ `IAssemblyView`). This enforces a 1:1 binding contract.
|
||||
- **Hierarchical Structure**:
|
||||
- `*ListViewModel` interfaces (`IAssemblyListViewModel`, `ITileListViewModel`, `IGroupListViewModel`) hold a `List<IView>` (not `IViewModel`) in their `GroupList` property.
|
||||
- This implies that list view models do *not* directly manage child view models—only the *views* they contain.
|
||||
- **GroupName Semantics**: All item-level view models (`IAssemblyViewModel`, `ITileViewModel`, `IGroupViewModel`) expose a `GroupName` property, suggesting that each item belongs to a named group.
|
||||
- **AssemblyList Consistency**: All item-level view models use `List<AssemblyNameImage>` for `AssemblyList`, indicating uniform data structure for underlying content.
|
||||
- **Parent Reference**: All list view models expose a `Parent` property of type `IMainViewModel`, enforcing a tree structure rooted at a main view model.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
#### Internal Dependencies (from source):
|
||||
- **Base Interfaces**:
|
||||
- All view interfaces inherit from `IBaseView`.
|
||||
- All view model interfaces inherit from `IBaseViewModel`.
|
||||
*(Exact definitions of `IBaseView` and `IBaseViewModel` are not provided here but are assumed to be in `DTS.Common.Base` or `DataPro.Common.Base`.)*
|
||||
- **Data Types**:
|
||||
- `AssemblyNameImage` (used in `AssemblyList`) is referenced but not defined in these files. Its definition must exist elsewhere (likely in `DTS.Common.Base` or `DataPro.Common.Base`).
|
||||
- **.NET Framework Types**:
|
||||
- `System.Collections.Generic.List<T>`
|
||||
- `System.Collections.ObjectModel.Collection<T>` (imported but unused in these files)
|
||||
- `System.Reflection.Assembly` (imported but unused in these files)
|
||||
|
||||
#### External Dependencies:
|
||||
- **Consumers**:
|
||||
- UI rendering layers (e.g., WPF/XAML views) must implement `*View` interfaces.
|
||||
- View model implementations (e.g., `AssemblyViewModel`, `TileListViewModel`) must implement `*ViewModel` interfaces.
|
||||
- `IMainViewModel` must be defined elsewhere and is required by all list view models.
|
||||
- **Namespaces**:
|
||||
- `DTS.Common.Interface` and `DataPro.Common.Interface` are used for view/view model interfaces.
|
||||
- `DTS.Common.Base` and `DataPro.Common.Base` are used for base interfaces.
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Inconsistent Namespace Usage**:
|
||||
Assembly-related interfaces (`IAssemblyView`, `IAssemblyListView`, `IAssemblyViewModel`, `IAssemblyListViewModel`) reside in `DTS.Common.Interface`, while tile/group equivalents (`ITile*`, `IGroup*`) are in `DataPro.Common.Interface`. This may reflect legacy code splitting and could cause confusion during refactoring or cross-feature development.
|
||||
|
||||
- **`GroupList` Holds Views, Not View Models**:
|
||||
In `IAssemblyListViewModel`, `ITileListViewModel`, and `IGroupListViewModel`, the `GroupList` property is typed as `List<IView>`, *not* `List<IViewModel>`. This breaks typical MVVM patterns where list view models manage child view models. Developers may mistakenly expect to access child view models via this list.
|
||||
|
||||
- **Unused Imports**:
|
||||
`System.Collections.ObjectModel` and `System.Reflection` are imported in several `*ViewModel` files but never used. This may indicate incomplete cleanup or future extensibility (e.g., planned use of `ObservableCollection`), but currently serves no purpose.
|
||||
|
||||
- **Ambiguity of `GroupName`**:
|
||||
While `GroupName` is present in all item view models, its semantics (e.g., is it a display name? a grouping key? a category?) are not defined here. Its value may be derived from the `AssemblyList` or external metadata.
|
||||
|
||||
- **No Method Signatures**:
|
||||
All interfaces are property-only. No commands or methods are declared, implying behavior is either in `IBaseViewModel` or handled externally (e.g., via event handlers or command binding in the view layer). This may limit testability or composability.
|
||||
|
||||
- **No Inheritance Between View Models**:
|
||||
Despite structural similarity, there is no shared base interface for item view models (e.g., `IAssemblyViewModel`, `ITileViewModel`, `IGroupViewModel` are independent). This duplication may increase maintenance burden.
|
||||
|
||||
- **No Validation or State Guarantees**:
|
||||
The interfaces do not specify constraints (e.g., `AssemblyList` must be non-null, `GroupName` must be non-empty). Implementers must infer or define such rules elsewhere.
|
||||
|
||||
> **None identified from source alone** for *behavioral quirks* or *historical tech debt*, but the above structural inconsistencies are notable.
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/Connection/IConnection.cs
|
||||
generated_at: "2026-04-16T02:59:48.622286+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "06a808aff2343a50"
|
||||
---
|
||||
|
||||
# Connection
|
||||
|
||||
### **Purpose**
|
||||
This module defines the `IConnection` interface, which abstracts network connection semantics for a proprietary DTS (likely *Device Tracking System* or similar) platform. It provides a unified contract for managing connection lifecycle (connect, disconnect, reconnect), asynchronous I/O operations (send/receive), and connection state tracking—including special handling for *soft disconnections*, where disconnection is intentional and reversible. The interface supports both synchronous and asynchronous patterns (including APM-style `Begin`/`End` methods), enabling flexible integration with legacy and modern async code while maintaining low-level socket control (e.g., `SocketFlags`, `Bind`, `Listen`, `Accept`). It serves as the foundational abstraction for device communication layers, likely implemented by concrete socket- or transport-specific classes.
|
||||
|
||||
---
|
||||
|
||||
### **Public Interface**
|
||||
|
||||
| Member | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| `SendAsync` | `Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)` | Sends data asynchronously. Returns the number of bytes sent. |
|
||||
| `IsSoftDisconnected` | `bool IsSoftDisconnected { get; }` | Returns `true` if the connection was *soft disconnected* (i.e., voluntarily disconnected with intent to reconnect later). |
|
||||
| `SoftDisconnect` | `void SoftDisconnect()` | Voluntarily disconnects the connection with the expectation of reconnection (does *not* fully tear down resources). |
|
||||
| `SoftConnect` | `void SoftConnect()` | Reconnects a connection previously soft-disconnected. |
|
||||
| `Flags` | `System.Net.Sockets.SocketFlags Flags { get; set; }` | Gets or sets socket flags used during send/receive operations. |
|
||||
| `OnDisconnected` | `event EventHandler OnDisconnected` | Raised when the connection is fully disconnected (not just soft-disconnected). |
|
||||
| `KeepAliveErrorReceived` | `void KeepAliveErrorReceived()` | Indicates that a keep-alive timeout occurred (device did not receive timely response). Likely triggers reconnection logic. |
|
||||
| `ConnectString` | `string ConnectString { get; }` | Returns the connection string used to establish the connection. |
|
||||
| `Connected` | `bool Connected { get; }` | Returns `true` if the connection is currently active (not disconnected or soft-disconnected). |
|
||||
| `Create` (overload 1) | `void Create(string connectString)` | Initializes the connection using a single connection string. |
|
||||
| `Create` (overload 2) | `void Create(string connectString, string hostIPAddress)` | Initializes the connection using a connection string and explicit host IP address. |
|
||||
| `GetConnectionData` | `string GetConnectionData()` | Returns diagnostic or metadata information about the current connection state. |
|
||||
| `BeginConnect` / `EndConnect` | `IAsyncResult BeginConnect(AsyncCallback callback, object callbackObject)`<br>`void EndConnect(IAsyncResult ar)` | Asynchronous connection initiation (APM pattern). |
|
||||
| `BeginDisconnect` / `EndDisconnect` | `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback callback, object state)`<br>`void EndDisconnect(IAsyncResult asyncResult)` | Asynchronous disconnection (APM pattern); `reuseSocket` indicates whether the underlying socket can be reused. |
|
||||
| `BeginAccept` / `EndAccept` | `IAsyncResult BeginAccept(AsyncCallback callback, object state)`<br>`IConnection EndAccept(IAsyncResult asyncResult)` | Asynchronous accept for server-side connections (APM pattern); returns a new `IConnection` for the accepted client. |
|
||||
| `Bind` | `void Bind(int port)` | Binds the connection to a local port (typically for server-side use). |
|
||||
| `Listen` | `void Listen(int backlog)` | Begins listening for incoming connections (server-side). |
|
||||
| `BeginSend` / `EndSend` | `IAsyncResult BeginSend(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend, AsyncCallback callback, object callbackObject)`<br>`int EndSend(IAsyncResult ar)` | Asynchronous send (APM pattern). Returns bytes sent. |
|
||||
| `BeginReceive` / `EndReceive` | `IAsyncResult BeginReceive(byte[] receiveBuffer, int bufferStartOffset, int maxSizeToReceive, AsyncCallback callback, object callbackObject)`<br>`int EndReceive(IAsyncResult ar)` | Asynchronous receive (APM pattern). Returns number of bytes received. |
|
||||
|
||||
> **Note**: Two methods (`GetCurrentUploadRate`, `GetCurrentDownloadRate`) are commented out and thus *not part of the public interface*.
|
||||
|
||||
---
|
||||
|
||||
### **Invariants**
|
||||
- `Connected` must be `false` when `IsSoftDisconnected` is `true`.
|
||||
- `SoftDisconnect()` must set `IsSoftDisconnected = true` and raise `OnDisconnected` *only if* the disconnection is final (not soft). Since soft disconnects are *intended to be reversible*, `OnDisconnected` is likely *not* raised during `SoftDisconnect()`.
|
||||
- `SoftConnect()` must restore `Connected = true` and `IsSoftDisconnected = false` without requiring full re-initialization (e.g., re-binding/listening if server-side).
|
||||
- `Flags` must be applied consistently to all socket operations (`Send`, `Receive`, `Accept`, etc.).
|
||||
- `ConnectString` must remain immutable after initialization (set via `Create`).
|
||||
- `KeepAliveErrorReceived()` must be called *only* when a keep-alive timeout occurs, and likely triggers `SoftDisconnect()` internally (implementation-dependent but implied by naming).
|
||||
|
||||
---
|
||||
|
||||
### **Dependencies**
|
||||
- **Depends on**:
|
||||
- `System` (core types: `EventHandler`, `IAsyncResult`, `AsyncCallback`, `Object`)
|
||||
- `System.Threading.Tasks` (for `Task<int>`)
|
||||
- `System.Net.Sockets` (for `SocketFlags`)
|
||||
- **Implied dependencies**:
|
||||
- Concrete implementations likely depend on `System.Net.Sockets.Socket` (for low-level socket operations).
|
||||
- May depend on internal logging, timing, or keep-alive services (not visible in interface but implied by `KeepAliveErrorReceived`).
|
||||
- **Depended on by**:
|
||||
- Higher-level connection managers or device drivers (e.g., `IDevice`, `ConnectionManager`) that consume `IConnection` for communication.
|
||||
- Unit tests or mock frameworks (due to clear interface boundaries).
|
||||
|
||||
---
|
||||
|
||||
### **Gotchas**
|
||||
- **Soft vs. Hard Disconnection**: `SoftDisconnect()` does *not* imply `Connected = false`; `Connected` remains `true` until a *hard* disconnect (e.g., via `EndDisconnect` or network failure). `IsSoftDisconnected` is the correct state to check for intentional disconnection.
|
||||
- **APM Pattern Consistency**: `BeginAccept` returns `IConnection` (not `IAsyncResult`), and `EndAccept` returns a *new* `IConnection` instance—this suggests the interface supports server-side connection multiplexing.
|
||||
- **`reuseSocket` in `BeginDisconnect`**: The `bool reuseSocket` parameter indicates socket reuse semantics (e.g., for `SO_REUSEADDR`), but behavior is implementation-defined. Misuse may cause socket exhaustion.
|
||||
- **`KeepAliveErrorReceived()` is a *notification*, not a trigger**: It signals an error condition but does *not* automatically disconnect; callers must handle reconnection logic (e.g., by calling `SoftDisconnect()`).
|
||||
- **`Create` overloads**: The two `Create` methods suggest dual-mode initialization (e.g., client vs. server), but the distinction is unclear without implementation details. `hostIPAddress` may be redundant with `connectString`.
|
||||
- **No cancellation support**: All async methods lack `CancellationToken`—legacy APM-only design may complicate modern async/await integration.
|
||||
- **No return value for `SoftConnect`/`SoftDisconnect`**: No indication of success/failure; exceptions likely used for error reporting (not documented here).
|
||||
- **`GetCurrentUploadRate`/`GetCurrentDownloadRate` commented out**: Rate-monitoring functionality is deprecated or incomplete; do not rely on it.
|
||||
|
||||
> **None identified from source alone** for additional gotchas beyond those listed.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user