6.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-17T15:49:45.052194+00:00 | zai-org/GLM-5-FP8 | 1 | b0635eb6f7e0c765 |
TDAS Command Module Documentation
1. Purpose
This module provides the command infrastructure for communicating with TDAS (Test Data Acquisition System) hardware. It implements a command/response protocol for sending control commands (such as test triggers) and receiving data, handling packet construction, response parsing, communication throttling, and diagnostic logging. The module supports both single-module and broadcast command modes for controlling test trigger states (ARM, STATUS, OFF) across TDAS recording devices.
2. Public Interface
TestTrigger (class)
Executes test trigger commands against a specific TDAS module.
Constructors:
TestTrigger(DTS.Common.Interface.DASFactory.ICommunication sock)— Creates command with default 30000ms timeout.TestTrigger(DTS.Common.Interface.DASFactory.ICommunication sock, int msTimeout)— Creates command with custom timeout.
Properties:
int ModuleIndex— Gets or sets the target module index.SubCommandValues SubCommand— Gets or sets the subcommand (ARM,STATUS,OFF).StatusValues TriggerStatus— Gets the trigger status from the response (ARMED,OFF).
Nested Enums:
SubCommandValues { ARM, STATUS, OFF }StatusValues { ARMED, OFF }
TestTriggerBroadcast (class)
Executes broadcast test trigger commands to TDAS modules.
Constructors:
TestTriggerBroadcast(DTS.Common.Interface.DASFactory.ICommunication sock, int moduleIndex)TestTriggerBroadcast(DTS.Common.Interface.DASFactory.ICommunication sock, int moduleIndex, int msTimeout)
Properties:
TestTrigger.SubCommandValues SubCommand— Gets or sets the subcommand.
CommandBase (class)
Base class for TDAS commands providing execution, response handling, and logging.
Constructors:
CommandBase(DTS.Common.Interface.DASFactory.ICommunication sock)CommandBase(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMillisec)
Properties:
string ResponseData— Lazy-loaded response data; callsProcessData()on first access.bool SingleModuleCommand— Gets or sets whether this is a single-module command.string RackSerialNumber— Gets or sets the rack serial number (default:"NONE").
Methods:
bool IsErrored()— Returnstrueif response starts with"err"(case-insensitive).string GetErrorString()— Extracts error message from response starting at"ERR"+ 4 characters.void SyncExecute()— Executes command with semaphore-based throttling.static void InitializeSemaphore(double delay, int spots)— Initializes throttling parameters.static void RollLog()— Triggers log file rollover.
TDASCommandPacketBase (class)
Builds and parses TDAS command packets.
Constructors:
TDASCommandPacketBase(CommandString cs)— Creates packet from a command string.TDASCommandPacketBase(byte[] buffer, CommandPacketBase command)— Creates packet from response bytes.
Properties:
bool RackCommand— Gets or sets whether this is a rack-level command.bool SingleModuleCommandstring RackSerialNumberint ModuleIndex— Must be < 10; throwsExceptionotherwise. Setting this setsRackCommand = false.bool AllModulebool RebuildBytes— Whentrue, forces byte rebuild on serialization.bool ExpectsDatabool ExpectsMultipleLinesint LinesExpectedbool UseMDBMode— Enables MDB (Memory Data Block) parsing mode.bool MonitorDataModebool RealtimeCommandbyte CharWait— Character wait value (default:0x01).int ReplyWait— Reply wait value (default:30).
Methods:
byte[] ToBytes()— Serializes packet to 536-byte CDB format.string GetCommandString(int index)— Gets command string at index.CommandString GetCommandStringObject(int index)— GetsCommandStringobject at index.string ToCommandString()— Returns ASCII command string from bytes.int GetExpectedBytes()— Returns expected data bytes in MDB mode.short[] GetData()— Extracts data from MDB blocks.PacketState VerifyPacket(byte[] Bytes)— Validates response packet completeness.void GetNextSequenceNumber()— Assigns next global sequence number (thread-safe).void ComputeCRCs()— No-op in this implementation.
CommandString (abstract class)
Base class for defining command strings.
Properties:
virtual string RequiredResponseString— Required response marker for packet completion validation.bool ExpectsData— Default:true.bool ExpectsMultipleLinesint LinesExpectedbool RackCommand— Default:true.bool SingleModuleCommandstring RackSerialNumberint Length— Cached byte length of command.
Methods:
virtual byte[] GetParameters()— Override to provide command parameters; default returns empty array.string GetCommandPortion()— Returns the command string.string GetCommandDescription()— Returns command description.byte[] GetBytes()— Serializes command with parameters and CRLF terminator.void RebuildBytes()— Clears cached bytes to force rebuild.
CommandPacketException (class)
Exception for command packet errors.
Constructor:
CommandPacketException(ERROR_CODES errorCode, string description)
Properties:
ERROR_CODES ErrorCode— ReturnsUNKNOWNif not set.
Enum:
ERROR_CODES { TOO_MANY_COMMANDS = 0, TOO_MANY_BYTES = 1, UNKNOWN = 2 }
3. Invariants
- Module Index Constraint:
ModuleIndexmust be less than 10; otherwiseTDASCommandPacketBasethrows anException. - Command Limits: Maximum of 1 command per packet (
MAX_CMD = 1) and maximum 512 bytes per command (MAX_CMD_SIZE = 512). - Packet Size: CDB packet size is fixed at 536 bytes (
CDB_SIZE = 536). - MDB Block Sizes:
MDB_BLOCK_SIZE = 52,DMA_SIZE = 1024,DMA_BLOCK_SIZE = 1076. - Default Timeout: Commands default to 30000ms timeout.
- Default Throttling: Semaphore defaults to 3 concurrent spots with 100ms delay.
- Status Packet Structure: TDAS status packet is 20 bytes, ending with 4 bytes of
0xFFat positions 16-19. - Sequence Numbers: