Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
operation_modes.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <expected>
5#include <nlohmann/json_fwd.hpp>
6#include <optional>
7#include <string>
8#include <vector>
9
10#include "node/device.h"
11#include "node/device_manager.h"
12
13namespace mm::node {
14
26
28enum class OperationModeKind : uint8_t {
29 kStandard,
31};
32
35 int value = 0;
36 std::string name;
37 std::string label;
39
42 std::optional<int> bit;
43
45 std::string abbreviation;
46
51 std::optional<bool> supported;
52
54 bool deprecated = false;
55};
56
59 uint32_t supportedDriveModes = 0;
60
67 std::vector<int> manufacturerBits;
68
71 std::vector<OperationModeInfo> modes;
72};
73void to_json(nlohmann::json& j, const OperationModes& modes);
74
84std::expected<OperationModes, std::string> deviceOperationModes(Device& device);
85
88std::expected<OperationModes, std::string> operationModes(DeviceManager& deviceManager,
89 uint16_t slavePosition);
90
91} // namespace mm::node
Owns the fieldbus driver and node collection, and drives PDO exchange.
Definition device_manager.h:287
Represents a single node on the fieldbus.
Definition device.h:116
Definition bus_health_source.h:7
std::expected< OperationModes, std::string > operationModes(DeviceManager &deviceManager, uint16_t slavePosition)
Borrow-and-delegate wrapper over deviceOperationModes, for a caller holding a bus position rather tha...
Definition operation_modes.cc:110
OperationModeKind
Where a mode is defined, which is also how much can be said about it.
Definition operation_modes.h:28
@ kManufacturer
Defined by the vendor; 0x6502 has no bit this code can read for it.
@ kStandard
Defined by CiA402; its support is advertised by a bit of 0x6502.
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
std::expected< OperationModes, std::string > deviceOperationModes(Device &device)
Builds the operation-mode table for device.
Definition operation_modes.cc:55
One operation mode of one device.
Definition operation_modes.h:34
std::string name
PascalCase identifier, as toString spells it.
Definition operation_modes.h:36
int value
The 0x6060 / 0x6061 value.
Definition operation_modes.h:35
std::string abbreviation
The profile's short form ("csp", "hm", …); empty for manufacturer modes and NoMode.
Definition operation_modes.h:45
bool deprecated
Whether the firmware marks the mode deprecated. Only a manufacturer mode carries this.
Definition operation_modes.h:54
std::string label
The profile's or the vendor's own wording.
Definition operation_modes.h:37
std::optional< int > bit
Definition operation_modes.h:42
std::optional< bool > supported
Definition operation_modes.h:51
OperationModeKind kind
Definition operation_modes.h:38
Every operation mode of one device, with what the drive says about each.
Definition operation_modes.h:58
uint32_t supportedDriveModes
0x6502 verbatim, for a client that wants the raw field.
Definition operation_modes.h:59
std::vector< int > manufacturerBits
Definition operation_modes.h:67
std::vector< OperationModeInfo > modes
Definition operation_modes.h:71