EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
InterfaceParams.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <string>
13
14#include "sensorring/platform/SensorringExport.hpp"
15
16namespace eduart {
17
18namespace sensorring {
19
20namespace com {
21
26struct SENSORRING_EXPORT InterfaceParams {
27 virtual ~InterfaceParams() = default;
28
30 std::string name;
31
32protected:
33 InterfaceParams() = default;
34 explicit InterfaceParams(std::string name)
35 : name(std::move(name)) {}
36};
37
42struct SENSORRING_EXPORT CanParams : InterfaceParams {
43
45 bool respond_with_brs = false;
46
48 unsigned int data_bitrate = 0;
49
51 float data_sample_point = 0.0f;
52
60 void send_with_brs(bool enable) { _send_with_brs = enable; }
61
66 bool send_with_brs() const { return _send_with_brs; }
67
68 CanParams() = default;
69 CanParams(std::string interface_name, bool respond_with_brs = false, unsigned int data_bitrate = 0, float data_sample_point = 0.0f)
70 : InterfaceParams(std::move(interface_name))
71 , respond_with_brs(respond_with_brs)
72 , data_bitrate(data_bitrate)
73 , data_sample_point(data_sample_point) {}
74
75private:
79 bool _send_with_brs = false;
80};
81
86struct SENSORRING_EXPORT SocketCanParams : CanParams {
87
88 SocketCanParams() = default;
89 SocketCanParams(std::string interface_name, bool respond_with_brs = false, unsigned int data_bitrate = 0, float data_sample_point = 0.0f)
90 : CanParams(std::move(interface_name), respond_with_brs, data_bitrate, data_sample_point) {}
91};
92
97struct SENSORRING_EXPORT UsbTingoParams : CanParams {
98
99 UsbTingoParams() = default;
100 UsbTingoParams(std::string interface_name, bool respond_with_brs = false, unsigned int data_bitrate = 0, float data_sample_point = 0.0f)
101 : CanParams(std::move(interface_name), respond_with_brs, data_bitrate, data_sample_point) {}
102};
103
104} // namespace com
105
106} // namespace sensorring
107
108} // namespace eduart
Shared parameters for a CAN interfaces.
Definition InterfaceParams.hpp:42
void send_with_brs(bool enable)
Enable CAN FD bit rate switching for the data phase when the host sends messages to the sensor boards...
Definition InterfaceParams.hpp:60
unsigned int data_bitrate
Data bitrate in bits per second in the range [1000000, 8000000]. Only relevant if one of the brs sett...
Definition InterfaceParams.hpp:48
bool send_with_brs() const
Get whether CAN FD bit rate switching for the data phase is enabled when the host sends messages to t...
Definition InterfaceParams.hpp:66
float data_sample_point
Data sample point in the range [0, 1]. Optional parameter for fine-tuning. Default 0 uses the CAN con...
Definition InterfaceParams.hpp:51
bool respond_with_brs
Enable CAN FD bit rate switching for the data phase when the sensor boards send messages to the host.
Definition InterfaceParams.hpp:45
Base class for interface configuration parameters.
Definition InterfaceParams.hpp:26
std::string name
Interface identifier (e.g. "can0" for SocketCAN, serial number for USBtingo).
Definition InterfaceParams.hpp:30