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

#include <device.hpp>

Inheritance diagram for fcf::devmgr::common::Device:
fcf::devmgr::common::IDevice fcf::devmgr::actuator::Actuator fcf::devmgr::adc::Adc fcf::devmgr::drot::Drot fcf::devmgr::lamp::Lamp fcf::devmgr::motor::Motor fcf::devmgr::piezo::Piezo fcf::devmgr::sensor::Sensor fcf::devmgr::shutter::Shutter testDeviceFacade::TestFailureDevice testDeviceFacade::TestMyDevice TestMyDevice TestShutter

Public Member Functions

 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...
 
virtual void RegisterComm (std::shared_ptr< fcf::common::IComm > comm_if, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)=0
 Register a communication interface object. More...
 
virtual void UpdateStatus ()=0
 Update internal status by connecting to the LCS. More...
 
virtual void Setup (const std::any &payload)=0
 Executes a setup. More...
 
virtual bool IsSetupActive (const std::any &payload) const =0
 Check if setup is still active. More...
 
virtual void Status (const std::any &payload, std::string &buffer)=0
 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)=0
 Obtain the status of the device. More...
 
virtual std::shared_ptr
< DeviceLcsIf
GetLcsIf () const =0
 Get a pointer of device LCS interface. More...
 
virtual std::shared_ptr
< IDeviceConfig
GetConfig () const =0
 Get a pointer of device configuration. More...
 

Protected Member Functions

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...
 

Protected Attributes

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...
 

Detailed Description

Device abstract class. This class represents the basic implementation of a device class. Most of the device share common properties and behavioural aspects. This class is implementing the common behaviour and defining the basic properties of all device classes.

Constructor & Destructor Documentation

fcf::devmgr::common::Device::Device ( const std::string  filename,
const std::string  name,
DataContext data_ctx 
)

Device abstract class constructor.

Parameters
[in]filenameFilename of device configuration
[in]nameDevice ID
[in,out]data_ctxReference to the data context object
fcf::devmgr::common::Device::~Device ( )
virtual

Default destructor.

Member Function Documentation

void fcf::devmgr::common::Device::CheckHwFailure ( ) const
overridevirtual

Check if device is in failure state.

Exceptions
anexception if an error ocurrs.

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

Reimplemented in TestMyDevice.

bool fcf::devmgr::common::Device::CheckNameParam ( const std::any &  payload)
protected

Determine whether paramater is included (device name).

Parameters
payloadPayload of the command, a vector of strings.

If the vector is empty, it will return true. If the vector contains the the id of the device it will also return true otherwise it will return false.

void fcf::devmgr::common::Device::Disable ( )
overridevirtual

Executes a Disable command.

Exceptions
anexception if an error ocurrs.

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

Reimplemented in testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::Enable ( )
overridevirtual

Executes a Enable command.

Exceptions
anexception if an error ocurrs.

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

Reimplemented in testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and fcf::devmgr::sensor::Sensor.

std::string fcf::devmgr::common::Device::GetName ( ) const
overridevirtual

Get device id.

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

void fcf::devmgr::common::Device::GetPrefix ( const std::vector< std::string >  prefix_list,
std::string &  prefix 
)
protected

Get prefix for writing attributes to the DB.

Parameters
prefix_listList of intermediate prefix values.
prefixString containing the formatted prefix.
void fcf::devmgr::common::Device::HwDisable ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware disable command.

Parameters
[in]last_eventpayload of the hw disable message
Exceptions
anexception if an error ocurrs.

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

Reimplemented in fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::HwEnable ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware enable command.

Parameters
[in]last_eventpayload of the hw enable message
Exceptions
anexception if an error ocurrs.

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

Reimplemented in fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::HwInit ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware init command.

Parameters
[in]last_eventpayload of the hw init message
Exceptions
anexception if an error ocurrs.

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

Reimplemented in fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::HwReset ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a hardware reset command.

Parameters
[in]last_eventpayload of the hw reset message
Exceptions
anexception if an error ocurrs.

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

Reimplemented in fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::Ignore ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a Ignore.

Parameters
[in]last_eventcontains the payload of the Ignore message.
Exceptions
anexception if an error ocurrs.

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

void fcf::devmgr::common::Device::Init ( )
overridevirtual

