MotionLib  1.0.0
SamBuCa motion library
MFEAxisPositionMonitor.hpp
1 /*
2 ** Copyright (C) 2025 CERN
3 **
4 ** This software is provided 'as-is', without any express or implied
5 ** warranty. In no event will the authors be held liable for any damages
6 ** arising from the use of this software.
7 **
8 ** Permission is granted to anyone to use this software for any purpose,
9 ** including commercial applications, and to alter it and redistribute it
10 ** freely, subject to the following restrictions:
11 **
12 ** 1. The origin of this software must not be misrepresented; you must not
13 ** claim that you wrote the original software. If you use this software
14 ** in a product, an acknowledgment in the product documentation would be
15 ** appreciated but is not required.
16 ** 2. Altered source versions must be plainly marked as such, and must not be
17 ** misrepresented as being the original software.
18 ** 3. This notice may not be removed or altered from any source distribution.
19 **
20 ** Created on: 2025-04-17T18:09:36
21 ** Author: Sylvain Fargier <sylvain.fargier@cern.ch>
22 */
23 
24 #ifndef MFEAXISPOSITIONMONITOR_HPP__
25 #define MFEAXISPOSITIONMONITOR_HPP__
26 
27 #include "device/AxisPositionMonitor.hpp"
28 namespace smc {
29 namespace internal {
30 
31 class MFEPlatform;
32 
34 {
35 public:
36  typedef std::shared_ptr<MFEAxisPositionMonitor> Shared;
37 
38  MFEAxisPositionMonitor(const std::string &uid,
39  const std::shared_ptr<Axis> &axis,
40  const std::shared_ptr<PositionSensor> &position,
41  const std::shared_ptr<MFEPlatform> &mfe);
42 
43  std::future<units::value_t> getDifference(units::unit_t unit) const override;
44 
45  std::future<units::value_t> getMaxDifference(
46  units::unit_t unit) const override;
47 
48  std::future<State> getState() const override;
49 
50  std::future<void> setEnabled(bool enabled) override;
51 
52  units::value_t lastDifference(units::unit_t unit) const override;
53 
54  State lastState() const override;
55 
56  std::future<std::set<std::string>> listConfig() const override;
57 
58  std::future<std::string> getConfig(const std::string &name) const override;
59 
60  std::future<void> setConfig(const std::string &name,
61  const std::string &value) const override;
62 
63 protected:
64  std::weak_ptr<MFEPlatform> m_mfe;
65 };
66 
67 } // namespace internal
68 } // namespace smc
69 
70 #endif
This object represent a link between an axis and a position sensor.
DeviceId uid() const
Get the address of device.
Definition: DeviceBase.cpp:76
units::value_t lastDifference(units::unit_t unit) const override
Get last known difference.
std::future< void > setEnabled(bool enabled) override
Enable/disable the monitor.
std::future< State > getState() const override
Get the current device state.
std::future< std::set< std::string > > listConfig() const override
list device configuration options
std::future< void > setConfig(const std::string &name, const std::string &value) const override
set device configuration value
std::future< units::value_t > getMaxDifference(units::unit_t unit) const override
Get max difference since monitor was enabled.
std::future< std::string > getConfig(const std::string &name) const override
get device configuration value
State lastState() const override
Get last known state.
std::future< units::value_t > getDifference(units::unit_t unit) const override
Get current position difference between axis and positionSensor.
main motion-lib namespace
Definition: Client.cpp:30