init
This commit is contained in:
@@ -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.
|
||||
Reference in New Issue
Block a user