|
Motion Master 6.0.0-alpha.111
Next-generation motion control software
|
Every procedure the server knows, and the four operations a client performs against it. More...
#include <procedure_registry.h>
Public Member Functions | |
| ProcedureRegistry (DeviceManager &deviceManager, ProcedureManager &procedureManager, ProcedureRegistryConfig config) | |
| const std::vector< ProcedureRegistryEntry > & | entries () const |
| Every entry, in the order a client should present them. | |
| std::expected< std::vector< ProcedureListing >, ProcedureError > | list (uint16_t devicePosition) const |
Every procedure devicePosition supports, each with its current or last-run snapshot. | |
| 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. | |
| 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. | |
| std::expected< void, ProcedureError > | cancel (uint16_t devicePosition, std::string_view name) const |
Asks the running name on devicePosition to stop. | |
Every procedure the server knows, and the four operations a client performs against it.
Built once, in the composition root, with the collaborators every procedure body shares and the callbacks of ProcedureRegistryConfig. Entries are never added or removed after construction, so a caller may hold a pointer into entries().
| mm::node::ProcedureRegistry::ProcedureRegistry | ( | DeviceManager & | deviceManager, |
| ProcedureManager & | procedureManager, | ||
| ProcedureRegistryConfig | config | ||
| ) |
| deviceManager | Where a device is looked up. Must outlive the registry. |
| procedureManager | Where a run is started, cancelled and polled. Must outlive the registry. |
| config | The outside callbacks, copied in. |
| std::expected< void, ProcedureError > mm::node::ProcedureRegistry::cancel | ( | uint16_t | devicePosition, |
| std::string_view | name | ||
| ) | const |
Asks the running name on devicePosition to stop.
Cancels the run, not the record: the retained snapshot stays behind reporting how far it got.
kUnknownProcedure covers both an unrecognised name and a recognised one with nothing running — from a client's side both mean "there is no run here to cancel".
|
inline |
Every entry, in the order a client should present them.
| std::expected< std::vector< ProcedureListing >, ProcedureError > mm::node::ProcedureRegistry::list | ( | uint16_t | devicePosition | ) | const |
Every procedure devicePosition supports, each with its current or last-run snapshot.
kUnknownDevice. | std::expected< ProcedureSnapshot, ProcedureError > mm::node::ProcedureRegistry::snapshot | ( | uint16_t | devicePosition, |
| std::string_view | name | ||
| ) | const |
The current or last-run state of one procedure on one device.
Never-run is not an error: it reports the descriptor's all-idle snapshot, so a client polls one shape whether or not the procedure has ever been run. kUnknownProcedure is reserved for a name that does not exist or that this device does not support — a genuine addressing mistake.
| std::expected< ProcedureSnapshot, ProcedureError > mm::node::ProcedureRegistry::start | ( | uint16_t | devicePosition, |
| std::string_view | name, | ||
| const nlohmann::json & | request | ||
| ) | const |
Starts name on devicePosition with request as its parameters.
runCount already bumped), or why it could not start — any of the four ProcedureError kinds.