ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shutterLcsIf.hpp
Go to the documentation of this file.
1 
10 #ifndef FCF_DEVMGR_DEVICE_SHUTTER_IF_HPP
11 #define FCF_DEVMGR_DEVICE_SHUTTER_IF_HPP
12 
13 // System headers
14 #include <unordered_map>
15 
16 // Third party headers
17 #include <yaml-cpp/yaml.h>
18 
19 #include <fcf/devmgr/common/events.rad.hpp>
20 
24 
25 #include <Fcfif.hpp>
26 #include <rad/mal/publisher.hpp>
27 
28 namespace fcf::devmgr::shutter {
29 
38  public:
40  virtual ~ShutterControllerData();
41 
42  inline std::string GetErrorText() const;
43  inline virtual std::string GetSubstateStr() const;
44 
45  void SetData(const ShutterControllerData& data);
46 
47  protected:
48 
49  };
50 
64  template<typename TOPIC_TYPE = fcfif::ShutterTopicUnion>
66  {
67 
68  public:
69 
77  ShutterLcsIf(std::shared_ptr<devmgr::common::IDeviceConfig> config,
78  devmgr::common::DataContext& data_ctx, bool initialise = true);
79 
80 
84  virtual ~ShutterLcsIf() {};
85 
90  virtual bool IsReady();
91 
96  virtual bool IsOperational();
97 
104  void Open();
105 
112  void Close();
113 
118  bool IsOpening();
119 
124  bool IsClosing();
125 
130  bool IsOpen();
131 
136  bool IsClose();
137 
142  virtual void ReadStatus(devmgr::common::DeviceControllerData& status);
143 
155  void Listener(fcf::common::VectorVariant& params);
156 
162  virtual std::string GetRpcError(const short error) const;
163 
164  private:
165 
177  void StoreAttribute(const std::string key,
178  const fcf::common::Variant& value,
179  bool publish,
180  int attribute);
181 
182 
183  protected:
184  std::unique_ptr<rad::cii::Publisher<TOPIC_TYPE>> m_publisher;
185 
186  private:
187 
188  };
189 }
190 
191 #include "shutterLcsIf.ipp"
192 
193 #endif //FCF_DEVMGR_DEVICE_SHUTTER_IF_HPP
virtual std::string GetRpcError(const short error) const
virtual std::string GetSubstateStr() const
bool IsOpen()
Check if shutter is open.
void Listener(fcf::common::VectorVariant &params)
Callback to manage changes on the monitored items.
virtual bool IsOperational()
Check if controller is in Operational.
ShutterConfig class header file.
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:31
virtual void ReadStatus(devmgr::common::DeviceControllerData &status)
Read status from the controller.
virtual bool IsReady()
Check if controller is in Standby/Ready state.
virtual ~ShutterControllerData()
Definition: shutterLcsIf.cpp:20
void SetData(const ShutterControllerData &data)
std::unique_ptr< rad::cii::Publisher< TOPIC_TYPE > > m_publisher
Definition: shutterLcsIf.hpp:184
ShutterLcsIf(std::shared_ptr< devmgr::common::IDeviceConfig > config, devmgr::common::DataContext &data_ctx, bool initialise=true)
ShutterLcsIf constructor.
bool IsClosing()
Check if controller is closing the shutter.
The ShutterControllerData struct.
Definition: shutterLcsIf.hpp:37
Shutter Local Control System (LCS) Interface (IF) class.
Definition: shutterLcsIf.hpp:65
bool IsOpening()
Check if controller is opening the shutter.
DataContext class header file.
Definition: dataContext.hpp:81
void Close()
Executes the Close RPC.
deviceLcsIf class header file.
virtual ~ShutterLcsIf()
Default destructor.
Definition: shutterLcsIf.hpp:84
void Open()
Executes the Open RPC.
Definition: deviceLcsIf.hpp:72
ShutterControllerData()
Definition: shutterLcsIf.cpp:16
bool IsClose()
Check if shutter is close.