6#include <nlohmann/json_fwd.hpp>
53 std::function<std::expected<ProcedureBody, std::string>(
const nlohmann::json& request)>
makeBody;
94 const std::vector<ProcedureRegistryEntry>&
entries()
const {
return entries_; }
100 std::expected<std::vector<ProcedureListing>,
ProcedureError>
list(uint16_t devicePosition)
const;
108 std::expected<ProcedureSnapshot, ProcedureError>
snapshot(uint16_t devicePosition,
109 std::string_view
name)
const;
115 std::expected<ProcedureSnapshot, ProcedureError>
start(uint16_t devicePosition,
116 std::string_view
name,
117 const nlohmann::json& request)
const;
127 std::expected<void, ProcedureError>
cancel(uint16_t devicePosition, std::string_view
name)
const;
131 std::expected<std::vector<const ProcedureRegistryEntry*>,
ProcedureError> applicableEntries(
132 uint16_t devicePosition)
const;
136 std::expected<const ProcedureRegistryEntry*, ProcedureError> applicableEntry(
137 uint16_t devicePosition, std::string_view
name)
const;
141 std::vector<ProcedureRegistryEntry> entries_;
Owns the fieldbus driver and node collection, and drives PDO exchange.
Definition device_manager.h:339
Represents a single node on the fieldbus.
Definition device.h:120
Runs off-RT command-and-wait procedures and remembers how each one went.
Definition procedure_manager.h:121
Every procedure the server knows, and the four operations a client performs against it.
Definition procedure_registry.h:84
std::expected< std::vector< ProcedureListing >, ProcedureError > list(uint16_t devicePosition) const
Every procedure devicePosition supports, each with its current or last-run snapshot.
Definition procedure_registry.cc:1191
std::expected< ProcedureSnapshot, ProcedureError > snapshot(uint16_t devicePosition, std::string_view name) const
The current or last-run state of one procedure on one device.
Definition procedure_registry.cc:1207
const std::vector< ProcedureRegistryEntry > & entries() const
Every entry, in the order a client should present them.
Definition procedure_registry.h:94
std::expected< void, ProcedureError > cancel(uint16_t devicePosition, std::string_view name) const
Asks the running name on devicePosition to stop.
Definition procedure_registry.cc:1236
std::expected< ProcedureSnapshot, ProcedureError > start(uint16_t devicePosition, std::string_view name, const nlohmann::json &request) const
Starts name on devicePosition with request as its parameters.
Definition procedure_registry.cc:1216
std::string name
Catalogue name, e.g. "sm2".
Definition eni_request.cc:37
Definition bus_health_source.h:7
std::function< std::expected< PlantModelFit, std::string >(const PlantMeasurement &measurement, double startFrequencyHz, double endFrequencyHz)> PlantModelFitFn
Fits a plant model to a measurement.
Definition plant_identification.h:55
void to_json(nlohmann::json &j, const Cia402Status &s)
Serialises a Cia402Status. Emits state/modeName as human-readable strings alongside the numeric statu...
Definition cia402_drive.cc:13
Plant identification: the model of a motor and its load that auto-tuning computes gains from,...
What a procedure is, independent of any run — the half of the registry a client needs to render a con...
Definition procedure.h:298
Why a procedure operation could not be performed. A caller must branch on this — an HTTP handler maps...
Definition procedure_manager.h:69
One procedure paired with how its last run on a device went — an entry of GET /api/devices/:pos/proce...
Definition procedure_registry.h:62
ProcedureSnapshot snapshot
Definition procedure_registry.h:64
ProcedureDescriptor descriptor
Definition procedure_registry.h:63
What the registry needs from outside mm::node.
Definition procedure_registry.h:73
PlantModelFitFn fitPlantModel
Definition procedure_registry.h:76
One procedure, as the registry knows it: what it is, who has it, and how to run it.
Definition procedure_registry.h:34
std::function< bool(Device &device)> applies
Whether device supports this procedure.
Definition procedure_registry.h:42
std::function< std::expected< ProcedureBody, std::string >(const nlohmann::json &request)> makeBody
Turns a client's request into the body that will run.
Definition procedure_registry.h:53
ProcedureDescriptor descriptor
What a client is told about it.
Definition procedure_registry.h:35
The complete state of a procedure on one device — everything a client polling GET /api/devices/:pos/p...
Definition procedure.h:111