EduArt Sensor Ring Library 3.0.0
Loading...
Searching...
No Matches
MeasurementManager.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <functional>
13#include <memory>
14
20#include "sensorring/platform/SensorringExport.hpp"
23
24namespace eduart {
25
26namespace manager {
27
28// Forward declaration of implementation class
29class SENSORRING_EXPORT MeasurementManagerImpl;
30
36class SENSORRING_EXPORT MeasurementManager {
37public:
43 MeasurementManager(ManagerParams params, std::unique_ptr<ring::SensorRing> sensor_ring);
44
47
52 bool measureSome() noexcept;
53
58 bool startMeasuring() noexcept;
59
64 bool stopMeasuring() noexcept;
65
70 bool isMeasuring() noexcept;
71
77 subscription::Subscription subscribeToStateChanges(std::function<void(const ManagerState state)> callback);
78
85 subscription::Subscription subscribeToDeviceGroup(device::DeviceType key, std::function<void(const device::DeviceGroup&)> callback);
86
91 void unsubscribe(subscription::SubscriberToken token);
92
97 ManagerState getManagerState() const noexcept;
98
103 ManagerParams getParams() const noexcept;
104
109 ring::SensorRing* getSensorRing() const noexcept;
110
115 void enqueueExtraAction(std::function<void()> action);
116
117private:
118 std::unique_ptr<MeasurementManagerImpl> _mm_impl;
119};
120
121} // namespace manager
122
123} // namespace eduart
Container for a group of devices with filtering and iteration by type.
Enumeration of supported device hardware types.
Parameter structure for the MeasurementManager.
ManagerState and helpers for the MeasurementManager.
ManagerState
Health state of the sensorring state machine worker.
Definition ManagerState.hpp:25
Top-level container managing multiple sensor buses.
Opaque token identifying a subscription.
RAII wrapper pairing a SubscriberToken with its cancel function.
bool stopMeasuring() noexcept
Stop the state machine worker loop and join the thread.
ring::SensorRing * getSensorRing() const noexcept
Return the SensorRing managed by this manager.
void unsubscribe(subscription::SubscriberToken token)
Cancel a subscription.
~MeasurementManager() noexcept
Destructor.
void enqueueExtraAction(std::function< void()> action)
Queue a callable to run once in the next extra-actions slot of the state machine.
MeasurementManager(ManagerParams params, std::unique_ptr< ring::SensorRing > sensor_ring)
Construct the manager with parameters and owned SensorRing.
bool measureSome() noexcept
Run one processing cycle of the state machine worker.
bool isMeasuring() noexcept
Report whether the measurement worker thread is running.
subscription::Subscription subscribeToDeviceGroup(device::DeviceType key, std::function< void(const device::DeviceGroup &)> callback)
Subscribe to device group updates; callback is invoked when the group is updated.
ManagerState getManagerState() const noexcept
Return the current health state of the state machine worker.
ManagerParams getParams() const noexcept
Return the parameters used to initialize the manager.
subscription::Subscription subscribeToStateChanges(std::function< void(const ManagerState state)> callback)
Subscribe to state changes; callback is invoked when the state changes.
bool startMeasuring() noexcept
Start the state machine worker loop in a dedicated thread.
Parameter structure of the MeasurementManager. The MeasurementManager handles the timing and communic...
Definition ManagerParams.hpp:24