EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
Device.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 <functional>
14#include <mutex>
15#include <optional>
16#include <vector>
17
23#include "sensorring/platform/SensorringExport.hpp"
25
26namespace eduart {
27
28namespace sensorring {
29
30namespace com {
31class ComInterface;
32}
33
34namespace device {
35
43class SENSORRING_EXPORT Device : public ActionDispatcher {
44public:
51 Device(DeviceID id, com::ComInterface* interface, com::ComEndpoint target);
52
53 virtual ~Device();
54
59
63 unsigned int getHwIdx() const;
64
69 void setDeviceIndex(unsigned int index);
70
75 virtual bool configure();
76
81 void setBoardContext(const board::SensorBoardParams* board_params);
82
88
93 void setPoseOffset(const math::Pose& offset);
94
100
106
107protected:
108 virtual void comCallback(const com::ComEndpoint source, std::uint8_t command, const std::vector<std::uint8_t>& data) = 0;
109
110 DeviceID _id;
111 unsigned int _hw_idx;
112
113 com::ComInterface* _interface;
114
115 const board::SensorBoardParams* _board_params = nullptr;
116 math::Pose _offset;
117
118 subscription::Subscription _com_subscription;
119};
120
121} // namespace device
122
123} // namespace sensorring
124
125} // namespace eduart
Base class that executes actions either immediately or via a managed queue.
Communication endpoint identifier.
Device identifier (type, name, index) for device registration.
Defines a pose with translation and orientation.
Parameter structure of a sensor board.
RAII wrapper pairing a SubscriberToken with its cancel function.
Base class that executes actions either immediately or via a managed queue.
Definition ActionDispatcher.hpp:29
virtual bool configure()
Apply post-reset runtime configuration for this device.
const board::SensorBoardParams * getBoardContext() const
Return the board-level context pointer (non-owning).
math::Pose getGlobalPose() const
Compute and return the global pose in the ring coordinate frame.
void setBoardContext(const board::SensorBoardParams *board_params)
Initialize board-level context pointer (non-owning).
DeviceID getDeviceID() const
Return the full device identifier (type + index).
void setPoseOffset(const math::Pose &offset)
Store a pose offset relative to the board centre.
unsigned int getHwIdx() const
Return the zero-based hardware board index on its bus (used for CAN addressing and protocol bitmasks)...
math::Pose getPoseOffset() const
Return the stored pose offset relative to the board centre.
void setDeviceIndex(unsigned int index)
Reassign the logical device index (DeviceID.index) without changing the hardware index.
Device(DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
Construct the device with identity and communication link.
Move-only RAII wrapper that pairs a SubscriberToken with an unsubscribe callable. Destroying a Subscr...
Definition Subscription.hpp:32
Parameter structure of a sensor board. A sensor board is one circuit board.
Definition SensorBoardParams.hpp:51
Uniquely identifies a communication endpoint as a (Direction, BoardAddress, DeviceId) tuple.
Definition ComEndpoint.hpp:37
Identifier for a device: type, human-readable name, and index.
Definition DeviceID.hpp:27
Defines a pose with translation and orientation.
Definition Pose.hpp:24