ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
devmgr::sensor::Sensor Class Reference

The Sensor class. More...

#include <sensor.hpp>

Inheritance diagram for devmgr::sensor::Sensor:
devmgr::common::Device devmgr::common::Device devmgr::common::Device devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice devmgr::common::IDevice testSensor::MySensor

Public Member Functions

 Sensor (const std::string &filename, const std::string &name, devmgr::common::DataContext &data_ctx)
 Sensor constructor. More...
 
void CreateObjects (std::shared_ptr< 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 bool IsDisabling () const
 Check if sensor is disablig. More...
 
virtual void Setup (const modif::ReqSetup &setupMsg)
 Executes a setup of the sensor device. More...
 
virtual bool IsSetupActive (const modif::ReqSetup &setupMsg) const
 Check if last setup message is still active. More...
 
virtual void Status (const modif::ReqStatus &statusMsg, std::string &buffer)
 Obtain the status of the device. More...
 
virtual void Status (bool end_acq, const dit::did::Did &dictionary, CCfits::FITS *fits_handle=nullptr)
 Obtain the status of the device. More...
 
virtual void UpdateStatus ()
 Update the status of the Sensor device in the OLDB. More...
 
virtual std::shared_ptr
< devmgr::common::DeviceLcsIf
GetLcsIf () const
 
virtual std::shared_ptr
< devmgr::common::IDeviceConfig
GetConfig () const
 Get a pointer of device configuration. More...
 
 Sensor (const std::string &filename, const std::string &name, devmgr::common::DataContext &data_ctx)
 Sensor constructor. More...
 
void CreateObjects (std::shared_ptr< 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 bool IsDisabling () const
 Check if sensor is disablig. More...
 
virtual void Setup (const modif::ReqSetup &setupMsg)
 Executes a setup of the sensor device. More...
 
virtual bool IsSetupActive (const modif::ReqSetup &setupMsg) const
 Check if last setup message is still active. More...
 
virtual void Status (const modif::ReqStatus &statusMsg, std::string &buffer)
 Obtain the status of the device. More...
 
virtual void Status (bool end_acq, const dit::did::Did &dictionary, CCfits::FITS *fits_handle=nullptr)
 Obtain the status of the device. More...
 
virtual void UpdateStatus ()
 Update the status of the Sensor device in the OLDB. More...
 
virtual std::shared_ptr
< devmgr::common::DeviceLcsIf
GetLcsIf () const
 
virtual std::shared_ptr
< devmgr::common::IDeviceConfig
GetConfig () const
 Get a pointer of device configuration. More...
 
 Sensor (const std::string &filename, const std::string &name, devmgr::common::DataContext &data_ctx)
 Sensor constructor. More...
 
void CreateObjects (std::shared_ptr< 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 bool IsDisabling () const
 Check if sensor is disablig. More...
 
virtual void Setup (const modif::ReqSetup &setupMsg)
 Executes a setup of the sensor device. More...
 
virtual bool IsSetupActive (const modif::ReqSetup &setupMsg) const
 Check if last setup message is still active. More...
 
virtual void Status (const modif::ReqStatus &statusMsg, std::string &buffer)
 Obtain the status of the device. More...
 
virtual void Status (bool end_acq, const dit::did::Did &dictionary, CCfits::FITS *fits_handle=nullptr)
 Obtain the status of the device. More...
 
virtual void UpdateStatus ()
 Update the status of the Sensor device in the OLDB. More...
 
virtual std::shared_ptr
< devmgr::common::DeviceLcsIf
GetLcsIf () const
 
virtual std::shared_ptr
< devmgr::common::IDeviceConfig
GetConfig () const
 Get a pointer of device configuration. More...
 
- Public Member Functions inherited from 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
 Check if device is Standby/NotReady. More...
 
virtual bool IsReady () const
 Check if device is Standby/Ready. More...
 
virtual bool IsOperational () const
 Check if device is Operational. More...
 
virtual void CheckHwFailure () const
 Check if device is in failure state. More...
 
virtual void Init ()
 Executes a Init command. More...
 
virtual void Enable ()
 Executes a Enable command. More...
 
virtual void Disable ()
 Executes a Disable command. More...
 
virtual void Stop ()
 Executes a Stop command. More...
 
virtual void Reset ()
 Executes a Reset command. More...
 
virtual void HwReset (modif::ReqHwReset &hwResetMsg)
 Executes a hardware reset command. More...
 
virtual void HwInit (modif::ReqHwInit &hwInitMsg)
 Executes a hardware init command. More...
 
virtual void HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Executes a hardware enable command. More...
 
virtual void HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Executes a hardware disable command. More...
 
virtual void Simulate (const modif::ReqSimulate &msg)
 Executes a Simulat. More...
 
virtual void StopSim (const modif::ReqStopSim &msg)
 Executes a StopSim. More...
 
virtual void Ignore (const modif::ReqIgnore &msg)
 Executes a Ignore. More...
 
virtual void StopIgn (const modif::ReqStopIgn &msg)
 Executes a StopIgn. More...
 
virtual void StartMonitoring ()
 Start device monitoring via OPCUA subscriptions. More...
 
virtual void StopMonitoring ()
 Stop device monitoring. More...
 
virtual std::string GetName () const
 Get device id. More...
 
 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
 Check if device is Standby/NotReady. More...
 
virtual bool IsReady () const
 Check if device is Standby/Ready. More...
 
virtual bool IsOperational () const
 Check if device is Operational. More...
 
virtual void CheckHwFailure () const
 Check if device is in failure state. More...
 
virtual void Init ()
 Executes a Init command. More...
 
virtual void Enable ()
 Executes a Enable command. More...
 
virtual void Disable ()
 Executes a Disable command. More...
 
virtual void Stop ()
 Executes a Stop command. More...
 
virtual void Reset ()
 Executes a Reset command. More...
 
virtual void HwReset (modif::ReqHwReset &hwResetMsg)
 Executes a hardware reset command. More...
 
virtual void HwInit (modif::ReqHwInit &hwInitMsg)
 Executes a hardware init command. More...
 
virtual void HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Executes a hardware enable command. More...
 
virtual void HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Executes a hardware disable command. More...
 
virtual void Simulate (const modif::ReqSimulate &msg)
 Executes a Simulat. More...
 
virtual void StopSim (const modif::ReqStopSim &msg)
 Executes a StopSim. More...
 
virtual void Ignore (const modif::ReqIgnore &msg)
 Executes a Ignore. More...
 
virtual void StopIgn (const modif::ReqStopIgn &msg)
 Executes a StopIgn. More...
 
virtual void StartMonitoring ()
 Start device monitoring via OPCUA subscriptions. More...
 
virtual void StopMonitoring ()
 Stop device monitoring. More...
 
virtual std::string GetName () const
 Get device id. More...
 
 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
 Check if device is Standby/NotReady. More...
 
virtual bool IsReady () const
 Check if device is Standby/Ready. More...
 
virtual bool IsOperational () const
 Check if device is Operational. More...
 
virtual void CheckHwFailure () const
 Check if device is in failure state. More...
 
virtual void Init ()
 Executes a Init command. More...
 
virtual void Enable ()
 Executes a Enable command. More...
 
virtual void Disable ()
 Executes a Disable command. More...
 
virtual void Stop ()
 Executes a Stop command. More...
 
virtual void Reset ()
 Executes a Reset command. More...
 
virtual void HwReset (modif::ReqHwReset &hwResetMsg)
 Executes a hardware reset command. More...
 
virtual void HwInit (modif::ReqHwInit &hwInitMsg)
 Executes a hardware init command. More...
 
virtual void HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Executes a hardware enable command. More...
 
virtual void HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Executes a hardware disable command. More...
 
virtual void Simulate (const modif::ReqSimulate &msg)
 Executes a Simulat. More...
 
virtual void StopSim (const modif::ReqStopSim &msg)
 Executes a StopSim. More...
 
virtual void Ignore (const modif::ReqIgnore &msg)
 Executes a Ignore. More...
 
virtual void StopIgn (const modif::ReqStopIgn &msg)
 Executes a StopIgn. More...
 
virtual void StartMonitoring ()
 Start device monitoring via OPCUA subscriptions. More...
 
virtual void StopMonitoring ()
 Stop device monitoring. More...
 
virtual std::string GetName () const
 Get device id. More...
 
- Public Member Functions inherited from devmgr::common::IDevice
virtual void CreateObjects (std::shared_ptr< devmgr::common::IDeviceConfig > config=nullptr)=0
 Create basic objects needed by the device class. More...
 
virtual void CreateObjects (std::shared_ptr< devmgr::common::IDeviceConfig > config=nullptr)=0
 Create basic objects needed by the device class. More...
 
virtual void CreateObjects (std::shared_ptr< devmgr::common::IDeviceConfig > config=nullptr)=0
 Create basic objects needed by the device class. More...
 

Protected Attributes

SensorControllerData m_controller_status
 < object containing the status of the controller More...
 
fcf::common::VectorVariant m_sensor_list
 pointer to device config object More...
 
std::shared_ptr< SensorConfigm_config
 
std::shared_ptr< SensorLcsIfm_lcs_if
 
- Protected Attributes inherited from 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
 
fcf::common::Dispatcher m_normal
 
std::shared_ptr< DeviceConfigm_config
 
std::shared_ptr< DeviceLcsIfm_lcs_if
 

Additional Inherited Members

- Protected Member Functions inherited from 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 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 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...
 

Detailed Description

The Sensor class.

This class handles the behaviour of a generic Sensor device.

The Sensor 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
SensorConfig
SensorLcsIf
Device
DeviceConfig
DeviceLcsIf

Constructor & Destructor Documentation

devmgr::sensor::Sensor::Sensor ( const std::string &  filename,
const std::string &  name,
devmgr::common::DataContext data_ctx 
)

Sensor constructor.

Parameters
[in]filenamefilename of Sensor configuration file
[in]nameSensor identifier
[in]data_ctxreference to data context object
devmgr::sensor::Sensor::Sensor ( const std::string &  filename,
const std::string &  name,
devmgr::common::DataContext data_ctx 
)

Sensor constructor.

Parameters
[in]filenamefilename of Sensor configuration file
[in]nameSensor identifier
[in]data_ctxreference to data context object
devmgr::sensor::Sensor::Sensor ( const std::string &  filename,
const std::string &  name,
devmgr::common::DataContext data_ctx 
)

Sensor constructor.

Parameters
[in]filenamefilename of Sensor configuration file
[in]nameSensor identifier
[in]data_ctxreference to data context object

Member Function Documentation

void devmgr::sensor::Sensor::CreateObjects ( std::shared_ptr< 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 sensorConfig.

void devmgr::sensor::Sensor::CreateObjects ( std::shared_ptr< 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 sensorConfig.

void devmgr::sensor::Sensor::CreateObjects ( std::shared_ptr< 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 sensorConfig.

std::shared_ptr< IDeviceConfig > devmgr::sensor::Sensor::GetConfig ( ) const
virtual

Get a pointer of device configuration.

Returns
shared pointer of internal configuration object

Implements devmgr::common::Device.

virtual std::shared_ptr<devmgr::common::IDeviceConfig> devmgr::sensor::Sensor::GetConfig ( ) const
virtual

Get a pointer of device configuration.

Returns
shared pointer of internal configuration object

Implements devmgr::common::Device.

virtual std::shared_ptr<devmgr::common::IDeviceConfig> devmgr::sensor::Sensor::GetConfig ( ) const
virtual

Get a pointer of device configuration.

Returns
shared pointer of internal configuration object

Implements devmgr::common::Device.

virtual std::shared_ptr<devmgr::common::DeviceLcsIf> devmgr::sensor::Sensor::GetLcsIf ( ) const
virtual
Returns
pointer to lcs interface object.

Implements devmgr::common::Device.

std::shared_ptr< DeviceLcsIf > devmgr::sensor::Sensor::GetLcsIf ( ) const
virtual
Returns
pointer to lcs interface object.

Implements devmgr::common::Device.

virtual std::shared_ptr<devmgr::common::DeviceLcsIf> devmgr::sensor::Sensor::GetLcsIf ( ) const
virtual
Returns
pointer to lcs interface object.

Implements devmgr::common::Device.

virtual bool devmgr::sensor::Sensor::IsDisabling ( ) const
virtual

Check if sensor is disablig.

Returns
true if sensor is disabling, false otherwise

Reimplemented from devmgr::common::Device.

virtual bool devmgr::sensor::Sensor::IsDisabling ( ) const
virtual

Check if sensor is disablig.

Returns
true if sensor is disabling, false otherwise

Reimplemented from devmgr::common::Device.

bool devmgr::sensor::Sensor::IsDisabling ( ) const
virtual

Check if sensor is disablig.

Returns
true if sensor is disabling, false otherwise

Reimplemented from devmgr::common::Device.

bool devmgr::sensor::Sensor::IsSetupActive ( const modif::ReqSetup setupMsg) const
virtual

Check if last setup message is still active.

Parameters
[in]setupMsgsetup 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 devmgr::common::Device.

virtual bool devmgr::sensor::Sensor::IsSetupActive ( const modif::ReqSetup setupMsg) const
virtual

Check if last setup message is still active.

Parameters
[in]setupMsgsetup 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 devmgr::common::Device.

virtual bool devmgr::sensor::Sensor::IsSetupActive ( const modif::ReqSetup setupMsg) const
virtual

Check if last setup message is still active.

Parameters
[in]setupMsgsetup 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 devmgr::common::Device.

void devmgr::sensor::Sensor::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 devmgr::common::Device.

void devmgr::sensor::Sensor::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 devmgr::common::Device.

void devmgr::sensor::Sensor::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 devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Setup ( const modif::ReqSetup setupMsg)
virtual

Executes a setup of the sensor device.

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

Implements devmgr::common::Device.

void devmgr::sensor::Sensor::Setup ( const modif::ReqSetup setupMsg)
virtual

Executes a setup of the sensor device.

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

Implements devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Setup ( const modif::ReqSetup setupMsg)
virtual

Executes a setup of the sensor device.

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

Implements devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Status ( const modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Obtain the status of the device.

Parameters
statusMsgStatus message object
bufferBuffer where the status will be written

Implements devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Status ( const modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Obtain the status of the device.

Parameters
statusMsgStatus message object
bufferBuffer where the status will be written

Implements devmgr::common::Device.

void devmgr::sensor::Sensor::Status ( const modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Obtain the status of the device.

Parameters
statusMsgStatus message object
bufferBuffer where the status will be written

Implements devmgr::common::Device.

void devmgr::sensor::Sensor::Status ( bool  end_acq,
const dit::did::Did dictionary,
CCfits::FITS *  fits_handle = nullptr 
)
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 devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Status ( bool  end_acq,
const dit::did::Did dictionary,
CCfits::FITS *  fits_handle = nullptr 
)
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 devmgr::common::Device.

virtual void devmgr::sensor::Sensor::Status ( bool  end_acq,
const dit::did::Did dictionary,
CCfits::FITS *  fits_handle = nullptr 
)
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 devmgr::common::Device.

virtual void devmgr::sensor::Sensor::UpdateStatus ( )
virtual

Update the status of the Sensor device in the OLDB.

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

Implements devmgr::common::Device.

virtual void devmgr::sensor::Sensor::UpdateStatus ( )
virtual

Update the status of the Sensor device in the OLDB.

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

Implements devmgr::common::Device.

void devmgr::sensor::Sensor::UpdateStatus ( )
virtual

Update the status of the Sensor device in the OLDB.

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

Implements devmgr::common::Device.

Member Data Documentation

std::shared_ptr< SensorConfig > devmgr::sensor::Sensor::m_config
protected
SensorControllerData devmgr::sensor::Sensor::m_controller_status
protected

< object containing the status of the controller

std::shared_ptr< SensorLcsIf > devmgr::sensor::Sensor::m_lcs_if
protected
fcf::common::VectorVariant devmgr::sensor::Sensor::m_sensor_list
protected

pointer to device config object


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