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

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...

#include <procedure.h>

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

Public Member Functions

bool required () const
 Whether a request must carry this parameter — true exactly when it has no default.
 

Public Attributes

std::string name
 The key in the request body, e.g. "registerAddress".
 
std::string title
 Short label, e.g. "Register address".
 
std::string description
 What it does and what a sensible value is.
 
ParameterType type = ParameterType::kInteger
 
nlohmann::json defaultValue
 What the procedure uses when the request omits this parameter; null makes it required.
 
std::optional< int64_t > minValue
 kInteger only — smallest accepted value.
 
std::optional< int64_t > maxValue
 kInteger only — largest accepted value.
 
std::optional< size_t > length
 kByteArray only — the exact number of bytes.
 
std::vector< ParameterOptionoptions
 kEnum only — the values that may be chosen.
 

Detailed Description

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.

Descriptive, not authoritative. The server validates every request in the procedure's own parse function whatever a client sends; this is what lets a client build a sensible form and catch a mistake before a request goes out. The two live next to each other (a parseXxxRequest beside the xxxParameters that describes it) precisely so they cannot drift.

A parameter with a default is optional; one without is required. That is the whole rule — there is no separate required flag to contradict the default, and a body that omits an optional parameter gets exactly what the descriptor advertised.

The three type-specific fields apply only where their comments say so, and are absent from the JSON otherwise.

name identifies and title displays, exactly as on the ProcedureDescriptor this is nested in — the two arrive in the same response, so one rule covers both. The value fields are named as DeviceParameter names its own (defaultValue, minValue, maxValue); there is no current value, because a parameter description says what a request may carry, never what one did.

Member Function Documentation

◆ required()

bool mm::node::ProcedureParameter::required ( ) const
inline

Whether a request must carry this parameter — true exactly when it has no default.

Member Data Documentation

◆ defaultValue

nlohmann::json mm::node::ProcedureParameter::defaultValue

What the procedure uses when the request omits this parameter; null makes it required.

◆ description

std::string mm::node::ProcedureParameter::description

What it does and what a sensible value is.

◆ length

std::optional<size_t> mm::node::ProcedureParameter::length

kByteArray only — the exact number of bytes.

◆ maxValue

std::optional<int64_t> mm::node::ProcedureParameter::maxValue

kInteger only — largest accepted value.

◆ minValue

std::optional<int64_t> mm::node::ProcedureParameter::minValue

kInteger only — smallest accepted value.

◆ name

std::string mm::node::ProcedureParameter::name

The key in the request body, e.g. "registerAddress".

◆ options

std::vector<ParameterOption> mm::node::ProcedureParameter::options

kEnum only — the values that may be chosen.

◆ title

std::string mm::node::ProcedureParameter::title

Short label, e.g. "Register address".

◆ type

ParameterType mm::node::ProcedureParameter::type = ParameterType::kInteger

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