ifw-fcf  4.1.0-pre2
motor.hpp
Go to the documentation of this file.
1 
10 #ifndef FCF_DEVMGR_DEVICE_MOTOR_HPP
11 #define FCF_DEVMGR_DEVICE_MOTOR_HPP
12 
13 #include <fcf/common/dispatcher.hpp>
14 
19 
20 namespace fcf::devmgr::motor {
21 
22 
40  {
41 
42  enum {
43  POS_TARGET = 0,
44  POS_ACTUAL,
45  SCALE_FACTOR,
46  AXIS_STATUS,
47  BCKLASHSTEP,
48  LAST_CMD,
49  ERROR_CODE,
50  INIT_STEP,
51  REF_SWITCH,
52  AT_MAX_POS,
53  AT_MAX_POS_VAL,
54  AT_MIN_POS,
55  AT_MIN_POS_VAL,
56  INFO_DATA1,
57  INFO_DATA2,
58  SWITCH_LHW,
59  BRAKE_ACTIVE,
60  LOCAL,
61  SWITCH_INDEX,
62  SWITCH_REF,
63  VEL_TARGET,
64  VEL_ACTUAL,
65  SWITCH_LSTOP,
66  SWITCH_USTOP
67  };
68 
69  public:
76  Motor(const std::string filename,
77  const std::string name,
79 
80 
84  virtual ~Motor() = default;
85 
97  void CreateObjects(std::shared_ptr<fcf::devmgr::common::IDeviceConfig> config = nullptr) override ;
98 
106  virtual void Setup(const std::any& payload) override ;
107 
115  virtual bool IsSetupActive(const std::any& payload) const override;
116 
122  virtual void Status(const std::any& payload, std::string& buffer) override;
123 
134  virtual void Status(bool end_acq,
135  const core::dit::did::Did& dictionary,
136  std::shared_ptr<CCfits::FITS>& fits_handle) override;
137 
138 
147  void GetStatusList(utils::bat::DbVector& cfg_status,
148  const MotorControllerData& status_data);
161  virtual void UpdateStatus() override;
162 
163  void SetTargetNamedPosition(const std::string named_position);
164  const std::string GetTargetNamedPosition();
165 
166  protected:
178  void GetStatusBuffer(const std::string& stat_prefix,
179  const MotorControllerData* const data,
180  std::string& buffer);
181 
189  void GetStatusHeader(const std::string& prefix,
190  const MotorControllerData* const data,
191  bool end_acq,
192  const core::dit::did::Did& dictionary,
193  std::shared_ptr<CCfits::FITS>& fits_handle);
194 
195  protected:
198  std::string m_target_named_pos;
199 
200  log4cplus::Logger m_logger;
201  };
202 
203 }
204 
205 
206 #endif //FCF_DEVMGR_DEVICE_MOTOR_HPP
fcf::devmgr::motor::Motor::Motor
Motor(const std::string filename, const std::string name, fcf::devmgr::common::DataContext &data_ctx)
Motor constructor.
Definition: motor.cpp:25
dataContext.hpp
DataContext class header file.
fcf::devmgr::motor
Definition: motor.hpp:20
device.hpp
Device class header file.
fcf::devmgr::motor::Motor::SetTargetNamedPosition
void SetTargetNamedPosition(const std::string named_position)
Definition: motor.cpp:165
motorLcsIf.hpp
ShutterLcsIf class header file.
fcf::devmgr::motor::Motor::GetTargetNamedPosition
const std::string GetTargetNamedPosition()
Definition: motor.cpp:172
Motor
Definition: Motor.py:1
fcf::devmgr::motor::Motor::Status
virtual void Status(const std::any &payload, std::string &buffer) override
Obtain the status of the device.
Definition: motor.cpp:374
fcf::devmgr::motor::Motor::Setup
virtual void Setup(const std::any &payload) override
Executes a setup of the motor device.
Definition: motor.cpp:50
fcf::devmgr::motor::Motor::GetStatusList
void GetStatusList(utils::bat::DbVector &cfg_status, const MotorControllerData &status_data)
Get a vector with device status data.
Definition: motor.cpp:178
fcf::devmgr::motor::Motor::IsSetupActive
virtual bool IsSetupActive(const std::any &payload) const override
Check if last setup message is still active.
Definition: motor.cpp:107
fcf::devmgr::motor::Motor::~Motor
virtual ~Motor()=default
Default destructor.
fcf::devmgr::motor::Motor::m_controller_status
MotorControllerData m_controller_status
< object containing the status of the controller
Definition: motor.hpp:197
fcf::devmgr::common::DataContext
Definition: dataContext.hpp:90
fcf::devmgr::motor::Motor::UpdateStatus
virtual void UpdateStatus() override
Update the status of the motor device in the OLDB.
Definition: motor.cpp:267
fcf::devmgr::motor::Motor::m_target_named_pos
std::string m_target_named_pos
Definition: motor.hpp:198
fcf::devmgr::common::Device
Definition: device.hpp:33
fcf::devmgr::motor::Motor::CreateObjects
void CreateObjects(std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config=nullptr) override
Create object instances.
Definition: motor.cpp:34
fcf::devmgr::motor::Motor::GetStatusHeader
void GetStatusHeader(const std::string &prefix, const MotorControllerData *const data, bool end_acq, const core::dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle)
Get device status for the data acquisition.
Definition: motor.cpp:406
fcf::devmgr::motor::Motor::GetStatusBuffer
void GetStatusBuffer(const std::string &stat_prefix, const MotorControllerData *const data, std::string &buffer)
Get status buffer.
Definition: motor.cpp:298
fcf::devmgr::motor::Motor::m_logger
log4cplus::Logger m_logger
Definition: motor.hpp:200
motorConfig.hpp
MotorConfig class header file.
fcf::devmgr::motor::MotorControllerData
The MotorControllerData struct.
Definition: motorLcsIf.hpp:34