Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
device_parameter.h File Reference
#include <cstdint>
#include <expected>
#include <format>
#include <nlohmann/json_fwd.hpp>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
Include dependency graph for device_parameter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::DeviceParameter
 A single object dictionary entry held by a Device. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 

Typedefs

using mm::node::DeviceParameterValue = std::variant< int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, float, double, std::string, std::vector< uint8_t > >
 Decoded value of a single device parameter (CoE object dictionary entry).
 

Enumerations

enum class  mm::node::SyncState : uint8_t { mm::node::Unknown , mm::node::Synced , mm::node::Pending }
 Tracks how a cached parameter value relates to the device. More...
 

Functions

constexpr uint32_t mm::node::makeParameterKey (uint16_t index, uint8_t subindex)
 Packs an object dictionary index and subindex into a single 32-bit key.
 
DeviceParameterValue mm::node::defaultValueForDataType (uint16_t dataType)
 Returns a zero-equivalent value for the given ETG.1020 dataType.
 
std::optional< double > mm::node::numericValue (const DeviceParameterValue &value)
 Coerces a DeviceParameterValue to a double, when it holds a number.
 
std::string_view mm::node::syncStateName (SyncState state)
 Returns the lowercase string form of state ("unknown" etc.).
 
std::expected< DeviceParameterValue, std::string > mm::node::decodeSdoBytes (uint16_t dataType, std::span< const uint8_t > bytes)
 Decodes a raw SDO byte sequence according to an ETG.1020 data type code.
 
std::expected< std::vector< uint8_t >, std::string > mm::node::encodeSdoBytes (uint16_t dataType, const DeviceParameterValue &value)
 Serialises a DeviceParameterValue to raw SDO bytes — the inverse of decodeSdoBytes.
 
void mm::node::to_json (nlohmann::json &j, const DeviceParameter &p)
 Serialises a DeviceParameter to JSON.