Motion Master
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <charconv>
5#include <cstdint>
6#include <fstream>
7#include <iostream>
8#include <iterator>
9#include <map>
10#include <memory>
11#include <nlohmann/json.hpp>
12#include <optional>
13#include <string>
14#include <string_view>
15#include <typeindex>
16#include <unordered_map>
17#include <utility>
18#include <variant>
19#include <vector>
20
21namespace common {
22
41template <typename T>
42T parseHex(const std::string& s) {
43 static_assert(std::is_unsigned<T>::value,
44 "parseHex only supports unsigned integer types");
45
46 // Use the appropriate std::stoul or std::stoull depending on size
47 if constexpr (sizeof(T) <= sizeof(unsigned long)) {
48 // Use std::stoul
49 return static_cast<T>(std::stoul(s, nullptr, 16));
50 } else {
51 // Use std::stoull for larger types like uint64_t
52 return static_cast<T>(std::stoull(s, nullptr, 16));
53 }
54}
55
66 std::map<std::uint16_t, std::vector<std::uint32_t>> rx;
67 std::map<std::uint16_t, std::vector<std::uint32_t>> tx;
68};
69
77};
78
90void from_json(const nlohmann::json& j, UiPdoMapping& p);
91
101void from_json(const nlohmann::json& j, UiConfigJson& r);
102
110enum class EtherCATVendorID : uint32_t {
116 SYNAPTICON = 0x000022d2,
117};
118
130inline bool operator==(uint32_t lhs, EtherCATVendorID rhs) {
131 return lhs == static_cast<uint32_t>(rhs);
132}
133
145inline bool operator==(EtherCATVendorID lhs, uint32_t rhs) {
146 return static_cast<uint32_t>(lhs) == rhs;
147}
148
159 uint16_t pdoIndex;
160 uint16_t index;
161 uint8_t subindex;
162 uint8_t
164};
165
181 std::vector<PdoMappingEntry> rxPdos;
183 std::vector<PdoMappingEntry> txPdos;
185};
186
194enum class ObjectFlags : uint16_t {
195 None = 0x0000,
196
197 // Read access
198 PO_RD = 0x0001,
199 SO_RD = 0x0002,
200 OP_RD = 0x0004,
201 ALL_RD = PO_RD | SO_RD | OP_RD,
202
203 // Write access
204 PO_WR = 0x0008,
205 SO_WR = 0x0010,
206 OP_WR = 0x0020,
207 ALL_WR = PO_WR | SO_WR | OP_WR,
208
209 // Read/Write combinations
210 PO_RDWR = PO_RD | PO_WR,
211 SO_RDWR = SO_RD | SO_WR,
212 OP_RDWR = OP_RD | OP_WR,
214
215 // Mapping
216 RXPDO_MAP = 0x0040,
217 TXPDO_MAP = 0x0080,
218 RXTXPDO_MAP = 0x00C0,
219
220 // Other flags
221 BACKUP = 0x0100,
222 STARTUP = 0x0200,
223
225};
226
238 return static_cast<ObjectFlags>(static_cast<uint16_t>(lhs) |
239 static_cast<uint16_t>(rhs));
240}
241
253 return static_cast<ObjectFlags>(static_cast<uint16_t>(lhs) &
254 static_cast<uint16_t>(rhs));
255}
256
268 lhs = lhs | rhs;
269 return lhs;
270}
271
286 ObjectFlags a) {
287 return b | s | p | a;
288}
289
302enum class ObjectDataType : uint16_t {
303 UNSPECIFIED = 0x0000,
304
305 BOOLEAN = 0x0001,
306 BYTE = 0x001E,
307 WORD = 0x001F,
308 DWORD = 0x0020,
309
310 BIT1 = 0x0030,
311 BIT2 = 0x0031,
312 BIT3 = 0x0032,
313 BIT4 = 0x0033,
314 BIT5 = 0x0034,
315 BIT6 = 0x0035,
316 BIT7 = 0x0036,
317 BIT8 = 0x0037,
318 BIT9 = 0x0038,
319 BIT10 = 0x0039,
320 BIT11 = 0x003A,
321 BIT12 = 0x003B,
322 BIT13 = 0x003C,
323 BIT14 = 0x003D,
324 BIT15 = 0x003E,
325 BIT16 = 0x003F,
326
327 BITARR8 = 0x002D,
328 BITARR16 = 0x002E,
329 BITARR32 = 0x002F,
330
331 INTEGER8 = 0x0002,
332 INTEGER16 = 0x0003,
333 INTEGER24 = 0x0010,
334 INTEGER32 = 0x0004,
335 INTEGER40 = 0x0012,
336 INTEGER48 = 0x0013,
337 INTEGER56 = 0x0014,
338 INTEGER64 = 0x0015,
339
340 UNSIGNED8 = 0x0005,
341 UNSIGNED16 = 0x0006,
342 UNSIGNED24 = 0x0016,
343 UNSIGNED32 = 0x0007,
344 UNSIGNED40 = 0x0018,
345 UNSIGNED48 = 0x0019,
346 UNSIGNED56 = 0x001A,
347 UNSIGNED64 = 0x001B,
348
349 REAL32 = 0x0008,
350 REAL64 = 0x0011,
351
352 GUID = 0x001D,
353
354 VISIBLE_STRING = 0x0009,
355 OCTET_STRING = 0x000A,
356 UNICODE_STRING = 0x000B,
358 ARRAY_OF_INT = 0x0260,
359 ARRAY_OF_SINT = 0x0261,
360 ARRAY_OF_DINT = 0x0262,
361 ARRAY_OF_UDINT = 0x0263,
362
363 PDO_MAPPING = 0x0021,
364 IDENTITY = 0x0023,
365 COMMAND_PAR = 0x0025,
366 PDO_PARAMETER = 0x0027,
367 ENUM = 0x0028,
369 0x0029,
370 RECORD = 0x002A,
372 BACKUP_PARAMETER = 0x002B,
373 MODULAR_DEVICE_PARAMETER = 0x002C,
375 ERROR_SETTING = 0x0281,
377 0x0282,
378 EXTERNAL_SYNC_STATUS = 0x0283,
380 EXTERNAL_SYNC_SETTINGS = 0x0284,
382 DEFTYPE_FSOEFRAME = 0x0285,
385 0x0286,
387
388 TIME_OF_DAY = 0x000C,
390 0x000D,
391 UTYPE_START = 0x0800,
392 UTYPE_END = 0x0FFF
393};
394
404enum class ObjectCode : uint16_t {
405 DEFTYPE = 0x0005,
406 DEFSTRUCT = 0x0006,
407 VAR = 0x0007,
408 ARRAY = 0x0008,
409 RECORD = 0x0009,
410};
411
419using ParameterKey = std::pair<uint16_t, uint8_t>;
420
445 std::variant<bool, std::int8_t, std::int16_t, std::int32_t, std::int64_t,
446 std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t,
447 float, double, std::string,
448 std::vector<std::uint8_t>>;
450
473 public:
477 std::string name;
478
482 std::uint16_t index;
483
487 std::uint8_t subindex;
488
492 std::uint16_t bitLength;
493
498
504
509
515
521
525 std::vector<std::uint8_t> data;
526
557 ParameterValue getValue() const;
558
576 template <typename T>
577 T getValue() const {
578 // Get the value as a ParameterValue
579 const ParameterValue& val = getValue();
580
581 // Try to get the value of type T from the variant
582 if (auto ptr = std::get_if<T>(&val)) {
583 return *ptr; // Return the value of type T
584 } else {
585 throw std::bad_variant_access(); // If type T is not found in the variant
586 }
587 }
588
604 template <typename T>
605 std::optional<T> tryGetValue() const {
606 const ParameterValue& val = getValue();
607 if (auto ptr = std::get_if<T>(&val)) {
608 return *ptr;
609 } else {
610 return std::nullopt;
611 }
612 }
613
634 void setValue(const ParameterValue& value);
635
652 template <typename T>
653 void setValue(const T& value) {
654 // Convert the input value to ParameterValue (variant)
655 ParameterValue parameterValue(value);
656
657 // Reuse the existing setValue function to handle the assignment
658 setValue(parameterValue);
659 }
660
675 template <typename T>
676 bool trySetValue(const T& value) {
677 auto expectedType = [this]() -> std::type_index {
678 switch (dataType) {
680 return typeid(bool);
681 }
683 return typeid(std::int8_t);
684 }
686 return typeid(std::int16_t);
687 }
690 return typeid(std::int32_t);
691 }
693 return typeid(std::int64_t);
694 }
700 return typeid(std::uint8_t);
701 }
703 return typeid(std::uint16_t);
704 }
707 return typeid(std::uint32_t);
708 }
710 return typeid(std::uint64_t);
711 }
713 return typeid(float);
714 }
716 return typeid(double);
717 }
721 return typeid(std::string);
722 }
723 default: {
724 return typeid(void);
725 }
726 }
727 };
728
729 const std::type_index expected = expectedType();
730 if (expected != typeid(T) &&
731 typeid(T) != typeid(std::vector<std::uint8_t>)) {
732 return false;
733 }
734
736 return true;
737 }
738
749 bool operator<(const Parameter& other) const {
750 if (index != other.index) {
751 return index < other.index; // Compare by index first
752 }
753 return subindex <
754 other.subindex; // Compare by subindex if indices are equal
755 }
756
767 bool operator>(const Parameter& other) const {
768 if (index != other.index) {
769 return index > other.index; // Compare by index first
770 }
771 return subindex >
772 other.subindex; // Compare by subindex if indices are equal
773 }
774
785 bool operator==(const Parameter& other) const {
786 return index == other.index && subindex == other.subindex;
787 }
788
799 static void to_json(nlohmann::json& j, const Parameter& p);
800
811 static void from_json(const nlohmann::json& j, Parameter& p);
812};
813
827
847void logParametersMap(const std::unordered_map<std::pair<uint16_t, uint8_t>,
848 Parameter>& parametersMap,
849 bool sortParameters = true);
850
858class Device {
859 public:
868 virtual ~Device() = default;
869
886 virtual uint8_t getState(
887 const std::chrono::steady_clock::duration expiryTime =
888 std::chrono::milliseconds(3000)) = 0;
889
902 virtual bool setState(uint8_t state,
903 const std::chrono::steady_clock::duration expiryTime =
904 std::chrono::milliseconds(3000)) = 0;
905
916 virtual std::vector<uint8_t> readFile(
917 const std::string& filename,
918 const std::chrono::steady_clock::duration expiryTime =
919 std::chrono::milliseconds(5000)) = 0;
920
932 virtual bool writeFile(const std::string& filename,
933 const std::vector<uint8_t>& data,
934 const std::chrono::steady_clock::duration expiryTime =
935 std::chrono::milliseconds(5000)) = 0;
936
945 virtual void loadParameters(
946 bool readValues, const std::chrono::steady_clock::duration expiryTime =
947 std::chrono::milliseconds(9000)) = 0;
948
955 virtual void clearParameters() = 0;
956
972 virtual Parameter& findParameter(uint16_t index, uint8_t subindex) = 0;
973
992 uint16_t index, uint8_t subindex,
993 const std::chrono::steady_clock::duration expiryTime =
994 std::chrono::milliseconds(5000)) = 0;
995
1011 virtual void download(uint16_t index, uint8_t subindex,
1012 const std::chrono::steady_clock::duration expiryTime =
1013 std::chrono::milliseconds(5000)) = 0;
1014
1032 virtual void download(uint16_t index, uint8_t subindex,
1033 const ParameterValue& value,
1034 const std::chrono::steady_clock::duration expiryTime =
1035 std::chrono::milliseconds(5000)) = 0;
1036
1050};
1051
1068template <typename T>
1069bool stringViewToNumber(std::string_view sv, T& result) {
1070 static_assert(std::is_arithmetic_v<T>, "T must be an arithmetic type");
1071
1072 auto [ptr, ec] = std::from_chars(sv.data(), sv.data() + sv.size(), result);
1073 return ec == std::errc();
1074}
1075
1076#include <algorithm> // for std::reverse
1077#include <bit>
1078#include <cstdint>
1079#include <type_traits>
1080#include <vector>
1081
1101template <typename T>
1102std::vector<uint8_t> toBytes(T value, bool bigEndian = false) {
1103 static_assert(std::is_trivially_copyable<T>::value,
1104 "T must be trivially copyable");
1105
1106 std::vector<uint8_t> bytes(sizeof(T));
1107 uint8_t* bytePtr = reinterpret_cast<uint8_t*>(&value);
1108
1109 for (size_t i = 0; i < sizeof(T); ++i) {
1110 bytes[i] = bytePtr[i];
1111 }
1112
1113 if (bigEndian) {
1114 std::reverse(bytes.begin(), bytes.end());
1115 }
1116
1117 return bytes;
1118}
1119
1134inline std::string makeParameterId(int index, int subindex) {
1135 std::stringstream oss;
1136 // Format index and subindex into "0xINDEX:SUBINDEX"
1137 oss << "0x" << std::setw(4) << std::setfill('0') << std::hex << std::uppercase
1138 << index << ":" << std::setw(2) << std::setfill('0') << std::hex
1139 << std::uppercase << subindex;
1140
1141 return oss.str();
1142}
1143
1158inline std::string bytesToHexString(const std::vector<uint8_t>& data) {
1159 std::ostringstream oss;
1160 for (uint8_t byte : data) {
1161 oss << "0x" << std::hex << std::setw(2) << std::setfill('0')
1162 << static_cast<int>(byte) << " ";
1163 }
1164 return oss.str();
1165}
1166
1179std::vector<uint8_t> readBinaryFile(const std::string& filename);
1180
1193std::string joinStrings(const std::vector<std::string>& list,
1194 const std::string& delimiter);
1195
1210std::string formatMacAddress(const std::string& originalMacAddress);
1211
1212} // namespace common
1213
1224namespace std {
1225template <>
1226struct hash<std::pair<uint16_t, uint8_t>> {
1237 size_t operator()(const std::pair<uint16_t, uint8_t>& p) const {
1238 return hash<uint16_t>()(p.first) ^ (hash<uint8_t>()(p.second) << 1);
1239 }
1240};
1241} // namespace std
Abstract interface representing a generic device.
Definition: common.h:858
virtual bool writeFile(const std::string &filename, const std::vector< uint8_t > &data, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0
Sends a file to the device.
virtual void download(uint16_t index, uint8_t subindex, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0
Downloads a parameter to the device using SDO communication.
virtual Parameter & findParameter(uint16_t index, uint8_t subindex)=0
Finds and returns a reference to a parameter by its index and subindex.
virtual void download(uint16_t index, uint8_t subindex, const ParameterValue &value, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0
Sets a parameter value in the local store and downloads it to the device.
virtual std::vector< uint8_t > readFile(const std::string &filename, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0
Reads the contents of a file from the device.
virtual void exchangeProcessDataAndUpdateParameters()=0
Exchanges process data with the remote device and updates local parameters accordingly.
virtual bool setState(uint8_t state, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(3000))=0
Sets the device to a specified state.
virtual void loadParameters(bool readValues, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(9000))=0
Loads parameters from the device and stores them locally.
virtual ~Device()=default
Virtual destructor for Device interface.
virtual void clearParameters()=0
Clears all loaded object dictionary parameters.
virtual uint8_t getState(const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(3000))=0
Reads and returns the current state of the device.
virtual Parameter & upload(uint16_t index, uint8_t subindex, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0
Uploads a parameter from the device via SDO and updates the local parameter store.
Represents a device parameter identified by index and subindex.
Definition: common.h:472
ParameterValue getValue() const
Retrieves the value of the parameter based on its data type.
Definition: common.cc:31
std::string name
Name of the parameter.
Definition: common.h:477
bool trySetValue(const T &value)
Attempts to set the parameter value with a strongly-typed input.
Definition: common.h:676
std::uint16_t bitLength
Bit length of the parameter.
Definition: common.h:492
common::ObjectFlags flags
The object flags for the parameter, defined by common::ObjectFlags.
Definition: common.h:514
void setValue(const ParameterValue &value)
Sets the internal raw data representation from a given value.
Definition: common.cc:118
std::optional< T > tryGetValue() const
Attempts to retrieve the parameter value from the ParameterValue variant as the specified type.
Definition: common.h:605
void setValue(const T &value)
Sets the parameter value using a strongly-typed input.
Definition: common.h:653
T getValue() const
Retrieves the parameter value from the ParameterValue variant as the specified type.
Definition: common.h:577
bool operator<(const Parameter &other) const
Compares two Parameter objects for ordering.
Definition: common.h:749
common::ObjectCode code
The object code for the parameter, defined by common::ObjectCode.
Definition: common.h:508
int byteLength
Byte length of the parameter.
Definition: common.h:497
static void from_json(const nlohmann::json &j, Parameter &p)
Deserializes a Parameter object from JSON.
Definition: common.cc:208
common::ObjectFlags access
The access flags for the parameter, defined by common::ObjectFlags.
Definition: common.h:520
bool operator==(const Parameter &other) const
Checks if two Parameter objects are equal.
Definition: common.h:785
bool operator>(const Parameter &other) const
Compares two Parameter objects for reverse ordering.
Definition: common.h:767
std::uint8_t subindex
Subindex of the parameter.
Definition: common.h:487
std::vector< std::uint8_t > data
Holds raw data as a vector of uint8_t elements.
Definition: common.h:525
std::uint16_t index
Index of the parameter.
Definition: common.h:482
static void to_json(nlohmann::json &j, const Parameter &p)
Serializes a Parameter object to JSON.
Definition: common.cc:197
common::ObjectDataType dataType
The data type of the parameter, defined by common::ObjectDataType.
Definition: common.h:503
uint8_t * value
Definition: co_dictionary.h:9
uint16_t index
Definition: co_dictionary.h:0
Definition: common.cc:5
std::string joinStrings(const std::vector< std::string > &list, const std::string &delimiter)
Joins a list of strings into a single string with a delimiter.
Definition: common.cc:278
std::vector< uint8_t > readBinaryFile(const std::string &filename)
Reads the contents of a binary file into a vector of uint8_t.
Definition: common.cc:265
T parseHex(const std::string &s)
Parses a hexadecimal string into an unsigned integer of type T.
Definition: common.h:42
std::string makeParameterId(int index, int subindex)
Formats the given index and subindex into a parameter identifier string.
Definition: common.h:1134
EtherCATVendorID
Enum class representing EtherCAT vendor IDs.
Definition: common.h:110
@ SYNAPTICON
Vendor ID for Synapticon GmbH.
ObjectFlags operator&(ObjectFlags lhs, ObjectFlags rhs)
Bitwise AND operator for ObjectFlags enum class.
Definition: common.h:252
ObjectCode
Enum class representing different object types used in the EtherCAT protocol.
Definition: common.h:404
@ DEFSTRUCT
Definition structure object.
@ DEFTYPE
Definition type object.
@ ARRAY
Array object type.
@ VAR
Variable object type.
std::pair< uint16_t, uint8_t > ParameterKey
Alias for a pair of uint16_t and uint8_t representing a parameter key.
Definition: common.h:419
void logParametersMap(const std::unordered_map< std::pair< uint16_t, uint8_t >, Parameter > &parametersMap, bool sortParameters)
Logs the contents of a map of parameters with an option to sort them.
Definition: common.cc:238
std::string convertParameterValueToString(const ParameterValue &value)
Converts a ParameterValue to a string representation.
Definition: common.cc:219
std::string formatMacAddress(const std::string &originalMacAddress)
Formats a MAC address string to ensure each component is two digits and uppercase.
Definition: common.cc:293
std::vector< uint8_t > toBytes(T value, bool bigEndian=false)
Converts a value of type T to a vector of bytes (uint8_t) in the specified byte order.
Definition: common.h:1102
void from_json(const nlohmann::json &j, UiPdoMapping &p)
Deserialize a JSON object into a UiPdoMapping structure.
Definition: common.cc:7
bool stringViewToNumber(std::string_view sv, T &result)
Converts a string_view to a numeric type.
Definition: common.h:1069
ObjectFlags
Enum class representing various object flags.
Definition: common.h:194
ObjectFlags operator|(ObjectFlags lhs, ObjectFlags rhs)
Bitwise OR operator for ObjectFlags enum class.
Definition: common.h:237
bool operator==(uint32_t lhs, EtherCATVendorID rhs)
Compares a uint32_t value with an EtherCATVendorID enum value.
Definition: common.h:130
ObjectDataType
Enumerates the supported data types for parameters.
Definition: common.h:302
@ BIT14
14-bit field.
@ UNSIGNED40
40-bit unsigned integer.
@ INTEGER16
16-bit signed integer.
@ BACKUP_PARAMETER
For BACKUP_PARAMETER definition see ETG.1020.
@ UNSPECIFIED
Undefined or unknown data type.
@ INTEGER64
64-bit signed integer.
@ SM_SYNCHRONIZATION
For SM_SYNCHRONIZATION definition see ETG.1000.
@ ERROR_SETTING
For ERROR_SETTING definition see ETG.1020.
@ INTEGER32
32-bit signed integer.
@ BIT10
10-bit field.
@ ARRAY_OF_INT
Sequence of INT.
@ TIME_OF_DAY
Time of day format (implementation-defined).
@ REAL32
32-bit floating-point number.
@ UNSIGNED56
56-bit unsigned integer.
@ UNSIGNED8
8-bit unsigned integer.
@ BITARR8
Array of 8 bits.
@ BITARR32
Array of 32 bits.
@ UNSIGNED64
64-bit unsigned integer.
@ REAL64
64-bit floating-point number (double).
@ BIT13
13-bit field.
@ GUID
128-bit globally unique identifier.
@ INTEGER40
40-bit signed integer.
@ PDO_PARAMETER
For PDO_PARAMETER definition see ETG.1020.
@ ENUM
For ENUM definition see ETG.1020.
@ UNSIGNED48
48-bit unsigned integer.
@ DWORD
Four octets (32 bits) unsigned integer.
@ BIT16
16-bit field.
@ UTYPE_END
End of user-defined type range.
@ ARRAY_OF_SINT
Sequence of SINT.
@ UNSIGNED16
16-bit unsigned integer.
@ INTEGER48
48-bit signed integer.
@ ARRAY_OF_UDINT
Sequence of UDINT.
@ INTEGER56
56-bit signed integer.
@ BITARR16
Array of 16 bits.
@ VISIBLE_STRING
Null-terminated ASCII string.
@ BIT11
11-bit field.
@ BIT12
12-bit field.
@ WORD
Two octets (16 bits) unsigned integer.
@ BIT15
15-bit field.
@ BOOLEAN
Boolean value (true or false).
@ UNSIGNED32
32-bit unsigned integer.
@ DIAGNOSIS_HISTORY
For DIAGNOSIS_HISTORY definition see ETG.1020.
@ INTEGER24
24-bit signed integer.
@ ARRAY_OF_DINT
Sequence of DINT.
@ COMMAND_PAR
For COMMAND_PAR definition see ETG.1000.
@ IDENTITY
For IDENTITY definition see ETG.1000.
@ TIME_DIFFERENCE
Time difference format (implementation-defined).
@ BYTE
8-bit unsigned integer.
@ PDO_MAPPING
For PDO_MAPPING definition see ETG.1000.
@ UNSIGNED24
24-bit unsigned integer.
@ OCTET_STRING
Array of raw bytes.
@ INTEGER8
8-bit signed integer.
@ UTYPE_START
Start of user-defined type range.
ObjectFlags SetObjectFlags(ObjectFlags b, ObjectFlags s, ObjectFlags p, ObjectFlags a)
Combine multiple ObjectFlags values into one.
Definition: common.h:285
std::string bytesToHexString(const std::vector< uint8_t > &data)
Converts a vector of bytes into a space-separated hexadecimal string.
Definition: common.h:1158
ObjectFlags & operator|=(ObjectFlags &lhs, ObjectFlags rhs)
Bitwise OR assignment operator for ObjectFlags enum class.
Definition: common.h:267
std::variant< bool, std::int8_t, std::int16_t, std::int32_t, std::int64_t, std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, float, double, std::string, std::vector< std::uint8_t > > ParameterValue
Definition: common.h:449
Specialization of std::hash for std::pair<uint16_t, uint8_t>.
Definition: common.h:1224
Represents a single PDO (Process Data Object) mapping entry.
Definition: common.h:158
uint16_t pdoIndex
The PDO index (e.g., 0x1600 or 0x1A00)
Definition: common.h:159
uint8_t subindex
The subindex of the object (e.g., 0x00)
Definition: common.h:161
uint16_t index
The object dictionary index (e.g., 0x607A)
Definition: common.h:160
uint8_t bitlength
The size of the mapped entry in bits (e.g., 16, 32, etc.)
Definition: common.h:163
Represents the mapped PDO entries for a slave device.
Definition: common.h:180
std::vector< PdoMappingEntry > txPdos
Definition: common.h:183
std::vector< PdoMappingEntry > rxPdos
Definition: common.h:181
Top-level UI configuration JSON structure.
Definition: common.h:75
UiPdoMapping pdoMapping
Definition: common.h:76
Represents the PDO mapping for RX and TX channels.
Definition: common.h:65
std::map< std::uint16_t, std::vector< std::uint32_t > > tx
Definition: common.h:67
std::map< std::uint16_t, std::vector< std::uint32_t > > rx
Definition: common.h:66
size_t operator()(const std::pair< uint16_t, uint8_t > &p) const
Computes a hash for a given std::pair<uint16_t, uint8_t>.
Definition: common.h:1237