Files

221 lines
17 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/IService/Interfaces/IAutoArmStatus.cs
- DataPRO/IService/Interfaces/ITimeActions.cs
- DataPRO/IService/Interfaces/IService.cs
- DataPRO/IService/Interfaces/IRealtime.cs
- DataPRO/IService/Interfaces/IDiagnos.cs
- DataPRO/IService/Interfaces/IDASCommunicationComparer.cs
- DataPRO/IService/Interfaces/IDASCommunicationEqComparer.cs
- DataPRO/IService/Interfaces/IUARTDownloadActions.cs
- DataPRO/IService/Interfaces/ITriggerCheckActions.cs
- DataPRO/IService/Interfaces/IRealTimeActions.cs
- DataPRO/IService/Interfaces/IDownloadActions.cs
- DataPRO/IService/Interfaces/IClockSyncActions.cs
- DataPRO/IService/Interfaces/IDiagnosticsActions.cs
- DataPRO/IService/Interfaces/IConfigurationActions.cs
- DataPRO/IService/Interfaces/IArmActions.cs
- DataPRO/IService/Interfaces/IDASCommunication.cs
generated_at: "2026-04-16T03:57:16.444957+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b07fbe9a3474c9e8"
---
# DASLib.Service Interfaces Documentation
## 1. Purpose
This module defines a set of interfaces that collectively represent the service layer for Data Acquisition Systems (DAS) in the DataPRO ecosystem. These interfaces abstract hardware-specific operations—such as arming, diagnostics, real-time data streaming, clock synchronization, UART communication, configuration, and download management—into a standardized contract. They serve as the primary API surface for interacting with DAS hardware units, enabling decoupling of service logic from device-specific implementations. The interfaces are designed to support multiple DAS types (e.g., SLICE, TDAS, G5, S6) and coordinate complex workflows like event-triggered acquisition, diagnostics validation, and low-power state transitions.
## 2. Public Interface
### `IAutoArmStatus`
- **`AutoArmStatus`** (`DFConstantsAndEnums.CommandStatus`): Gets or sets the auto-arm status of the DAS unit.
### `ITimeActions` *(internal)*
- **`Synchronize(ServiceCallback callback, object userData, DateTime time)`**: Synchronizes the DAS clock to the specified `time`.
- **`QueryTime(ServiceCallback callback, object userData)`**: Queries the current time from the DAS.
### `IService`
- **`ServiceCallback`** delegate: `void ServiceCallback(ServiceCallbackData data)` — The callback signature used to return results from service operations.
### `IRealTime`
- **`RealtimeDASChannels`** (`List<int>`): Gets or sets the list of channel indices to stream in real-time mode.
- **`TiltAxisData`** (`List<double>`): Gets or sets the SLICE6 Axis 1/2/3 (X/Y/Z) tilt data in degrees.
### `IDiagnos`
- **`ChannelDiagnostics`** (`DiagnosticsActions[]`): Gets or sets the diagnostics actions to perform per channel.
- **`ChannelDiagnosticsResults`** (`DiagnosticsResult[]`): Gets or sets the results of channel diagnostics.
- **`ModuleDiagnosticsResults`** (`ModuleDiagnosticsResult[]`): Gets or sets the results of module-level diagnostics.
- **`BaseInput`** (`BaseInputValues`): Gets or sets base input voltage/temperature values.
- **`DASClockSyncStatus`** (`ClockSyncStatus`): Gets or sets the DAS clock synchronization status.
- **`ArmCheckActions`** (`ArmCheckActions`): Gets or sets the arm check actions to perform.
- **`ArmCheckResults`** (`ArmCheckResults`): Gets or sets the results of arm checks.
### `IDASCommunicationComparer`
- **`Compare(IDASCommunication x, IDASCommunication y)`** (`int`): Compares two `IDASCommunication` instances by `SerialNumber`. Handles nulls and reference equality.
### `IDASCommunicationEqComparer`
- **`Equals(IDASCommunication x, IDASCommunication y)`** (`bool`): Returns `true` if both instances have the same `SerialNumber`.
- **`GetHashCode(IDASCommunication idascom)`** (`int`): Returns hash code based on `SerialNumber`.
### `IUARTDownloadActions`
- **`UARTDownload(ServiceCallback callback, object userData)`**: Downloads data as specified in `WhatToDownload`.
- **`QueryUARTDownload(ServiceCallback callback, object userData, int eventIndex, TDASServiceSetupInfo setupInfo)`**: Queries available UART events for download.
- **`SetUARTSettings(ServiceCallback callback, object userData, uint baudRate, uint dataBits, uint stopBits, uint parity, uint flowControl)`**: Sets UART connection parameters (FB15268).
- **`GetUARTSettings(ServiceCallback callback, object userData)`**: Retrieves current UART settings.
### `ITriggerCheckActions` *(internal)*
- **`PreStartTriggerCheck(ServiceCallback callback, object userData)`**: Prepares hardware before `StartTriggerCheck` (e.g., for S6 ATD/SLICE PRO trigger check failures, issue #13820).
- **`PostStartTriggerCheck(ServiceCallback callback, object userData)`**: Performs post-`StartTriggerCheck` cleanup.
- **`StartTriggerCheck(ServiceCallback callback, object userData)`**: Sets DAS to latch signal lines for trigger checking.
- **`DoTriggerCheck(ServiceCallback callback, object userData)`**: Performs trigger check and stores result in `TriggerResult`.
- **`DoTriggerCheckSync()`**: Synchronous version of `DoTriggerCheck`.
- **`DoStartCheck(ServiceCallback callback, object userData)`**: Performs start check and stores result in `StartResult`.
- **`CancelTriggerCheck(ServiceCallback callback, object userData)`**: Resets DAS latching mechanism to normal mode.
### `IRealTimeActions` *(internal)*
- **`RealTime(...)`**: Starts real-time streaming with configurable sample rate, channels, AAF, UDP settings, etc.
- **`RealTimePolling(ServiceCallback callback, object userData, ManualResetEvent stopEvent, byte[] channels)`**: Polls DAS for real-time sample averages.
- **`ExitRealTimeMode(ServiceCallback callback, object userData)`**: Stops real-time data streaming.
- **`RealTimeTiltPolling(ServiceCallback callback, object userData, ManualResetEvent stopEvent)`**: Polls tilt data in real-time.
- **`SetUDPStreamProfile(...)`**: Configures UDP streaming for S6A (FB15313).
- **`GetUDPStreamProfile(ServiceCallback callback, object userData)`**: Retrieves current UDP streaming profile.
### `IDownloadActions` *(internal)*
- **`Download(ServiceCallback callback, object userData)`**: Downloads data as specified in `WhatToDownload`.
- **`Cancel()`**: Cancels current download operation.
- **`ForceCancel()`**: Cancels with shorter clear time.
- **`ClearCancel()`**: Clears the cancel flag.
- **`QueryDownload(...)`**: Queries available events for download.
- **`QueryDownloadedStatus(...)`**: Checks if events have been downloaded.
- **`SetTriggerSampleNumbers(...)`**: Updates trigger sample numbers in hardware.
- **`SetDownloaded(...)`**: Marks event as downloaded (used when no data exists).
- **`SetEventInfo(...)`**: Updates event metadata (ID, GUID, samples, etc.).
- **`CorrectT0s(...)`**: Recovers T0 and total sample counts via ADC rail/peak detection (issue #18469).
### `IClockSyncActions`
- **`GetClockSyncStatus(ServiceCallback callback, object userData)`**: Retrieves clock source and sync status (32-byte payload; see comments for layout).
- **`SetClockSyncConfig(ServiceCallback callback, object userData, ClockSyncProfile profile)`**: Sets input/output clock configuration (PTP, IRIG-B122, GPS/1PPS, etc.).
- **`GetPTPDomainID(ServiceCallback callback, object userData)`**: Gets PTP domain ID.
- **`SetPTPDomainID(ServiceCallback callback, object userData, byte domainID)`**: Sets PTP domain ID.
### `IDiagnosticsActions`
- **`ClearTriggerOut(ServiceCallback callback, object userData)`**: Clears trigger output line via `SetSwitchImmediate`.
- **`ClearLatches(ServiceCallback callback, object userData)`**: Clears latched FPGA via QATS.
- **`PerformVoltageCheck(...)`**: Performs voltage checks.
- **`PerformArmChecks(...)`**: Performs arm checks.
- **`SaveTiltSensorDataPre(...)` / `SaveTemperaturesPre(...)`**: Saves pre-event tilt/temperature data.
- **`PrepareForBridgeResistanceMeasurement(...)`**: Warms up analog circuits before bridge resistance measurement.
- **`PrepareForDiagnostics(...)`**: Prepares for diagnostics (sample rate, AAF, pre/post result type).
- **`SetStatusIndicator(...)`**: Sets diagnostics status indicator state.
- **`DiagnosAndGetResults(...)`**: Runs diagnostics and stores results.
- **`GetEventDiagnosticsResults(...)`**: Retrieves pre/post event diagnostics results.
- **`ClearDASTriggerLine(...)`**: Explicitly clears DAS trigger lines after `PreStartTriggerCheck` (issue #14229).
- **`SquibFireCheckArm(...)`**: Performs squib fire check during arming.
- **`TriggerCheckTrigger(...)` / `TriggerCheckDownload(...)`**: Triggers and downloads trigger check data.
- **`GetBridgeMeasurement(...)`**: Retrieves bridge resistance measurement.
- **`MeasureTransferSpeed(...)`**: Measures data transfer speed.
### `IConfigurationActions`
- **`AutoDetect(bool bQueryConfiguration, ServiceCallback callback, object userData)`**: Resets channels to auto-detect mode (e.g., for SLICE2 IEPE/bridge).
- **`VerifyConfig(bool DoStrictCheck)` / `VerifyConfig(bool DoStrictCheck, ErrorCallback FailedChallengeFunc)`**: Validates `ConfigData`.
- **`SetFirstUseDate(...)`**: Sets first-use date (use `MsqlDateTime.MinValue` to unset).
- **`StoreTestSetupXML(...)`**: Stores test setup XML; resets trigger/start lines.
- **`ResetHardwareLines(...)`**: Resets hardware trigger/start lines.
- **`CheckAAFilterRate(...)`**: Validates AAF rate.
- **`QueryTestSetup(...)`**: Retrieves test setup from DAS.
- **`Configure(...)`**: Applies configuration from `ConfigData` to DAS (supports UDP streaming, DSP filters, UART, etc.).
- **`ApplyLevelTriggers(...)`**: Applies only level triggers (no full config).
- **`QueryConfiguration(...)`**: Retrieves configuration from DAS into `ConfigData`.
- **`UpdateConfigurationFromFile(...)`**: Updates config from XML file (issue #17872).
- **`UpdateIDs(...)` / `UpdateId(...)`**: Retrieves EIDs or single module/channel ID.
- **`CheckSafetyState(...)`**: Checks safety state (armed/unarmed).
- **`Reboot(...)`**: Reboots device (FB15335).
### `IArmActions` *(internal)*
- **`TurnOffT0Lights(...)`**: Turns off T0 indicator lights.
- **`BeginBackgroundFlashErase(...)`**: Starts background flash erase (non-blocking).
- **`SupportsBackgroundFlashErase`** (`bool`): Indicates if background flash erase is supported.
- **`BackgroundFlashEraseStarted`** (`bool`): Indicates if background erase has started.
- **`BackgroundFlashEraseStartTime`** (`DateTime?`): Timestamp of background erase start.
- **`BeginFlashErase(...)`**: Starts asynchronous flash erase.
- **`QueryFlashEraseStatus(...)`**: Queries flash erase progress/errors.
- **`ReadyForArming(...)`**: Prepares DAS for arming (event GUID, timeout, testing mode, etc.).
- **`ArmNow(...)`**: Arms DAS immediately.
- **`PrepareForArmNow(...)` / `PreparedArmNow(...)`**: Pre-arming steps.
- **`ReArm(...)`**: Re-arms units with optional auto-arm/repeat flags.
- **`AutoArmUDPSetting`** (`string`): UDP broadcast address for auto-arm status (issue #17583).
- **`AutoArmNow(...)`**: Auto-arms DAS with diagnostics delay and repeat enable.
- **`EnableFaultChecking(...)`**: Arms multiple chained DAS units.
- **`CheckAlreadyLevelTriggered(...)`**: Checks if channels are level-triggered.
- **`Disarm(...)` / `DisAutoArm(...)`**: Disarms or disables auto-arm.
- **`GetArmStatus(...)` / `GetAutoArmStatus(...)`**: Retrieves current arm/auto-arm status.
- **`EnterLowPowerMode(...)`**: Sets DAS to low-power mode.
- **`StartRecord(...)`**: Instructs DAS to start recording.
- **`Trigger(...)`**: Sends hardware trigger signal.
- **`GetExtendedFaultIds(...)`**: Queries extended fault IDs.
### `IDASCommunication`
- **Inherits** from: `IConfiguration`, `IDiagnos`, `ITriggerCheck`, `IRealTime`, `IArmStatus`, `IDownload`, `IInformation`, `IAutoArmStatus`, `IAutoArmed`, `IRangeBandwidthLimited`, `ITimeSynchronization`.
- **`RecordId`** (`int`): Gets/sets the record ID.
- **`GetNominalRanges(BridgeType bridge)`** (`double[]`): Returns nominal voltage ranges for given bridge type.
- **Voltage properties** (`InputLow/Medium/HighVoltage`, `BatteryLow/Medium/HighVoltage`, `Minimum/MaximumValid...Voltage`): Hardware-specific voltage thresholds.
- **`SerialNumber`** (`string`): Base unit serial number.
- **`FirmwareVersion`** (`string`): Firmware version (read-only).
- **`DiagnosticsHasBeenRun`** / **`ConfigureHasBeenRun`** (`bool`): Flags indicating if diagnostics/configuration have been run.
- **`NumberOfConfiguredChannels()` / `NumberOfChannels()`** (`int`): Counts configured or total channels.
- **`MaxMemory()`** (`long`): Maximum memory capacity.
- **`MaxModules`** (`int`): Maximum module count.
- **`MinSampleRate()` / `MaxSampleRate()`** (`uint`): Sample rate limits.
- **Feature support flags** (`SupportsAutoArm`, `SupportsLevelTrigger`, `SupportsRealtime`, etc.): Hardware capability indicators.
- **`InvertTrigger` / `InvertStart`** (`bool`): Trigger/start line inversion (SLICE-specific).
- **`IgnoreShortedStart` / `IgnoreShortedTrigger`** (`bool`): Ignore shorted start/trigger lines.
- **`SupportsHardwareInputCheck()`** (`bool`): Hardware input status check support (SLICE Base firmware ≥ v7).
- **`SupportsMultipleSampleRealtime()`** (`bool`): Multiple sample real-time support.
- **`ControlsDAQ()`** (`bool`): Indicates if base unit controls module DAQ.
- **`CheckAAF(float rate)`** (`bool`): Validates new AAF rate (e.g., SLICE2 rate tables).
- **`RequireDiagnosticRateMatchSampleRate()`** (`bool`): Requires diagnostic sample rate to match data rate.
- **`GetPhaseShiftSamples(...)`** (`ulong`): Returns phase delay in samples (module-specific).
- **`IsEthernetDistributor()` / `IsSlice6Distributor()`** (`bool`): Identifies distributor devices (e.g., SLICEDb).
- **`MACAddress`** / **`DownstreamMACAddresses`** (`string[]`): Network identifiers.
- **`SupportsIndividualChannelRealtimeStreaming`** (`bool`): Per-channel real-time streaming (SPS only, issue #10572).
## 3. Invariants
- **`IDASCommunication`** instances must uniquely identify hardware units via `SerialNumber`. Comparers (`IDASCommunicationComparer`, `IDASCommunicationEqComparer`) enforce this via `SerialNumber`-based equality.
- **`ServiceCallback`** must be invoked exactly once per service operation, carrying `ServiceCallbackData` with operation result.
- **`RealtimeDASChannels`** and **`RealTime(...)`** `channels` parameter must contain valid channel indices for the DAS unit.
- **`DiagnosticsHasBeenRun`** and **`ConfigureHasBeenRun`** flags must be set only after successful completion of respective operations.
- **`AutoArmUDPSetting`** must be a valid UDP address string when auto-arm is enabled; otherwise, it may be null/empty.
- **`TiltAxisData`** must contain exactly 3 elements (X, Y, Z) for SLICE6 tilt reporting.
- **`IDownloadActions.Cancel()`** and **`ForceCancel()`** must set an internal cancel flag that is checked during download operations.
- **`ITriggerCheckActions.PreStartTriggerCheck`** and **`PostStartTriggerCheck`** are *not* generic services—they are called explicitly by the `StartTriggerCheck` service to handle hardware-specific timing (e.g., S6 ATD quirks, issue #13820).
## 4. Dependencies
### Dependencies *on* this module:
- **`DTS.Common.*`** namespaces:
- `DTS.Common.Enums.DASFactory` (e.g., `CommandStatus` in `IAutoArmStatus`)
- `DTS.Common.Interface.DASFactory` (e.g., `IDASCommunication` inherits from `IConfiguration`, `IDiagnos`, etc.)
- `DTS.Common.DAS.Concepts`, `DTS.Common.Enums.Sensors`, `DTS.Common.Classes.DSP`
- **System namespaces**: `System`, `System.Collections.Generic`, `System.IO.Ports`, `System.Threading`
- **Windows Forms**: `System.Windows.Forms` (only in `IService.cs`, likely for legacy UI integration)
### Dependencies *of* this module:
- **`IDASCommunication`** is the central abstraction; all service interfaces (`IArmActions`, `IDiagnosticsActions`, etc.) operate on `List<IDASCommunication>` (implied by usage).
- **`ServiceCallback`** is used by all service interfaces to return results.
- **`TDASServiceSetupInfo`** is referenced in `IUARTDownloadActions.QueryUARTDownload` and `IDownloadActions.QueryDownload`.
- **`PrePostResults`** is used in `IDiagnosticsActions` methods (e.g., `PrepareForDiagnostics`, `DiagnosAndGetResults`).
- **`UDPStreamProfile`**, **`ClockSyncProfile`**, **`DiagnosticsStatusIndicatorState`**, **`DiagnosticsActions`**, **`ArmCheckActions`**, etc., are defined in external `DTS.Common.*` assemblies.
## 5. Gotchas
- **`ITimeActions`** and **`IRealTimeActions`** are marked `internal`—they are not part of the public API surface and should not be used outside `DTS.DASLib.Service`.
- **`ITriggerCheckActions.PreStartTriggerCheck`/`PostStartTriggerCheck`** are *not* generic services; they are called by the `StartTriggerCheck` service to handle hardware-specific timing (e.g., S6 ATD/SLICE PRO trigger check failures, issue #13820).
- **`IDownloadActions.CorrectT0s(...)`** may return an error on devices that do not support T0 recovery (e.g., non-circular buffer/hybrid recorders, issue #18469).
- **`IUARTDownloadActions.SetUARTSettings(...)`** uses `uint` for all UART parameters (baudRate, dataBits, etc.), but actual hardware may have constrained ranges (e.g., dataBits ∈ {7,8}, stopBits ∈ {1,2}).
- **`IDiagnosticsActions.PrepareForBridgeResistanceMeasurement(...)`** must be called *only* if units were previously in low-power mode; otherwise, it is unnecessary but harmless (per comment).
- **`IDASCommunication.CheckAAF(float rate)`** is primarily used for SLICE2s multiple AAF rate tables; other DAS types may ignore it.
- **`IArmActions.Background