init
This commit is contained in:
328
docs/ai/DataPRO/SLICECommands/DownloadCommands.md
Normal file
328
docs/ai/DataPRO/SLICECommands/DownloadCommands.md
Normal file
@@ -0,0 +1,328 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryEventDataReport.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/ResetEventList.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryTotalEventCount.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/EventDataCommands.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/StartDownloadStreamData.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/DownloadByteConverter.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryEthernetEventInfo.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryEthernetEventData.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryUARTEventData.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryUARTEventInfo.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/QueryEventDataBase.cs
|
||||
- DataPRO/SLICECommands/DownloadCommands/GetNextDownloadStreamDataSamples.cs
|
||||
generated_at: "2026-04-17T15:47:37.787305+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cb54d2338175f8ff"
|
||||
---
|
||||
|
||||
# Documentation: DTS.DASLib.Command.SLICE.DownloadCommands
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a command library for downloading event data from SLICE data acquisition devices. It implements the `EventDataCommands` abstract base class and multiple concrete command classes for querying event metadata, downloading event data samples (ADC, UART, Ethernet), resetting event lists, and managing streaming data downloads. The module serves as the client-side implementation of a command/response protocol for retrieving recorded event data from SLICE firmware (version >= A1N4 for streaming features).
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `EventDataCommands` (Abstract Base Class)
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Abstract base class for all event data commands. Inherits from `CommandBase`.
|
||||
|
||||
**Protected Enum:**
|
||||
```csharp
|
||||
protected enum Commands
|
||||
{
|
||||
Reserved = 0x00,
|
||||
ResetEventList = 0x01,
|
||||
QueryTotalEventCount = 0x02,
|
||||
QueryMatchingEvents = 0x03,
|
||||
QueryEventData = 0x04,
|
||||
SetEventData = 0x05,
|
||||
StartDownloadStreamData = 0x06,
|
||||
GetNextDownloadStreamDataSamples = 0x07,
|
||||
QueryUartEventInfo = 0x09,
|
||||
QueryUartEventData = 0x0A,
|
||||
SetUartEventData = 0x0B,
|
||||
GenerateEvent = 0x0C,
|
||||
QueryEthernetEventInfo = 0x0D,
|
||||
QueryEthernetEventData = 0x0E,
|
||||
SetEthernetEventData = 0x0F
|
||||
}
|
||||
```
|
||||
|
||||
**Constructors:**
|
||||
- `protected EventDataCommands(ICommunication sock)` — Initializes with default timeout.
|
||||
- `protected EventDataCommands(ICommunication sock, int timeoutMillisec)` — Initializes with custom timeout.
|
||||
|
||||
**Abstract Property:**
|
||||
- `protected abstract Commands Command { get; }` — Derived classes must specify their command code.
|
||||
|
||||
---
|
||||
|
||||
### `QueryEventDataReport`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Implements `ICommandReport`. Carries results from event data queries.
|
||||
|
||||
**Properties:**
|
||||
- `public object CallbackObject { get; set; }` — User-provided callback data.
|
||||
- `public CommandStatus Status { get; set; }` — Execution status.
|
||||
- `public short[][] Data { get; set; }` — Downloaded ADC sample data per channel.
|
||||
|
||||
**Constructor:**
|
||||
- `public QueryEventDataReport(CommandStatus status, object cbData)`
|
||||
|
||||
---
|
||||
|
||||
### `ResetEventList`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Resets the event list on the device. Command code: `0x01`.
|
||||
|
||||
**Constructors:**
|
||||
- `public ResetEventList(ICommunication sock)`
|
||||
- `public ResetEventList(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
---
|
||||
|
||||
### `QueryTotalEventCount`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Queries the total number of events stored on the device. Command code: `0x02`.
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryTotalEventCount(ICommunication sock)`
|
||||
- `public QueryTotalEventCount(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort Count { get; }` — The total event count returned by the device.
|
||||
|
||||
**Overrides:**
|
||||
- `protected override CommandReceiveAction WholePackage()` — Extracts count from response.
|
||||
- `public override void ResponseToString(ref List<List<string>> lines)`
|
||||
|
||||
---
|
||||
|
||||
### `StartDownloadStreamData`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Initiates streaming download mode on SLICE2 firmware >= A1N4. Command code: `0x06`.
|
||||
|
||||
**Constructors:**
|
||||
- `public StartDownloadStreamData(ICommunication sock)` — Initializes 18-byte parameter array.
|
||||
- `public StartDownloadStreamData(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Constants:**
|
||||
- `public const byte AllChannels = 0xFF`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventNumber { get; set; }` — Written to parameter offset 0.
|
||||
- `public virtual ulong FirstSample { get; set; }` — Written to parameter offset 2.
|
||||
- `public virtual ulong LastSample { get; set; }` — Written to parameter offset 10.
|
||||
|
||||
---
|
||||
|
||||
### `DownloadByteConverter`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Parses raw byte arrays from streaming download responses.
|
||||
|
||||
**Enum:**
|
||||
```csharp
|
||||
public enum DlByteIndex
|
||||
{
|
||||
Sync = 0, Type = 1, Command = 2, Status = 3, Group = 4, Id = 5,
|
||||
Datalength = 6, SequenceNumber = 8, HeaderCRC = 10, DataCRC = 12,
|
||||
DataADCStartOffset = 14, DataADCEndOffset = 22, DataStart = 30
|
||||
}
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
- `public DownloadByteConverter(byte[] bytes)` — Parses the byte array.
|
||||
|
||||
**Properties:**
|
||||
- `public ushort SeqNumber { get; }` — Packet sequence number.
|
||||
- `public ushort SeqNumberPrev { get; }` — Previous sequence number (tracks across calls).
|
||||
- `public ulong DlAdcStartOffset { get; }` — ADC start offset.
|
||||
- `public ulong DlAdcEndOffset { get; }` — ADC end offset.
|
||||
- `public ulong DlStreamSampleNumber { get; }` — Stream sample number.
|
||||
- `public ushort[] DlData { get; }` — Parsed data samples.
|
||||
- `public uint[] DlChannels { get; }` — Channel information.
|
||||
|
||||
---
|
||||
|
||||
### `QueryEthernetEventInfo`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Retrieves metadata about an Ethernet recorder event. Command code: `0x0D`.
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryEthernetEventInfo(ICommunication sock)` — Initializes 4-byte parameter array.
|
||||
- `public QueryEthernetEventInfo(ICommunication sock, int TimeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventID { get; set; }` — Input: Event ID to query (parameter offset 0).
|
||||
- `public ushort DataDownloaded { get; }` — Output: Whether data was downloaded.
|
||||
- `public ulong TotalByteCount { get; }` — Output: Total bytes in event.
|
||||
- `public ulong TriggerByteCount { get; }` — Output: Byte count at trigger.
|
||||
- `public ulong FaultByteCount { get; }` — Output: Byte count at fault.
|
||||
- `public uint[] DataStartTimeStamp { get; }` — Output: `[seconds, nanoseconds]`.
|
||||
|
||||
**Overrides:**
|
||||
- `protected override CommandReceiveAction WholePackage()`
|
||||
- `public override void ResponseToString(ref List<List<string>> lines)`
|
||||
|
||||
---
|
||||
|
||||
### `QueryEthernetEventData`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Retrieves Ethernet data payload from an event. Command code: `0x0E`.
|
||||
|
||||
**Constants:**
|
||||
- `private const int PARAMETER_BYTE_COUNT = 14`
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryEthernetEventData(ICommunication sock)`
|
||||
- `public QueryEthernetEventData(ICommunication sock, int timeoutMS)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventID { get; set; }` — Parameter offset 0.
|
||||
- `public uint RequestByteCount { get; set; }` — Parameter offset 2.
|
||||
- `public ulong StartDataOffsetBytes { get; set; }` — Parameter offset 6.
|
||||
- `public byte[] Data { get; }` — Retrieved data payload.
|
||||
|
||||
**Overrides:**
|
||||
- `protected override CommandReceiveAction WholePackage()`
|
||||
- `public override void CommandToString(ref List<List<string>> lines)`
|
||||
- `public override void ResponseToString(ref List<List<string>> lines)`
|
||||
|
||||
---
|
||||
|
||||
### `QueryUARTEventData`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Retrieves UART event data payload. Command code: `0x0A`.
|
||||
|
||||
**Constants:**
|
||||
- `public const int MAX_DATA_LENGTH = 2000`
|
||||
- `public const int PAYLOAD_HEADER_LENGTH = 14`
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryUARTEventData(ICommunication sock)`
|
||||
- `public QueryUARTEventData(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventNumber { get; set; }` — Parameter offset 0.
|
||||
- `public uint RequestByteCount { get; set; }` — Parameter offset 2.
|
||||
- `public ulong RequestOffsetByteCount { get; set; }` — Parameter offset 6.
|
||||
- `public uint PayloadByteCount { get; }` — Bytes returned.
|
||||
- `public ulong PayloadOffsetByteCount { get; }` — Offset of returned data.
|
||||
- `public byte[] PayloadData { get; }` — The data bytes.
|
||||
|
||||
**Methods:**
|
||||
- `public override void Execute(CommandCallback cb, object cbData)`
|
||||
- `public override void SyncExecute()`
|
||||
- `public void LogResponse()`
|
||||
|
||||
**Overrides:**
|
||||
- `protected override CommandReceiveAction WholePackage()`
|
||||
- `protected override CommandReceiveAction WholePackagePost()`
|
||||
|
||||
---
|
||||
|
||||
### `QueryUARTEventInfo`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Retrieves metadata about a UART event. Command code: `0x09`.
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryUARTEventInfo(ICommunication sock)`
|
||||
- `public QueryUARTEventInfo(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventNumber { get; set; }` — Input: Event number to query.
|
||||
- `public bool DataPresent { get; }` — Whether data exists.
|
||||
- `public bool DataDownloaded { get; }` — Whether data was downloaded.
|
||||
- `public ulong TotalByteCount { get; }`
|
||||
- `public ulong TriggerByteCount { get; }`
|
||||
- `public ulong FaultByteCount { get; }`
|
||||
- `public uint StartTimestamp { get; }`
|
||||
- `public uint EndTimestamp { get; }`
|
||||
- `public uint BaudRate { get; }`
|
||||
|
||||
**Methods:**
|
||||
- `public override void Execute(CommandCallback cb, object cbData)`
|
||||
- `public override void SyncExecute()`
|
||||
- `public void LogResponse()`
|
||||
|
||||
---
|
||||
|
||||
### `QueryEventDataBase`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Queries ADC sample data for an event. Command code: `0x04`.
|
||||
|
||||
**Constants:**
|
||||
- `private const ushort ADC_OFFSET = 0x8000`
|
||||
- `public const byte ALL_CHANNELS = 0xFF`
|
||||
|
||||
**Constructors:**
|
||||
- `public QueryEventDataBase(ICommunication sock)`
|
||||
- `public QueryEventDataBase(ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `public ushort EventNumber { get; set; }` — Parameter offset 0.
|
||||
- `public virtual ulong FirstSample { get; set; }` — Parameter offset 2.
|
||||
- `public virtual ulong LastSample { get; set; }` — Parameter offset 10.
|
||||
- `public byte Channel { get; set; }` — Parameter offset 18; `0xFF` for all channels.
|
||||
- `public int ChannelsDownloaded { get; set; }` — Set to 3 if all channels, else 1.
|
||||
- `public int Count { get; }` — Number of samples downloaded.
|
||||
|
||||
**Methods:**
|
||||
- `public virtual void GetChannelData(int channel, out short[] signedADC)` — Extracts signed ADC data for a specific channel. Applies ADC_OFFSET subtraction.
|
||||
- `public virtual void GetRawIndexedData(int index, out ushort[] data)` — Extracts raw indexed data.
|
||||
- `public void LogResponse()`
|
||||
|
||||
**Overrides:**
|
||||
- `public override void Execute(CommandCallback cb, object cbData)` — Throws if `FirstSample > LastSample`.
|
||||
- `public override void SyncExecute()` — Throws if `FirstSample > LastSample`.
|
||||
- `protected override CommandReceiveAction WholePackage()`
|
||||
- `protected override CommandReceiveAction WholePackagePost()`
|
||||
|
||||
---
|
||||
|
||||
### `GetNextDownloadStreamDataSamples`
|
||||
**Namespace:** `DTS.DASLib.Command.SLICE.DownloadCommands`
|
||||
|
||||
Reads streaming download data without sending a command. Command code: `0x07`.
|
||||
|
||||
**Constructors:**
|
||||
- `public GetNextDownloadStreamDataSamples(ICommunication sock)`
|
||||
- `public GetNextDownloadStreamDataSamples(ICommunication sock, int msTimeout)`
|
||||
|
||||
**Properties:**
|
||||
- `public DownloadByteConverter DlData { get; private set; }` — Parsed streaming data.
|
||||
|
||||
**Methods:**
|
||||
- `public void ProcessData()` — Parses response bytes, validates CRC, checks sequence numbers.
|
||||
- `public override void SyncExecute()` — **Special implementation:** Does NOT send any data; only reads from buffer. Sending would stop streaming.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Sample Range:** For `QueryEventDataBase`, `FirstSample` must be less than or equal to `LastSample`. Violation throws `ApplicationException`.
|
||||
|
||||
2. **Parameter Array Sizes:**
|
||||
- `StartDownloadStreamData`: 18 bytes
|
||||
- `QueryEthernetEventInfo`: 4 bytes
|
||||
- `QueryEthernetEventData`: 14 bytes
|
||||
- `QueryUARTEventData`: 14 bytes
|
||||
- `QueryUARTEventInfo`: 2 bytes
|
||||
-
|
||||
340
docs/ai/DataPRO/SLICECommands/MulticastCommands.md
Normal file
340
docs/ai/DataPRO/SLICECommands/MulticastCommands.md
Normal file
@@ -0,0 +1,340 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastIdentify.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastResetMcu.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MACTableEntry.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastSetIPAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastSetSubnetAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastSetGatewayAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastSetDhcp.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastSetDnsAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastGetIpAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastGetDnsAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastGetSubnetAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastGetDhcp.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastGetGatewayAddress.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastAutoDiscover.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastDiscoverSlice6.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastUDPQueryQATS.cs
|
||||
- DataPRO/SLICECommands/MulticastCommands/MulticastCommandBase.cs
|
||||
generated_at: "2026-04-17T15:46:31.054314+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4ef2eef25bbbfbe1"
|
||||
---
|
||||
|
||||
# MulticastCommands Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides multicast command infrastructure for discovering and configuring SLICE devices (Slice6, S6DB, TSR-Air, etc.) on a network. It implements a UDP multicast command/response pattern supporting device auto-discovery, network configuration (IP, subnet, gateway, DNS, DHCP settings), device identification, MCU reset, MAC table retrieval, and QATS (Query Arm-Trigger Status) polling. The module serves as the network-level device management layer for the DASLib command system.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### MulticastCommandBase (Abstract Base Class)
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastCommandBase(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastCommandBase(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string HostMac` - Gets/sets the host MAC address; setter writes to parameter offset 0
|
||||
- `string ClientMac` - Sets the target client MAC address at offset 18
|
||||
- `int ReceiveTimeoutMs` - Get/set receive timeout (default 3000ms)
|
||||
- `IPAddress BindToAdapterIPAddress` - Get/set adapter binding (default `IPAddress.Any`)
|
||||
|
||||
**Methods:**
|
||||
- `void BuildPacket()` - Computes CRCs on the base command
|
||||
- `void SendCommand()` - Sends multicast request without waiting for response
|
||||
- `void MulticastExecute(CancellationToken ct, bool waitForResponse = true)` - Sends command and waits for responses
|
||||
- `void StartListening()` - Starts async listening thread
|
||||
- `void StopListening()` - Signals listening thread to terminate
|
||||
- `static string GetMacAddress()` - Returns first multicast-compatible, operational network interface's MAC
|
||||
|
||||
**Static Configuration:**
|
||||
- `string MulticastAddress` - Default "239.1.2.3"
|
||||
- `string MulticastReceiveAddress` - Default "239.4.5.6"
|
||||
- `int CommandPort` - Default 8501
|
||||
- `int ResponsePort` - Default 8503
|
||||
|
||||
**Nested Enums:**
|
||||
- `Commands` - Command IDs (AutoDiscover=0x01, SetIpAddress=0x02, GetIpAddress=0x03, etc.)
|
||||
- `Ports` - Command=8501, Response=8503
|
||||
- `DeviceClasses` - Slice6, SDB, ECM, S6DB, Slice6Air, PowerPro, TsrAir, S6DB3, Any
|
||||
- `ResponseOptions` - AlwaysRespond, RespondIfNotBusy, RespondIfNotConnected
|
||||
|
||||
---
|
||||
|
||||
### MulticastIdentify
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastIdentify(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastIdentify(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Methods:**
|
||||
- `override void CommandToString(ref List<List<string>> lines)` - Appends MAC to output
|
||||
|
||||
---
|
||||
|
||||
### MulticastResetMcu
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastResetMcu(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastResetMcu(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Methods:**
|
||||
- `override void CommandToString(ref List<List<string>> lines)` - Appends MAC to output
|
||||
|
||||
---
|
||||
|
||||
### MulticastSetIpAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastSetIpAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastSetIpAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Ip` - Set-only; writes IP to parameter at `FIRST_PARAMETER_OFFSET`
|
||||
|
||||
---
|
||||
|
||||
### MulticastSetSubnetAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastSetSubnetAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastSetSubnetAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Subnet` - Set-only; writes subnet to parameter at `FIRST_PARAMETER_OFFSET`
|
||||
|
||||
---
|
||||
|
||||
### MulticastSetGatewayAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastSetGatewayAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastSetGatewayAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Gateway` - Set-only; writes gateway to parameter at `FIRST_PARAMETER_OFFSET`
|
||||
|
||||
---
|
||||
|
||||
### MulticastSetDhcp
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastSetDhcp(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastSetDhcp(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `bool Dhcp` - Set-only; converts to byte and writes at `FIRST_PARAMETER_OFFSET`
|
||||
|
||||
---
|
||||
|
||||
### MulticastSetDnsAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastSetDnsAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastSetDnsAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Dns` - Set-only; writes DNS to parameter at `FIRST_PARAMETER_OFFSET`
|
||||
|
||||
---
|
||||
|
||||
### MulticastGetIpAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastGetIpAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastGetIpAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Ip` - Get-only; populated after successful response
|
||||
|
||||
---
|
||||
|
||||
### MulticastGetSubnetAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastGetSubnetAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastGetSubnetAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Subnet` - Get-only; populated after successful response
|
||||
|
||||
---
|
||||
|
||||
### MulticastGetGatewayAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastGetGatewayAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastGetGatewayAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Gateway` - Get-only; populated after successful response
|
||||
|
||||
---
|
||||
|
||||
### MulticastGetDnsAddress
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastGetDnsAddress(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastGetDnsAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `string Dns` - Get-only; populated after successful response
|
||||
|
||||
---
|
||||
|
||||
### MulticastGetDhcp
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastGetDhcp(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `MulticastGetDhcp(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `bool Dhcp` - Get-only; converted from byte after successful response
|
||||
|
||||
---
|
||||
|
||||
### MulticastAutoDiscover
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastAutoDiscover()`
|
||||
- `MulticastAutoDiscover(string macAddress)`
|
||||
- `MulticastAutoDiscover(int timeoutMillisec)`
|
||||
- `MulticastAutoDiscover(string macAddress, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `List<IDiscoveredDevice> DiscoveredDevices` - Get-only; populated during response processing
|
||||
- `TextLogger Logger` - Get/set for debug logging
|
||||
- `MultiCastDeviceClasses DeviceClass` - Set-only; default is `Any`
|
||||
- `ResponseOptions ResponseOption` - Set-only; default is `AlwaysRespond`
|
||||
- `IPAddress Address` - Set-only; updates multicast config
|
||||
|
||||
**Methods:**
|
||||
- `void Init(string macAddress = "")` - Initializes command parameters
|
||||
|
||||
---
|
||||
|
||||
### MulticastDiscoverSlice6
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastDiscoverSlice6(DeviceClasses deviceClass, string hostMac)`
|
||||
- `MulticastDiscoverSlice6(string hostMac, int timeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `DeviceClasses DeviceClass` - Set-only
|
||||
- `ResponseOptions ResponseOption` - Set-only; default `AlwaysRespond`
|
||||
- `uint DesiredPort` - Set-only; port bitmask
|
||||
- `byte[] MACFilter` - Set-only; default filters to 00:19:9b prefix
|
||||
- `TextLogger Logger` - Get/set
|
||||
- `Dictionary<string, IDiscoveredDevice> MACAddressToDevice` - Get/set
|
||||
- `DiscoveredConnectedSlice[] ConnectedDevices` - Get-only
|
||||
|
||||
**Methods:**
|
||||
- `static string MACAddressToString(IEnumerable<byte> mac)` - Converts byte array to hex string format
|
||||
|
||||
---
|
||||
|
||||
### MulticastUdpQueryQATS
|
||||
|
||||
**Constructors:**
|
||||
- `MulticastUdpQueryQATS(ICommunication sock)`
|
||||
- `MulticastUdpQueryQATS(string macAddress)`
|
||||
- `MulticastUdpQueryQATS(int timeoutMillisec)`
|
||||
- `MulticastUdpQueryQATS(string macAddress, int timeoutMillisec)`
|
||||
- `MulticastUdpQueryQATS(ICommunication sock, int TimeoutMillisec)`
|
||||
|
||||
**Properties:**
|
||||
- `MultiCastDeviceClasses DeviceClass` - Set-only; default `Any`
|
||||
- `ResponseOptions ResponseOption` - Set-only; default `AlwaysRespond`
|
||||
- `IPAddress Address` - Set-only
|
||||
- `int Port` - Set-only
|
||||
- `List<IUDPQATSEntry> QATSEntry` - Get/set; populated from responses
|
||||
|
||||
**Methods:**
|
||||
- `void Init(string macAddress = "")` - Initializes with 5000ms receive timeout
|
||||
- `IUDPQATSEntry[] GetUDPQATs()` - Returns all entries and clears the list (thread-safe)
|
||||
|
||||
---
|
||||
|
||||
### MACTableEntry
|
||||
|
||||
**Constructor:**
|
||||
- `MACTableEntry(ushort age, ushort port, ushort filter, byte[] mac)`
|
||||
|
||||
**Properties:**
|
||||
- `ushort Age` - Get-only
|
||||
- `ushort Port` - Get-only
|
||||
- `ushort Filter` - Get-only
|
||||
- `byte[] MAC` - Get-only
|
||||
|
||||
---
|
||||
|
||||
### DiscoveredConnectedSlice
|
||||
|
||||
**Constructor:**
|
||||
- `DiscoveredConnectedSlice(string deviceMAC, MACTableEntry[] devices)`
|
||||
|
||||
**Properties:**
|
||||
- `string DeviceMAC` - Get-only
|
||||
- `MACTableEntry[] ConnectedDevices` - Get-only
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **MAC Address Size:** Always 18 bytes in command payloads
|
||||
- **IP Address Size:** Always 16 bytes in command payloads
|
||||
- **Double MAC Size:** 36 bytes (2 × 18)
|
||||
- **Parameter Offsets:** Host MAC at offset 0, Client MAC at offset 18, first parameter at offset 36
|
||||
- **Response Validation:** `WholePackage()` in base class validates that `CommandClientMac` equals `ResponseClientMac` AND `HostMac` equals `ResponseHostMac`
|
||||
- **Command Type:** All multicast commands set `command.Type = CommandPacket.CommandType.Multicast`
|
||||
- **StopAfterFirstMessage:** Defaults to `true`; discovery commands override to `false` to collect multiple responses
|
||||
- **Payload Sizes:**
|
||||
- Set commands (IP/Subnet/Gateway/DNS): `DOUBLE_MAC_ADDR_SIZE + IP_ADDR_SIZE` = 52 bytes
|
||||
- SetDhcp: `DOUBLE_MAC_ADDR_SIZE + 1` = 37 bytes
|
||||
- AutoDiscover command: 63 bytes, response: 278 bytes
|
||||
- DiscoverSlice6 command: 80 bytes
|
||||
- UDPQueryQATS command: 63 bytes, response: 215 bytes
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**External Dependencies (inferred from imports):**
|
||||
- `DTS.Common.ICommunication` - Command packet infrastructure
|
||||
- `DTS.Common.Interface.DASFactory` - `ICommunication` interface
|
||||
- `DTS.Common.Enums.DASFactory` - `DFConstantsAndEnums`, `CommandStatus`
|
||||
- `DTS.Common.Utilities.Logging` - `TextLogger`, `APILogger`
|
||||
- `DTS.Common.Utils` - `NetworkUtils`
|
||||
- `DTS.DASLib.Command.Classes` - `IDiscoveredDevice`, `DiscoveredDevice`, `ConnectedEthernetDevice`, `IUDPQATSEntry`, `UDPQATSEntry`
|
||||
|
||||
**System Dependencies:**
|
||||
- `System.Net`, `System.Net.Sockets`, `System.Net.NetworkInformation` - UDP multicast networking
|
||||
- `System.Threading`, `System.Threading.Tasks` - Async operations
|
||||
- `System.Collections.Generic` - Collections
|
||||
|
||||
**Dependents:**
|
||||
- Unknown from source alone (this module appears to be a leaf library consumed by higher-level application code)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **GetMacAddress() returns first available interface:** The method returns the first network interface that is `Up` and supports multicast, which may not be the interface intended for device communication. The comment in source acknowledges this is "a little hokey."
|
||||
|
||||
2. **Inconsistent MAC reference in MulticastGetDhcp:** `CommandToString()` uses `ResponseClientMac` while other get commands use `CommandClientMac`. This appears to be an inconsistency.
|
||||
|
||||
3. **Null socket in discovery constructors:** `MulticastAutoDiscover` and `MulticastUdpQueryQATS` have constructors that pass `null` to the base class for the `ICommunication` parameter.
|
||||
|
||||
4. **MAC address format conversion:** Response MACs are converted from dash-separated to colon-separated format (`Replace('-', ':')`) in discovery commands, but the wire format handling is not explicitly documented.
|
||||
|
||||
5. **Thread safety on QATSEntry:** `MulticastUdpQueryQATS.QATSEntry` uses a lock (`MyLock`) for thread safety, but other list properties like `DiscoveredDevices` in `MulticastAutoDiscover` do not appear to have equivalent synchronization.
|
||||
|
||||
6. **Silent exception handling in MulticastAutoDiscover:** The try/catch block around device class checking (lines ~100-107) has an empty body for Slice6/S6DB device classes, suggesting incomplete implementation or dead code.
|
||||
|
||||
7. **Hardcoded magic numbers:** Response parsing uses hardcoded offsets (e.g., 36, 40, 41, 57, 73, 89, 105, 107, 108, 118, 198, 230, 262 in `MulticastAutoDiscover`) without named constants for all fields.
|
||||
46
docs/ai/DataPRO/SLICECommands/Properties.md
Normal file
46
docs/ai/DataPRO/SLICECommands/Properties.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/SLICECommands/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:14:40.310892+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "723d0bf96eb46676"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `ICommand` assembly. It is a standard .NET Framework properties file that defines version information, COM visibility settings, and assembly identity attributes. This assembly appears to be a core component of the DataPRO system, with an initial copyright date of 2008, suggesting it is one of the older foundational modules.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this module. The file contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: Set to `"ICommand"`
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: Empty
|
||||
- `AssemblyProduct`: Set to `"ICommand"`
|
||||
- `AssemblyCopyright`: Set to `"Copyright © 2008"`
|
||||
- `AssemblyCulture`: Empty
|
||||
- `ComVisible`: Set to `false`
|
||||
- `Guid`: Set to `"14230b85-7fbb-40ce-973e-c0aecb2e8b44"`
|
||||
- `AssemblyVersion`: Set to `"1.06.0081"`
|
||||
- `AssemblyFileVersion`: Set to `"1.06.0081"`
|
||||
|
||||
### Invariants
|
||||
- The assembly version and file version are synchronized at `"1.06.0081"`.
|
||||
- COM visibility is explicitly disabled (`ComVisible(false)`), meaning types in this assembly are not exposed to COM components by default.
|
||||
- The GUID `"14230b85-7fbb-40ce-973e-c0aecb2e8b44"` uniquely identifies this assembly's type library if exposed to COM.
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**Dependents:** Cannot be determined from this file alone. The `ICommand` assembly name suggests it may be a library or interface definition that other modules depend on.
|
||||
|
||||
### Gotchas
|
||||
- The `AssemblyDescription` attribute is empty, providing no documentation of the assembly's purpose at the metadata level.
|
||||
- The `AssemblyCompany` attribute is empty, indicating no corporate branding is embedded in the assembly metadata.
|
||||
- The version format `"1.06.0081"` suggests a custom versioning scheme (possibly Major.Minor.Build where Build encodes date or sequence information).
|
||||
|
||||
---
|
||||
444
docs/ai/DataPRO/SLICECommands/RealtimeCommands.md
Normal file
444
docs/ai/DataPRO/SLICECommands/RealtimeCommands.md
Normal file
@@ -0,0 +1,444 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/SLICECommands/RealtimeCommands/EndRealtimeMode.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/UDPStreamPacket.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/StartRealtimeMode.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/RealtimeCommandBase.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/IGetRealtimeSamples.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/GetRealtimeSamplesSLICE6.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/GetRealtimeSamplesSLICE2.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/RetrieveSingleSample.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/GetRealtimeSamplesTSRAIR.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/RetrieveSampleAverage.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/StartRealtimeStreamingMode.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/GetRealtimeSamples.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/RealtimeStreamDecoder.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/UDPRealtimeByteConverter.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/StreamReaderUDP.cs
|
||||
- DataPRO/SLICECommands/RealtimeCommands/StreamConfigUDP.cs
|
||||
generated_at: "2026-04-17T15:47:03.304493+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f9034be22d5d24be"
|
||||
---
|
||||
|
||||
# Documentation: DTS.DASLib.Command.SLICE.RealtimeCommands
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the command infrastructure for realtime data acquisition from SLICE data acquisition devices. It handles the complete lifecycle of realtime operations: starting/stopping realtime mode, configuring and reading UDP data streams, retrieving samples (single, averaged, or multi-sample batches), and decoding binary stream packets. The module supports multiple hardware variants (SLICE2, SLICE6, TSRAIR) with device-specific data handling for byte ordering and sign conversion.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces
|
||||
|
||||
#### `IGetRealtimeSamples`
|
||||
Interface for objects capable of retrieving realtime samples from SLICE devices.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SampleNumber` | `ulong SampleNumber { get; }` | Returns the sample number for the first sample; subsequent samples are consecutive. |
|
||||
| `TimeStamp` | `ulong TimeStamp { get; }` | Returns the timestamp of the samples. |
|
||||
| `SequenceNumber` | `ulong SequenceNumber { get; }` | Returns the sequence number. |
|
||||
| `GetChannelData` | `short[] GetChannelData(int zeroBasedChannel)` | Returns all samples for the specified channel. |
|
||||
| `Channels` | `ushort Channels { get; set; }` | Total channel count for the unit. |
|
||||
| `SamplesReturned` | `int SamplesReturned { get; }` | Count of samples per channel returned. |
|
||||
| `LogCommands` | `bool LogCommands { get; set; }` | Whether to log commands (default false to avoid spammy logs). |
|
||||
| `SyncExecute` | `void SyncExecute()` | Executes the sample retrieval. |
|
||||
|
||||
---
|
||||
|
||||
### Abstract Base Class
|
||||
|
||||
#### `RealtimeCommandBase`
|
||||
Abstract base class for all realtime commands. Inherits from `CommandBase`.
|
||||
|
||||
**Protected Enum `Commands`:**
|
||||
| Value | Name | Code |
|
||||
|-------|------|------|
|
||||
| `Reserved` | 0x00 |
|
||||
| `StartRealtimeMode` | 0x01 |
|
||||
| `EndRealtimeMode` | 0x02 |
|
||||
| `GetRealtimeSamples` | 0x03 |
|
||||
| `RetrieveSingleSample` | 0x04 |
|
||||
| `RetrieveSampleAverage` | 0x05 |
|
||||
| `RetrieveInternalOffsetSampleAvg` | 0x06 |
|
||||
| `StartRealtimeStreamingMode` | 0x07 |
|
||||
| `GetRealtimeStreamSamples` | 0x08 |
|
||||
| `StartTimeStampStreamMode` | 0x09 |
|
||||
| `GetTimeStampStreamSamples` | 0x0A |
|
||||
| `ChannelTappedTest` | 0x0B |
|
||||
| `I106StreamConfigSet` | 0x0C |
|
||||
| `I106StreamConfigGet` | 0x0D |
|
||||
|
||||
**Constructors:**
|
||||
- `protected RealtimeCommandBase(DTS.Common.Interface.DASFactory.ICommunication sock)`
|
||||
- `protected RealtimeCommandBase(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)`
|
||||
|
||||
**Abstract Property:**
|
||||
- `protected abstract Commands _Command { get; }` — Derived classes must specify their command code.
|
||||
|
||||
---
|
||||
|
||||
### Concrete Command Classes
|
||||
|
||||
#### `EndRealtimeMode`
|
||||
Command to end realtime mode on a SLICE device.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public EndRealtimeMode(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public EndRealtimeMode(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
Overrides `_Command` to return `Commands.EndRealtimeMode`.
|
||||
|
||||
---
|
||||
|
||||
#### `StartRealtimeMode`
|
||||
Command to start realtime mode on a SLICE device.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StartRealtimeMode(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public StartRealtimeMode(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `SupportsMultipleSampleRealtime` | `bool` | Gets/sets whether multiple-sample realtime is supported. When set, allocates `byte[1]` or `byte[0]` for `command.Parameter`. |
|
||||
|
||||
**Behavior:** The presence of `command.Parameter` (even as a single byte) signals firmware that multiple-sample realtime is supported.
|
||||
|
||||
---
|
||||
|
||||
#### `GetRealtimeSamples`
|
||||
Base implementation of `IGetRealtimeSamples` for retrieving realtime samples.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public GetRealtimeSamples(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public GetRealtimeSamples(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec, bool bPolling = false)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `SampleNumber` | `ulong` | First sample number; remaining samples are sequential. |
|
||||
| `TimeStamp` | `ulong` | Timestamp of samples. |
|
||||
| `SequenceNumber` | `ulong` | Sequence number. |
|
||||
| `Channels` | `ushort` | Channel count (must be set before execution). |
|
||||
| `SamplesReturned` | `int` | Number of samples returned per channel. Can be 0. |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetChannelData` | `public short[] GetChannelData(int zeroBasedChannel)` | Returns sample array for specified channel. |
|
||||
|
||||
**Default timeout:** 2000ms.
|
||||
|
||||
---
|
||||
|
||||
#### `GetRealtimeSamplesSLICE6`
|
||||
SLICE6-specific implementation of `GetRealtimeSamples`.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public GetRealtimeSamplesSLICE6(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public GetRealtimeSamplesSLICE6(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
**Data handling:** SLICE6 data is signed; byte-swapped but no offset conversion applied.
|
||||
|
||||
---
|
||||
|
||||
#### `GetRealtimeSamplesSLICE2`
|
||||
SLICE2-specific implementation of `GetRealtimeSamples`.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public GetRealtimeSamplesSLICE2(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public GetRealtimeSamplesSLICE2(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
**Data handling:** Converts unsigned to signed data with `+ 0x8000` offset after byte swapping. Sets `LogCommands = false` by default.
|
||||
|
||||
---
|
||||
|
||||
#### `GetRealtimeSamplesTSRAIR`
|
||||
TSRAIR-specific implementation of `GetRealtimeSamples`.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public GetRealtimeSamplesTSRAIR(ICommunication sock)` |
|
||||
| | `public GetRealtimeSamplesTSRAIR(ICommunication sock, int TimeoutMillisec)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Timestamps` | `List<UInt64>` | List of timestamps (protected `_timestamps` field). |
|
||||
|
||||
**Data handling:** TSRAIR data is unsigned; byte-swapped but no normalization applied.
|
||||
|
||||
---
|
||||
|
||||
#### `RetrieveSingleSample`
|
||||
Command to retrieve a single sample from all channels.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public RetrieveSingleSample(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public RetrieveSingleSample(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Channels` | `ushort` | Number of channels (derived from `_data` length). |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetChannelData` | `public short GetChannelData(int zeroBasedChannel)` | Returns single sample value for specified channel. |
|
||||
|
||||
---
|
||||
|
||||
#### `RetrieveSampleAverage`
|
||||
Command to retrieve averaged sample data.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public RetrieveSampleAverage(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public RetrieveSampleAverage(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Samples` | `ushort` | Number of samples to average (sent as parameter at position 0). |
|
||||
| `Channels` | `ushort` | Number of channels returned. |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetChannelData` | `public short GetChannelData(int zeroBasedChannel)` | Returns averaged value for specified channel. |
|
||||
|
||||
**Constants:** `SAMPLES_POSITION = 0`, `DATA_POSITION = 2`.
|
||||
|
||||
---
|
||||
|
||||
#### `StartRealtimeStreamingMode`
|
||||
Command to put firmware into realtime streaming mode for continuous data transmission.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StartRealtimeStreamingMode(DTS.Common.Interface.DASFactory.ICommunication sock, byte[] channelList)` |
|
||||
| | `public StartRealtimeStreamingMode(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec, byte[] channelList)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ChannelList` | `byte[]` | Channels to collect data on; each channel represented as a byte. |
|
||||
|
||||
---
|
||||
|
||||
#### `StartTimeStampStreamMode`
|
||||
Command to start IRIG realtime stream with timestamped data.
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StartTimeStampStreamMode(DTS.Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public StartTimeStampStreamMode(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `SupportsMultipleSampleRealtime` | `bool` | Controls parameter allocation (backing field `_bSupportsIrigTimeStampSampleRealtime`). |
|
||||
| `ParamsToSend` | `byte[]` | Parameters to send with the command. |
|
||||
|
||||
**Behavior:** Sets `MinimumProtocolVersion` using `sock.GetMinProto(ProtocolLimitedCommands.UDPRealtimeStream)`.
|
||||
|
||||
---
|
||||
|
||||
#### `StreamConfigUDPGet`
|
||||
Command to retrieve UDP stream configuration (I106 format).
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StreamConfigUDPGet(Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public StreamConfigUDPGet(Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)` |
|
||||
|
||||
| Property | Type | Parameter Position |
|
||||
|----------|------|-------------------|
|
||||
| `Stream_Profile_Number` | `byte` | 0 |
|
||||
| `UdpIpPort` | `byte[]` | 1-28 |
|
||||
| `TimeChannelID` | `ushort` | 29 |
|
||||
| `DataChannelID` | `ushort` | 31 |
|
||||
| `TMNS_PCMSUBFRAMEID` | `uint` | 33 |
|
||||
| `TMNS_MSGID` | `uint` | 37 |
|
||||
| `TMNS_PCMINORPERMAJOR` | `uint` | 41 |
|
||||
| `TMNS_TMATSPORTNUMBER` | `uint` | 45 |
|
||||
| `IENAUDP_PortNumber` | `uint` | 49 |
|
||||
| `TMNS5` | `uint` | 53 |
|
||||
| `TMNS6` | `uint` | 57 |
|
||||
| `TMNS7` | `uint` | 61 |
|
||||
|
||||
**Constant:** `COMMAND_PAYLOAD_SIZE = 65`.
|
||||
|
||||
---
|
||||
|
||||
#### `StreamConfigUDPSet`
|
||||
Command to set UDP stream configuration (I106 format).
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StreamConfigUDPSet(Common.Interface.DASFactory.ICommunication sock)` |
|
||||
| | `public StreamConfigUDPSet(Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)` |
|
||||
|
||||
| Property | Type | Parameter Position |
|
||||
|----------|------|-------------------|
|
||||
| `Stream_Profile_Number` | `byte` | 0 |
|
||||
| `UdpIpPort` | `byte[]` | 1 |
|
||||
| `Irig106Config0` | `ushort` | 29 |
|
||||
| `Irig106Config1` | `ushort` | 31 |
|
||||
| `TMNS_PCMSubFrameId` | `uint` | 33 |
|
||||
| `TMNS_MsgId` | `uint` | 37 |
|
||||
| `TMNS_PCMMinorPerMajor` | `uint` | 41 |
|
||||
| `TMNS_TMATSPortNumber` | `uint` | 45 |
|
||||
| `IENAUDP_PortNumber` | `uint` | 49 |
|
||||
| `TMNS5` | `uint` | 53 |
|
||||
| `TMNS6` | `uint` | 57 |
|
||||
| `TMNS7` | `uint` | 61 |
|
||||
|
||||
**Constant:** `COMMAND_PAYLOAD_SIZE = 74`.
|
||||
|
||||
---
|
||||
|
||||
### Data/Utility Classes
|
||||
|
||||
#### `UDPStreamPacket`
|
||||
Data structure representing a UDP stream packet (ported from FWTU).
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ChannelData` | `short[][]` | First array = channels, second array = sample index. |
|
||||
| `TimeStamp` | `long` | Timestamp value. |
|
||||
| `SampleNumber` | `ulong` | Sample number. |
|
||||
| `SequenceNumber` | `ulong` | Sequence number. |
|
||||
| `PTPTimesec` | `uint` | PTP time seconds component. |
|
||||
| `PTPTimeNsec` | `uint` | PTP time nanoseconds component. |
|
||||
| `PTPSyncStatusError` | `bool` | PTP sync error flag. |
|
||||
| `ADCOverflowStatus` | `bool` | ADC overflow flag. |
|
||||
| `PTPTimeString` | `string` | Formatted string: `"{sec}:{nsec padded to 9 digits}"`. |
|
||||
|
||||
---
|
||||
|
||||
#### `RealtimeStreamDecoder`
|
||||
Decodes SPS realtime stream packets.
|
||||
|
||||
**Enum `ByteIndex`:**
|
||||
| Value | Offset |
|
||||
|-------|--------|
|
||||
| `Sync` | 0 |
|
||||
| `Type` | 1 |
|
||||
| `Command` | 2 |
|
||||
| `Status` | 3 |
|
||||
| `Group` | 4 |
|
||||
| `Id` | 5 |
|
||||
| `DataLength` | 6 |
|
||||
| `SequenceNumber` | 8 |
|
||||
| `HeaderCRC` | 10 |
|
||||
| `DataCRC` | 12 |
|
||||
| `TimeStamp` | 14 |
|
||||
| `ChannelList` | 22 |
|
||||
| `SampleNumber` | 26 |
|
||||
| `DataStart` | 34 |
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public RealtimeStreamDecoder(IReadOnlyList<byte> bytes)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `SequenceNumber` | `ushort` | Decoded sequence number. |
|
||||
| `TimeStamp` | `ulong` | Decoded timestamp. |
|
||||
| `SampleNumber` | `ulong` | Decoded sample number. |
|
||||
| `Channels` | `int[]` | Array of active channel indices. |
|
||||
| `RtData` | `ushort[]` | Raw data for all channels (not yet converted to signed). |
|
||||
|
||||
---
|
||||
|
||||
#### `UDPRealtimeByteConverter`
|
||||
Converts UDP realtime byte streams (ported from FWTU).
|
||||
|
||||
**Enum `UDP_BYTE_INDEX`:**
|
||||
| Value | Offset |
|
||||
|-------|--------|
|
||||
| `PKT_PATTERN` | 0 |
|
||||
| `CHANNEL_ID` | 2 |
|
||||
| `PKT_LEN` | 4 |
|
||||
| `DATA_LEN` | 8 |
|
||||
| `DATA_TYPE_VER` | 12 |
|
||||
| `SEQ_NUMBER` | 13 |
|
||||
| `PKT_FLAGS` | 14 |
|
||||
| `DATA_TYPE` | 15 |
|
||||
| `REL_TIME32` | 16 |
|
||||
| `REL_TIME16` | 20 |
|
||||
| `HDR_CRC16` | 22 |
|
||||
| `PTP_U32_LSW` | 24 |
|
||||
| `PTP_U32_MSW` | 28 |
|
||||
| `RSV_U16` | 32 |
|
||||
| `HDR2CRC16` | 34 |
|
||||
| `CSDW` | 36 |
|
||||
| `DATA_START` | 40 |
|
||||
|
||||
**Enum `UDP_DATA_TYPE`:**
|
||||
| Value | Code | Description |
|
||||
|-------|------|-------------|
|
||||
| `CGDP_TYPE` | 0x01 | Setup XML record. |
|
||||
| `TIME_DATA_PTP` | 0x12 | Time data, format 2. |
|
||||
| `ANALOG_DATA_FORMAT_1` | 0x21 | Analog data format 1. |
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public UDPRealtimeByteConverter(byte[] bytes)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `PacketPattern` | `ushort` | Packet pattern. |
|
||||
| `DataChannelID` | `ushort` | Channel ID. |
|
||||
| `PacketLength` | `uint` | Total packet length. |
|
||||
| `DataLength` | `uint` | Data length (not same as `RtData.Length`). |
|
||||
| `DataTypeVersion` | `byte` | Data type version. |
|
||||
| `SequenceNumber` | `byte` | Sequence number. |
|
||||
| `PacketFlags` | `byte` | Packet flags. |
|
||||
| `DataType` | `byte` | Data type indicator. |
|
||||
| `RelativeTime32` | `uint` | Relative time (32-bit portion). |
|
||||
| `RelativeTime16` | `ushort` | Relative time (16-bit portion). |
|
||||
| `HdrCrc16` | `ushort` | Header CRC. |
|
||||
| `PtpTimeStampSec` | `uint` | PTP timestamp seconds. |
|
||||
| `PtpTimeStampNsec` | `uint` | PTP timestamp nanoseconds. |
|
||||
| `Hdr2Crc16` | `uint` | Secondary header CRC. |
|
||||
| `ChannelMask` | `uint` | Channel mask. |
|
||||
| `UdpSampleCount` | `ulong` | Sample count. |
|
||||
| `RtData` | `ushort[]` | Realtime data array (XOR'd with 0x8000). |
|
||||
| `Channels` | `uint[]` | Active channels. |
|
||||
| `SequenceNumberPrev` | `byte` | Previous sequence number. |
|
||||
|
||||
---
|
||||
|
||||
#### `StreamReaderUDP`
|
||||
UDP stream reader for receiving realtime data (ported from FWTU).
|
||||
|
||||
| Constructor | Signature |
|
||||
|-------------|-----------|
|
||||
| | `public StreamReaderUDP(string streamAddress, string hostAddress, UDPStreamProfile uDPStreamType, byte[] channels)` |
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `StreamAddress` | `string` | UDP stream address. |
|
||||
| `cmdline` | `byte[]` | Parameters sent to start command. |
|
||||
| `HostIPAddress` | `string` | IP of receive endpoint (default `IPAddress.Any`). |
|
||||
| `UDPStreamType` | `UDPStreamProfile` | Stream profile type. |
|
||||
| `UDPEndpoint` | `EndPoint` | UDP endpoint. |
|
||||
| `UDPSampleNumber` | `ulong` | Sample number counter. |
|
||||
| `Channels` | `byte[]` | Channels to receive. |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CloseSocket` | `public void CloseSocket()` | Closes the UDP socket. |
|
||||
| `Read` | `public UDPStreamPacket Read()` | Receives packets and returns decoded `UDPStreamPacket`, or `null` if no data. |
|
||||
|
||||
**Behavior:** Supports multicast (IP range 224-239). Sets socket receive timeout to 2000ms. Hardcoded to 6 channels for UDP data parsing.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Command Type:** All realtime commands
|
||||
Reference in New Issue
Block a user