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

#include <deviceFacade.hpp>

Public Member Functions

 DeviceFacade (rad::SMAdapter &sm, IConfig &config, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
 
virtual ~DeviceFacade ()
 ~DeviceFacade More...
 
virtual bool Init (rad::SMAdapter &sm, rad::Activity *activity)
 Init all devices managed by the devmgr. More...
 
virtual bool Enable (rad::SMAdapter &sm, rad::Activity *activity)
 Enable all devices managed by the devmgr. More...
 
virtual bool Recover (rad::SMAdapter &sm, rad::Activity *activity)
 Recover all devices managed by the devmgr. More...
 
virtual bool Disable ()
 Disable all devices managed by the devmgr. More...
 
virtual bool Setup (modif::ReqSetup setupMsg, modif::TaskId &taskId, rad::Activity *activity)
 Executes a setup message. More...
 
virtual bool Stop ()
 Abort all devices managed by the devmgr. More...
 
virtual bool Reset ()
 Reset devices. More...
 
virtual bool Status (modif::ReqStatus &statusMsg, std::string &buffer)
 Get status from devices. More...
 
virtual void Simulate (modif::ReqSimulate &msg)
 Simulate devices managed by the server. More...
 
virtual void StopSim (modif::ReqStopSim &msg)
 Stop simulating devices managed by the server. More...
 
virtual void Ignore (modif::ReqIgnore &msg)
 Ignore devices managed by the server. More...
 
virtual void StopIgn (modif::ReqStopIgn &msg)
 Stop ignoring devices managed by the server. More...
 
virtual bool HwReset (modif::ReqHwReset &hwResetMsg)
 Reset hardware. More...
 
virtual bool HwInit (modif::ReqHwInit &hwInitMsg)
 Init hardware. More...
 
virtual bool HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Enable hardware. More...
 
virtual bool HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Disable hardware. More...
 
virtual bool BeginAcq (modif::ReqBeginAcq &beginAcqMsg)
 Begin Acquisition. More...
 
virtual bool EndAcq (modif::ReqEndAcq &endAcqMsg)
 End Acquisition. 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...
 
fcf::common::Dispatcher & GetFailureCB ()
 Get reference to failure CB. More...
 
fcf::common::Dispatcher & GetNormalCB ()
 Get reference to normal CB. More...
 
const int GetNumDevices ()
 Get the number of devices. More...
 
 DeviceFacade (rad::SMAdapter &sm, IConfig &config, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
 
virtual ~DeviceFacade ()
 ~DeviceFacade More...
 
virtual bool Init (rad::SMAdapter &sm, rad::Activity *activity)
 Init all devices managed by the devmgr. More...
 
virtual bool Enable (rad::SMAdapter &sm, rad::Activity *activity)
 Enable all devices managed by the devmgr. More...
 
virtual bool Recover (rad::SMAdapter &sm, rad::Activity *activity)
 Recover all devices managed by the devmgr. More...
 
virtual bool Disable ()
 Disable all devices managed by the devmgr. More...
 
virtual bool Setup (modif::ReqSetup setupMsg, modif::TaskId &taskId, rad::Activity *activity)
 Executes a setup message. More...
 
virtual bool Stop ()
 Abort all devices managed by the devmgr. More...
 
virtual bool Reset ()
 Reset devices. More...
 
virtual bool Status (modif::ReqStatus &statusMsg, std::string &buffer)
 Get status from devices. More...
 
virtual void Simulate (modif::ReqSimulate &msg)
 Simulate devices managed by the server. More...
 
virtual void StopSim (modif::ReqStopSim &msg)
 Stop simulating devices managed by the server. More...
 
virtual void Ignore (modif::ReqIgnore &msg)
 Ignore devices managed by the server. More...
 
virtual void StopIgn (modif::ReqStopIgn &msg)
 Stop ignoring devices managed by the server. More...
 
virtual bool HwReset (modif::ReqHwReset &hwResetMsg)
 Reset hardware. More...
 
virtual bool HwInit (modif::ReqHwInit &hwInitMsg)
 Init hardware. More...
 
virtual bool HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Enable hardware. More...
 
virtual bool HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Disable hardware. More...
 
virtual bool BeginAcq (modif::ReqBeginAcq &beginAcqMsg)
 Begin Acquisition. More...
 
virtual bool EndAcq (modif::ReqEndAcq &endAcqMsg)
 End Acquisition. 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...
 
fcf::common::Dispatcher & GetFailureCB ()
 Get reference to failure CB. More...
 
fcf::common::Dispatcher & GetNormalCB ()
 Get reference to normal CB. More...
 
const int GetNumDevices ()
 Get the number of devices. More...
 
 DeviceFacade (rad::SMAdapter &sm, IConfig &config, fcf::common::Dispatcher<> &failure, fcf::common::Dispatcher<> &normal)
 
virtual ~DeviceFacade ()
 ~DeviceFacade More...
 
virtual bool Init (rad::SMAdapter &sm, rad::Activity *activity)
 Init all devices managed by the devmgr. More...
 
virtual bool Enable (rad::SMAdapter &sm, rad::Activity *activity)
 Enable all devices managed by the devmgr. More...
 
virtual bool Recover (rad::SMAdapter &sm, rad::Activity *activity)
 Recover all devices managed by the devmgr. More...
 
virtual bool Disable ()
 Disable all devices managed by the devmgr. More...
 
virtual bool Setup (modif::ReqSetup setupMsg, modif::TaskId &taskId, rad::Activity *activity)
 Executes a setup message. More...
 
virtual bool Stop ()
 Abort all devices managed by the devmgr. More...
 
virtual bool Reset ()
 Reset devices. More...
 
virtual bool Status (modif::ReqStatus &statusMsg, std::string &buffer)
 Get status from devices. More...
 
virtual void Simulate (modif::ReqSimulate &msg)
 Simulate devices managed by the server. More...
 
virtual void StopSim (modif::ReqStopSim &msg)
 Stop simulating devices managed by the server. More...
 
virtual void Ignore (modif::ReqIgnore &msg)
 Ignore devices managed by the server. More...
 
virtual void StopIgn (modif::ReqStopIgn &msg)
 Stop ignoring devices managed by the server. More...
 
virtual bool HwReset (modif::ReqHwReset &hwResetMsg)
 Reset hardware. More...
 
virtual bool HwInit (modif::ReqHwInit &hwInitMsg)
 Init hardware. More...
 
virtual bool HwEnable (modif::ReqHwEnable &hwEnableMsg)
 Enable hardware. More...
 
virtual bool HwDisable (modif::ReqHwDisable &hwDisableMsg)
 Disable hardware. More...
 
virtual bool BeginAcq (modif::ReqBeginAcq &beginAcqMsg)
 Begin Acquisition. More...
 
virtual bool EndAcq (modif::ReqEndAcq &endAcqMsg)
 End Acquisition. 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...
 
fcf::common::Dispatcher & GetFailureCB ()
 Get reference to failure CB. More...
 
fcf::common::Dispatcher & GetNormalCB ()
 Get reference to normal CB. More...
 
const int GetNumDevices ()
 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

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

Constructor.

Parameters
[in]smReference to the state machine sigleton.
[in]failureDispatcher for failure events.
[in]normalDispatcher for normal events.
devmgr::common::DeviceFacade::~DeviceFacade ( )
virtual

~DeviceFacade

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

Constructor.

Parameters
[in]smReference to the state machine sigleton.
[in]failureDispatcher for failure events.
[in]normalDispatcher for normal events.
virtual devmgr::common::DeviceFacade::~DeviceFacade ( )
virtual

~DeviceFacade

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

Constructor.

Parameters
[in]smReference to the state machine sigleton.
[in]failureDispatcher for failure events.
[in]normalDispatcher for normal events.
virtual devmgr::common::DeviceFacade::~DeviceFacade ( )
virtual

~DeviceFacade

Member Function Documentation

void 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.
void 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.
void 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.
virtual bool devmgr::common::DeviceFacade::BeginAcq ( modif::ReqBeginAcq beginAcqMsg)
virtual

Begin 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
EndAcq
bool devmgr::common::DeviceFacade::BeginAcq ( modif::ReqBeginAcq beginAcqMsg)
virtual

Begin 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
EndAcq
virtual bool devmgr::common::DeviceFacade::BeginAcq ( modif::ReqBeginAcq beginAcqMsg)
virtual

Begin 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
EndAcq
void devmgr::common::DeviceFacade::ClearDevices ( )

Empty internal device map.

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

Empty internal device map.

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

Empty internal device map.

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

Disable all devices managed by the devmgr.

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

Disable all devices managed by the devmgr.

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

Disable all devices managed by the devmgr.

Returns
bool devmgr::common::DeviceFacade::Enable ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Enable all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
virtual bool devmgr::common::DeviceFacade::Enable ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Enable all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
virtual bool devmgr::common::DeviceFacade::Enable ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Enable all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
virtual bool devmgr::common::DeviceFacade::EndAcq ( modif::ReqEndAcq endAcqMsg)
virtual

End 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 BeginAcq method.

See Also
BeginAcq
bool devmgr::common::DeviceFacade::EndAcq ( modif::ReqEndAcq endAcqMsg)
virtual

End 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 BeginAcq method.

See Also
BeginAcq
virtual bool devmgr::common::DeviceFacade::EndAcq ( modif::ReqEndAcq endAcqMsg)
virtual

End 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 BeginAcq method.

See Also
BeginAcq
fcf::common::Dispatcher& devmgr::common::DeviceFacade::GetFailureCB ( )

Get reference to failure CB.

Returns
fcf::common::Dispatcher & devmgr::common::DeviceFacade::GetFailureCB ( )

Get reference to failure CB.

Returns
fcf::common::Dispatcher& devmgr::common::DeviceFacade::GetFailureCB ( )

Get reference to failure CB.

Returns
fcf::common::Dispatcher& devmgr::common::DeviceFacade::GetNormalCB ( )

Get reference to normal CB.

Returns
fcf::common::Dispatcher & devmgr::common::DeviceFacade::GetNormalCB ( )

Get reference to normal CB.

Returns
fcf::common::Dispatcher& devmgr::common::DeviceFacade::GetNormalCB ( )

Get reference to normal CB.

Returns
const int devmgr::common::DeviceFacade::GetNumDevices ( )

Get the number of devices.

Returns
Return the number of devices registered in the facade.
const int devmgr::common::DeviceFacade::GetNumDevices ( )

Get the number of devices.

Returns
Return the number of devices registered in the facade.
const int devmgr::common::DeviceFacade::GetNumDevices ( )

Get the number of devices.

Returns
Return the number of devices registered in the facade.
virtual bool devmgr::common::DeviceFacade::HwDisable ( modif::ReqHwDisable hwDisableMsg)
virtual

Disable hardware.

Returns
bool devmgr::common::DeviceFacade::HwDisable ( modif::ReqHwDisable hwDisableMsg)
virtual

Disable hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwDisable ( modif::ReqHwDisable hwDisableMsg)
virtual

Disable hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwEnable ( modif::ReqHwEnable hwEnableMsg)
virtual

Enable hardware.

Returns
bool devmgr::common::DeviceFacade::HwEnable ( modif::ReqHwEnable hwEnableMsg)
virtual

Enable hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwEnable ( modif::ReqHwEnable hwEnableMsg)
virtual

Enable hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwInit ( modif::ReqHwInit hwInitMsg)
virtual

Init hardware.

Returns
bool devmgr::common::DeviceFacade::HwInit ( modif::ReqHwInit hwInitMsg)
virtual

Init hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwInit ( modif::ReqHwInit hwInitMsg)
virtual

Init hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwReset ( modif::ReqHwReset hwResetMsg)
virtual

Reset hardware.

Returns
bool devmgr::common::DeviceFacade::HwReset ( modif::ReqHwReset hwResetMsg)
virtual

Reset hardware.

Returns
virtual bool devmgr::common::DeviceFacade::HwReset ( modif::ReqHwReset hwResetMsg)
virtual

Reset hardware.

Returns
virtual void devmgr::common::DeviceFacade::Ignore ( modif::ReqIgnore msg)
virtual

Ignore devices managed by the server.

void devmgr::common::DeviceFacade::Ignore ( modif::ReqIgnore msg)
virtual

Ignore devices managed by the server.

virtual void devmgr::common::DeviceFacade::Ignore ( modif::ReqIgnore msg)
virtual

Ignore devices managed by the server.

bool devmgr::common::DeviceFacade::Init ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Init all devices managed by the devmgr.

Returns
virtual bool devmgr::common::DeviceFacade::Init ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Init all devices managed by the devmgr.

Returns
virtual bool devmgr::common::DeviceFacade::Init ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Init all devices managed by the devmgr.

Returns
virtual bool devmgr::common::DeviceFacade::Recover ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Recover all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
bool devmgr::common::DeviceFacade::Recover ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Recover all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
virtual bool devmgr::common::DeviceFacade::Recover ( rad::SMAdapter sm,
rad::Activity activity 
)
virtual

Recover all devices managed by the devmgr.

Parameters
[in]smReference to the SM sigleton.
[in]activityPointer to the current activity.
Returns
virtual bool devmgr::common::DeviceFacade::Reset ( )
virtual

Reset devices.

Returns
virtual bool devmgr::common::DeviceFacade::Reset ( )
virtual

Reset devices.

Returns
bool devmgr::common::DeviceFacade::Reset ( )
virtual

Reset devices.

Returns
virtual bool devmgr::common::DeviceFacade::Setup ( modif::ReqSetup  setupMsg,
modif::TaskId taskId,
rad::Activity activity 
)
virtual

Executes a setup message.

Parameters
[in]setupMsgmessage containing the setup payload
[in]task_idid of the task executing the setup
[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 succesfully 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 bool devmgr::common::DeviceFacade::Setup ( modif::ReqSetup  setupMsg,
modif::TaskId taskId,
rad::Activity activity 
)
virtual

Executes a setup message.

Parameters
[in]setupMsgmessage containing the setup payload
[in]task_idid of the task executing the setup
[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 succesfully 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.

bool devmgr::common::DeviceFacade::Setup ( modif::ReqSetup  setupMsg,
modif::TaskId taskId,
rad::Activity activity 
)
virtual

Executes a setup message.

Parameters
[in]setupMsgmessage containing the setup payload
[in]task_idid of the task executing the setup
[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 succesfully 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 void devmgr::common::DeviceFacade::Simulate ( modif::ReqSimulate msg)
virtual

Simulate devices managed by the server.

void devmgr::common::DeviceFacade::Simulate ( modif::ReqSimulate msg)
virtual

Simulate devices managed by the server.

virtual void devmgr::common::DeviceFacade::Simulate ( modif::ReqSimulate msg)
virtual

Simulate devices managed by the server.

virtual bool devmgr::common::DeviceFacade::Status ( modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Get status from devices.

Returns
bool devmgr::common::DeviceFacade::Status ( modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Get status from devices.

Returns
virtual bool devmgr::common::DeviceFacade::Status ( modif::ReqStatus statusMsg,
std::string &  buffer 
)
virtual

Get status from devices.

Returns
virtual bool devmgr::common::DeviceFacade::Stop ( )
virtual

Abort all devices managed by the devmgr.

Returns
virtual bool devmgr::common::DeviceFacade::Stop ( )
virtual

Abort all devices managed by the devmgr.

Returns
bool devmgr::common::DeviceFacade::Stop ( )
virtual

Abort all devices managed by the devmgr.

Returns
virtual void devmgr::common::DeviceFacade::StopIgn ( modif::ReqStopIgn msg)
virtual

Stop ignoring devices managed by the server.

virtual void devmgr::common::DeviceFacade::StopIgn ( modif::ReqStopIgn msg)
virtual

Stop ignoring devices managed by the server.

void devmgr::common::DeviceFacade::StopIgn ( modif::ReqStopIgn msg)
virtual

Stop ignoring devices managed by the server.

virtual void devmgr::common::DeviceFacade::StopSim ( modif::ReqStopSim msg)
virtual

Stop simulating devices managed by the server.

virtual void devmgr::common::DeviceFacade::StopSim ( modif::ReqStopSim msg)
virtual

Stop simulating devices managed by the server.

void devmgr::common::DeviceFacade::StopSim ( modif::ReqStopSim msg)
virtual

Stop simulating devices managed by the server.

void 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
void 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
void 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: