ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
motor.hpp
Go to the documentation of this file.
1 
10 #ifndef DEVMGR_DEVICE_MOTOR_HPP
11 #define DEVMGR_DEVICE_MOTOR_HPP
12 
13 #include <fcf/common/dispatcher.hpp>
14 
15 #include <devmgr/common/device.hpp>
16 #include <devmgr/devices/motorConfig.hpp>
17 #include <devmgr/devices/motorLcsIf.hpp>
18 #include <devmgr/common/dataContext.hpp>
19 
20 namespace devmgr {
21  namespace motor {
22 
39  class Motor : public devmgr::common::Device
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,
78  devmgr::common::DataContext& data_ctx);
79 
80 
92  void CreateObjects(std::shared_ptr<devmgr::common::IDeviceConfig> config = nullptr);
93 
109  void RegisterComm(std::shared_ptr<fcf::common::IComm> comm_if,
110  fcf::common::Dispatcher<>& failure,
111  fcf::common::Dispatcher<>& normal);
112 
120  virtual void Setup(const modif::ReqSetup& setupMsg);
121 
129  virtual bool IsSetupActive(const modif::ReqSetup& setupMsg) const;
130 
136  virtual void Status(const modif::ReqStatus& statusMsg, std::string& buffer);
137 
148  virtual void Status(bool end_acq,
149  const dit::did::Did& dictionary,
150  CCfits::FITS* fits_handle = nullptr);
163  virtual void UpdateStatus();
164 
165  virtual std::shared_ptr<devmgr::common::DeviceLcsIf> GetLcsIf() const;
166 
172  virtual std::shared_ptr<devmgr::common::IDeviceConfig> GetConfig() const;
173 
174  void SetTargetNamedPosition(const std::string named_position);
175  const std::string GetTargetNamedPosition();
176 
177  protected:
179  MotorControllerData m_controller_status;
180  std::string m_target_named_pos;
181 
183  std::shared_ptr<MotorConfig> m_config;
185  std::shared_ptr<MotorLcsIf> m_lcs_if;
186  };
187  }
188 }
189 
190 
191 #endif //DEVMGR_DEVICE_MOTOR_HPP
virtual void Setup(const modif::ReqSetup &setupMsg)
Executes a setup of the motor device.
Definition: motor.cpp:116
virtual bool IsSetupActive(const modif::ReqSetup &setupMsg) const
Check if last setup message is still active.
Definition: motor.cpp:214
Motor(const std::string filename, const std::string name, devmgr::common::DataContext &data_ctx)
Motor constructor.
Definition: motor.cpp:26
virtual std::shared_ptr< devmgr::common::IDeviceConfig > GetConfig() const
Get a pointer of device configuration.
Definition: motor.cpp:110
void CreateObjects(std::shared_ptr< devmgr::common::IDeviceConfig > config=nullptr)
Create object instances.
Definition: device.hpp:32
Definition: requests.pb.h:5446
std::shared_ptr< MotorLcsIf > m_lcs_if
Definition: motor.hpp:185
virtual std::shared_ptr< devmgr::common::DeviceLcsIf > GetLcsIf() const
Get a pointer of device LCS interface.
Definition: motor.cpp:105
virtual void UpdateStatus()
Update the status of the motor device in the OLDB.
Definition: motor.cpp:286
const std::string GetTargetNamedPosition()
Definition: motor.cpp:280
void RegisterComm(std::shared_ptr< fcf::common::IComm > comm_if, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
Register a communication interface object.
Definition: motor.cpp:94
Definition: dataContext.hpp:73
void SetTargetNamedPosition(const std::string named_position)
Definition: motor.cpp:273
virtual void Status(const modif::ReqStatus &statusMsg, std::string &buffer)
Obtain the status of the device.
Definition: motor.cpp:389
std::string m_target_named_pos
pointer to device config object
Definition: motor.hpp:180
std::shared_ptr< MotorConfig > m_config
Local Control System Interface.
Definition: motor.hpp:183
Data Interface Dictionary class.
Definition: Did.hpp:25
MotorControllerData m_controller_status
&lt; object containing the status of the controller
Definition: motor.hpp:179
Definition: requests.pb.h:1584
optional string name
Definition: topics.proto:50