ifw-fcf  5.0.0-pre2
Public Member Functions | List of all members
fcf::devmgr::common::DeviceFacade Class Reference

#include <deviceFacade.hpp>

Public Member Functions

 DeviceFacade (rad::SMAdapter &sm, Config &config, protocol::base::Dispatcher<> &failure, protocol::base::Dispatcher<> &normal)
 
virtual ~DeviceFacade ()
 ~DeviceFacade More...
 
virtual bool Init (rad::SMAdapter &sm, rad::ThreadActivity *activity)
 Init all devices managed by the devmgr. More...
 
virtual bool Enable (rad::SMAdapter &sm, rad::ThreadActivity *activity)
 Enable all devices managed by the devmgr. More...
 
virtual bool Recover (rad::SMAdapter &sm, rad::ThreadActivity *activity)
 Recover all devices managed by the devmgr. More...
 
virtual bool Disable ()
 Disable all devices managed by the devmgr. More...
 
virtual bool Setup (const std::any &payload, rad::ThreadActivity *activity)
 Executes a setup message. More...
 
virtual void Stop ()
 Abort all devices managed by the devmgr. More...
 
virtual void Reset ()
 Reset devices. More...
 
virtual void Status (const std::any &payload, std::string &buffer)
 Get status from devices. More...
 
virtual void Simulate (rad::AnyEvent const &last_event)
 Simulate devices managed by the server. More...
 
virtual void StopSim (rad::AnyEvent const &last_event)
 Stop simulating devices managed by the server. More...
 
virtual void Ignore (rad::AnyEvent const &last_event)
 Ignore devices managed by the server. More...
 
virtual void StopIgn (rad::AnyEvent const &last_event)
 Stop ignoring devices managed by the server. More...
 
virtual void HwReset (rad::AnyEvent const &last_event)
 Reset hardware. More...
 
virtual void HwInit (rad::AnyEvent const &last_event)
 Init hardware. More...
 
virtual void HwEnable (rad::AnyEvent const &last_event)
 Enable hardware. More...
 
virtual void HwDisable (rad::AnyEvent const &last_event)
 Disable hardware. More...
 
virtual std::string DevNames () const
 Get list of managed devices. More...
 
virtual std::string DevInfo () const
 Get information of managed devices. More...
 
virtual std::string DevConfig (const std::string devname) const
 Get configuration for a given device. More...
 
void StartDaq (std::string daqid)
 Start Data Acquisition. More...
 
fcf::devmgr::common::DaqInfo StopDaq (std::string daqid)
 Stop Data Acquisition. More...
 
void AbortDaq (std::string daqid)
 Abort Data Acquisition. More...
 
fcf::devmgr::common::DaqInfo GetDaqStatus (std::string daqid) const
 Get Daq Status. More...
 
void TriggerInternalEvent (rad::SMAdapter &sm, rad::UniqueEvent &&e)
 Trigger an internal event. More...
 
void AddDevice (std::shared_ptr< IDevice > device)
 Add a device instance to be managed by the facade. More...
 
void ClearDevices ()
 Empty internal device map. More...
 
protocol::base::Dispatcher & GetFailureCB ()
 Get reference to failure CB. More...
 
protocol::base::Dispatcher & GetNormalCB ()
 Get reference to normal CB. More...
 
const int GetNumDevices () const noexcept
 Get the number of devices. More...
 

Detailed Description

This class provide a device facade object to allow the devmgr managing easily all the devices under its control. This class relies on a device abstract class that implement all common features of the devices.

See also
Device

Constructor & Destructor Documentation

◆ DeviceFacade()

fcf::devmgr::common::DeviceFacade::DeviceFacade ( rad::SMAdapter &  sm,
Config config,
protocol::base::Dispatcher<> &  failure,
protocol::base::Dispatcher<> &  normal 
)

Constructor.

Parameters
[in]smReference to the state machine sigleton.
[in]configConfig reference object.
[in]failureDispatcher for failure events.
[in]normalDispatcher for normal events.

◆ ~DeviceFacade()

fcf::devmgr::common::DeviceFacade::~DeviceFacade ( )
virtual

~DeviceFacade

Member Function Documentation

◆ AbortDaq()

void fcf::devmgr::common::DeviceFacade::AbortDaq ( std::string  daqid)

Abort Data Acquisition.

See also
StartDaq

◆ AddDevice()

void fcf::devmgr::common::DeviceFacade::AddDevice ( std::shared_ptr< IDevice device)

Add a device instance to be managed by the facade.

Parameters
[in]deviceSmart pointer to the device.

◆ ClearDevices()

void fcf::devmgr::common::DeviceFacade::ClearDevices ( )

Empty internal device map.

◆ DevConfig()

std::string fcf::devmgr::common::DeviceFacade::DevConfig ( const std::string  devname) const
virtual

Get configuration for a given device.

Returns

◆ DevInfo()

std::string fcf::devmgr::common::DeviceFacade::DevInfo ( ) const
virtual

Get information of managed devices.

Returns

◆ DevNames()

std::string fcf::devmgr::common::DeviceFacade::DevNames ( ) const
virtual

Get list of managed devices.

Returns

◆ Disable()

bool fcf::devmgr::common::DeviceFacade::Disable ( )
virtual

Disable all devices managed by the devmgr.

Returns

◆ Enable()

bool fcf::devmgr::common::DeviceFacade::Enable ( rad::SMAdapter &  sm,
rad::ThreadActivity *  activity 
)
virtual

Enable all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns

◆ GetDaqStatus()

fcf::devmgr::common::DaqInfo fcf::devmgr::common::DeviceFacade::GetDaqStatus ( std::string  daqid) const

Get Daq Status.

See also
StartDaq

◆ GetFailureCB()

protocol::base::Dispatcher & fcf::devmgr::common::DeviceFacade::GetFailureCB ( )

Get reference to failure CB.

Returns

◆ GetNormalCB()

protocol::base::Dispatcher & fcf::devmgr::common::DeviceFacade::GetNormalCB ( )

Get reference to normal CB.

Returns

◆ GetNumDevices()

const int fcf::devmgr::common::DeviceFacade::GetNumDevices ( ) const
noexcept

Get the number of devices.

Returns
Return the number of devices registered in the facade.

◆ HwDisable()

void fcf::devmgr::common::DeviceFacade::HwDisable ( rad::AnyEvent const last_event)
virtual

Disable hardware.

Returns

◆ HwEnable()

void fcf::devmgr::common::DeviceFacade::HwEnable ( rad::AnyEvent const last_event)
virtual

Enable hardware.

Returns

◆ HwInit()

void fcf::devmgr::common::DeviceFacade::HwInit ( rad::AnyEvent const last_event)
virtual

Init hardware.

Returns

◆ HwReset()

void fcf::devmgr::common::DeviceFacade::HwReset ( rad::AnyEvent const last_event)
virtual

Reset hardware.

Returns

◆ Ignore()

void fcf::devmgr::common::DeviceFacade::Ignore ( rad::AnyEvent const last_event)
virtual

Ignore devices managed by the server.

◆ Init()

bool fcf::devmgr::common::DeviceFacade::Init ( rad::SMAdapter &  sm,
rad::ThreadActivity *  activity 
)
virtual

Init all devices managed by the devmgr.

Returns

◆ Recover()

bool fcf::devmgr::common::DeviceFacade::Recover ( rad::SMAdapter &  sm,
rad::ThreadActivity *  activity 
)
virtual

Recover all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns

◆ Reset()

void fcf::devmgr::common::DeviceFacade::Reset ( )
virtual

Reset devices.

Returns

◆ Setup()

bool fcf::devmgr::common::DeviceFacade::Setup ( const std::any &  payload,
rad::ThreadActivity *  activity 
)
virtual

Executes a setup message.

Parameters
[in]payloadmessage containing the setup payload
[in]activitypointer to the thread
Returns
true if the execution was succesful, false otherwise.

This method takes care of forwarding the setup message to all devices registered in the facade. Once the setup is successfully executed, the method waits until the action is finished or an error occurs.

The device facade class handles devices sequentially. In case of an error, the setup will finish immediately. The device facade does not know the internals of each device, it just forward the message blindly to all devices. Each device class is responsible of handling the parameters and actions defined in the setup message, as well as determining when the action is finished.

The setup will be stopped whenever the thread (activity) will be stopped.

◆ Simulate()

void fcf::devmgr::common::DeviceFacade::Simulate ( rad::AnyEvent const last_event)
virtual

Simulate devices managed by the server.

◆ StartDaq()

void fcf::devmgr::common::DeviceFacade::StartDaq ( std::string  daqid)

Start Data Acquisition.

Returns

This method collect data from devices at the beginning of the acquisition. It also register the data for defining the name of data product that will be generated at the end of the acquisition

See also
StopAcq

◆ Status()

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

Get status from devices.

Parameters
payloadStatus message object
bufferBuffer where the status will be written

◆ Stop()

void fcf::devmgr::common::DeviceFacade::Stop ( )
virtual

Abort all devices managed by the devmgr.

Returns

◆ StopDaq()

fcf::devmgr::common::DaqInfo fcf::devmgr::common::DeviceFacade::StopDaq ( std::string  daqid)

Stop Data Acquisition.

This method collect data from devices at the end of the acquisition and it creates the data product FITS file including the meta-data for all devices currently managed by the server.

The filename follows the following convention:

<prefix>_<dp_id>_<fcs_id>.fits

The information for the filename is defined by the StartDaq method.

See also
StartDaq

◆ StopIgn()

void fcf::devmgr::common::DeviceFacade::StopIgn ( rad::AnyEvent const last_event)
virtual

Stop ignoring devices managed by the server.

◆ StopSim()

void fcf::devmgr::common::DeviceFacade::StopSim ( rad::AnyEvent const last_event)
virtual

Stop simulating devices managed by the server.

◆ TriggerInternalEvent()

void fcf::devmgr::common::DeviceFacade::TriggerInternalEvent ( rad::SMAdapter &  sm,
rad::UniqueEvent &&  e 
)

Trigger an internal event.

Parameters
[in]smReference to the SM sigleton.
[in]eEvent to be triggered.
Returns

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