Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
procedure.h File Reference
#include <cstdint>
#include <mutex>
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
Include dependency graph for procedure.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::ProgressStep
 One step of a procedure — an entry in the fixed, ordered array a procedure publishes. More...
 
struct  mm::node::ProcedureSnapshot
 The complete state of a procedure on one device — everything a client polling GET /api/devices/:pos/procedures/:name receives. More...
 
struct  mm::node::ParameterOption
 One choice of a kEnum parameter: the value that goes on the wire, and its label. More...
 
struct  mm::node::ProcedureParameter
 One named parameter a procedure accepts — enough for a client to render a field for it and for a user to know what to put in. More...
 
struct  mm::node::ProcedureDescriptor
 What a procedure is, independent of any run — the half of the catalogue a client needs to render a control for it. More...
 
class  mm::node::ProgressReporter
 The handle a procedure body uses to report where it has got to. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 

Enumerations

enum class  mm::node::ProgressStatus : uint8_t { mm::node::kIdle , mm::node::kRunning , mm::node::kSucceeded , mm::node::kFailed }
 Status of one step within a procedure. More...
 
enum class  mm::node::ProcedureStatus : uint8_t {
  mm::node::kIdle , mm::node::kRunning , mm::node::kSucceeded , mm::node::kFailed ,
  mm::node::kCancelled
}
 Overall status of a procedure run — the single field a polling client checks. More...
 
enum class  mm::node::ParameterType : uint8_t {
  mm::node::kInteger , mm::node::kBoolean , mm::node::kEnum , mm::node::kByteArray ,
  mm::node::kString , mm::node::kStringArray , mm::node::kFile
}
 What kind of value a procedure parameter takes — the client's cue for which control to render, and the only vocabulary a generic form has to understand. More...
 

Functions

constexpr std::string_view mm::node::toString (ProgressStatus status)
 Human-readable name of a step status (for logging / JSON). Never returns nullptr.
 
constexpr std::string_view mm::node::toString (ProcedureStatus status)
 Human-readable name of a procedure status (for logging / JSON). Never nullptr.
 
void mm::node::to_json (nlohmann::json &j, const ProgressStep &step)
 
void mm::node::to_json (nlohmann::json &j, const ProcedureSnapshot &snapshot)
 
ProcedureSnapshot mm::node::idleSnapshot (std::vector< ProgressStep > steps)
 A well-formed snapshot for a procedure that never ran — idle, no timestamps, and every step idle from steps.
 
std::vector< ProgressStepmm::node::stepsFrom (std::initializer_list< std::string_view > ids)
 A procedure's step template: the given ids, in order, all idle.
 
constexpr std::string_view mm::node::toString (ParameterType type)
 Human-readable name of a parameter type (for JSON). Never returns nullptr.
 
void mm::node::to_json (nlohmann::json &j, const ParameterOption &option)
 
void mm::node::to_json (nlohmann::json &j, const ProcedureParameter &parameter)
 
ProcedureParameter mm::node::integerParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue, int64_t minValue, int64_t maxValue)
 A whole-number parameter accepting minValue to maxValue inclusive.
 
ProcedureParameter mm::node::booleanParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue)
 A true/false parameter. defaultValue as in integerParameter.
 
ProcedureParameter mm::node::enumParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue, std::vector< ParameterOption > options)
 A parameter whose value is one of options. defaultValue as in integerParameter, and it should be one of the option values.
 
ProcedureParameter mm::node::byteArrayParameter (std::string name, std::string title, std::string description, size_t length)
 A parameter taking exactly length byte values.
 
ProcedureParameter mm::node::stringParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue)
 A free-text parameter. defaultValue as in integerParameter.
 
ProcedureParameter mm::node::stringArrayParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue)
 A parameter taking a list of strings, which the client renders as an editable list.
 
ProcedureParameter mm::node::fileParameter (std::string name, std::string title, std::string description, nlohmann::json defaultValue)
 A parameter carrying a whole file, base64-encoded in a JSON string.
 
void mm::node::to_json (nlohmann::json &j, const ProcedureDescriptor &descriptor)