MotionLib  1.0.0
SamBuCa motion library
MFEPositionSensor.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-17T16:15:01
21 ** Author: Sylvain Fargier <sylvain.fargier@cern.ch>
22 */
23 
24 #ifndef MFEPOSITIONSENSOR_HPP__
25 #define MFEPOSITIONSENSOR_HPP__
26 
27 #include <memory>
28 #include <string>
29 
30 #include "device/PositionSensor.hpp"
31 
32 namespace smc {
33 namespace internal {
34 
35 class MFEPlatform;
36 
38 {
39 public:
40  typedef std::shared_ptr<MFEPositionSensor> Shared;
41 
42  MFEPositionSensor(const std::string &uid,
43  const std::shared_ptr<MFEPlatform> &mfe);
44 
45  std::future<units::value_t> getPosition(units::unit_t unit) const override;
46 
47  std::future<void> setActualPosition(
48  const units::value_t &value) const override;
49 
50  units::value_t lastPosition(units::unit_t unit) const override;
51 
52  std::future<std::set<std::string>> listConfig() const override;
53 
54  std::future<std::string> getConfig(const std::string &name) const override;
55 
56  std::future<void> setConfig(const std::string &name,
57  const std::string &value) const override;
58 
59  bool canConvert(const units::Value &value,
60  units::unit_t unit) const override;
61 
62  bool convert(units::Value &value, units::unit_t unit) const override;
63 
64 protected:
65  std::weak_ptr<MFEPlatform> m_mfe;
66 };
67 } // namespace internal
68 } // namespace smc
69 
70 #endif
DeviceId uid() const
Get the address of device.
Definition: DeviceBase.cpp:76
std::future< std::string > getConfig(const std::string &name) const override
get device configuration value
bool convert(units::Value &value, units::unit_t unit) const override
Convert value in a manner specific to this device.
std::future< void > setActualPosition(const units::value_t &value) const override
Set the current position value.
units::value_t lastPosition(units::unit_t unit) const override
Get last known position.
bool canConvert(const units::Value &value, units::unit_t unit) const override
Check if unit conversion is possible in a manner specific to this device.
std::future< units::value_t > getPosition(units::unit_t unit) const override
Get current position value.
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
main motion-lib namespace
Definition: Client.cpp:30