EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
EnumerationInformation.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <cstdint>
13#include <iostream>
14#include <string>
15#include <vector>
16
19#include "sensorring/platform/SensorringExport.hpp"
20
21namespace eduart {
22
23namespace sensorring {
24
29struct SENSORRING_EXPORT Version {
31 unsigned int major = 0;
33 unsigned int minor = 0;
35 unsigned int patch = 0;
36
41 std::string toString() const;
42
49 friend std::ostream& operator<<(std::ostream& os, const Version& v) noexcept;
50
56 bool operator==(const Version& other) const noexcept;
57
63 bool operator<(const Version& other) const noexcept;
64};
65
70struct SENSORRING_EXPORT CommitHash {
72 std::uint32_t hash = 0;
73
78 std::string toString() const;
79
86 friend std::ostream& operator<<(std::ostream& os, const CommitHash& ch) noexcept;
87
93 bool operator==(const CommitHash& other) const noexcept;
94
100 bool operator=(const std::uint32_t& other) noexcept;
101};
102
103namespace board {
104
117
130
136SENSORRING_EXPORT std::string toString(ConnectionState state);
137
143SENSORRING_EXPORT std::string toString(ConfigurationState state);
144
148SENSORRING_EXPORT std::ostream& operator<<(std::ostream& os, const ConnectionState state) noexcept;
149
153SENSORRING_EXPORT std::ostream& operator<<(std::ostream& os, const ConfigurationState state) noexcept;
154
159struct SENSORRING_EXPORT EnumerationInformation {
161 unsigned int idx = 0;
162
165
168
171
173 std::uint16_t device_options = 0;
174
176 std::vector<device::DeviceType> devices;
177
180
183
185 std::vector<device::DeviceType> configured_devices;
186
191 bool isUndefined() const noexcept;
192
198 static EnumerationInformation fromBuffer(const std::vector<uint8_t>& buffer);
199
205 bool hasDevice(device::DeviceType type) const noexcept;
206
212 bool operator==(unsigned int other) const noexcept;
213
219 bool operator==(const EnumerationInformation& other) const noexcept;
220
226 bool operator<(const EnumerationInformation& other) const noexcept;
227
232 std::string toString() const;
233};
234
235} // namespace board
236
237} // namespace sensorring
238
239} // namespace eduart
Enumeration of supported device hardware types.
ConfigurationState
Whether a board or device was declared by the user via the factory.
Definition EnumerationInformation.hpp:122
@ Configured
The board/device was declared by the user (expectBoard) and matched by the factory.
Definition EnumerationInformation.hpp:126
@ Undefined
Configuration state has not been determined yet.
Definition EnumerationInformation.hpp:124
@ Unconfigured
The board/device was discovered by hardware but not declared by the user.
Definition EnumerationInformation.hpp:128
ConnectionState
Physical connection state of a board after enumeration.
Definition EnumerationInformation.hpp:109
@ Unconnected
Board is not physically connected.
Definition EnumerationInformation.hpp:115
@ Connected
Board is physically connected.
Definition EnumerationInformation.hpp:113
@ Undefined
Connection state has not been determined yet.
Definition EnumerationInformation.hpp:111
SENSORRING_EXPORT std::ostream & operator<<(std::ostream &os, const ConnectionState state) noexcept
Stream connection state as string.
SENSORRING_EXPORT std::string toString(ConnectionState state)
Convert connection state to a human-readable string.
Board type enum for sensor board hardware variants (matches firmware).
SensorBoardType
Hardware variant of a sensor board.
Definition SensorBoardType.hpp:28
@ Undefined
Board type could not be determined.
Definition SensorBoardType.hpp:33
32-bit commit hash (e.g. from firmware) with byte-wise construction and string output.
Definition EnumerationInformation.hpp:70
bool operator==(const CommitHash &other) const noexcept
Compare two commit hashes for equality.
std::string toString() const
Format hash as hex string.
std::uint32_t hash
32-bit hash value.
Definition EnumerationInformation.hpp:72
friend std::ostream & operator<<(std::ostream &os, const CommitHash &ch) noexcept
Stream hash as hex string.
bool operator=(const std::uint32_t &other) noexcept
Assign commit hash from a 32-bit integer.
Semantic version (major, minor, patch) for firmware or board.
Definition EnumerationInformation.hpp:29
friend std::ostream & operator<<(std::ostream &os, const Version &v) noexcept
Stream version as "major.minor.patch".
unsigned int patch
Patch version number.
Definition EnumerationInformation.hpp:35
std::string toString() const
Format version as "major.minor.patch".
unsigned int minor
Minor version number.
Definition EnumerationInformation.hpp:33
bool operator<(const Version &other) const noexcept
Lexicographic less-than comparison (major, minor, patch).
unsigned int major
Major version number.
Definition EnumerationInformation.hpp:31
bool operator==(const Version &other) const noexcept
Compare two versions for equality.
Information reported by a board during enumeration: index, version, commit hash, board type,...
Definition EnumerationInformation.hpp:159
SensorBoardType type
Detected or configured board type.
Definition EnumerationInformation.hpp:170
bool isUndefined() const noexcept
Return true if this instance has not been filled from a valid enumeration response.
unsigned int idx
Board index.
Definition EnumerationInformation.hpp:161
bool hasDevice(device::DeviceType type) const noexcept
Check if a specific device type is reported as populated.
CommitHash hash
Commit hash from enumeration response.
Definition EnumerationInformation.hpp:167
ConnectionState state
Configuration/connection state after enumeration.
Definition EnumerationInformation.hpp:179
std::vector< device::DeviceType > devices
Devices on the board.
Definition EnumerationInformation.hpp:176
std::string toString() const
Format this board's enumeration info as a human-readable string.
Version version
Firmware/board version from enumeration response.
Definition EnumerationInformation.hpp:164
ConfigurationState config_state
Configuration state set by the factory during build().
Definition EnumerationInformation.hpp:182
std::vector< device::DeviceType > configured_devices
Device types that were instantiated by the factory (subset of devices).
Definition EnumerationInformation.hpp:185
static EnumerationInformation fromBuffer(const std::vector< uint8_t > &buffer)
Parse enumeration info from the raw response buffer (e.g. CMD_ACTIVE_DEVICE_RESPONSE payload).
std::uint16_t device_options
Bitmask describing which devices are physically populated on the board.
Definition EnumerationInformation.hpp:173