ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lampLcsIf.hpp
Go to the documentation of this file.
1 
10 #ifndef FCF_DEVMGR_DEVICE_LAMP_IF_HPP
11 #define FCF_DEVMGR_DEVICE_LAMP_IF_HPP
12 
13 // System headers
14 #include <unordered_map>
15 
16 // Third party headers
17 #include <yaml-cpp/yaml.h>
18 
19 
23 
24 #include <Fcfif.hpp>
25 #include <rad/mal/publisher.hpp>
26 
27 namespace fcf::devmgr::lamp {
28 
37  public:
39  virtual ~LampControllerData();
40 
41  inline double GetIntensity() const;
42  inline void SetIntensity(double intensity);
43 
44  inline std::string GetErrorText() const;
45  inline virtual std::string GetSubstateStr() const;
46 
47  void SetData(const LampControllerData& data);
48 
49  protected:
50  double m_intensity;
51  };
52 
53 
54 
68  template<typename TOPIC_TYPE = fcfif::LampTopicUnion>
70  {
71 
72  // enumerations for the lamp 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_INTENSITY = 6,
80  STAT_STATUS = 7
81  };
82 
83  public:
91  LampLcsIf(std::shared_ptr<devmgr::common::IDeviceConfig> config,
92  devmgr::common::DataContext& data_ctx, bool initialise = true);
93 
94 
98  virtual ~LampLcsIf() {};
99 
104  virtual bool IsReady();
105 
110  virtual bool IsOperational();
111 
112 
119  void SwitchOn(double intensity, unsigned int time);
120 
127  void SwitchOff();
128 
133  bool IsTurningOn();
134 
139  bool IsTurningOff();
140 
145  bool IsOn();
146 
151  bool IsOff();
152 
161  virtual void ReadStatus(LampControllerData& status);
162 
174  void Listener(fcf::common::VectorVariant& params);
175 
181  virtual std::string GetRpcError(const short error_code) const;
182 
183 
184  private:
185 
197  void StoreAttribute(const std::string key,
198  const fcf::common::Variant& value,
199  bool publish,
200  int attribute);
201 
202  protected:
203  std::unique_ptr<rad::cii::Publisher<TOPIC_TYPE>> m_publisher;
204 
205  private:
206 
207 
208 
209 
210  };
211 
212 }
213 
214 #include "lampLcsIf.ipp"
215 
216 #endif //FCF_DEVMGR_DEVICE_LAMP_IF_HPP
bool IsTurningOn()
Check if controller is switching the lamp on.
LampConfig class header file.
LampLcsIf(std::shared_ptr< devmgr::common::IDeviceConfig > config, devmgr::common::DataContext &data_ctx, bool initialise=true)
LampLcsIf constructor.
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:31
void SwitchOff()
Executes the SwitchOff RPC.
std::unique_ptr< rad::cii::Publisher< TOPIC_TYPE > > m_publisher
Definition: lampLcsIf.hpp:203
bool IsOff()
Check if lamp is off.
Lamp Local Control System (LCS) Interface (IF) class.
Definition: lampLcsIf.hpp:69
void Listener(fcf::common::VectorVariant &params)
Callback to manageUpdateStatus(); changes on the monitored items.
virtual std::string GetSubstateStr() const
void SetIntensity(double intensity)
void SwitchOn(double intensity, unsigned int time)
Executes the SwitchOn RPC.
DataContext class header file.
virtual bool IsReady()
Check if controller is in Standby/Ready state.
Definition: dataContext.hpp:81
virtual std::string GetRpcError(const short error_code) const
bool IsTurningOff()
Check if controller is switching the lamp off.
deviceLcsIf class header file.
virtual ~LampControllerData()
Definition: lampLcsIf.cpp:20
double m_intensity
Definition: lampLcsIf.hpp:50
bool IsOn()
Check if lamp is on.
virtual void ReadStatus(LampControllerData &status)
Read status from the controller.
void SetData(const LampControllerData &data)
Definition: lampLcsIf.cpp:23
virtual ~LampLcsIf()
Default destructor.
Definition: lampLcsIf.hpp:98
LampControllerData()
Definition: lampLcsIf.cpp:15
virtual bool IsOperational()
Check if controller is in Operational.
The LampControllerData struct.
Definition: lampLcsIf.hpp:36
Definition: deviceLcsIf.hpp:72