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

Generic CANopen (CiA301) procedure bodies — the non-volatile storage commands every CoE device carries, whatever profile it implements. More...

#include <chrono>
#include <expected>
#include <nlohmann/json_fwd.hpp>
#include <stop_token>
#include <string>
#include <string_view>
#include <vector>
#include "node/device.h"
#include "node/procedure.h"
#include "node/profile_device.h"
Include dependency graph for profile_procedures.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::RestoreDefaultParametersRequest
 What one restore was asked to do. More...
 
struct  mm::node::DeviceLocateRequest
 What one locate run was asked to do. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 

Functions

std::vector< ProgressStep > mm::node::storeParametersSteps ()
 Store parameters' step template — one step, idle.
 
std::expected< void, std::string > mm::node::runStoreParametersProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, StoreParametersConfig config={})
 Runs a parameter store (0x1010) as a procedure body.
 
std::expected< RestoreDefaultParametersRequest, std::string > mm::node::parseRestoreDefaultParametersRequest (const nlohmann::json &body)
 Parses and validates a client's restore request body.
 
std::vector< ProcedureParameter > mm::node::restoreDefaultParametersParameters ()
 What restoring default parameters accepts, as its descriptor advertises it.
 
std::vector< ProgressStep > mm::node::restoreDefaultParametersSteps ()
 Restore default parameters' step template — one step, idle.
 
std::expected< void, std::string > mm::node::runRestoreDefaultParametersProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const RestoreDefaultParametersRequest &request, RestoreDefaultParametersConfig config={})
 Runs a restore of default parameters (0x1011) as a procedure body.
 
std::expected< DeviceLocateRequest, std::string > mm::node::parseDeviceLocateRequest (const nlohmann::json &body)
 Parses and validates a client's locate request body: {"duration": 10}, in seconds, optional.
 
std::vector< ProcedureParameter > mm::node::deviceLocateParameters ()
 What blinking the LEDs accepts, as its descriptor advertises it.
 
std::vector< ProgressStep > mm::node::deviceLocateSteps ()
 The locate procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runDeviceLocateProcedure (Device &device, ProgressReporter &reporter, const std::stop_token &stop, const DeviceLocateRequest &request)
 Blinks the device's LEDs for request.duration, so that someone can find it.
 

Variables

constexpr std::string_view mm::node::kStoreParametersProcedure = "store-parameters"
 Procedure name for storing parameters, as it appears in its URL and its snapshot key.
 
constexpr std::string_view mm::node::kStoreParametersStep = "store"
 The single step storing parameters reports against.
 
constexpr std::string_view mm::node::kRestoreDefaultParametersProcedure = "restore-default-parameters"
 Procedure name for restoring default parameters, as it appears in its URL and its snapshot key.
 
constexpr std::string_view mm::node::kRestoreDefaultParametersStep = "restore"
 The single step restoring default parameters reports against.
 
constexpr std::string_view mm::node::kDeviceLocateProcedure = "device-locate"
 Procedure name for blinking a device's LEDs, as it appears in its URL and snapshot key.
 
constexpr std::string_view mm::node::kDeviceLocateStep = "locate"
 The single step blinking the LEDs reports against.
 

Detailed Description

Generic CANopen (CiA301) procedure bodies — the non-volatile storage commands every CoE device carries, whatever profile it implements.

The ProfileDevice counterpart of somanet_procedures.h, and the reason the registry is not a vendor's list: these apply to any device with a CoE mailbox, so a third-party slave offers them too.

Both are command-and-wait walks — write a signature, then poll the same sub-entry until the device reports the command complete — which is what makes them procedures rather than requests. A store takes about a second while the device writes to flash, and a poll during that window can fail outright; each body runs on its own thread, reports one step, and retains its result.