Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
mm::node::ProcedureSnapshot Struct Reference

The complete state of a procedure on one device — everything a client polling GET /api/devices/:pos/procedures/:name receives. More...

#include <procedure.h>

Collaboration diagram for mm::node::ProcedureSnapshot:
[legend]

Public Attributes

ProcedureStatus status = ProcedureStatus::kIdle
 The one field a polling loop checks.
 
uint32_t runCount = 0
 How many runs this device accepted since the last rescan (a rejected start does not count).
 
std::optional< int64_t > startedAt
 Epoch ms the run began; absent when never run.
 
std::optional< int64_t > finishedAt
 Epoch ms the run ended; absent while running.
 
std::vector< ProgressStepsteps
 The ordered step array, always the full template.
 
std::optional< std::string > error
 Why the run failed, when no step captured it.
 

Detailed Description

The complete state of a procedure on one device — everything a client polling GET /api/devices/:pos/procedures/:name receives.

This is an accumulating snapshot, not an event: every finished step keeps its terminal status and its measured value for as long as the snapshot is retained. That is what makes polling lossless — a step that both starts and finishes between two polls is still visible as kSucceeded with its value in the next one, so a client that never opens a WebSocket cannot miss a result. Only the transient kRunning blip on a fast step can be skipped, and it carries no data.

A device that never ran the procedure still yields a well-formed snapshot — kIdle, runCount 0, no timestamps, every step kIdle from the template — so a client renders one component with no empty-state special case.

Member Data Documentation

◆ error

std::optional<std::string> mm::node::ProcedureSnapshot::error

Why the run failed, when no step captured it.

A body normally fails the step that went wrong, so the reason is visible where it happened and this stays empty. It is for the failure that belongs to no step — the device turning out not to be the right kind, say — which would otherwise leave a run marked failed with nothing anywhere saying why.

◆ finishedAt

std::optional<int64_t> mm::node::ProcedureSnapshot::finishedAt

Epoch ms the run ended; absent while running.

◆ runCount

uint32_t mm::node::ProcedureSnapshot::runCount = 0

How many runs this device accepted since the last rescan (a rejected start does not count).

Doubles as a generation counter, which is what makes polling safe without a run id: a run started elsewhere that begins and finishes between two polls would otherwise be invisible, and its result silently read as the run being watched. A changed runCount says "this is a different run"; (devicePosition, procedureName, runCount) identifies one uniquely.

◆ startedAt

std::optional<int64_t> mm::node::ProcedureSnapshot::startedAt

Epoch ms the run began; absent when never run.

◆ status

ProcedureStatus mm::node::ProcedureSnapshot::status = ProcedureStatus::kIdle

The one field a polling loop checks.

◆ steps

std::vector<ProgressStep> mm::node::ProcedureSnapshot::steps

The ordered step array, always the full template.


The documentation for this struct was generated from the following file: