ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
piezoLcsIf.hpp
Go to the documentation of this file.
1 
10 #ifndef DEVMGR_DEVICE_PIEZO_IF_HPP
11 #define DEVMGR_DEVICE_PIEZO_IF_HPP
12 
13 #include <unordered_map>
14 
15 #include <yaml-cpp/yaml.h>
19 
20 #include <Fcfif.hpp>
21 #include <rad/mal/publisher.hpp>
22 
23 namespace fcf::devmgr {
24  namespace piezo {
25 
34  public:
36  virtual ~PiezoControllerData();
37 
38  inline std::string GetErrorText() const;
39  void SetData(const PiezoControllerData& data);
40  void SetPosBit(short axis, int value);
41  void SetPosUser(short axis, double value);
42  int GetPosBit(short axis) const;
43  double GetPosUser(short axis) const;
44  inline virtual std::string GetSubstateStr() const;
45 
46  protected:
47  std::vector<int> m_pos_bit;
48  std::vector<double> m_pos_user;
49 
50 
51  };
52 
53 
54 
68  template<typename TOPIC_TYPE = fcfif::PiezoTopicUnion>
70  {
71 
72  // enumerations for Piezo status
73  enum {
74  STAT_LOCAL = 1,
75  STAT_ERROR = 2,
76  STAT_HW_STATUS = 3,
77  STAT_STATE = 4,
78  STAT_SUBSTATE = 5,
79  STAT_BIT1,
80  STAT_BIT2,
81  STAT_BIT3,
82  STAT_POS1,
83  STAT_POS2,
84  STAT_POS3,
85  STAT_MON_BIT1,
86  STAT_MON_BIT2,
87  STAT_MON_BIT3,
88  STAT_MON_POS1,
89  STAT_MON_POS2,
90  STAT_MON_POS3
91  };
92 
93  public:
101  PiezoLcsIf(std::shared_ptr<devmgr::common::IDeviceConfig> config,
102  devmgr::common::DataContext& data_ctx, bool initialise = true);
103 
104 
108  virtual ~PiezoLcsIf() {};
109 
114  virtual bool IsReady();
115 
120  virtual bool IsOperational() ;
121 
133  bool IsInAuto();
134 
139  bool IsInPos();
140 
141  void Auto();
142 
149  void Home();
150 
157  void Pos();
158 
168  void MoveBits(short bit1, short bit2, short bit3);
169 
179  void MoveUser(double pos1, double pos2, double pos3);
180 
189  virtual void ReadStatus(PiezoControllerData& status);
190 
191 
203  void Listener(fcf::common::VectorVariant& params);
204 
210  virtual std::string GetRpcError(const short error_code) const;
211 
212 
213  private:
214 
226  void StoreAttribute(const std::string key,
227  const fcf::common::Variant& value,
228  bool publish,
229  int attribute);
230 
231 
232  protected:
233  std::unique_ptr<rad::cii::Publisher<TOPIC_TYPE>> m_publisher;
234 
235  private:
236 
237 
238  };
239  }
240 }
241 
242 #include "piezoLcsIf.ipp"
243 
244 #endif //DEVMGR_DEVICE_PIEZO_IF_HPP
void SetPosUser(short axis, double value)
void MoveBits(short bit1, short bit2, short bit3)
Executes the MoveBits RPC.
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:31
The piezoControllerData struct.
Definition: piezoLcsIf.hpp:33
PiezoLcsIf(std::shared_ptr< devmgr::common::IDeviceConfig > config, devmgr::common::DataContext &data_ctx, bool initialise=true)
piezoLcsIf constructor.
std::vector< double > m_pos_user
Definition: piezoLcsIf.hpp:48
virtual bool IsReady()
Check if controller is in Standby/Ready state.
virtual std::string GetSubstateStr() const
bool IsInAuto()
Executes the Auto RPC.
std::unique_ptr< rad::cii::Publisher< TOPIC_TYPE > > m_publisher
Definition: piezoLcsIf.hpp:233
virtual ~PiezoControllerData()
Definition: piezoLcsIf.cpp:37
void SetPosBit(short axis, int value)
void MoveUser(double pos1, double pos2, double pos3)
Executes the MoveUser RPC.
virtual ~PiezoLcsIf()
Default destructor.
Definition: piezoLcsIf.hpp:108
Piezo Local Control System (LCS) Interface (IF) class.
Definition: piezoLcsIf.hpp:69
PiezoConfig class header file.
virtual std::string GetRpcError(const short error_code) const
std::vector< int > m_pos_bit
Definition: piezoLcsIf.hpp:47
DataContext class header file.
bool IsInPos()
Check if piezo is in POS state.
Definition: dataContext.hpp:81
virtual void ReadStatus(PiezoControllerData &status)
Read status from the controller.
virtual bool IsOperational()
Check if controller is in Operational.
deviceLcsIf class header file.
void Home()
Executes the Home RPC.
double GetPosUser(short axis) const
PiezoControllerData()
Definition: piezoLcsIf.cpp:31
void Pos()
Executes the Pos RPC.
Definition: deviceLcsIf.hpp:72
void SetData(const PiezoControllerData &data)
Definition: piezoLcsIf.cpp:40
void Listener(fcf::common::VectorVariant &params)
Callback to manage changes on the monitored items.