12 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:48:00.912898+00:00 | zai-org/GLM-5-FP8 | 1 | ae149525b5d620e6 |
SLICE Commands Module Documentation
1. Purpose
This module provides a command hierarchy for communicating with SLICE hardware devices in the DataPRO system. It implements a command pattern where each operation (firmware updates, PTP1588 clock synchronization, stack utilities, etc.) is encapsulated as a discrete command object that manages its own serialization, transmission, and response handling. The module serves as the protocol layer between the application and SLICE hardware, handling command packet construction, sequence number management, and response parsing.
2. Public Interface
CommandPacket (DTS.DASLib.Command.SLICE)
Constructors:
CommandPacket()- Creates an empty command packetCommandPacket(byte[] Bytes)- Creates a command packet from raw bytes
Public Methods:
override void GetNextSequenceNumber()- Thread-safely assigns the next global sequence number to this packetoverride object ConvertByteToCommandType(byte b)- Converts a byte to aCommandTypeenum value
Public Types:
public enum CommandType
{
Reserved = 0,
Arm = 1,
Attribute = 2,
Diagnostics = 3,
EventData = 4,
FirmwareUpdate = 5,
Information = 6,
QAandUtility = 7,
Realtime = 8,
Bulk = 9,
StackFirmwareUpdate = 10,
Ptp1588 = 11,
Multicast = 12,
}
CommandBase (DTS.DASLib.Command.SLICE)
Abstract base class for all SLICE commands.
Constructors:
CommandBase(DTS.Common.Interface.DASFactory.ICommunication sock)CommandBase(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
Protected Methods:
override CommandPacketBase GetCommandPacket()override CommandPacketBase GetCommandPacket(byte[] buffer)
BusPowerControl (DTS.DASLib.Command.SLICE)
Controls bus power to SLICE devices.
Constructors:
BusPowerControl(ICommunication sock)BusPowerControl(ICommunication sock, int TimeoutMillisec)
Properties:
bool PowerOn- Gets or sets the bus power state; setter encodes parameter as byte 0 or 1
Methods:
override string CommandToString()- Returns command descriptionoverride string ResponseToString()- Returns response description
ForceEnumeration (DTS.DASLib.Command.SLICE)
Forces device enumeration on the stack.
Constructors:
ForceEnumeration(ICommunication sock)ForceEnumeration(ICommunication sock, int TimeoutMillisec)
Properties:
int SLICECount- Gets the count of enumerated SLICE devices from response
Protected Methods:
override CommandReceiveAction WholePackage()- Parses response to extract SLICE count
Firmware Update Commands
QueryFirmwareUpdateBlockSize
Properties: ushort BlockSize - Block size from response
QueryBootloaderVersion
Properties: string Version - Bootloader version string from response
SwitchToFirmwareUpdateMode
No additional properties; signals device to enter firmware update mode.
BeginFirmwareUpdate
No additional properties; initiates firmware update process.
ProgramFirmwareUpdateBlock
Properties:
uint BlockBaseAddress- Block address (parameter offset 0)ushort BlockSize- Data block size (parameter offset 4)ushort BlockCRC16- CRC16 of block (parameter offset 6)bool Upper- Upper/lower flag (parameter offset 8)byte[] Data- Firmware data bytes (starting at parameter offset 10)
FinishFirmwareUpdate
Properties:
ushort ImageCRC16- CRC16 of entire firmware image (parameter offset 0)
Reboot
No additional properties; reboots the device.
QueryInFirmwareUpdateMode
Properties:
bool InUpdateMode- True if not in FW modebool IsFwMode- True if in firmware modebool IsBlMode- True if in bootloader modebool IsBllMode- True if in secondary bootloader modeFirmwareMode Mode- Current firmware mode enum value
Load_SliceProStackFirmwareImage
Properties:
uint StartByteCount- Byte offset for this block (parameter offset 2)byte[] Data- Firmware data (maxMAX_FILE_LENGTH= 400 bytes)int Size- Data sizeint MaximumFileStreamBytes- Returns 400
Methods:
void LogResponse()- Logs command response
Start_SliceProStackFirmwareUpdate
No additional properties; starts stack firmware update process.
Set_SliceProStackFirmwareUpdateMode
Properties:
int SliceModuleCount- Number of slice modulesbyte[] SliceModuledateMode- Update mode per module
Get_SliceProStackFirmwareUpdateMode
Properties:
int SliceModuleCount- Count from responsebyte[] SliceModuledateMode- Mode per module from response
PTP1588 Commands
Ptp1588SetMode
Methods:
void SetClockType(PtpClockType clockType)- Sets clock type (parameter offset 0)void SetDelayMechanism(PtpDelayMechanism delayMechanism)- Sets delay mechanism (parameter offset 2)
Ptp1588GetMode
Properties:
PtpClockType ClockType- Clock type from responsePtpDelayMechanism DelayMechanism- Delay mechanism from response
Ptp1588GetSyncStatus
Properties:
PtpSyncStatus SyncStatus- Synchronization statusint OFM- Offset from master (nanoseconds)int FreqAdj- Frequency adjustment
Ptp1588SetTime / Ptp1588SetAutoTriggerTime
Methods:
void SetSeconds(uint seconds)- Sets seconds component (parameter offset 0)void SetNanoseconds(uint ns)- Sets nanoseconds component (parameter offset 4)
Ptp1588GetTime / Ptp1588GetAutoTriggerTime
Properties:
uint Seconds- Seconds from responseuint Nanoseconds- Nanoseconds from responsestring Timestamp- Formatted timestamp string
Ptp1588GetTimestamp
Properties:
PtpTimestampUnits TimestampUnit- Sets timestamp unit to query (parameter offset 0)uint Seconds,uint Nanoseconds,bool IsValid,string Timestamp- From response
Ptp1588SetEnableTimestamping
Methods:
void SetEnable(bool enable)- Enables/disables timestamping
Ptp1588SetAdcClockFrequency
Properties:
uint RequestedFrequency- Sets requested frequency (parameter offset 0)- Actual frequency returned in response (accessible via
WholePackage())
Ptp1588RunClockAdjustmentCalibration
Methods:
void SetDuration(ushort duration)- Calibration duration in seconds (parameter offset 0)void SetSaveAttribute(bool b)- Whether to save calibration (parameter offset 2)
QueryClockSyncStatus
Properties:
byte InputState,byte OutputState,byte SyncStatusClockSyncProfile ClockSyncProfileList<InputClockSource> InputSourcesList<OutputClockSource> OutputSourcesIDictionary<InputClockSource, bool> InputSyncStatus
SetClockSyncConfig
Configuration setter; response indicates success/failure.
Static Utility
Ptp1588Commands.ToTimestampString(uint s, uint ns)
Returns formatted timestamp string: "{seconds}.{nanoseconds:000000000}"
3. Invariants
-
Sequence Number Uniqueness:
CommandPacket.GlobalSequenceNumberis incremented atomically underGlobalSequenceNumberLockto ensure thread-safe unique sequence numbers across all command packets. -
Command Type Assignment: All concrete command classes must set
command.Typeto the appropriateCommandPacket.CommandTypevalue in their constructors. -
Parameter Array Initialization: Commands must initialize
command.Parameterto an appropriately sized byte array before setting parameters. -
Protocol Version Requirements: Commands using
MinimumProtocolVersion(e.g.,Load_SliceProStackFirmwareImage,QueryClockSyncStatus,SetClockSyncConfig) must retrieve the minimum protocol version viasock.GetMinProto(). -
Firmware Data Size Limit:
Load_SliceProStackFirmwareImage.Datamust not exceedMAX_FILE_LENGTH(400 bytes); throwsNotImplementedExceptionif exceeded. -
Response Parsing Guard: All
WholePackage()overrides checkresponse.Status == CommandStatus.StatusNoErrorbefore parsing response parameters.
4. Dependencies
This module depends on:
DTS.DASLib.Communication-ICommunicationinterfaceDTS.DASLib.Utility- Utility functionsDTS.Common.ICommunication- Communication interfacesDTS.Common.Utilities.Logging- Logging infrastructureDTS.Common.Enums.DASFactory-DFConstantsAndEnums,ProtocolLimitedCommandsDTS.Common-ClockSyncProfile,InputClockSource,OutputClockSourcetypes- Base classes
SliceCommandBaseandSliceCommandPacketBase(location not shown in source)
Inheritance Hierarchy:
SliceCommandPacketBase
└── CommandPacket
SliceCommandBase
└── CommandBase
├── Commands_Stack_Setup
├── Commands_Stack_Utility
│ ├── BusPowerControl
│ └── ForceEnumeration
├── FirmwareUpdateCommands
│ ├── QueryFirmwareUpdateBlockSize
│ ├── QueryBootloaderVersion
│ ├── SwitchToFirmwareUpdateMode
│ ├── BeginFirmwareUpdate
│ ├── ProgramFirmwareUpdateBlock
│ ├── FinishFirmwareUpdate
│ ├── Reboot
│ ├── QueryInFirmwareUpdateMode
│ ├── Load_SliceProStackFirmwareImage
│ ├── Start_SliceProStackFirmwareUpdate
│ ├── Set_SliceProStackFirmwareUpdateMode
│ └── Get_SliceProStackFirmwareUpdateMode
└── Ptp1588Commands
├── Ptp1588SetMode
├── Ptp1588GetMode
├── Ptp1588GetSyncStatus
├── Ptp1588SetTime
├── Ptp1588GetTime
├── Ptp1588SetAutoTriggerTime
├── Ptp1588GetAutoTriggerTime
├── Ptp1588GetTimestamp
├── Ptp1588SetEnableTimestamping
├── Ptp1588SetAdcClockFrequency
├── Ptp1588RunClockAdjustmentCalibration
├── QueryClockSyncStatus
└── SetClockSyncConfig
5. Gotchas
-
Empty Commands Enum:
Commands_Stack_Setupdefines aCommandsenum with no members. This appears to be incomplete—no concrete implementations derive from this class in the provided source. -
Typo in Property Name:
Set_SliceProStackFirmwareUpdateMode.SliceModuledateModeandGet_SliceProStackFirmwareUpdateMode.SliceModuledateModeappear to have a typo ("date" instead of "Update"). -
Typo in Command Enum:
Ptp1588Commands.Commands.SetAdcClockFrquencyis misspelled (missing 'e' in "Frequency"). -
Inconsistent ICommunication Types: Some classes use
DTS.DASLib.Communication.ICommunicationwhile others useDTS.Common.Interface.DASFactory.ICommunication. The relationship between these interfaces is unclear from the source. -
Logging Disabled for Firmware Load:
Load_SliceProStackFirmwareImagesetscommand.ShouldLog = falsein its constructor, meaning these commands won't be logged by default—likely due to high volume during firmware uploads. -
Hardcoded File ID:
Load_SliceProStackFirmwareImagehardcodes_fileID = 20with no way to change it via public interface. -
NotImplementedException for Oversized Data:
Load_SliceProStackFirmwareImage.DatathrowsNotImplementedExceptionrather thanArgumentExceptionwhen data exceeds 400 bytes—an unusual exception choice for a validation error. -
Protocol Version Required but Not Enforced: Commands like
Load_SliceProStackFirmwareImagesetMinimumProtocolVersionbut the source does not show how this is enforced or validated before command execution.