Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
device_parameter.cc File Reference
#include "node/device_parameter.h"
#include <algorithm>
#include <array>
#include <cstdint>
#include <cstring>
#include <expected>
#include <format>
#include <nlohmann/json.hpp>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
#include "comm/object_data_types.h"
Include dependency graph for device_parameter.cc:

Namespaces

namespace  mm
 
namespace  mm::node
 

Functions

DeviceParameterValue mm::node::defaultValueForDataType (uint16_t dataType)
 Returns a zero-equivalent value for the given ETG.1020 dataType.
 
bool mm::node::isScalarDataType (uint16_t dataType)
 Whether a value of dataType is stored in DeviceParameter::bits.
 
size_t mm::node::scalarByteWidth (uint16_t dataType)
 Width in bytes of a value of dataType, or 0 when it is not a scalar.
 
uint64_t mm::node::packLeBits (std::span< const uint8_t > bytes)
 Packs up to eight raw little-endian wire bytes into a uint64_t (zero-extended).
 
void mm::node::unpackLeBits (uint64_t bits, std::span< uint8_t > out)
 Unpacks bits into out, little-endian. The inverse of packLeBits.
 
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.
 
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::string_view mm::node::parameterOriginName (ParameterOrigin origin)
 Returns the string form of origin ("objectDictionary" / "sii").
 
void mm::node::to_json (nlohmann::json &j, const DeviceParameter &p)
 Serialises a DeviceParameter to JSON.