Files

216 lines
15 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/IService/Classes/SLICE/DASConfigurationEventArg.cs
- DataPRO/IService/Classes/SLICE/SLICE6DB3.cs
- DataPRO/IService/Classes/SLICE/S6DBConnectedDevice.cs
- DataPRO/IService/Classes/SLICE/SLICEPRODB.cs
- DataPRO/IService/Classes/SLICE/SLICE6AIRBR.cs
- DataPRO/IService/Classes/SLICE/SLICE6AIRTC.cs
generated_at: "2026-04-16T03:58:03.811712+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "4572c24a2832d452"
---
# SLICE
**Documentation Page: SLICE DAS Device Implementations and Configuration Events**
---
### 1. Purpose
This module provides concrete implementations of DAS (Data Acquisition System) device types for the SLICE family (SLICE6DB3, SLICEPRODB, SLICE6AIRBR, SLICE6AIRTC), each tailored to specific hardware capabilities and protocol support levels. It also defines `DASConfigurationArg`, a data carrier for the `DASConfigurationEvent`, enabling consumers to react to configuration read outcomes (e.g., blank configs, validation failures). These classes implement core DAS functionality—configuration, diagnostics, clock synchronization, and real-time streaming—while accounting for hardware-specific limitations and protocol versioning. The module serves as the runtime bridge between high-level service logic and low-level device communication, ensuring correct behavior per device variant.
---
### 2. Public Interface
#### `DASConfigurationArg`
- **Namespace**: `DTS.DASLib.Service`
- **Implements**: `IDASConfigurationArg`
- **Purpose**: Encapsulates state passed during a `DASConfigurationEvent`.
| Member | Type | Description |
|--------|------|-------------|
| `DAS` | `IDASCommunication` | The DAS instance whose configuration event occurred. Read-only. |
| `BlankConfigurationRead` | `bool` | `true` if the configuration loaded from disk was blank (e.g., empty filestore). Read-only. |
| `ConfigurationFailedValidation` | `bool` | `true` if the loaded configuration failed validation. Read-only. |
| **Constructor** | `DASConfigurationArg(IDASCommunication das, bool blankRead, bool failedValidation)` | Initializes the event args with the given state. |
#### `SLICE6DB3<T>`
- **Namespace**: `DTS.DASLib.Service`
- **Inherits**: `SLICE6DB<T>`
- **Constraints**: `T : IConnection, new()`
- **Purpose**: A limited SLICE6DB variant without PTP/IEEE 1588 support.
| Member | Type | Description |
|--------|------|-------------|
| `SetClockSyncConfig(ServiceCallback callback, object userData, ClockSyncProfile profile)` | `override void` | No-op; returns success immediately. Clock sync not supported. |
| `GetClockSyncStatus(ServiceCallback callback, object userData)` | `override void` | No-op; returns success immediately. |
| `SetPTPDomainID(ServiceCallback callback, object userData, byte domainID)` | `override void` | No-op; returns success immediately. PTP not supported. |
| `GetPTPDomainID(ServiceCallback callback, object userData)` | `override void` | No-op; returns success immediately. |
#### `S6DBConnectedDevice`
- **Namespace**: `DTS.DASLib.Service.Classes.SLICE`
- **Implements**: `IDASConnectedDevice`
- **Purpose**: Represents a device discovered on a SLICE6DB via `QAUTIL_QUERY_MAC_IP_TABLE`.
| Member | Type | Description |
|--------|------|-------------|
| `DeviceType` | `HardwareTypes` | Default `HardwareTypes.SLICE6_Base`; set to `HardwareTypes.SLICE6_AIR` if `SerialNumber` starts with `"S6A"`. Read-only. |
| `Port` | `int` | 0-based port index. Valid only if ≥ 0. Default `-1`. |
| `SpotOnPort` | `int` | 0-based position on the port/chain. Valid only if ≥ 0. Default `-1`. |
| `PhysicalAddress` | `PhysicalAddress` | MAC address of the device. |
| `IPAddress` | `string` | IP address reported by device. Default `""`. |
| `SerialNumber` | `string` | Device serial number. Default `""`. |
| `Location` | `string` | Device location string. Default `""`. |
| `Version` | `string` | Device firmware version. Default `""`. |
| **Constructor** | `S6DBConnectedDevice(int port, int spotOnPort, PhysicalAddress physicalAddress, string ipAddress, string serialNumber, string location, string version)` | Initializes all fields; updates `DeviceType` if `SerialNumber` starts with `"S6A"`. |
#### `SLICEPRODB<T>`
- **Namespace**: `DTS.DASLib.Service`
- **Inherits**: `SLICE6DB<T>`, implements `IDownloadActions`
- **Constraints**: `T : IConnection, new()`
- **Purpose**: SLICEPRO DB variant with limited protocol support (e.g., no MAC table query, no PTP).
| Member | Type | Description |
|--------|------|-------------|
| `QueryConnectedDevices()` | `override void` | No-op; sets `ConnectedDevices` to an empty array. |
| `IsSlice6Distributor()` | `override bool` | Returns `false`. |
| `IsBattery()` | `override bool` | Returns `true` (comment: “um maybe?”). |
| `SupportsTimeSynchronization` | `override bool` | Returns `false`. |
| `SupportsTemperatureCheck` | `protected override bool` | Returns `true`. |
| `SupportsTiltCheck` | `protected override bool` | Returns `true`. |
| `SupportsClockSyncCheck` | `protected override bool` | Returns `true`. |
| `InitMinProto()` | `override void` | Populates `MinimumProtocols` dictionary with protocol version requirements. Key commands with `byte.MaxValue` are unsupported (e.g., `PTPSyncStatus`, `SetClockSyncConfig`, `QueryEthernetMacTable`). |
| `MinimumProtocols` | `Dictionary<ProtocolLimitedCommands, byte>` | Inherited from base; set in `InitMinProto()`. |
#### `SLICE6AIRBR<T>`
- **Namespace**: `DTS.DASLib.Service`
- **Inherits**: `SLICE6_Base<T>`, implements `IAlignUDPToPPSAware`
- **Constraints**: `T : IConnection, new()`
- **Purpose**: SLICE6 AIR BR variant with PTP, UDP alignment, and full feature set.
| Member | Type | Description |
|--------|------|-------------|
| `AlignUDPToPPS` | `bool` | Property to configure UDP alignment to PPS. |
| `SupportsRemoveLeapSeconds` | `override bool` | Returns `true`. |
| `SupportsADCSamplesPerPacket` | `override bool` | Returns `true`. |
| `RequiresNon0QualificationSamples` | `protected override bool` | Returns `true`. |
| `GetRTChannelIndices(RealTimeAsyncPacket packet)` | `override byte[]` | Returns channel indices `[0x00..0x05]` (6 channels). |
| `SetIsStreamingSupported(bool)` | `override void` | Sets `IsStreamingSupported = true`. |
| `DASIndex` | `int` | Device order among multiple DAS units. Default `-1`. |
| `InitMinProto()` | `override void` | Populates `SLICE6AIR_BR_MinimumProtocols` dictionary. Includes protocol versions for `UDPAlignOnPPS` (`UDPALIGNONPPS_PROTOCOL`) and `ADCSamplesPerPacket` (`ADC_SAMPLES_PER_PACKET_VER`). |
| `MaxSampleRateHz` | `protected override uint` | Queries `MaximumSampleRate` system attribute; returns `50000` on error. |
| `MakeConfigModuleFromInfoModule(InfoResult.Module)` | `override DASModule` | Creates `DASModule` with `AnalogInputDASChannel` (full/half bridge support) or `StreamOutputDASChannel`. |
| `AsyncConfigure(object)` | `override void` | Full configuration flow: sets UDP/PPS, leap seconds, ADC samples/packet, resets event list, configures modules, stores attributes, and calls `RemainingConfigWork`. |
| `GetIsStreaming()` | `override bool` | Returns `true` if `DASArmStatus.ReceivedInvalidModeDuringSetup` or `DASArmStatus.IsInRealtime`. |
#### `SLICE6AIRTC<T>`
- **Namespace**: `DTS.DASLib.Service`
- **Inherits**: `SLICE6_Base<T>`, implements `IAlignUDPToPPSAware`, `IDASReconfigure`, `ITCDiagnosticResults`, `IUARTDownloadActions`, `IUARTDownload`
- **Constraints**: `T : IConnection, new()`
- **Purpose**: SLICE6 AIR TC variant with thermocouple diagnostics, UART support, and PTP.
| Member | Type | Description |
|--------|------|-------------|
| `WhatUARTToDownload` | `IUARTDownloadRequest` | Request object for UART event download. |
| `SetWhatUARTToDownload(IUARTDownloadRequest, bool)` | `void` | Delegates to `UARTDownloadRequest.SetWhatToDownload`. |
| `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl` | `uint` / `StopBits` / `Parity` / `Handshake` | UART settings. Populated by `AsyncGetUARTSettings`. |
| `UARTDownload(ServiceCallback, object)` | `void` | Returns `"Not supported"` error. |
| `QueryUARTDownload(ServiceCallback, object, int, TDASServiceSetupInfo)` | `void` | Launches `AsyncQueryUARTDownload`. |
| `AsyncQueryUARTDownload(object)` | `protected virtual void` | Checks `IsCommandSupported(ProtocolLimitedCommands.QueryUARTDownload)`; errors if unsupported. |
| `GetUARTSettings(ServiceCallback, object)` | `void` | Launches `AsyncGetUARTSettings`. |
| `AsyncGetUARTSettings(object)` | `protected virtual void` | Queries `S6A_GpsCanUARTSettings` system attribute; populates UART fields. Handles retries (`PERMITTED_FAILURES`). |
| `SetUARTSettings(ServiceCallback, object, uint, uint, uint, uint, uint)` | `void` | Launches `AsyncSetUARTSettings`. |
| `AsyncSetUARTSettings(object)` | `protected virtual void` | Sets `S6A_GpsCanUARTSettings` system attribute. |
| `TCDiagnosticResults` | `ITCDiagnosticResult[]` | Array of thermocouple diagnostic results. |
| `ClearTCDiagnosticResults()` | `void` | Resets `TCDiagnosticResults` to empty array. |
| `SetTCDiagnosticResults(ITCDiagnosticResult[])` | `void` | Sets `TCDiagnosticResults`. |
| `InitializeTCDiagnostics()` | `private void` | Allocates 24 `TCDiagnosticResult` entries, one per channel. |
| `AsyncDiagnosAndGetResults(object)` | `override void` | Initializes diagnostics, then calls `MeasureOffsets` and `MeasureShunts`. |
| `MeasureShunts(SliceServiceAsyncInfo)` | `private bool` | Queries `QueryChannelShuntResults`; sets `ConnectionStatus` based on deflection values (`0``ModuleNotConnected`, `100``Connected`). |
| `MeasureOffsets(SliceServiceAsyncInfo)` | `private bool` | Queries `RetrieveSampleAverage` (4000 samples); sets `CurrentReading` (scaled by `0.1`). |
| `GetChannelName(int)` | `private string` | Returns `UserChannelName` or `IsoChannelName` for given channel index. |
| `IsSlice6AirTc()` | `override bool` | Returns `true`. |
| `GetMaxFileLengthTMATS()` | `override int` | Returns `MAX_TMATS_FILE_LENGTH` (32000). |
| `AlignUDPToPPS` | `bool` | Property to configure UDP alignment to PPS. |
| `SupportsRemoveLeapSeconds` | `override bool` | Returns `true`. |
| `SupportsADCSamplesPerPacket` | `override bool` | Returns `true`. |
| `RequiresNon0QualificationSamples` | `protected override bool` | Returns `true`. |
| `GetRTChannelIndices(RealTimeAsyncPacket)` | `override byte[]` | Returns channel indices based on `_maxModuleCount`: 8, 16, or 24 channels. |
| `GetRealtimeSamplesClass(ICommunication, bool)` | `override IGetRealtimeSamples` | Returns `RealtimeStreamingNextSamples` (signed data) if streaming supported. |
| `SetIsStreamingSupported(bool)` | `override void` | Sets `IsStreamingSupported = true`. |
| `InitMinProto()` | `override void` | Populates `SLICE6AIR_TC_MinimumProtocols` dictionary. Includes `GetUARTSettings`, `SetUARTSettings`, `AutoArmUDPSetting`. |
| `GetConfigAttributes(ICommunication)` | `override ConfigAttributes` | Returns `S6ATCConfigAttributes` (bridge/AC-coupling NOOPs). |
| `MakeConfigModuleFromInfoModule(InfoResult.Module)` | `override DASModule` | Creates `DASModule` with `AnalogInputDASChannel`, `StreamOutputDASChannel`, or `UARTInputDASChannel`. |
| `AsyncConfigure(object)` | `override void` | Similar to `SLICE6AIRBR`, but includes `numUart` in `StoreConfigAttributes`. |
| `GetIsStreaming()` | `override bool` | Same logic as `SLICE6AIRBR`. |
| `GetStackChannelConfigTypes()` | `override int[]` | Queries `StackChannelConfigType` attribute; returns array of channel types or `[0]` on error. |
---
### 3. Invariants
- **`DASConfigurationArg`**:
- `BlankConfigurationRead` and `ConfigurationFailedValidation` are mutually independent; both may be `true` or `false`.
- `DAS` is non-null at construction (enforced by caller).
- **`S6DBConnectedDevice`**:
- `Port` and `SpotOnPort` are valid only when ≥ 0. Negative values indicate uninitialized state.
- `DeviceType` is derived solely from `SerialNumber.StartsWith("S6A")`; no other logic modifies it.
- **`SLICE6DB3<T>`**:
- All clock sync and PTP methods are no-ops; they never query the device or throw exceptions.
- `SupportsTimeSynchronization` is always `false`.
- **`SLICEPRODB<T>`**:
- `QueryConnectedDevices()` always sets `ConnectedDevices` to an empty array.
- `IsSlice6Distributor()` is always `false`.
- `IsBattery()` is hardcoded to `true`.
- Protocol commands with `byte.MaxValue` in `MinimumProtocols` are unsupported and must not be invoked.
- **`SLICE6AIRBR<T>` / `SLICE6AIRTC<T>`**:
- `GetIsStreaming()` relies on `DASArmStatus` flags (`ReceivedInvalidModeDuringSetup`, `IsInRealtime`); returns `false` if `DASArmStatus` is `null`.
- `MaxSampleRateHz` caches the value after first query; errors default to `50000`.
- `GetRTChannelIndices()` returns channel indices based on `_maxModuleCount` (0 → 8, 1 → 16, ≥2 → 24).
- `AsyncConfigure` always calls `ResetEventListPriorToConfigure()` before configuration.
---
### 4. Dependencies
#### Imports/Usings
- **Common Infrastructure**:
- `DTS.Common.Interface.DASFactory` (`IDASCommunication`, `IDASConfigurationArg`, `DASModule`, `DASChannel`, `DASInfo`, etc.)
- `DTS.Common.Interface.Connection` (`IConnection`)
- `DTS.Common.Interface.Communication` (`ICommunication`)
- `DTS.Common.Enums.Hardware` (`HardwareTypes`)
- `DTS.Common.Enums.Sensors` (`SensorConstants.BridgeType`)
- `DTS.Common.Constant.DASSpecific` (e.g., `AttributeTypes`, `DFConstantsAndEnums`)
- `DTS.Common.Utilities.Logging` (`APILogger`)
- `DTS.DASLib.Command.SLICE` (e.g., `QuerySystemAttributeSLICE6`, `SetSystemAttributeSLICE6AIR`, `RetrieveSampleAverage`, `QueryChannelShuntResults`)
#### Inheritance Hierarchy
- `SLICE6DB3<T>`, `SLICEPRODB<T>`, `SLICE6AIRBR<T>`, `SLICE6AIRTC<T>` all inherit from `SLICE6DB<T>` or `SLICE6_Base<T>`.
- `SLICE6_Base<T>` likely inherits from a base `DAS` class implementing `IDASCommunication`.
#### Usage Inferred From Source
- `SLICE6AIRBR<T>` and `SLICE6AIRTC<T>` are used for devices requiring advanced features (PTP, UDP alignment, thermocouple diagnostics).
- `SLICE6DB3<T>` is used for devices without PTP.
- `SLICEPRODB<T>` is used for battery-powered or simplified units.
- `S6DBConnectedDevice` is populated by `QueryConnectedDevices()` in other classes (e.g., `SLICE6DB` base), though `SLICEPRODB` overrides it to do nothing.
---
### 5. Gotchas
- **`SLICEPRODB<T>.IsBattery()`**: Comment `//um maybe?` suggests uncertainty or incomplete validation. Verify behavior with hardware team.
- **`SLICE6DB3<T>` Clock Sync Methods**: All clock sync/PTP methods are no-ops and silently succeed. Calling code must not assume actual configuration occurred.
- **`S6DBConnectedDevice.DeviceType`**: Only updates to `SLICE6_AIR` if `SerialNumber.StartsWith("S6A")`; no other device type detection logic exists.
- **`SLICE6AIRBR<T>.GetRTChannelIndices()`**: Returns only 6 channels (`0x00..0x05`), regardless of `_maxModuleCount`. This may be intentional for BR variant.
- **`SLICE6AIRTC<T>.AsyncConfigure()`**: Includes `numUart` in `StoreConfigAttributes`, but `MakeConfigModuleFromInfoModule` creates `UARTInputDASChannel` only if `ModuleType.UART == configModule.ModuleType()`. Ensure `InfoResult.Module.TypeOfModule` is correctly set.
- **`SLICE6AIRTC<T>.UARTDownload()`**: Explicitly returns `"Not supported"`; callers must check `WhatUARTToDownload` and use `QueryUARTDownload`/`GetUARTSettings` instead.
- **`SLICE6AIRBR<T>`/`SLICE6AIRTC<T>` `MaxSampleRateHz`**: Caching may cause stale values if firmware changes dynamically. Re-query may be needed on reconnection.
- **Protocol Versioning**: Commands with