|
Motion Master 6.0.0-alpha.86
Next-generation motion control software
|
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>
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< ParameterOption > | options |
kEnum only — the values that may be chosen. | |
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.
|
inline |
Whether a request must carry this parameter — true exactly when it has no default.
| nlohmann::json mm::node::ProcedureParameter::defaultValue |
What the procedure uses when the request omits this parameter; null makes it required.
| std::string mm::node::ProcedureParameter::description |
What it does and what a sensible value is.
| std::optional<size_t> mm::node::ProcedureParameter::length |
kByteArray only — the exact number of bytes.
| std::optional<int64_t> mm::node::ProcedureParameter::maxValue |
kInteger only — largest accepted value.
| std::optional<int64_t> mm::node::ProcedureParameter::minValue |
kInteger only — smallest accepted value.
| std::string mm::node::ProcedureParameter::name |
The key in the request body, e.g. "registerAddress".
| std::vector<ParameterOption> mm::node::ProcedureParameter::options |
kEnum only — the values that may be chosen.
| std::string mm::node::ProcedureParameter::title |
Short label, e.g. "Register address".
| ParameterType mm::node::ProcedureParameter::type = ParameterType::kInteger |