Executes a Init command.

Returns
true if command is successfully executed, false otherwise.
Exceptions
anexception if an error ocurrs.

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

Reimplemented in testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.

bool fcf::devmgr::common::Device::IsDisabling ( ) const
overridevirtual

Check if device is disablig.

Returns
true if device is disabling, false otherwise

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

Reimplemented in testDeviceFacade::TestMyDevice, TestMyDevice, and fcf::devmgr::sensor::Sensor.

bool fcf::devmgr::common::Device::IsMsgForMe ( const std::string &  id) const
protected

Check if received message id is addressed to me.

Parameters
[in]idmessage id
Returns
true is message id matches own device id, false otherwise.
bool fcf::devmgr::common::Device::IsNotReady ( ) const
overridevirtual

Check if device is Standby/NotReady.

Returns
true is device is Standby/NotReady, false otherwise

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

Reimplemented in testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestMyDevice.

bool fcf::devmgr::common::Device::IsOperational ( ) const
overridevirtual

Check if device is Operational.

Returns
true is device is Operational, false otherwise

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

bool fcf::devmgr::common::Device::IsReady ( ) const
overridevirtual

Check if device is Standby/Ready.

Returns
true is device is Standby/Ready, false otherwise

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

Reimplemented in testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestMyDevice.

void fcf::devmgr::common::Device::Reset ( )
overridevirtual

Executes a Reset command.

Exceptions
anexception if an error ocurrs.

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

Reimplemented in testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, TestMyDevice, and TestShutter.

void fcf::devmgr::common::Device::SetIgnore ( bool  flag)
protected

SetIgnore.

Parameters
flag
void fcf::devmgr::common::Device::SetSimulation ( bool  flag)
protected

SetSimulation.

Parameters
flag
void fcf::devmgr::common::Device::Simulate ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a Simulat.

Parameters
[in]last_eventcontains the payload of the Simulat message.
Exceptions
anexception if an error ocurrs.

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

void fcf::devmgr::common::Device::StartMonitoring ( )
overridevirtual

Start device monitoring via OPCUA subscriptions.

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

void fcf::devmgr::common::Device::Status ( DeviceControllerData data,
std::string &  buffer 
)
void fcf::devmgr::common::Device::Status ( const std::string  prefix,
const dit::did::Did &  dictionary,
std::shared_ptr< CCfits::FITS > &  fits_handle 
)
virtual

Obtain the status of the device.

Parameters
prefixPrefix for the status
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.

void fcf::devmgr::common::Device::Stop ( )
overridevirtual

Executes a Stop command.

Exceptions
anexception if an error ocurrs.

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

Reimplemented in fcf::devmgr::sensor::Sensor.

void fcf::devmgr::common::Device::StopIgn ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a StopIgn.

Parameters
[in]last_eventcontains the payload of the StopIgn message.
Exceptions
anexception if an error ocurrs.

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

void fcf::devmgr::common::Device::StopMonitoring ( )
overridevirtual

Stop device monitoring.

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

void fcf::devmgr::common::Device::StopSim ( rad::AnyEvent const &  last_event)
overridevirtual

Executes a StopSim.

Parameters
[in]last_eventcontains the payload of the StopSim message.
Exceptions
anexception if an error ocurrs.

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

void fcf::devmgr::common::Device::UpdateDb ( std::vector< std::string >  attr_vector)
protected

Update device database.

Parameters
attr_vectorList of attributes with their values.

Member Data Documentation

std::shared_ptr<DeviceConfig> fcf::devmgr::common::Device::m_config
protected

Pointer to configuration object.

DataContext& fcf::devmgr::common::Device::m_data_ctx
protected

reference to the data context object.

fcf::common::Dispatcher fcf::devmgr::common::Device::m_failure
protected

Dispatcher for managing failures.

std::string fcf::devmgr::common::Device::m_filename
protected

device configuration filename.

std::shared_ptr<DeviceLcsIf> fcf::devmgr::common::Device::m_lcs_if
protected

Local Control System Interface.

std::string fcf::devmgr::common::Device::m_name
protected

device ID.

fcf::common::Dispatcher fcf::devmgr::common::Device::m_normal
protected

Dispatcher for managing positive events.


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