Files
DP44/docs/ai/DataPRO/IService/StateMachine/States.md
2026-04-17 14:55:32 -04:00

60 lines
2.4 KiB
Markdown

---
source_files:
- DataPRO/IService/StateMachine/States/Arm.cs
- DataPRO/IService/StateMachine/States/Arming.cs
- DataPRO/IService/StateMachine/States/Realtime.cs
- DataPRO/IService/StateMachine/States/Download.cs
- DataPRO/IService/StateMachine/States/HardwareDiscovery.cs
- DataPRO/IService/StateMachine/States/Prepare.cs
- DataPRO/IService/StateMachine/States/ConfigureStart.cs
- DataPRO/IService/StateMachine/States/RealtimeStart.cs
- DataPRO/IService/StateMachine/States/Configure.cs
- DataPRO/IService/StateMachine/States/Diagnose.cs
- DataPRO/IService/StateMachine/States/DownloadStart.cs
- DataPRO/IService/StateMachine/States/HardwareDiscoveryStart.cs
generated_at: "2026-04-17T16:34:18.361174+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "916778b8f4ae68d3"
---
# State Machine States Module Documentation
## 1. Purpose
This module implements the concrete state classes for a Data Acquisition System (DAS) service state machine within the `DTS.DASLib.Service.StateMachine` namespace. It defines individual state behaviors and state transition logic for the system's operational lifecycle, including hardware discovery, configuration, diagnosis, arming, real-time operation, and data download phases. The states follow a polymorphic design pattern with two class hierarchies: simple states (`DASState`) and state selectors (`DASStateSelector`) that determine the next state transition.
---
## 2. Public Interface
### Simple States (inherit from `DASState`)
#### `Realtime` (public)
```csharp
public override State State => State.Realtime;
```
A terminal state representing real-time data acquisition mode. No custom entry behavior is defined in this class.
---
### State Selectors (inherit from `DASStateSelector`)
#### `Configure` (public)
```csharp
public override State State => State.Configure;
public override IDASState StateSelector();
public bool AllowApplyConfig();
```
- **`StateSelector()`**: Returns `States.Instance.ConfigureStart` if `AllowApplyConfig()` returns `true`; otherwise returns `States.Instance.Configure`.
- **`AllowApplyConfig()`**: Currently returns `true` unconditionally. Source contains TODO comments indicating future logic for channel resolution validation.
---
#### `ConfigureStart` (public)
```csharp
public override State State => State.ConfigureStart;
public override IDASState StateSelector();
public override Action OnEntry { get; }
private void ApplyConfig();
``