The DiagnoseParameters class encapsulates configuration and state-tracking data for a diagnostic phase within a state machine. It determines how the system transitions out of the diagnostic state—specifically whether to proceed to the real-time operational state—and tracks whether all units have passed their diagnostics. This class serves as a parameter object passed to or managed by the diagnostic state handler, enabling configurable behavior (e.g., strict vs. permissive pass requirements) and runtime status updates during diagnostics execution.
2. Public Interface
class DiagnoseParameters : IStatusParameters
Implements IStatusParameters (interface not shown in source) to provide status-related parameters for a diagnostic state.
bool ProceedToRealtimeWhenDone { get; set; }
Controls whether the state machine should transition to the real-time state upon successful completion of diagnostics. Default: true.
bool RequireAllUnitsPassDiagnostic { get; set; }
If true, the diagnostic phase is considered successful only if all units pass; if false, the phase may succeed even if some units fail. Default: false.
bool AllUnitsPassedDiagnostic { get; set; }
Reflects the actual outcome of the diagnostic run: true if all units passed, false otherwise. Initialized to false.
void Reset()
Resets all properties to their default values:
ProceedToRealtimeWhenDone → true
RequireAllUnitsPassDiagnostic → false
AllUnitsPassedDiagnostic → false
3. Invariants
AllUnitsPassedDiagnostic must be set by external logic (e.g., diagnostic execution logic) before the state machine evaluates transition conditions based on this flag.
RequireAllUnitsPassDiagnostic and AllUnitsPassedDiagnostic jointly determine diagnostic success:
If RequireAllUnitsPassDiagnostic is true, success requires AllUnitsPassedDiagnostic == true.
If RequireAllUnitsPassDiagnostic is false, success is assumed regardless of AllUnitsPassedDiagnostic (though the exact semantics depend on downstream state machine logic, which is not provided).
After Reset() is called, all properties revert to their documented default values; no partial resets occur.
DiagnoseParameters is a mutable class—consumers must be cautious about shared instances and concurrent access (no thread-safety guarantees are implied by the source).
4. Dependencies
Depends on:
System (core .NET namespaces: System, System.Collections.Generic, System.Linq, System.Text, System.Threading.Tasks).
DTS.DASLib.Service.StateMachine namespace (same assembly/project), specifically the IStatusParameters interface.
Used by:
State machine logic within DTS.DASLib.Service.StateMachine (inferred from namespace and class name), particularly code managing the diagnostic state.
Likely consumed by diagnostic execution components that set AllUnitsPassedDiagnostic and by state transition logic that inspects ProceedToRealtimeWhenDone and RequireAllUnitsPassDiagnostic.
5. Gotchas
Ambiguous success semantics: The source does not specify how diagnostic success is determined when RequireAllUnitsPassDiagnostic is false. It is unclear whether success is automatic, or if other conditions (e.g., AllUnitsPassedDiagnostic == true) still apply.
No validation in Reset(): The method does not validate or guard against invalid states (e.g., resetting mid-diagnostic), potentially leading to inconsistent behavior if called at inappropriate times.
No thread-safety: The class is a simple POCO with no synchronization primitives; concurrent use without external locking may cause race conditions.
No documentation on IStatusParameters contract: Since IStatusParameters is not included, it is unknown whether DiagnoseParameters is expected to implement additional members or adhere to further constraints.
Default behavior may be surprising: ProceedToRealtimeWhenDone defaults to true, meaning the system will proceed to real-time mode unless explicitly configured otherwise—even if diagnostics fail—unless downstream logic overrides this.