ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
iDevice.hpp
Go to the documentation of this file.
1
7
8#ifndef FCF_DEVMGR_COMMON_IDEVICE_HPP
9#define FCF_DEVMGR_COMMON_IDEVICE_HPP
10
11#include <any>
12#include <functional>
13#include <memory>
14
15#include <rad/getPayload.hpp>
16#include <ifw/core/dit/fits/fits.hpp>
17
18#include <ifw/fnd/defs/iCommAdapter.hpp>
19
20// For convenience this macro has been added.
21// This allows you to register the second you inherited from Device class
22// without the need to include anything else
23
25#define REGISTER_DEVICE(T) static ifw::fcf::devmgr::common::DeviceMaker<T> maker(#T)
26
27
28namespace ifw::fcf {
29 namespace devmgr {
30 namespace common {
31
32 class IDeviceConfig;
33 class DeviceLcsIf;
41 class IDevice {
42
43 public:
44
45
50 virtual void CreateObjects(std::shared_ptr<ifw::fcf::devmgr::common::IDeviceConfig> config = nullptr)=0;
67 virtual void RegisterComm(std::shared_ptr<ifw::fnd::defs::ICommAdapter> comm_if,
68 std::function<void()> on_failure,
69 std::function<void()> on_normal) = 0;
70
71
77 virtual bool IsNotReady() const = 0;
83 virtual bool IsReady() const = 0;
84
90 virtual bool IsOperational() const = 0;
91
97 virtual void CheckHwFailure() const = 0;
98
104 virtual bool IsDisabling() const = 0;
105
111 virtual void Init() = 0;
112
118 virtual void Enable() = 0;
119
125 virtual void Disable() = 0;
126
132 virtual void Stop() = 0;
133
139 virtual void Reset() = 0;
140
141
145 virtual void UpdateStatus() = 0;
146
154 virtual void Setup(const std::any& payload) = 0;
155
165 virtual bool IsSetupActive(const std::any& payload) const = 0;
166
172 virtual void Status(const std::any& payload, std::string& buffer) = 0;
173
174
185 virtual void Status(bool end_acq,
186 const ifw::core::dit::did::Did& dictionary,
187 std::shared_ptr<CCfits::FITS>& fits_handle) = 0;
188
196 virtual void Simulate(rad::AnyEvent const& last_event) = 0;
197
205 virtual void StopSim(rad::AnyEvent const& last_event) = 0;
206
214 virtual void Ignore(rad::AnyEvent const& last_event) = 0;
215
223 virtual void StopIgn(rad::AnyEvent const& last_event) = 0;
224
232 virtual void HwReset(rad::AnyEvent const& last_event) = 0;
233
241 virtual void HwInit(rad::AnyEvent const& last_event) = 0;
242
250 virtual void HwEnable(rad::AnyEvent const& last_event) = 0;
251
259 virtual void HwDisable(rad::AnyEvent const& last_event) = 0;
260
266 virtual std::shared_ptr<DeviceLcsIf> GetLcsIf() const noexcept = 0;
267
273 virtual std::shared_ptr<IDeviceConfig> GetConfig() const = 0;
274
278 virtual void StartMonitoring() = 0;
279
283 virtual void StopMonitoring() = 0;
284
288 virtual void WriteConfig() = 0;
289
294 virtual std::string GetName() const noexcept = 0;
295 };
296
297 }
298 }
299}
300
301
302#endif //FCF_DEVMGR_COMMON_IDEVICE_HPP
Device Configuration class.
Definition iDeviceConfig.hpp:29
Definition iDevice.hpp:41
virtual void StopSim(rad::AnyEvent const &last_event)=0
Executes a StopSim.
virtual std::shared_ptr< DeviceLcsIf > GetLcsIf() const noexcept=0
Get a pointer of device LCS interface.
virtual void CreateObjects(std::shared_ptr< ifw::fcf::devmgr::common::IDeviceConfig > config=nullptr)=0
Create basic objects needed by the device class.
virtual bool IsNotReady() const =0
Check if device is Standby/NotReady.
virtual void Stop()=0
Executes a Stop command.
virtual void HwEnable(rad::AnyEvent const &last_event)=0
Executes a hardware enable command.
virtual void Status(const std::any &payload, std::string &buffer)=0
Obtain the status of the device.
virtual bool IsOperational() const =0
Check if device is Operational.
virtual void StopIgn(rad::AnyEvent const &last_event)=0
Executes a StopIgn.
virtual std::shared_ptr< IDeviceConfig > GetConfig() const =0
Get a pointer of device configuration.
virtual void Simulate(rad::AnyEvent const &last_event)=0
Executes a Simulat.
virtual void HwDisable(rad::AnyEvent const &last_event)=0
Executes a hardware disable command.
virtual bool IsSetupActive(const std::any &payload) const =0
Check if setup is still active.
virtual void Setup(const std::any &payload)=0
Executes a setup.
virtual void Ignore(rad::AnyEvent const &last_event)=0
Executes a Ignore.
virtual void WriteConfig()=0
Write configuration into OLDB.
virtual void Status(bool end_acq, const ifw::core::dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle)=0
Obtain the status of the device.
virtual void RegisterComm(std::shared_ptr< ifw::fnd::defs::ICommAdapter > comm_if, std::function< void()> on_failure, std::function< void()> on_normal)=0
Register a communication client and callback hooks.
virtual void Enable()=0
Executes a Enable command.
virtual void Reset()=0
Executes a Reset command.
virtual void HwInit(rad::AnyEvent const &last_event)=0
Executes a hardware init command.
virtual void UpdateStatus()=0
Update internal status by connecting to the LCS.
virtual bool IsDisabling() const =0
Check if device is disablig.
virtual void CheckHwFailure() const =0
Check if device is in failure state.
virtual void StopMonitoring()=0
Stop device monitoring.
virtual void HwReset(rad::AnyEvent const &last_event)=0
Executes a hardware reset command.
virtual void Disable()=0
Executes a Disable command.
virtual void Init()=0
Executes a Init command.
virtual std::string GetName() const noexcept=0
Get device name.
virtual void StartMonitoring()=0
Start device monitoring via OPCUA subscriptions.
virtual bool IsReady() const =0
Check if device is Standby/Ready.
ActionsEnable class source file.
Definition actionMgr.cpp:28
std::string const
Definition test{{cookiecutter.device_name|capitalize()}}.cpp:159