Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
procedure_catalogue.h File Reference

The registry of every procedure the server knows, and the four operations a client performs against it. More...

#include <cstdint>
#include <expected>
#include <functional>
#include <nlohmann/json_fwd.hpp>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include "node/device.h"
#include "node/device_manager.h"
#include "node/procedure.h"
#include "node/procedure_manager.h"
Include dependency graph for procedure_catalogue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::ProcedureCatalogueEntry
 One procedure, as the catalogue knows it: what it is, who has it, and how to run it. More...
 
struct  mm::node::ProcedureListing
 One procedure paired with how its last run on a device went — an entry of GET /api/devices/:pos/procedures. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 

Functions

const std::vector< ProcedureCatalogueEntry > & mm::node::procedureCatalogue ()
 Every procedure the server knows, in the order a client should present them.
 
void mm::node::to_json (nlohmann::json &j, const ProcedureListing &listing)
 
std::expected< std::vector< ProcedureListing >, ProcedureErrormm::node::listProcedures (DeviceManager &deviceManager, ProcedureManager &procedureManager, uint16_t devicePosition)
 Every procedure devicePosition supports, each with its current or last-run snapshot.
 
std::expected< ProcedureSnapshot, ProcedureErrormm::node::procedureSnapshot (DeviceManager &deviceManager, ProcedureManager &procedureManager, uint16_t devicePosition, std::string_view name)
 The current or last-run state of one procedure on one device.
 
std::expected< ProcedureSnapshot, ProcedureErrormm::node::startProcedure (DeviceManager &deviceManager, ProcedureManager &procedureManager, uint16_t devicePosition, std::string_view name, const nlohmann::json &request)
 Starts name on devicePosition with request as its parameters.
 
std::expected< void, ProcedureErrormm::node::cancelProcedure (DeviceManager &deviceManager, ProcedureManager &procedureManager, uint16_t devicePosition, std::string_view name)
 Asks the running name on devicePosition to stop.
 

Detailed Description

The registry of every procedure the server knows, and the four operations a client performs against it.

This is the layer that makes one generic route triple serve every procedure: the HTTP handler forwards a name and a JSON body, and the catalogue resolves both. Adding a procedure is adding a row here — a descriptor, a predicate saying which devices have it, and a factory turning a request into a body — with no route, no handler and no ProcedureManager change.

It sits outward of DeviceManager and ProcedureManager and may name profile types freely; both of those stay profile-ignorant. It is also where the two error kinds those classes cannot judge come from: whether a procedure exists at all, and whether a request for it validates.