ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
fcf::devmgr::lamp::Lamp Class Reference

The Lamp class. More...

#include <lamp.hpp>

Inheritance diagram for fcf::devmgr::lamp::Lamp:
fcf::devmgr::common::Device fcf::devmgr::common::IDevice testLamp::MyLamp

Public Member Functions

 Lamp (const std::string &filename, const std::string &name, fcf::devmgr::common::DataContext &data_ctx)
 Lamp constructor. More...
 
virtual ~Lamp ()
 Default destructor. More...
 
void CreateObjects (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config=nullptr)
 Create object instances. More...
 
void RegisterComm (std::shared_ptr< fcf::common::IComm > comm_if, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
 Register a communication interface object. More...
 
virtual void Setup (const std::any &payload)
 Executes a setup of the lamp device. More...
 
virtual bool IsSetupActive (const std::any &payload) const
 Check if last setup message is still active. More...
 
virtual void Status (const std::any &payload, std::string &buffer)
 Obtain the status of the device. More...
 
virtual void Status (bool end_acq, const dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle)
 Obtain the status of the device. More...
 
virtual void UpdateStatus ()
 Update the status of the lamp device in the OLDB. More...
 
virtual std::shared_ptr
< fcf::devmgr::common::DeviceLcsIf
GetLcsIf () const
 
virtual std::shared_ptr
< fcf::devmgr::common::IDeviceConfig
GetConfig () const
 Get a pointer of device configuration. More...
 
- Public Member Functions inherited from fcf::devmgr::common::Device
 Device (const std::string filename, const std::string name, DataContext &data_ctx)
 Device abstract class constructor. More...
 
virtual ~Device ()
 Default destructor. More...
 
virtual bool IsNotReady () const override
 Check if device is Standby/NotReady. More...
 
virtual bool IsReady () const override
 Check if device is Standby/Ready. More...
 
virtual bool IsOperational () const override
 Check if device is Operational. More...
 
virtual void CheckHwFailure () const override
 Check if device is in failure state. More...
 
virtual bool IsDisabling () const override
 Check if device is disablig. More...
 
virtual void Init () override
 Executes a Init command. More...
 
virtual void Enable () override
 Executes a Enable command. More...
 
virtual void Disable () override
 Executes a Disable command. More...
 
virtual void Stop () override
 Executes a Stop command. More...
 
virtual void Reset () override
 Executes a Reset command. More...
 
void Status (DeviceControllerData *data, std::string &buffer)
 
virtual void Status (const std::string prefix, const dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle)
 Obtain the status of the device. More...
 
virtual void Simulate (rad::AnyEvent const &last_event) override
 Executes a Simulat. More...
 
virtual void StopSim (rad::AnyEvent const &last_event) override
 Executes a StopSim. More...
 
virtual void Ignore (rad::AnyEvent const &last_event) override
 Executes a Ignore. More...
 
virtual void StopIgn (rad::AnyEvent const &last_event) override
 Executes a StopIgn. More...
 
virtual void HwReset (rad::AnyEvent const &last_event) override
 Executes a hardware reset command. More...
 
virtual void HwInit (rad::AnyEvent const &last_event) override
 Executes a hardware init command. More...
 
virtual void HwEnable (rad::AnyEvent const &last_event) override
 Executes a hardware enable command. More...
 
virtual void HwDisable (rad::AnyEvent const &last_event) override
 Executes a hardware disable command. More...
 
virtual void StartMonitoring () override
 Start device monitoring via OPCUA subscriptions. More...
 
virtual void StopMonitoring () override
 Stop device monitoring. More...
 
virtual std::string GetName () const override
 Get device id. More...
 
- Public Member Functions inherited from fcf::devmgr::common::IDevice
virtual void CreateObjects (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config=nullptr)=0
 Create basic objects needed by the device class. More...
 

Protected Attributes

LampControllerData m_controller_status
 < object containing the status of the controller More...
 
std::shared_ptr< LampConfigm_config
 
std::shared_ptr< LampLcsIf
< fcfif::LampTopicUnion > > 
m_lcs_if
 
- Protected Attributes inherited from fcf::devmgr::common::Device
std::string m_filename
 device configuration filename. More...
 
std::string m_name
 device ID. More...
 
DataContextm_data_ctx
 reference to the data context object. More...
 
fcf::common::Dispatcher m_failure
 Dispatcher for managing failures. More...
 
fcf::common::Dispatcher m_normal
 Dispatcher for managing positive events. More...
 
std::shared_ptr< DeviceConfigm_config
 Pointer to configuration object. More...
 
std::shared_ptr< DeviceLcsIfm_lcs_if
 Local Control System Interface. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fcf::devmgr::common::Device
bool IsMsgForMe (const std::string &id) const
 Check if received message id is addressed to me. More...
 
void UpdateDb (std::vector< std::string > attr_vector)
 Update device database. More...
 
void SetIgnore (bool flag)
 SetIgnore. More...
 
void SetSimulation (bool flag)
 SetSimulation. More...
 
void GetPrefix (const std::vector< std::string > prefix_list, std::string &prefix)
 Get prefix for writing attributes to the DB. More...
 
bool CheckNameParam (const std::any &payload)
 Determine whether paramater is included (device name). More...
 

Detailed Description

The Lamp class.

This class handles the behaviour of a generic lamp device.

The Lamp class have two auxiliary objects. One for managing the device configuration and the other one for managing the connection to the device controller running in the Local Control System (LCS). These two objects are created by a dedicated method. These objects inherits basic behaviours from their parent classes.

See Also
LampConfig
LampLcsIf
Device
DeviceConfig
DeviceLcsIf

Constructor & Destructor Documentation

fcf::devmgr::lamp::Lamp::Lamp ( const std::string &  filename,
const std::string &  name,
fcf::devmgr::common::DataContext data_ctx 
)

Lamp constructor.

Parameters
[in]filenamefilename of lamp configuration file
[in]namelamp identifier
[in]data_ctxreference to data context object
virtual fcf::devmgr::lamp::Lamp::~Lamp ( )
inlinevirtual

Default destructor.

Member Function Documentation

void fcf::devmgr::lamp::Lamp::CreateObjects ( std::shared_ptr< fcf::devmgr::common::IDeviceConfig config = nullptr)

Create object instances.

Parameters
configShared pointer to a device config object

This method creates the instances of the device configuration and LCS interface objects that are needed by the device. If can override the type of the configuration by passing a parameter otherwise it will use the default LampConfig.

std::shared_ptr< fcs::IDeviceConfig > fcf::devmgr::lamp::Lamp::GetConfig ( ) const
virtual

Get a pointer of device configuration.

Returns
shared pointer of internal configuration object

Implements fcf::devmgr::common::IDevice.

std::shared_ptr< fcs::DeviceLcsIf > fcf::devmgr::lamp::Lamp::GetLcsIf ( ) const
virtual
Returns
pointer to lcs interface object.

Implements fcf::devmgr::common::IDevice.

bool fcf::devmgr::lamp::Lamp::IsSetupActive ( const std::any &  payload) const
virtual

Check if last setup message is still active.

Parameters
[in]payloadsetup message associated with the action
Returns
true is action is still ongoing, false otherwise.

In case an error with the hardware while waiting for the setup to finish, the method will catch the exception and rethrow a new one with more context information.

Exceptions
anexception if an error ocurrs.

Implements fcf::devmgr::common::IDevice.

void fcf::devmgr::lamp::Lamp::RegisterComm ( std::shared_ptr< fcf::common::IComm >  comm_if,
fcf::common::Dispatcher<> &  failure,
fcf::common::Dispatcher<> &  normal 
)
virtual

Register a communication interface object.

Parameters
[in]comm_ifshared pointer to the communication interface object
[in]failuredispatcher object for failure events
[in]normaldispatcher object for recovery of failure events.

This method register a particular communication interface. Most of the devices will use OPCUA but there might be several implementations so with this method one can register an interface that has been created previously and registered in the communication factory.

See Also
iComm
commFactory
commMaker

Implements fcf::devmgr::common::IDevice.

void fcf::devmgr::lamp::Lamp::Setup ( const std::any &  payload)
virtual

Executes a setup of the lamp device.

Parameters
[in]payloadcontains the payload of the setup message.
Exceptions
anexception if an error ocurrs.

Implements fcf::devmgr::common::IDevice.

void fcf::devmgr::lamp::Lamp::Status ( const std::any &  payload,
std::string &  buffer 
)
virtual

Obtain the status of the device.

Parameters
payloadStatus message object
bufferBuffer where the status will be written

Implements fcf::devmgr::common::IDevice.

void fcf::devmgr::lamp::Lamp::Status ( bool  end_acq,
const dit::did::Did &  dictionary,
std::shared_ptr< CCfits::FITS > &  fits_handle 
)
virtual

Obtain the status of the device.

Parameters
end_acqFlag to indicate is the end of the acquisition
dictionaryReference to the dictionary object
fits_handlePointer to the CCFITS object

This method will obtain the data from each device and add the corresponding meta-data to the CCfits object. If the end_acq is not true it will just register the start of the acquisition.

Implements fcf::devmgr::common::IDevice.

void fcf::devmgr::lamp::Lamp::UpdateStatus ( )
virtual

Update the status of the lamp device in the OLDB.

This method reads the status from the controller and updates the database accordingly.

Implements fcf::devmgr::common::IDevice.

Member Data Documentation

std::shared_ptr<LampConfig> fcf::devmgr::lamp::Lamp::m_config
protected
LampControllerData fcf::devmgr::lamp::Lamp::m_controller_status
protected

< object containing the status of the controller

pointer to device config object

std::shared_ptr<LampLcsIf<fcfif::LampTopicUnion> > fcf::devmgr::lamp::Lamp::m_lcs_if
protected

The documentation for this class was generated from the following files: