9.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T02:41:35.863754+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | b5e818821adb9531 |
DASFactory
Documentation: DASFactory Configuration Classes
1. Purpose
This module provides strongly-typed configuration classes for DASFactory subsystems, encapsulating low-level data structures used for communication with hardware devices. Specifically, TemperatureConfig manages temperature/humidity logging channel selection and timing, TMNSConfig encapsulates TMNS (Telemetry Network Service) streaming parameters, and ATDStagger (currently commented out) was designed to serialize device command execution to avoid communication bottlenecks. These classes replace raw arrays with named fields and helper methods to improve maintainability, type safety, and clarity in configuration serialization/deserialization workflows.
2. Public Interface
TemperatureConfig
-
public ushort LogEnable { get; set; }
Enables/disables logging (non-zero = enabled). -
public ushort LogIntervalSec { get; set; }
Logging interval in seconds. -
public ushort Channels { get; set; }
Bitfield representing enabled channels (16-bit value). Setting updates internalBitArray; reading convertsBitArraytoushort. -
public const ushort Reserved = 0;
Reserved field value (always 0). -
public bool MCUTemp { get; set; }
Gets/sets the On-Board MCU Temperature channel (bit 0 of_channels). -
public bool OnBoardHumidity { get; set; }
Gets/sets the On-Board Humidity channel (bit 1 of_channels). -
public bool EnvironmentalCh1 { get; set; }
Gets/sets Environmental Channel 1 (bit 2 of_channels). -
public bool EnvironmentalCh2 { get; set; }
Gets/sets Environmental Channel 2 (bit 3 of_channels). -
public bool EnvironmentalCh3 { get; set; }
Gets/sets Environmental Channel 3 (bit 4 of_channels). -
public bool EnvironmentalCh4 { get; set; }
Gets/sets Environmental Channel 4 (bit 5 of_channels). -
public ushort[] ToUShortArray()
Returns[LogEnable, LogIntervalSec, Channels, Reserved]in that order. -
public TemperatureConfig()
Default constructor. -
public TemperatureConfig(ushort[] ushortArray)
Constructor fromushort[]. Reads indices 0–2; missing indices default to0. Does not initializeReserved. -
public int[] GetChannelsArray()
Returns list of bit indices where_channelsis set (e.g.,[0,2,4]if MCUTemp, Ch1, Ch3 enabled). -
public S6DBDiagnosticChannelList[] GetMeasurementChannels()
Maps enabled channels to correspondingS6DBDiagnosticChannelListenum values (e.g.,DiagMcuTemperature,DiagEnv_1_Temperature, etc.). -
public TempLogChannelBits GetChannelBitForDiagChannel(S6DBDiagnosticChannelList ch)
Maps aS6DBDiagnosticChannelListvalue to its correspondingTempLogChannelBitsenum. ThrowsNullReferenceExceptionif not found.
TMNSConfig
-
public uint TMNS_PCMSubFrameId { get; set; }
TMNS PCM sub-frame ID. -
public uint TMNS_MsgId { get; set; }
TMNS message ID. -
public uint TMNS_PCMMinorPerMajor { get; set; }
TMNS PCM minor-per-major setting. -
public uint TMNS_TMATSPortNumber { get; set; }
TMNS TMATS port number. -
public uint IENAUDP_PortNumber { get; set; }
IENA UDP source port number. -
public uint TMNS5, TMNS6, TMNS7 { get; set; }
Reserved fields (5–7). -
public enum Fields { ... }
Ordered list of field indices:TMNS_PCMSubFrameID,TMNS_MsgId,TMNS_PCMMinorPerMajor,TMNS_TMATSPortNumber,IENAUDP_PortNumber,TMNS5,TMNS6,TMNS7. -
public TMNSConfig()
Default constructor; initializes_valuesarray to length 8 with zeros. -
public TMNSConfig(uint[] parameters)
Constructor fromuint[]. Copies up to 8 values; missing indices default to0. -
public TMNSConfig(string parameters)
Constructor from comma-separated string (e.g.,"(1,2,3)"). Parsesuintvalues; invalid tokens default to0. -
public void SetValue(Fields field, uint value)
Sets_values[(int)field]. -
public uint GetValue(Fields field)
Returns_values[(int)field]. -
public uint[] ToUintArray()
Returns a copy of_values. -
public string ToCSVString()
Returns string in format"(x,y,z,...)". -
public static bool IsCh10(UDPStreamProfile profile)
Returnstrueifprofileis one of the CH10 variants. -
public static bool IsIENA(UDPStreamProfile profile)
Returnstrueifprofile == UDPStreamProfile.IENA_PTYPE_STREAM. -
public static bool IsTMNS(UDPStreamProfile profile)
ReturnstrueifprofileisTMNS_PCM_STANDARDorTMNS_PCM_SUPERCOM. -
public static bool IsUART(UDPStreamProfile profile)
Returnstrueifprofile == UDPStreamProfile.UART_STREAM.
ATDStagger (commented out)
- No public interface is active — the entire class is commented out. The source includes only historical comments and implementation notes. No runtime behavior can be documented.
3. Invariants
-
TemperatureConfig_channelsis always a 16-bitBitArray(2 bytes), initialized to0x0000.Channelsproperty setter always replaces_channelswith a newBitArrayconstructed from theushort’s bytes.LogEnable,LogIntervalSec, andChannelsare the only fields populated fromushort[]constructor;Reservedis ignored in constructor.GetChannelBitForDiagChannelthrowsNullReferenceException(notKeyNotFoundException) if the key is missing — a bug in implementation.
-
TMNSConfig_valuesis always exactly 8 elements long (matchingFieldsenum count).ToUintArray()returns a copy, not a reference.ToCSVString()always includes parentheses and commas, even for empty/zero values.
-
ATDStagger- N/A — class is commented out; no invariants apply.
4. Dependencies
-
TemperatureConfig- Imports:
DTS.Common.Enums.DASFactory(forDFConstantsAndEnums,TempLogChannelBits),System,System.Collections,System.Collections.Generic. - Uses:
BitConverter,BitArray. - Depends on:
TempLogChannelBitsandS6DBDiagnosticChannelListenums (defined inDTS.Common.Enums.DASFactoryandDTS.Common.Enums, respectively — not shown). - Used by: Likely consumed by firmware/hardware communication layers to configure logging; inferred from usage of
ToUShortArray()andGetMeasurementChannels().
- Imports:
-
TMNSConfig- Imports:
DTS.Common.Enums,System,System.Linq,System.Text. - Uses:
UDPStreamProfileenum (fromDTS.Common.Enums— not shown). - Depends on:
UDPStreamProfileforIsCh10,IsIENA,IsTMNS,IsUARTmethods. - Used by: Likely used by telemetry configuration modules (e.g., FWTU, DP — mentioned in summary).
- Imports:
-
ATDStagger- Imports:
DTS.Common.Interface.DASFactory,DTS.Common.Utilities.Logging,System,System.Collections.Generic,System.Data,System.Linq. - Uses:
IDASCommunication,ICommunication,APILogger,IDbCommand. - Depends on: Database schema (
[DataPro].[dbo].[DAS]table with columnsSerialNumber,PositionOnDistributor,PositionOnChain,Port,ParentDAS), andIsSlice6Distributor()extension method. - Used by: Service execution logic (not visible in source).
- Imports:
5. Gotchas
-
TemperatureConfigReservedis aconst, but theushort[]constructor does not read index 3 —Reservedis always0regardless of input.GetChannelBitForDiagChannelthrowsNullReferenceExceptioninstead ofKeyNotFoundException— misleading and non-idiomatic.Channelssetter usesBitConverter.ToUInt16(bytes, 0)— assumes little-endian platform (standard on .NET, but not guaranteed by spec).GetUShortsilently defaults to0for out-of-bounds indices — may hide configuration errors.
-
TMNSConfigToCSVString()always includes parentheses — callers expecting bare comma-separated values may need to strip them.- String constructor allows
(1,2,3)but does not validate length — extra tokens are ignored, missing tokens default to0. IsCh10,IsIENA, etc., arestaticand operate onUDPStreamProfile— not directly tied toTMNSConfiginstance state.
-
ATDStagger- Entire class is commented out — do not use. Historical comments suggest it was intended for ATD device sequencing but was never enabled.
- Logic for assigning devices to ports (e.g., "even if we end up talking to 4 devices on one port it’ll be better...") is heuristic and not guaranteed optimal.
-
All Classes
- No validation on
LogIntervalSec(e.g., no minimum/maximum checks). - No thread-safety guarantees beyond
lockusage inATDStagger(which is commented out).TemperatureConfigandTMNSConfigare not thread-safe.
- No validation on
-
None identified from source alone for
ATDStagger— class is inactive.