ifw-fcf  5.0.0-pre2
Public Member Functions | Protected Attributes | List of all members
fcf::devmgr::adc::Adc Class Reference

The Adc class. More...

#include <adc.hpp>

Inheritance diagram for fcf::devmgr::adc::Adc:
fcf::devmgr::common::Device fcf::devmgr::common::IDevice

Public Member Functions

 Adc (const std::string &filename, const std::string &name, fcf::devmgr::common::DataContext &data_ctx)
 Adc constructor. More...
 
virtual ~Adc ()=default
 Default destructor. More...
 
void CreateObjects (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config=nullptr) override
 Create object instances. More...
 
virtual void Setup (const std::any &payload) override
 Executes a setup of the adc device. More...
 
virtual bool IsSetupActive (const std::any &payload) const override
 Check if last setup message is still active. More...
 
void SetTargetNamedPosition (const std::string named_position)
 
const std::string GetTargetNamedPosition ()
 
virtual void Status (const std::any &payload, std::string &buffer) override
 Obtain the status of the device. More...
 
virtual void Status (bool end_acq, const core::dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle) override
 Obtain the status of the device. More...
 
virtual void UpdateStatus () override
 Update the status of the Adc device in the OLDB. More...
 
void GetStatusList (utils::bat::DbVector &cfg_status, const AdcControllerData &status_data)
 
- 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...
 
virtual void GetStatusBuffer (const std::string &stat_prefix, const DeviceControllerData *const data, std::string &buffer)
 
void GetStatusHeader (const std::string &prefix, const core::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 noexcept override
 Get device id. More...
 
virtual std::string GetLogName () const noexcept
 Get device id for logging purposes. More...
 
virtual std::shared_ptr< fcf::devmgr::common::DeviceLcsIfGetLcsIf () const noexcept
 
virtual std::shared_ptr< fcf::devmgr::common::IDeviceConfigGetConfig () const noexcept
 Get a pointer of device configuration. More...
 
void RegisterComm (std::shared_ptr< protocol::base::IComm > comm_if, protocol::base::Dispatcher<> &failure, protocol::base::Dispatcher<> &normal)
 Register a communication interface object. 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

AdcControllerData m_controller_status
 < object containing the status of the controller More...
 
std::string m_target_named_pos
 
- 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...
 
protocol::base::Dispatcher m_failure
 Dispatcher for managing failures. More...
 
protocol::base::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 noexcept
 Check if received message id is addressed to me. More...
 
void UpdateDb (utils::bat::DbVector &vec)
 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) const
 Get prefix for writing attributes to the DB. More...
 
std::string GetCfgPrefix (const std::vector< std::string > prefix_list) const
 
std::string GetStatPrefix (const std::vector< std::string > prefix_list) const
 
bool CheckNameParam (const std::any &payload)
 Determine whether paramater is included (device name). More...
 
void GetStatusList (utils::bat::DbVector &cfg_list, const DeviceControllerData &status)
 
virtual void WriteConfig ()
 Write configuration into OLDB. More...
 

Detailed Description

The Adc class.

This class handles the behaviour of a generic Adc device.

The Adc 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
AdcConfig
AdcLcsIf
Device
DeviceConfig
DeviceLcsIf

Constructor & Destructor Documentation

◆ Adc()

fcf::devmgr::adc::Adc::Adc ( const std::string &  filename,
const std::string &  name,
fcf::devmgr::common::DataContext data_ctx 
)

Adc constructor.

Parameters
[in]filenamefilename of Adc configuration file
[in]nameAdc identifier
[in]data_ctxreference to data context object

◆ ~Adc()

virtual fcf::devmgr::adc::Adc::~Adc ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ CreateObjects()

void fcf::devmgr::adc::Adc::CreateObjects ( std::shared_ptr< fcf::devmgr::common::IDeviceConfig config = nullptr)
override

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

◆ GetStatusList()

void fcf::devmgr::adc::Adc::GetStatusList ( utils::bat::DbVector &  cfg_status,
const AdcControllerData status_data 
)

◆ GetTargetNamedPosition()

const std::string fcf::devmgr::adc::Adc::GetTargetNamedPosition ( )

◆ IsSetupActive()

bool fcf::devmgr::adc::Adc::IsSetupActive ( const std::any &  payload) const
overridevirtual

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
std::runtime_error

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

◆ SetTargetNamedPosition()

void fcf::devmgr::adc::Adc::SetTargetNamedPosition ( const std::string  named_position)

◆ Setup()

void fcf::devmgr::adc::Adc::Setup ( const std::any &  payload)
overridevirtual

Executes a setup of the adc device.

Parameters
[in]payloadcontains the payload of the setup message.
Returns
true if command is successfully executed, false otherwise.
Exceptions
anexception if an error ocurrs.

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

◆ Status() [1/2]

void fcf::devmgr::adc::Adc::Status ( bool  end_acq,
const core::dit::did::Did &  dictionary,
std::shared_ptr< CCfits::FITS > &  fits_handle 
)
overridevirtual

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.

◆ Status() [2/2]

void fcf::devmgr::adc::Adc::Status ( const std::any &  payload,
std::string &  buffer 
)
overridevirtual

Obtain the status of the device.

Parameters
payloadStatus message object
bufferBuffer where the status will be written

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

◆ UpdateStatus()

void fcf::devmgr::adc::Adc::UpdateStatus ( )
overridevirtual

Update the status of the Adc 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

◆ m_controller_status

AdcControllerData fcf::devmgr::adc::Adc::m_controller_status
protected

< object containing the status of the controller

◆ m_target_named_pos

std::string fcf::devmgr::adc::Adc::m_target_named_pos
protected

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