ifw-fcf
5.0.0-pre2
|
#include <device.hpp>
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... | |
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::DeviceLcsIf > | GetLcsIf () const noexcept |
virtual std::shared_ptr< fcf::devmgr::common::IDeviceConfig > | GetConfig () 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... | |
![]() | |
virtual void | CreateObjects (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config=nullptr)=0 |
Create basic objects needed by the device class. 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 core::dit::did::Did &dictionary, std::shared_ptr< CCfits::FITS > &fits_handle)=0 |
Obtain the status of the device. More... | |
Protected Member Functions | |
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... | |
Protected Attributes | |
std::string | m_filename |
device configuration filename. More... | |
std::string | m_name |
device ID. More... | |
DataContext & | m_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< DeviceConfig > | m_config |
Pointer to configuration object. More... | |
std::shared_ptr< DeviceLcsIf > | m_lcs_if |
Local Control System Interface. More... | |
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.
fcf::devmgr::common::Device::Device | ( | const std::string | filename, |
const std::string | name, | ||
DataContext & | data_ctx | ||
) |
|
virtual |
Default destructor.
|
overridevirtual |
Check if device is in failure state.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice.
|
protected |
Determine whether paramater is included (device name).
payload | Payload 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.
|
overridevirtual |
Executes a Disable command.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
Reimplemented in testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.
|
overridevirtual |
Executes a Enable command.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
Reimplemented in testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.
|
protected |
|
inlinevirtualnoexcept |
Get a pointer of device configuration.
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestShutter.
|
inlinevirtualnoexcept |
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestShutter.
|
inlinevirtualnoexcept |
Get device id for logging purposes.
|
inlineoverridevirtualnoexcept |
Get device id.
Implements fcf::devmgr::common::IDevice.
|
protected |
Get prefix for writing attributes to the DB.
prefix_list | List of intermediate prefix values. |
prefix | String containing the formatted prefix. |
|
protected |
|
virtual |
void fcf::devmgr::common::Device::GetStatusHeader | ( | const std::string & | prefix, |
const core::dit::did::Did & | dictionary, | ||
std::shared_ptr< CCfits::FITS > & | fits_handle | ||
) |
Obtain the status of the device.
prefix | Prefix for the status |
dictionary | Reference to the dictionary object |
fits_handle | Pointer 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.
|
protected |
|
overridevirtual |
Executes a hardware disable command.
[in] | last_event | payload of the hw disable message |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a hardware enable command.
[in] | last_event | payload of the hw enable message |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a hardware init command.
[in] | last_event | payload of the hw init message |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a hardware reset command.
[in] | last_event | payload of the hw reset message |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a Ignore.
[in] | last_event | contains the payload of the Ignore message. |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a Init command.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
Reimplemented in testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.
|
overridevirtual |
Check if device is disablig.
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, and testDeviceFacade::TestMyDevice.
|
inlineprotectednoexcept |
Check if received message id is addressed to me.
[in] | id | message id |
|
overridevirtual |
Check if device is Standby/NotReady.
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.
|
overridevirtual |
Check if device is Operational.
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Check if device is Standby/Ready.
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, and testDeviceFacade::TestMyDevice.
|
virtual |
Register a communication interface object.
[in] | comm_if | shared pointer to the communication interface object |
[in] | failure | dispatcher object for failure events |
[in] | normal | dispatcher 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.
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestShutter.
|
overridevirtual |
Executes a Reset command.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
Reimplemented in TestMyDevice, testDeviceFacade::TestFailureDevice, testDeviceFacade::TestMyDevice, and TestShutter.
|
protected |
SetIgnore.
flag |
|
protected |
SetSimulation.
flag |
|
overridevirtual |
Executes a Simulat.
[in] | last_event | contains the payload of the Simulat message. |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Start device monitoring via OPCUA subscriptions.
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a Stop command.
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a StopIgn.
[in] | last_event | contains the payload of the StopIgn message. |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Stop device monitoring.
Implements fcf::devmgr::common::IDevice.
|
overridevirtual |
Executes a StopSim.
[in] | last_event | contains the payload of the StopSim message. |
an | exception if an error ocurrs. |
Implements fcf::devmgr::common::IDevice.
|
protected |
Update device database.
attr_vector | List of attributes with their values. |
|
protectedvirtual |
Write configuration into OLDB.
Implements fcf::devmgr::common::IDevice.
|
protected |
Pointer to configuration object.
|
protected |
reference to the data context object.
|
protected |
Dispatcher for managing failures.
|
protected |
device configuration filename.
|
protected |
Local Control System Interface.
|
protected |
device ID.
|
protected |
Dispatcher for managing positive events.