init
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.CommonCore/Interface/Networking/INetworkingView.cs
|
||||
- Common/DTS.CommonCore/Interface/Networking/INetworkAdapterView.cs
|
||||
- Common/DTS.CommonCore/Interface/Networking/INetworkAdapterViewModel.cs
|
||||
- Common/DTS.CommonCore/Interface/Networking/INetworkingViewModel.cs
|
||||
generated_at: "2026-04-16T02:19:48.560146+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9f8faed114584889"
|
||||
---
|
||||
|
||||
# Networking
|
||||
|
||||
## Documentation: Networking Interface Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of interfaces that establish the contract for networking-related UI and ViewModel layers within the application’s MVVM (Model-View-ViewModel) architecture. It enables separation of concerns by decoupling networking functionality (e.g., multicast configuration, network adapter selection) from concrete implementations, supporting testability and modularity. Specifically, it provides typed interfaces for views (`INetworkingView`, `INetworkAdapterView`) and view models (`INetworkingViewModel`, `INetworkAdapterViewModel`) that manage network adapter state and SLICE6 multicast communication parameters.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `INetworkingView`
|
||||
- **Signature**: `public interface INetworkingView : IBaseView`
|
||||
- **Behavior**: Represents the view layer for the networking UI. Inherits from `IBaseView`, implying it participates in the base view lifecycle (e.g., binding, initialization). No additional members defined—acts as a marker interface for networking-specific views.
|
||||
|
||||
#### `INetworkAdapterView`
|
||||
- **Signature**: `public interface INetworkAdapterView : IBaseView`
|
||||
- **Behavior**: Represents the view layer for network adapter selection UI. Like `INetworkingView`, it is a marker interface inheriting `IBaseView`, used to identify views responsible for network adapter presentation.
|
||||
|
||||
#### `INetworkAdapterViewModel`
|
||||
- **Signature**: `public interface INetworkAdapterViewModel : IBaseViewModel`
|
||||
- **Behavior**: Manages state for network adapter selection. Exposes a single property:
|
||||
- `SelectedNetworkInterface`: Gets or sets the currently selected `System.Net.NetworkInformation.NetworkInterface`. This is the core data point for adapter-related logic.
|
||||
|
||||
#### `INetworkingViewModel`
|
||||
- **Signature**: `public interface INetworkingViewModel : IBaseViewModel`
|
||||
- **Behavior**: Coordinates high-level networking configuration, particularly for SLICE6 multicast communication. Key members:
|
||||
- `View`: Gets or sets the associated `INetworkingView` instance (enabling view-model-to-view binding).
|
||||
- `SLICE6MulticastAddress`: Gets or sets the IPv6 multicast address (e.g., `"ff02::1:2"`) as a `string`.
|
||||
- `SLICE6MulticastAddressHasError`: Gets a `bool` indicating whether the current `SLICE6MulticastAddress` value is invalid (e.g., malformed or unreachable).
|
||||
- `SLICE6MulticastCommandPort`: Gets or sets the UDP port used for sending multicast commands (e.g., `5000`).
|
||||
- `SLICE6MulticastResponsePort`: Gets or sets the UDP port used for receiving multicast responses (e.g., `5001`).
|
||||
- `SetStatus(StatusInfo.StatusState status, string message = "", decimal percentage = -1, int processId = 0)`: Updates the UI status (e.g., progress, error, success) via the view. Parameters align with `StatusInfo.StatusState` (from `DTS.Common.Base`) and support optional progress/message context.
|
||||
|
||||
### 3. Invariants
|
||||
- **`INetworkingViewModel`**:
|
||||
- `SLICE6MulticastAddressHasError` must be `true` if and only if `SLICE6MulticastAddress` is syntactically invalid or otherwise unusable (e.g., not a valid IPv6 multicast address).
|
||||
- `SLICE6MulticastCommandPort` and `SLICE6MulticastResponsePort` must be valid port numbers (0–65535), though validation is not enforced by the interface itself.
|
||||
- `View` must be assigned before `SetStatus` is called; otherwise, behavior is undefined (no null-safety guaranteed in interface).
|
||||
- **`INetworkAdapterViewModel`**:
|
||||
- `SelectedNetworkInterface` may be `null` (e.g., if no adapter is selected), but implementations are expected to handle null gracefully (e.g., disable dependent operations).
|
||||
- **General**: All interfaces extend `IBaseViewModel`/`IBaseView`, implying adherence to base lifecycle contracts (e.g., disposal, initialization), though specifics are defined in `DTS.Common.Base`.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `DTS.Common.Base` (provides `IBaseView`, `IBaseViewModel`, and `StatusInfo.StatusState`).
|
||||
- `System.Net.NetworkInformation` (for `NetworkInterface`).
|
||||
- `System.Collections.Generic`, `System.Threading.Tasks`, `DTS.Common.Events` (via `INetworkingViewModel`, though no methods use them directly—likely for future extensibility or internal implementation).
|
||||
- **Depended on by**:
|
||||
- Concrete implementations of networking views (e.g., WPF/WinForms UI pages) and view models (e.g., `NetworkingViewModel`, `NetworkAdapterViewModel`).
|
||||
- Likely consumed by higher-level modules managing network configuration, device discovery, or SLICE6 protocol communication (inferred from `SLICE6Multicast*` naming).
|
||||
|
||||
### 5. Gotchas
|
||||
- **`SLICE6MulticastAddressHasError` is read-only**: Validation state is exposed via a getter, but the interface provides no method to explicitly trigger validation. Implementations must self-validate (e.g., on property setter or external events).
|
||||
- **No explicit error details**: `SLICE6MulticastAddressHasError` only indicates *whether* an error exists, not *why*. Consumers must parse `SLICE6MulticastAddress` or rely on implementation-specific logging.
|
||||
- **`SetStatus` signature is generic**: The method uses `StatusInfo.StatusState` (from `DTS.Common.Base`), but the interface does not define what states exist (e.g., `Idle`, `Processing`, `Error`). Consumers must reference `StatusInfo` to interpret status transitions.
|
||||
- **No async support in `INetworkingViewModel`**: Despite `System.Threading.Tasks` being imported, no async methods are declared—suggesting networking operations may be handled elsewhere or via side effects.
|
||||
- **`View` property is bidirectional but unenforced**: While `INetworkingViewModel` exposes a `View` property, the interface does not specify when it must be set (e.g., during construction vs. binding). Null assignments may cause runtime failures in `SetStatus`.
|
||||
|
||||
None identified beyond the above.
|
||||
Reference in New Issue
Block a user