9.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:28:43.247435+00:00 | zai-org/GLM-5-FP8 | 1 | f5d708ac0e3a8539 |
Documentation: DTS.DASLib.Service
1. Purpose
This module serves as the data contract and utility layer for the DTS Data Acquisition System (DAS) service infrastructure. It defines the fundamental data structures used to represent hardware configuration (ConfigurationData), device information (InfoResult), sensor identification (EID), and acquired sample data (SampleData, NewDataData). Additionally, it provides utilities for XML serialization (XMLHelper), hardware interaction callbacks (ServiceCallbackData), and custom error handling via specific exception types. It acts as the bridge between the hardware communication layer and the higher-level application logic.
2. Public Interface
Classes
ConfigurationData
Implements IConfigurationData, IXmlSerializable. Represents the configuration of a DAS device.
IDASModule[] Modules: Array of modules in the DAS.IEID[] IDs: EIDs for the DAS (ignored in XML serialization).string TestID,string InstanceID,string Description: Test metadata.int NumberOfConfiguredChannels(): Returns the count of channels whereIsConfiguredis true.static void Serialize(string file, ConfigurationData config): Serializes config to an XML file.static string Serialize(ConfigurationData config): Serializes config to an XML string.static byte[] SerializeBin(ConfigurationData config): Serializes config to a binary blob (usesBinaryFormatter).static ConfigurationData Deserialize(string file): Deserializes XML file to object.static ConfigurationData DeserializeFromString(string SerializedText): Deserializes XML string to object.void WriteXml(XmlWriter writer): Custom XML write logic.void ReadXml(XmlReader reader): Custom XML read logic.
InfoResult
Implements IInfoResult. Contains hardware information about a discovered DAS device.
IInfoResultModule[] Modules: Array of module descriptors.string MACAddress: The MAC address of the device.IEID BatteryID: Electronic ID of the battery.bool HasBattery: Calculated property checking if a valid battery ID is present.byte MapDASChannelNumber2ModuleArrayIndex(int channelNumber): Converts global channel number to module index.byte MapDASChannelNumber2ModuleChannelNumber(int channelNumber): Converts global channel number to local module channel number.byte MapModuleArrayIndexAndChannelNum2DASChannel(int moduleArrayIdx, int channelNumber): Converts local module/channel indices to global DAS channel number.static void SetDASInfo(IDASCommunication das, IInfoResult dasInfo, bool bSetInDb = true): Updates DAS info, optionally persisting to the database.
EID (Electronic ID)
Implements IEID, IComparable<EID>, IComparable<string>. Represents a sensor Electronic ID.
string ID: The ID string.byte[] Blob: Raw binary data.bool IsValid(): Validates the ID (checks length=16, hex format, non-blank, and CRC8).int CompareTo(EID eid): Case-insensitive comparison.
EIDReader
Static helper class for reading EIDs from hardware.
static bool SupportsQueryOneWireID(ICommunication comm): Returns false forEthernetTsrAirandWinUSBTsrAir; true otherwise.static IEID[] RetriveEIDs(ICommunication comm, byte DASChannelNumber, int idType): Retrieves EIDs with retry logic (3 attempts). Returnsnullon failure or if unsupported.static EID[] RetriveEIDs(ICommunication comm, int moduleIndex): Retrieves EIDs for a specific module index.static EID[][] RetrieveEIDsG5(ICommunication comm): Retrieves EIDs for G5 hardware racks.static bool IsBlankID(string id): Checks if ID equalsBLANK_ID("0000000000000000").
ServiceCallbackData
Base class for internal service callbacks.
CallbackStatus Status: Enum (ProgressReport, NewData, Timeout, Success, Failure, Canceled, InvalidParameters).SampleData[] DataSamples: Array of sample data segments.void AddSampleData(short[][] data, ulong sampleNumber, ulong timeStamp, ulong sequenceNumber): Adds a sample segment to the internal list.void SetNewDiagnosticData(DiagnosticNewData data),SetNewTiltData(TiltNewData data), etc.: Setters for specific data payload types.
XMLHelper
Static helper for type-safe XML parsing/writing using InvariantCulture.
GetString(XmlReader reader): Reads element text content.GetDouble(XmlReader reader),GetInt(XmlReader reader), etc.: Parses text to specific types.TryGetString(...),TryGetDouble(...), etc.: Safe versions returning default values on failure.PutString(XmlWriter writer, string tag, string value),PutDouble(...), etc.: Writes elements with specified tags.
SampleData
Represents a single poll of hardware data.
short[][] Data: Jagged array of channel data.ulong SampleNumber,TimeStamp,SequenceNumber: Metadata for the sample.
NewDataData
Container for bulk data acquisition results.
short[][][] datas: 3D array of data.ulong[] SampleNumbers,TimeStamps,SequenceNumbers: Arrays of metadata.
TOMModule
Inherits from DASModule. Represents a digital output channel.
TomTriggerType TriggerType: Enum defining trigger source (NONE, BUS_ONLY, PANEL_ONLY, BUS_PANEL).
ModuleDiagnosticsResult
Implements IModuleDiagnosticsResult. Holds temperature readings from diagnostics.
float TemperatureLocation1Pre...TemperatureLocation4Post: Temperature properties.
FlashEraseStatus
Tracks flash erase progress.
CommandStatus LastError: Status of the operation.float PercentComplete: Progress percentage.
TriggerCheckResult
Implements ITriggerCheckResult. Holds trigger line states.
bool IsStatusGood,IsTriggered,HasTriggered,IsStartRecordActive,HasStartRecordBeenActive.
Exceptions
BusyException: Thrown when a service is called while already busy.TriggerShortedException,StartShortedException: Hardware trigger faults.NoDiagnosticsAvailable: Diagnostics data requested before diagnostics run.TooManyDiagnosticsAvailable: Ambiguous diagnostic results found.
Enums
ConfigurationConstants.VerifyConfig_Errors: ContainsDefaultHardwareFilterRateOutOfRange.
3. Invariants
- EID Validation: A valid
EIDmust be exactly 16 characters, in Hex format, not equal to "0000000000000000", and must match the internal CRC8 checksum calculated via the staticCRCTable. - XML Parsing:
XMLHelpermethods enforceInvariantCulturefor all numeric parsing to ensure locale independence. - Sample Data:
SampleDataandNewDataDataassociate data arrays strictly with corresponding metadata arrays (SampleNumbers, TimeStamps, etc.). The consumer must ensure array lengths match. - Module Mapping:
InfoResultmapping functions assumeModulesis ordered byModuleArrayIndex.MapDASChannelNumber2ModuleArrayIndexdefaults to the last module index if the channel number exceeds the calculated total.
4. Dependencies
Internal Dependencies (within DTS.DASLib.Service)
TOMModuledepends onDASModule(base class).ServiceCallbackDatadepends onSampleData.ConfigurationDatadepends onXMLHelper,DASModule,EID.InfoResultdepends onEID,EIDReader.
External Dependencies
- DTS.Common.Interface.DASFactory: Interfaces
IDASCommunication,ICommunication,IEID,IInfoResult,IModuleDiagnosticsResult,ITriggerCheckResult,IDASModule. - DTS.Common.Enums.DASFactory: Enums
CommandStatus,ModuleType,RecordingMode. - DTS.Common.Utilities:
HexEncoding,APILogger. - DTS.DASLib.Command.SLICE:
QueryOneWireIDcommand. - DTS.DASLib.Command.TDAS:
ReadSensorIDs,RackIDXcommands. - DASFactoryDb: Database wrapper for configuration and info storage (
Config.SetConfiguration,DbWrapper).
5. Gotchas
- Null vs Empty Array in EIDReader: The method
EIDReader.RetriveEIDsexplicitly returnsnullinstead of an empty array if no IDs are found or the device is unsupported. The source comments indicate this is to avoid breaking legacy "CalStation" code that indexes the result directly (e.g.,result[0]) without checking length. - Method Name Typo: The method
RetriveEIDsinEIDReaderis misspelled (missing an 'e'). - BinaryFormatter Obsolescence:
ConfigurationData.SerializeBinusesBinaryFormatter, which is deprecated in modern .NET versions due to security risks. - Silent Failures in Deserialization:
ConfigurationData.DeserializeFromStringcatches exceptions, logs them, and returnsnullrather than propagating the exception to the caller. - Hardcoded G5Digital Channel Count: In
InfoResult.MapDASChannelNumber2RealtimeChannelNumber, the case forModuleType.G5Digitalreturns a hardcoded32, though the comment notes this case is currently unreachable due to logic flow. - Redundant Class Name: The class
NewDataDatahas a redundant name. - Magic Numbers:
EIDvalidation relies on a hardcoded 256-byte CRC lookup table.InfoResultdefaultsNumberOfBridgeChannelsto 3.