ifw-fcf  5.0.0-pre2
motorLcsIf.hpp
Go to the documentation of this file.
1 
9 #ifndef FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
10 #define FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
11 
12 // System headers
13 #include <unordered_map>
14 
15 // Third party headers
16 #include <yaml-cpp/yaml.h>
17 
21 
22 #include <Fcfif.hpp>
23 #include <rad/mal/publisher.hpp>
24 
25 namespace fcf::devmgr::motor {
26 
35  public:
37  virtual ~MotorControllerData();
38 
39  inline double GetScaleFactor() const;
40  inline void SetScaleFactor(double scale);
41 
42  inline bool GetBrakeFlag() const;
43  inline void SetBrakeFlag(bool flag);
44 
45  inline bool GetEnableFlag() const;
46  inline void SetEnableFlag(bool flag);
47 
48  inline bool GetLockFlag() const;
49  inline void SetLockFlag(bool flag);
50 
51  inline int GetMode() const;
52  inline void SetMode(int mode);
53 
54  inline bool GetReadyFlag() const;
55  inline void SetReadyFlag(bool flag);
56 
57  inline bool GetInPositionFlag() const;
58  inline void SetInPositionFlag(bool flag);
59 
60  inline short GetInfoData1() const;
61  inline void SetInfoData1(short info);
62 
63  inline short GetInfoData2() const;
64  inline void SetInfoData2(short info);
65 
66  inline bool GetSignalFlag(Signal signal) const;
67  inline void SetSignalFlag(Signal signal, bool flag);
68 
69  inline virtual std::string GetErrorText() const;
70 
71  void SetData(const MotorControllerData& data);
72 
73  protected:
74  double m_scale_factor {1};
75  bool m_brake {false};
76  bool m_enabled {false};
77  bool m_locked {false};
78  int m_mode {};
79  bool m_ready {false};
80  bool m_in_position {false};
81  int m_info_data1 {};
82  int m_info_data2 {};
83  std::vector<bool> m_signals;
84  };
85 
100  {
101  public:
102  enum {
121  };
122 
123  public:
124 
133  MotorLcsIf(std::shared_ptr<fcf::devmgr::common::IDeviceConfig> config,
135 
139  virtual ~MotorLcsIf() {};
140 
141 
150  virtual void InitObject();
151 
161  virtual void ReadStatus(MotorControllerData& status);
162 
174  void Listener(protocol::base::VectorVariant& params);
175 
181  virtual std::string GetRpcError(const short error_code) const;
182 
183 
184  protected:
185 
194  void StorePosition(const protocol::base::Variant& value,
195  int attribute);
196 
197 
198  protected:
199 
202  int m_mot_mode {};
205  bool m_mot_axis_ready {false};
206  bool m_mot_axis_enable {false};
207  bool m_mot_axis_brake {false};
208  bool m_mot_axis_lock {false};
209  bool m_mot_axis_inpos {false};
210  bool m_mot_signal_lstop {false};
211  bool m_mot_signal_lhw {false};
212  bool m_mot_signal_ref {false};
213  bool m_mot_signal_index {false};
214  bool m_mot_signal_uhw {false};
215  bool m_mot_signal_ustop {false};
216 
217  private:
218  log4cplus::Logger m_logger;
219 
220 
221  };
222 
223 }
224 
225 #include "motorLcsIf.ipp"
226 
227 #endif //FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
Definition: dataContext.hpp:90
Motor Local Control System (LCS) Interface (IF) class.
Definition: motorBaseLcsIf.hpp:75
@ STAT_MOTOR_BASE_END
Definition: motorBaseLcsIf.hpp:89
Motor Local Control System (LCS) Interface (IF) class.
Definition: motorLcsIf.hpp:100
bool m_mot_signal_ustop
Definition: motorLcsIf.hpp:215
bool m_mot_axis_enable
Definition: motorLcsIf.hpp:206
bool m_mot_signal_uhw
Definition: motorLcsIf.hpp:214
void Listener(protocol::base::VectorVariant &params)
Callback to manage changes on the monitored items.
Definition: motorLcsIf.cpp:98
short m_mot_axis_info2
Definition: motorLcsIf.hpp:204
virtual void ReadStatus(MotorControllerData &status)
Read status from the controller.
Definition: motorLcsIf.cpp:80
int m_mot_mode
Definition: motorLcsIf.hpp:202
bool m_mot_signal_index
Definition: motorLcsIf.hpp:213
bool m_mot_axis_inpos
Definition: motorLcsIf.hpp:209
virtual void InitObject()
Initialize object.
Definition: motorLcsIf.cpp:38
bool m_mot_axis_ready
Definition: motorLcsIf.hpp:205
bool m_mot_signal_lstop
Definition: motorLcsIf.hpp:210
@ STAT_SIGNAL_INDEX
Definition: motorLcsIf.hpp:116
@ STAT_SIGNAL_LSTOP
Definition: motorLcsIf.hpp:113
@ STAT_AXIS_LOCK
Definition: motorLcsIf.hpp:105
@ STAT_INIT_ACTION
Definition: motorLcsIf.hpp:112
@ STAT_SIGNAL_USTOP
Definition: motorLcsIf.hpp:118
@ STAT_MODE
Definition: motorLcsIf.hpp:106
@ STAT_AXIS_INPOS
Definition: motorLcsIf.hpp:108
@ STAT_AXIS_READY
Definition: motorLcsIf.hpp:107
@ STAT_SCALE_FACTOR
Definition: motorLcsIf.hpp:119
@ STAT_AXIS_INFO2
Definition: motorLcsIf.hpp:110
@ STAT_INIT_STEP
Definition: motorLcsIf.hpp:111
@ STAT_MOTOR_END
Definition: motorLcsIf.hpp:120
@ STAT_AXIS_ENABLE
Definition: motorLcsIf.hpp:104
@ STAT_SIGNAL_REF
Definition: motorLcsIf.hpp:115
@ STAT_AXIS_INFO1
Definition: motorLcsIf.hpp:109
@ STAT_SIGNAL_UHW
Definition: motorLcsIf.hpp:117
@ STAT_AXIS_BRAKE
Definition: motorLcsIf.hpp:103
@ STAT_SIGNAL_LHW
Definition: motorLcsIf.hpp:114
bool m_mot_axis_lock
Definition: motorLcsIf.hpp:208
bool m_mot_signal_lhw
Definition: motorLcsIf.hpp:211
bool m_mot_axis_brake
Definition: motorLcsIf.hpp:207
int m_mot_init_action
Definition: motorLcsIf.hpp:201
void StorePosition(const protocol::base::Variant &value, int attribute)
Store Position.
Definition: motorLcsIf.cpp:322
MotorLcsIf(std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
MotorLcsIf constructor.
Definition: motorLcsIf.cpp:28
bool m_mot_signal_ref
Definition: motorLcsIf.hpp:212
short m_mot_axis_info1
Definition: motorLcsIf.hpp:203
virtual ~MotorLcsIf()
Default destructor.
Definition: motorLcsIf.hpp:139
virtual std::string GetRpcError(const short error_code) const
Definition: motorLcsIf.cpp:289
int m_mot_init_step
Definition: motorLcsIf.hpp:200
DataContext class header file.
ShutterLcsIf class header file.
MotorConfig class header file.
Definition: motor.hpp:18
Signal
Definition: motorConfig.hpp:126
The MotorBaseControllerData struct.
Definition: motorBaseLcsIf.hpp:34
The MotorControllerData struct.
Definition: motorLcsIf.hpp:34
MotorControllerData()
Definition: motorLcsIf.cpp:4
virtual std::string GetErrorText() const
bool GetSignalFlag(Signal signal) const
bool m_locked
Definition: motorLcsIf.hpp:77
int m_mode
Definition: motorLcsIf.hpp:78
virtual ~MotorControllerData()
Definition: motorLcsIf.cpp:20
double m_scale_factor
Definition: motorLcsIf.hpp:74
void SetSignalFlag(Signal signal, bool flag)
bool m_in_position
Definition: motorLcsIf.hpp:80
bool m_brake
Definition: motorLcsIf.hpp:75
bool m_ready
Definition: motorLcsIf.hpp:79
int m_info_data1
Definition: motorLcsIf.hpp:81
int m_info_data2
Definition: motorLcsIf.hpp:82
bool m_enabled
Definition: motorLcsIf.hpp:76
std::vector< bool > m_signals
Definition: motorLcsIf.hpp:83
void SetData(const MotorControllerData &data)
Definition: motorLcsIf.cpp:23