Files
DP44/docs/ai/DataPRO/IService/Classes/SLICE.md
2026-04-17 14:55:32 -04:00

216 lines
16 KiB
Markdown

---
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-17T15:30:50.633601+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "434d25165d2bfceb"
---
# SLICE Device Service Classes Documentation
## 1. Purpose
This module provides specialized implementations for various SLICE hardware devices (Data Acquisition Systems) within the DTS.DASLib.Service namespace. It contains device-specific classes that handle configuration, communication protocols, diagnostics, and real-time streaming for different SLICE variants including SLICE6DB3 (limited PTP support), SLICEPRODB (battery/distributor), SLICE6AIRBR (bridge recorder), and SLICE6AIRTC (thermocouple). The module also includes supporting classes for device discovery (`S6DBConnectedDevice`) and configuration event handling (`DASConfigurationArg`).
---
## 2. Public Interface
### DASConfigurationArg
**Namespace:** `DTS.DASLib.Service`
**Implements:** `IDASConfigurationArg`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DAS` | `IDASCommunication DAS { get; private set; }` | Gets the DAS communication interface associated with this configuration event. |
| `BlankConfigurationRead` | `bool BlankConfigurationRead { get; private set; }` | Indicates whether a blank configuration was read (used during emergency downloads with blank filestore). |
| `ConfigurationFailedValidation` | `bool ConfigurationFailedValidation { get; private set; }` | Indicates whether the configuration failed validation. |
| Constructor | `DASConfigurationArg(IDASCommunication das, bool blankRead, bool failedValidation)` | Constructs a new configuration argument with the specified DAS, blank read status, and validation status. |
---
### SLICE6DB3\<T\>
**Namespace:** `DTS.DASLib.Service`
**Base Class:** `SLICE6DB<T>`
**Constraint:** `where T : IConnection, new()`
A limited version of SLICE6DB without IEEE1588/PTP support.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SetClockSyncConfig` | `override void SetClockSyncConfig(ServiceCallback callback, object userData, ClockSyncProfile profile)` | No-op implementation that immediately reports success. |
| `GetClockSyncStatus` | `override void GetClockSyncStatus(ServiceCallback callback, object userData)` | No-op implementation that immediately reports success. |
| `SetPTPDomainID` | `override void SetPTPDomainID(ServiceCallback callback, object userData, byte domainID)` | No-op implementation that stores domainID in functionData and reports success. |
| `GetPTPDomainID` | `override void GetPTPDomainID(ServiceCallback callback, object userData)` | No-op implementation that immediately reports success. |
---
### S6DBConnectedDevice
**Namespace:** `DTS.DASLib.Service.Classes.SLICE`
**Implements:** `IDASConnectedDevice`
Describes a device connected to a S6DB as determined by `QAUTIL_QUERY_MAC_IP_TABLE`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DeviceType` | `HardwareTypes DeviceType { get; }` | The device type, defaults to `HardwareTypes.SLICE6_Base`. Changes to `HardwareTypes.SLICE6_AIR` if SerialNumber starts with "S6A". |
| `Port` | `int Port { get; private set; }` | The port the device is on (0-based, positive values valid, default -1). |
| `SpotOnPort` | `int SpotOnPort { get; private set; }` | Position on the chain/port (0-based, positive values valid, default -1). |
| `PhysicalAddress` | `PhysicalAddress PhysicalAddress { get; private set; }` | MAC address of the device. |
| `IPAddress` | `string IPAddress { get; private set; }` | IP address reported by device (default empty string). |
| `SerialNumber` | `string SerialNumber { get; private set; }` | Serial number of device (default empty string). |
| `Location` | `string Location { get; private set; }` | Location of device (default empty string). |
| `Version` | `string Version { get; private set; }` | Version of device (default empty string). |
| Constructor | `S6DBConnectedDevice(int port, int spotOnPort, PhysicalAddress physicalAddress, string ipAddress, string serialNumber, string location, string version)` | Constructs a new connected device record with all parameters. |
---
### SLICEPRODB\<T\>
**Namespace:** `DTS.DASLib.Service`
**Base Class:** `SLICE6DB<T>`
**Implements:** `IDownloadActions`
**Constraint:** `where T : IConnection, new()`
| Member | Signature | Description |
|--------|-----------|-------------|
| `QueryConnectedDevices` | `override void QueryConnectedDevices()` | No functionality for SLICEPRO DB; sets connected devices to empty array. |
| `IsSlice6Distributor` | `override bool IsSlice6Distributor()` | Returns `false`. |
| `IsBattery` | `override bool IsBattery()` | Returns `true`. |
| `SupportsTemperatureCheck` | `protected override bool SupportsTemperatureCheck { get; }` | Returns `true`. |
| `SupportsTiltCheck` | `protected override bool SupportsTiltCheck { get; }` | Returns `true`. |
| `SupportsClockSyncCheck` | `protected override bool SupportsClockSyncCheck { get; }` | Returns `true`. |
| `SupportsTimeSynchronization` | `public override bool SupportsTimeSynchronization { get; }` | Returns `false`. |
| `InitMinProto` | `public override void InitMinProto()` | Initializes protocol limitations dictionary with minimum protocol version 1 for supported commands and `byte.MaxValue` for unsupported commands (PTP, temperature log, tilt queries, Ethernet MAC table). |
| `AsyncQueryConfiguration` | `protected override void AsyncQueryConfiguration(object configAsyncInfo)` | Initializes minimum protocol, creates default config from info, and reports success. |
---
### SLICE6AIRBR\<T\>
**Namespace:** `DTS.DASLib.Service`
**Base Class:** `SLICE6_Base<T>`
**Implements:** `IAlignUDPToPPSAware`
**Constraint:** `where T : IConnection, new()`
Bridge recorder variant of SLICE6 AIR.
| Member | Signature | Description |
|--------|-----------|-------------|
| `AlignUDPToPPS` | `bool AlignUDPToPPS { get; set; }` | Gets or sets UDP to PPS alignment flag. |
| `SupportsRemoveLeapSeconds` | `public override bool SupportsRemoveLeapSeconds { get; }` | Returns `true`. |
| `SupportsADCSamplesPerPacket` | `public override bool SupportsADCSamplesPerPacket { get; }` | Returns `true`. |
| `RequiresNon0QualificationSamples` | `protected override bool RequiresNon0QualificationSamples { get; }` | Returns `true`. |
| `DASIndex` | `int DASIndex { get; set; }` | The order of this DAS among multiple DAS (default -1). |
| `SetIsStreamingSupported` | `public override void SetIsStreamingSupported(bool supported)` | Always sets `IsStreamingSupported = true`. |
| `InitMinProto` | `public override void InitMinProto()` | Initializes extensive protocol limitations dictionary for SLICE6 AIR BR. |
| `MaxSampleRateHz` | `protected override uint MaxSampleRateHz { get; }` | Lazy-loaded max sample rate, queries device via `QuerySystemAttributeSLICE6`. Falls back to 50000 on error. |
| `MakeConfigModuleFromInfoModule` | `protected override DASModule MakeConfigModuleFromInfoModule(InfoResult.Module infoModule)` | Creates DASModule with channels supporting FullBridge and HalfBridge types (no IEPE). |
| `AsyncConfigure` | `protected override void AsyncConfigure(object configAsyncInfo)` | Complex configuration method handling UDP alignment, leap seconds, ADC samples per packet, channel configuration, bridge modes, coupling, and level triggers. |
| `GetIsStreaming` | `public override bool GetIsStreaming()` | Returns true if `DASArmStatus.ReceivedInvalidModeDuringSetup` or `DASArmStatus.IsInRealtime`. |
---
### SLICE6AIRTC\<T\>
**Namespace:** `DTS.DASLib.Service`
**Base Class:** `SLICE6_Base<T>`
**Implements:** `IAlignUDPToPPSAware`, `IDASReconfigure`, `ITCDiagnosticResults`, `IUARTDownloadActions`, `IUARTDownload`
**Constraint:** `where T : IConnection, new()`
Thermocouple variant of SLICE6 AIR with UART download support.
| Member | Signature | Description |
|--------|-----------|-------------|
| `WhatUARTToDownload` | `IUARTDownloadRequest WhatUARTToDownload { get; set; }` | Gets or sets the UART download request. |
| `SetWhatUARTToDownload` | `void SetWhatUARTToDownload(IUARTDownloadRequest request, bool bSetInDb = true)` | Sets what to download via `UARTDownloadRequest.SetWhatToDownload`. |
| `BaudRate` | `uint BaudRate { get; private set; }` | UART baud rate setting. |
| `DataBits` | `uint DataBits { get; private set; }` | UART data bits setting. |
| `StopBits` | `StopBits StopBits { get; private set; }` | UART stop bits setting. |
| `Parity` | `Parity Parity { get; private set; }` | UART parity setting. |
| `FlowControl` | `Handshake FlowControl { get; private set; }` | UART flow control setting. |
| `DataFormat` | `UartDataFormat DataFormat { get; private set; }` | UART data format setting. |
| `TCDiagnosticResults` | `ITCDiagnosticResult[] TCDiagnosticResults { get; private set; }` | Array of 24 thermocouple diagnostic results. |
| `ClearTCDiagnosticResults` | `void ClearTCDiagnosticResults()` | Clears diagnostic results to empty array. |
| `SetTCDiagnosticResults` | `void SetTCDiagnosticResults(ITCDiagnosticResult[] results)` | Sets diagnostic results array. |
| `IsSlice6AirTc` | `public override bool IsSlice6AirTc()` | Returns `true`. |
| `GetMaxFileLengthTMATS` | `public override int GetMaxFileLengthTMATS()` | Returns `32000`. |
| `UARTDownload` | `public void UARTDownload(ServiceCallback callback, object userData)` | Returns error "Not supported". |
| `QueryUARTDownload` (explicit) | `void IUARTDownloadActions.QueryUARTDownload(ServiceCallback callback, object userData, int eventIndex, TDASServiceSetupInfo setupInfo)` | Queries UART download availability. |
| `GetUARTSettings` (explicit) | `void IUARTDownloadActions.GetUARTSettings(ServiceCallback callback, object userData)` | Retrieves UART settings via `QuerySystemAttributeSLICE6AIR`. |
| `SetUARTSettings` (explicit) | `void IUARTDownloadActions.SetUARTSettings(ServiceCallback callback, object userData, uint baudRate, uint dataBits, uint stopBits, uint parity, uint flowControl)` | Sets UART settings via `SetSystemAttributeSLICE6AIR`. |
| `SetMaxModuleCount` (explicit) | `void IDASReconfigure.SetMaxModuleCount(int count)` | Sets the maximum module count. |
| `GetMaxModuleCount` (explicit) | `int IDASReconfigure.GetMaxModuleCount()` | Gets the cached maximum module count. |
| `GetStackChannelConfigTypes` | `public override int[] GetStackChannelConfigTypes()` | Queries arm attribute for stack channel config types. |
| `InitMinProto` | `public override void InitMinProto()` | Initializes protocol limitations for SLICE6 AIR TC including UART settings commands. |
| `GetRTChannelIndices` | `protected override byte[] GetRTChannelIndices(RealTimeAsyncPacket packet)` | Returns channel indices based on `_maxModuleCount`: 8 channels (0 modules), 16 channels (1 module), or 24 channels (2+ modules). |
| `GetRealtimeSamplesClass` | `protected override IGetRealtimeSamples GetRealtimeSamplesClass(ICommunication iCommunication, bool bPolling = false)` | Returns `RealtimeStreamingNextSamples` with `SignedData = true` if streaming supported, otherwise falls back to base implementation. |
---
## 3. Invariants
- **S6DBConnectedDevice.Port** and **SpotOnPort**: Only positive values are valid; default is -1 (invalid state).
- **S6DBConnectedDevice.DeviceType**: Defaults to `HardwareTypes.SLICE6_Base` but changes to `HardwareTypes.SLICE6_AIR` if SerialNumber starts with "S6A".
- **SLICEPRODB**: Always returns `false` for `IsSlice6Distributor()` and `true` for `IsBattery()`.
- **SLICEPRODB**: `QueryConnectedDevices()` always sets an empty connected devices array.
- **SLICE6AIRBR/SLICE6AIRTC**: `SetIsStreamingSupported()` always sets `IsStreamingSupported = true` regardless of parameter.
- **SLICE6AIRTC.TCDiagnosticResults**: Initialized with 24 elements (indexed 0-23).
- **SLICE6AIRTC.GetRTChannelIndices**: Returns 8, 16, or 24 channel indices based on `_maxModuleCount` value.
- **SLICE6DB3**: All clock sync and PTP methods are no-ops that immediately report success without performing actual operations.
- **Protocol limitations**: Commands with `byte.MaxValue` protocol version are unsupported; commands with `MIN_PROTOCOL_VER` (1) are supported.
---
## 4. Dependencies
### External Dependencies (Imports):
- `DTS.Common.Interface.Connection` - Connection interfaces (`IConnection`)
- `DTS.Common.Interface.DASFactory` - DAS factory interfaces (`IDASCommunication`, `IDASConfigurationArg`, `ICommunication`, `IDASConnectedDevice`, `IDASReconfigure`, `ITCDiagnosticResult`, `IUARTDownload`, `IUARTDownloadActions`, `IUARTDownloadRequest`)
- `DTS.Common.Interface.DASFactory.Config` - Configuration types (`DASModule`, `DASChannel`, `AnalogInputDASChannel`, `StreamOutputDASChannel`, `UARTInputDASChannel`)
- `DTS.Common.Interface.Communication` - Communication interfaces
- `DTS.Common.Enums.DASFactory` - Enums and constants (`DFConstantsAndEnums`, `ProtocolLimitedCommands`, `ModuleType`)
- `DTS.Common.Enums.Hardware` - Hardware type enums (`HardwareTypes`)
- `DTS.Common.Enums.Sensors` - Sensor enums (`SensorConstants.BridgeType`)
- `DTS.Common.Constant.DASSpecific` - DAS-specific constants (`SLICE6AIRBR`, `SLICE6AIRTC`)
- `DTS.Common.ICommunication` - Communication types (`InfoResult`, `RealTimeAsyncPacket`)
- `DTS.Common.Utilities.Logging` - Logging (`APILogger`)
- `DTS.Common.Utils` - Utility functions (`Utils.IsZero`, `Utils.AlmostEqual`)
- `DTS.Common.Classes.DASFactory` - DAS factory classes
- `DTS.Common.Enums` - General enums
- `DTS.DASLib.Command.SLICE` - SLICE command classes (`QuerySystemAttributeSLICE6`, `SetSystemAttributeSLICE6AIR`, `QueryChannelShuntResults`, `RetrieveSampleAverage`, `QueryArmAttribute`)
- `DTS.DASLib.Command.SLICE.RealtimeCommands` - Realtime command classes (`RealtimeStreamingNextSamples`)
- `DTS.DASLib.Command` - Base command classes (`AbstractCommandBase`)
- `DTS.DASLib.Service.Interfaces` - Service interfaces (`IDownloadActions`)
- `System.Net.NetworkInformation` - `PhysicalAddress` class
- `System.IO.Ports` - Serial port enums (`StopBits`, `Parity`, `Handshake`)
- `System.Collections.Generic`
### Inferred Dependents:
- Classes inherit from `SLICE6DB<T>` and `SLICE6_Base<T>` (not provided in source), suggesting a class hierarchy for SLICE device implementations.
- `SliceServiceAsyncInfo`, `SliceConfigServiceAsyncInfo`, `QueryDownloadAsyncInfo`, `SetUARTSettingsAsyncInfo`, `SliceUARTDownloadState` are used but not defined in provided source.
---
## 5. Gotchas
1. **SLICE6DB3 PTP No-ops**: The `SetClockSyncConfig`, `GetClockSyncStatus`, `SetPTPDomainID`, and `GetPTPDomainID` methods in `SLICE6DB3` are no-ops that immediately call `Success()` without performing any actual device communication. Code expecting real PTP functionality will silently succeed without effect.
2. **SLICEPRODB IsBattery Ambiguity**: The `IsBattery()` method returns `true` with the comment "um maybe?", indicating uncertainty about the correctness of this implementation.
3. **SLICE6AIRBR SetIsStreamingSupported Ignores Parameter**: The `SetIsStreamingSupported(bool supported)` method ignores its parameter and always sets `IsStreamingSupported = true`.
4. **SLICE6AIRTC UARTDownload Not Supported**: The `UARTDownload` method immediately returns an error "Not supported" despite the class implementing `IUARTDownload`.
5. **SLICE6AIRTC GetIsStreaming Dual Condition**: The streaming status check uses `DASArmStatus.ReceivedInvalidModeDuringSetup || DASArmStatus.IsInRealtime` - the comment references bug 18852 indicating this is a workaround for unreliable status detection.
6. **SLICE6AIRTC Failure Threshold**: UART settings methods track `straightFailures` and only report errors after exceeding `PERMITTED_FAILURES` (constant not defined in provided source), otherwise silently succeeding on failure.
7. **SLICE6AIRBR MaxSampleRateHz Fallback**: On error querying max sample rate, returns hardcoded 50000 Hz with a log message, potentially masking device communication issues.
8. **S6DBConnectedDevice Default Values**: Port and SpotOnPort default to -1 (invalid), and string properties default to empty strings. Consumers must check validity before use.
9. **SLICE6AIRTC S6ATCConfigAttributes No-ops**: The nested `S6ATCConfigAttributes` class overrides `ConfigureCoupling`, `ConfigureBridge`, and `ConfigureBridgeResistance` as no-ops, which could cause confusion if bridge configuration is expected.