ifw-fcf
5.0.0-pre2
|
#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... | |
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.
fcf::devmgr::common::DeviceFacade::DeviceFacade | ( | rad::SMAdapter & | sm, |
Config & | config, | ||
protocol::base::Dispatcher<> & | failure, | ||
protocol::base::Dispatcher<> & | normal | ||
) |
Constructor.
[in] | sm | Reference to the state machine sigleton. |
[in] | config | Config reference object. |
[in] | failure | Dispatcher for failure events. |
[in] | normal | Dispatcher for normal events. |
|
virtual |
~DeviceFacade
void fcf::devmgr::common::DeviceFacade::AbortDaq | ( | std::string | daqid | ) |
Abort Data Acquisition.
void fcf::devmgr::common::DeviceFacade::AddDevice | ( | std::shared_ptr< IDevice > | device | ) |
Add a device instance to be managed by the facade.
[in] | device | Smart pointer to the device. |
void fcf::devmgr::common::DeviceFacade::ClearDevices | ( | ) |
Empty internal device map.
|
virtual |
Get configuration for a given device.
|
virtual |
Get information of managed devices.
|
virtual |
Get list of managed devices.
|
virtual |
Disable all devices managed by the devmgr.
|
virtual |
Enable all devices managed by the devmgr.
[in] | sm | Reference to the SM sigleton. |
[in] | activity | Pointer to the current activity. |
fcf::devmgr::common::DaqInfo fcf::devmgr::common::DeviceFacade::GetDaqStatus | ( | std::string | daqid | ) | const |
Get Daq Status.
protocol::base::Dispatcher & fcf::devmgr::common::DeviceFacade::GetFailureCB | ( | ) |
Get reference to failure CB.
protocol::base::Dispatcher & fcf::devmgr::common::DeviceFacade::GetNormalCB | ( | ) |
Get reference to normal CB.
|
noexcept |
Get the number of devices.
|
virtual |
Disable hardware.
|
virtual |
Enable hardware.
|
virtual |
Init hardware.
|
virtual |
Reset hardware.
|
virtual |
Ignore devices managed by the server.
|
virtual |
Init all devices managed by the devmgr.
|
virtual |
Recover all devices managed by the devmgr.
[in] | sm | Reference to the SM sigleton. |
[in] | activity | Pointer to the current activity. |
|
virtual |
Reset devices.
|
virtual |
Executes a setup message.
[in] | payload | message containing the setup payload |
[in] | activity | pointer to the thread |
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.
|
virtual |
Simulate devices managed by the server.
void fcf::devmgr::common::DeviceFacade::StartDaq | ( | std::string | daqid | ) |
Start Data Acquisition.
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
|
virtual |
Get status from devices.
payload | Status message object |
buffer | Buffer where the status will be written |
|
virtual |
Abort all devices managed by the devmgr.
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.
|
virtual |
Stop ignoring devices managed by the server.
|
virtual |
Stop simulating devices managed by the server.
void fcf::devmgr::common::DeviceFacade::TriggerInternalEvent | ( | rad::SMAdapter & | sm, |
rad::UniqueEvent && | e | ||
) |
Trigger an internal event.
[in] | sm | Reference to the SM sigleton. |
[in] | e | Event to be triggered. |