Files

82 lines
5.5 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Interface/Realtime/IRealtimeChannelSelectView.cs
- Common/DTS.Common/Interface/Realtime/IRealtimeChannelSelectViewModel.cs
- Common/DTS.Common/Interface/Realtime/IRealtimeChannel.cs
generated_at: "2026-04-16T03:01:17.710649+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "bf3c4958ff00a0d7"
---
# Realtime
## Documentation: Realtime Channel Selection Module
### 1. Purpose
This module defines the foundational interfaces for a channel selection UI component in the Realtime domain. It establishes the contract between the view (`IRealtimeChannelSelectView`), its associated view model (`IRealtimeChannelSelectViewModel`), and the data model for individual channels (`IRealtimeChannel`). Its role is to enable users to select from a list of available real-time measurement channels—each representing a sensor or data source—while supporting search, channel population, and selection state management. It serves as the UI layer abstraction for channel selection workflows in real-time monitoring or analysis applications.
### 2. Public Interface
#### `IRealtimeChannelSelectView`
- **Inherits**: `IBaseView`
- **Description**: A marker interface representing the view layer for channel selection. It carries no additional members beyond its base contract, implying the view implementation is expected to be driven entirely by its associated view model.
#### `IRealtimeChannelSelectViewModel`
- **Inherits**: `IBaseViewModel`
- **Properties**:
- `IRealtimeChannelSelectView ChannelSelectView { get; set; }`
Gets or sets the view instance bound to this view model. Enables two-way binding or manual view assignment.
- **Methods**:
- `void SetAvailableChannels(IRealtimeChannel[] channels)`
Populates the list of selectable channels. The view should render these channels (e.g., in a dropdown or list).
- `void SetSearchText(string searchText)`
Sets the current search/filter text input. The view/model should use this to filter the available channels.
- `void SetRealtimeChannel(IRealtimeChannel channel)`
Records the users selection of a specific channel. This likely triggers state updates or navigation in the broader UI flow.
#### `IRealtimeChannel`
- **Description**: Represents a single real-time data channel (e.g., a sensor output). Provides metadata and identification for display and logic purposes.
- **Properties**:
- `double Capacity`
- `int DisplayOrder`
- `string SensorName`
- `string ChannelName`
- `string[] DasNames`
- `string SensorSerial`
- `string Units`
- `string UserValue1`
- `string GroupName`
- `string DisplayUnit`
- `string HardwareChannelString`
- `string ISOCode`
- `string SensorsString`
- `string DasName`
- `string GetId()` *(method, not property)*
- `bool HasPassedLevelTrigger`
- `string Name`
- **Note**: `GetId()` is declared as a method, not a property, despite other identifiers being properties.
### 3. Invariants
- **Channel Identity**: Each `IRealtimeChannel` must provide a unique identifier via `GetId()` (implied by naming and usage, though not explicitly stated in the interface).
- **Display Consistency**: `DisplayOrder` and `GroupName` likely govern UI ordering/grouping, but no ordering guarantees are enforced by the interface itself.
- **Search Filtering**: `SetSearchText` is expected to filter the list provided via `SetAvailableChannels`, but the interface does not specify *how* filtering is implemented (e.g., substring match, case sensitivity).
- **Selection State**: `SetRealtimeChannel` implies a single active selection, but the interface does not enforce uniqueness or prevent null/invalid selections.
- **Null Safety**: No nullability annotations or guarantees are present in the source; implementations must handle nulls (e.g., `channels` array, `searchText`, or `channel` parameter).
### 4. Dependencies
- **Depends On**:
- `DTS.Common.Base.IBaseView` and `DTS.Common.Base.IBaseViewModel` (via inheritance).
- **Depended On By**:
- Any module implementing or consuming the channel selection UI (e.g., a real-time dashboard, configuration wizard, or channel setup screen).
- Concrete implementations of `IRealtimeChannel` (e.g., sensor data adapters) must be provided by other modules.
- **No direct dependencies** on other `DTS.Common.Interface.Realtime` interfaces beyond `IRealtimeChannel` and itself.
### 5. Gotchas
- **`GetId()` is a method, not a property**: This is inconsistent with other identifier-like properties (`SensorSerial`, `ISOCode`, etc.) and may cause confusion or misuse (e.g., expecting `channel.Id` syntax).
- **Ambiguous `DasNames` vs. `DasName`**: `DasNames` is an array (`string[]`), while `DasName` is a single `string`. Their relationship and which to use for display/logic is not clarified.
- **No validation on `SetAvailableChannels`**: Passing `null`, empty, or duplicate channels is not guarded against by the interface.
- **No event/notification mechanism**: The interface provides no way to notify consumers when selection changes (e.g., via event or callback), implying selection state must be polled or handled externally.
- **`UserValue1` purpose unclear**: Its meaning is undocumented; may be legacy or domain-specific.
- **No ordering guarantee**: `DisplayOrder` exists but is not used in the interface methods—implementation may ignore it.
- **None identified from source alone** for behavior beyond the above (e.g., thread-safety, lifecycle, or concurrency rules are not specified).