Files
DP44/docs/ai/DataPRO/SLICECommands/DownloadCommands.md
2026-04-17 14:55:32 -04:00

12 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
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
2026-04-17T15:47:37.787305+00:00 zai-org/GLM-5-FP8 1 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:

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:

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