7.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||
|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T04:00:12.173977+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9b91ae827f1dd2a6 |
StatusAndParameters
Documentation: State Machine Status and Parameters Module
1. Purpose
This module defines the core data structures and interfaces for tracking and managing the runtime state and configuration parameters of a distributed acquisition system (DAS) within the state machine framework. It provides typed containers for status information (read-only or observation-oriented state, e.g., device presence in certain operational modes) and status parameters (configurable settings that influence behavior, e.g., multicast or auto-sense flags). The Status class aggregates all such state and parameter objects into a single, resettable snapshot used by the state machine to make decisions and coordinate subsystems.
2. Public Interface
Interfaces
-
IStatusInfovoid Reset();Marker interface for status information types that support resetting to default state. No behavior beyond
Reset()is defined here. -
IStatusParametersvoid Reset();Marker interface for status parameter types that support resetting to default values. No behavior beyond
Reset()is defined here.
Concrete Classes
-
GlobalStatusParameters(implementsIStatusParameters)public bool AllowUDPMulticast { get; set; } = true; public bool DisableAutoSense { get; set; } = SensorConstants.DisableAutoSense; public void Reset();Holds global configuration flags.
Reset()restoresAllowUDPMulticasttotrueandDisableAutoSensetoSensorConstants.DisableAutoSense. -
Status(aggregate container)public HardwareDiscoveryParameters HardwareDiscoveryParams; public HardwareDiscoveryStatusInfo HardwareDiscoveryStatusInfo; public GlobalStatusInformation GlobalStatusInformation; public GlobalStatusParameters GlobalStatusParameters; public ConfigureStatusInformation ConfigureStatus; public ConfigureStatusParameters ConfigureParameters; public RealtimeStatusInformation RealtimeStatus; public RealtimeParameters RealtimeParams; public DiagnoseParameters DiagnoseParams; public DownloadParameters DownloadParams; public DownloadStatusInformation DownloadStatusInfo; public void Reset();Central state container.
Reset()invokesReset()on all contained sub-objects exceptDownloadStatusInfoandDownloadParams(note: these are omitted fromReset()).⚠️ Observed omission:
DownloadStatusInfo.Reset()andDownloadParams.Reset()are not called inStatus.Reset(), despite both being declared as fields. -
GlobalStatusInformation(implementsIStatusInfo)public IDASCommunication[] GetUnitsInRealtime(); public void AddUnitInRealtime(IDASCommunication device); public IDASCommunication[] GetUnitsInArm(); public void AddUnitInArm(IDASCommunication device); public IDASCommunication[] GetUnitsAtLowPower(); public void AddUnitAtLowPower(IDASCommunication das); public IDASCommunication[] GetUnitsAtHighPower(); public void AddUnitAtHighPower(IDASCommunication das); public bool ExcitationOn { get; set; } = false; public void Reset();Tracks device presence and power/excitation state.
AddUnitInRealtime,AddUnitInArm,AddUnitAtLowPower,AddUnitAtHighPowerare idempotent (no-op if device already present).AddUnitAtLowPowerremoves device from_unitsAtHighPowerif present.AddUnitAtHighPowerremoves device from_unitsAtLowPowerif present.Reset()clears all device lists and setsExcitationOn = false.
3. Invariants
- Thread Safety: All list-modifying operations in
GlobalStatusInformationare guarded by a private staticlock (MyLock). Reads viaGet*()methods are also lock-protected. - Mutual Exclusivity: A device cannot be simultaneously in
_unitsAtLowPowerand_unitsAtHighPower. Adding to one list removes it from the other. - Idempotency:
AddUnit*()methods silently ignore duplicate additions (checked viaContains()before adding). - Reset Scope:
Status.Reset()does not resetDownloadStatusInfoorDownloadParameters(per source code). - Default Values:
GlobalStatusParameters.AllowUDPMulticastdefaults totrue.GlobalStatusParameters.DisableAutoSensedefaults toSensorConstants.DisableAutoSense.GlobalStatusInformation.ExcitationOndefaults tofalse.
4. Dependencies
Imports/References
DTS.Common.Enums.Sensors
Used inGlobalStatusParametersto initializeDisableAutoSenseviaSensorConstants.DisableAutoSense.DTS.Common.Interface.DASFactory
Used inGlobalStatusInformationfor theIDASCommunicationinterface (device abstraction).
Consumed By
- The state machine logic (implied by namespace
DTS.DASLib.Service.StateMachine). - Any component needing to inspect or update device status (e.g.,
Statusinstance likely passed to state handlers).
Consumed By (Inferred)
GlobalStatusInformation’sIDASCommunicationusage implies integration with a device communication layer (e.g., factory-created units implementingIDASCommunication).
5. Gotchas
- Incomplete Reset:
Status.Reset()omitsDownloadStatusInfoandDownloadParameters. This is likely unintentional (both haveReset()methods per naming convention), and may cause stale download state to persist across resets. - No Removal Methods:
GlobalStatusInformationlacks explicitRemoveUnit*()methods. Devices are only removed viaReset()or implicitly viaAddUnitAtLowPower/AddUnitAtHighPower(which remove from the opposite power list). There is no way to remove a device fromRealtimeorArmlists except viaReset(). - Static Lock Scope: The
MyLockobject isstatic, meaning all instances ofGlobalStatusInformationshare the same lock. This could cause contention if multipleGlobalStatusInformationinstances are used concurrently (though only one is used viaStatus.GlobalStatusInformation). - No Validation in
Add*(): Methods likeAddUnitInRealtimedo not validate device state consistency (e.g., allowing a device to be added to bothRealtimeandArmsimultaneously is permitted). DisableAutoSenseInitialization: Default value depends onSensorConstants.DisableAutoSense, whose value is not visible here. Its semantics (e.g.,true= disable auto-sense?) must be verified inDTS.Common.Enums.Sensors.
None identified beyond those above.