ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
actuatorLcsIf.hpp
Go to the documentation of this file.
1 
10 #ifndef DEVMGR_DEVICE_ACTUATOR_IF_HPP
11 #define DEVMGR_DEVICE_ACTUATOR_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 actuator {
25 
34  public:
36  virtual ~ActuatorControllerData();
37 
38  inline std::string GetErrorText() const;
39  void SetData(const ActuatorControllerData& data);
40 
41  inline virtual std::string GetSubstateStr() const;
42 
43  protected:
44 
45  };
46 
47 
61  template<typename TOPIC_TYPE = fcfif::ActuatorTopicUnion>
63  {
64 
65  // enumerations for actuator status
66  enum {
67  STAT_LOCAL = 1,
68  STAT_ERROR = 2,
69  STAT_HW_STATUS = 3,
70  STAT_STATE = 4,
71  STAT_SUBSTATE = 5,
72  };
73 
74  public:
82  ActuatorLcsIf(std::shared_ptr<devmgr::common::IDeviceConfig> config,
83  devmgr::common::DataContext& data_ctx, bool initialise = true);
84 
88  virtual ~ActuatorLcsIf() {};
89 
94  virtual bool IsReady();
95 
100  virtual bool IsOperational() ;
101 
108  void SwitchOn();
109 
116  void SwitchOff();
117 
122  bool IsSwitchingOn();
123 
128  bool IsSwitchingOn(int state, int substate);
129 
134  bool IsSwitchingOff();
135 
140  bool IsSwitchingOff(int state, int substate);
141 
146  bool IsOn();
147 
152  bool IsOn(int state, int substate);
153 
158  bool IsOff();
159 
164  bool IsOff(int state, int substate);
165 
174  virtual void ReadStatus(ActuatorControllerData& status);
175 
176 
188  void Listener(fcf::common::VectorVariant& params);
189 
195  virtual std::string GetRpcError(const short error_code) const;
196 
197 
198  private:
199 
211  void StoreAttribute(const std::string key,
212  const fcf::common::Variant& value,
213  bool publish,
214  int attribute);
215 
216 
217  protected:
218  std::unique_ptr<rad::cii::Publisher<TOPIC_TYPE>> m_publisher;
219 
220  private:
221 
222 
223  };
224  }
225 }
226 
227 #include "actuatorLcsIf.ipp"
228 
229 #endif //DEVMGR_DEVICE_ACTUATOR_IF_HPP
void SwitchOff()
Executes the SwitchOff RPC.
bool IsOff()
Check if switch is off.
virtual void ReadStatus(ActuatorControllerData &status)
Read status from the controller.
ActuatorLcsIf(std::shared_ptr< devmgr::common::IDeviceConfig > config, devmgr::common::DataContext &data_ctx, bool initialise=true)
actuatorLcsIf constructor.
bool IsSwitchingOn()
Check if controller is switching the switch on.
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:31
actuator Local Control System (LCS) Interface (IF) class
Definition: actuatorLcsIf.hpp:62
std::unique_ptr< rad::cii::Publisher< TOPIC_TYPE > > m_publisher
Definition: actuatorLcsIf.hpp:218
virtual ~ActuatorLcsIf()
Default destructor.
Definition: actuatorLcsIf.hpp:88
bool IsOn()
Check if switch is on.
void SetData(const ActuatorControllerData &data)
Definition: actuatorLcsIf.cpp:38
virtual bool IsOperational()
Check if controller is in Operational.
virtual std::string GetSubstateStr() const
void Listener(fcf::common::VectorVariant &params)
Callback to manage changes on the monitored items.
virtual bool IsReady()
Check if controller is in Standby/Ready state.
DataContext class header file.
ActuatorControllerData()
Definition: actuatorLcsIf.cpp:31
The actuatorControllerData struct.
Definition: actuatorLcsIf.hpp:33
Definition: dataContext.hpp:81
void SwitchOn()
Executes the SwitchOn RPC.
bool IsSwitchingOff()
Check if controller is switching the switch off.
virtual ~ActuatorControllerData()
Definition: actuatorLcsIf.cpp:35
deviceLcsIf class header file.
virtual std::string GetRpcError(const short error_code) const
actuatorConfig class header file.
Definition: deviceLcsIf.hpp:72