#include <subsysFacade.hpp>
Public Member Functions | |
| SubsysFacade (rad::SMAdapter &sm, DataContext &data_ctx) | |
| virtual | ~SubsysFacade () |
| ~SubsysFacade | |
| void | Connect () |
| Connect. | |
| void | StartMonitoring () |
| StartMonitoring. | |
| void | Init (rad::SMAdapter &sm, rad::ThreadActivity *activity) |
| Init all subsystems managed by the Supervisor. | |
| void | Enable (rad::SMAdapter &sm, rad::ThreadActivity *activity) |
| Enable all subsystems managed by the Supervisor. | |
| void | Disable (rad::SMAdapter &sm, rad::ThreadActivity *activity) |
| Disable all subsystems managed by the Supervisor. | |
| void | Recover (rad::SMAdapter &sm, rad::ThreadActivity *activity) |
| Recover all subsystems managed by the Supervisor. | |
| void | DisableAccess () |
| Disable Access for all subsystems. | |
| void | SetAccess (std::string subsys, bool access) |
| void | Setup (const std::any &payload) |
| Executes a setup message. | |
| virtual void | Stop () |
| Abort all subsystems managed by the devmgr. | |
| virtual void | Reset () |
| Reset subsystems. | |
| template<typename EVENT_TYPE, typename OBJECT> | |
| void | SubsysCommand (scxml4cpp::Context *c, OBJECT &obj) |
| Forward request to an specific subsystem. | |
| void | UpdateConfiguration () |
| Triggers the update of the subsystem configuration. | |
| void | UpdateHandler () |
| Triggers the update of the estimated state/substate. | |
| virtual void | EstimateState (std::vector< State::StateEnum > &states, std::vector< State::SubstateEnum > &substates) |
| EstimateState. | |
| void | SetSubsystemConnectionState (std::string name, SubsysData::ConnectionEnum connection) |
| Get subsystem connection state. | |
| void | SetSubsystemState (std::string name, std::string state) |
| Set the subsystem state. | |
| void | SetSubsystemStates (std::string name, std::string state, std::string substate) |
| Set the subsystem states: state and substate. | |
| void | SetSubsystemSubstate (std::string name, std::string substate) |
| Set the subsystem substate. | |
| void | GetSubsystemStatus (const std::string &payload, std::string &buffer) |
| Get subsystem status. | |
| void | AddSubsys (std::unique_ptr< Subsys > subsys) |
| Add a subsystems instance to be managed by the facade. | |
| void | ClearSubsys () |
| Empty internal subsys map. | |
| const int | GetNumSubsys () |
| Get the number of subsystems. | |
| std::string | GetSubsysNames () |
| Get list of subsystems managed by the Supervisor. | |
| void | StartDaq (std::string daqid) |
| Start Data Acquisition. | |
| DaqInfo | StopDaq (std::string daqid) |
| Stop Data Acquisition. | |
| void | AbortDaq (std::string daqid) |
| Abort Data Acquisition. | |
| DaqInfo | GetDaqStatus (std::string daqid) const |
| Get Daq Status. | |
Public Attributes | |
| SingleReplier< Events::SubInit > | m_init_replier |
| SingleReplier< Events::SubEnable > | m_enable_replier |
| SingleReplier< Events::SubDisable > | m_disable_replier |
| SingleReplier< Events::SubReset > | m_reset_replier |
This class provides a facade object to allow the supervisor managing easily all the subsystems under its control. This class relies on a subsystem abstract class that implement all common features of the subsystems.
| ifw::sup::syssup::common::SubsysFacade::SubsysFacade | ( | rad::SMAdapter & | sm, |
| DataContext & | data_ctx ) |
Constructor.
| [in] | sm | Reference to the state machine sigleton. |
| [in] | data_ctx | reference to data object context |
|
virtual |
~SubsysFacade
| void ifw::sup::syssup::common::SubsysFacade::AbortDaq | ( | std::string | daqid | ) |
Abort Data Acquisition.
| void ifw::sup::syssup::common::SubsysFacade::AddSubsys | ( | std::unique_ptr< Subsys > | subsys | ) |
Add a subsystems instance to be managed by the facade.
| [in] | subsys | Smart pointer to the subsys. |
| void ifw::sup::syssup::common::SubsysFacade::ClearSubsys | ( | ) |
Empty internal subsys map.
| void ifw::sup::syssup::common::SubsysFacade::Connect | ( | ) |
Connect.
This methods establishes the connection to subsystems via the CII MAL and updates its internal status. This method is blocking and it will wait until timeout is reached. The timeout is a configurable parameter (waittout). The timeout should be small, normally around 500 msecs.
For all connected subsystems, it will send the GetStatus to update the subsystem status.
This method shall be called once at the beginning of the application. Once the replies from GetStatus are received, this method will call the callback to update the estimated state/substate.
| void ifw::sup::syssup::common::SubsysFacade::Disable | ( | rad::SMAdapter & | sm, |
| rad::ThreadActivity * | activity ) |
Disable all subsystems managed by the Supervisor.
| [in] | sm | Reference to the SM sigleton. |
| [in] | activity | Pointer to the current activity. |
This methods triggers the move to the Enabling transient substate in the state machine which is executed in a dedicated thread.
| void ifw::sup::syssup::common::SubsysFacade::DisableAccess | ( | ) |
Disable Access for all subsystems.
| void ifw::sup::syssup::common::SubsysFacade::Enable | ( | rad::SMAdapter & | sm, |
| rad::ThreadActivity * | activity ) |
Enable all subsystems managed by the Supervisor.
| [in] | sm | Reference to the SM sigleton. |
| [in] | activity | Pointer to the current activity. |
|
virtual |
EstimateState.
| states | list of subsystem states as values |
| substates | list of subsystem substates as values |
This is a virtual method to estimate the overall state/substate of the Supervisor based on the individual subsystem contributions.
This method will update the internal estimated state and substate based on the algorith that will take as input the list of states and substates of the subsystems. Projects may provide its own method to estimate the global state/substates.
Criteria:
The overall state corresponds to the minimum state within all managed subsystems.
The overal substate is obtained according to the following:
| DaqInfo ifw::sup::syssup::common::SubsysFacade::GetDaqStatus | ( | std::string | daqid | ) | const |
Get Daq Status.
| const int ifw::sup::syssup::common::SubsysFacade::GetNumSubsys | ( | ) |
Get the number of subsystems.
| std::string ifw::sup::syssup::common::SubsysFacade::GetSubsysNames | ( | ) |
Get list of subsystems managed by the Supervisor.
| void ifw::sup::syssup::common::SubsysFacade::GetSubsystemStatus | ( | const std::string & | payload, |
| std::string & | buffer ) |
Get subsystem status.
| [in] | payload | Name of the subsystem |
| [in,out] | buffer | Reference to the output buffer |
In the name of the subsystem is empty, the method will return the status of all subsystems registerd in the facade.
| void ifw::sup::syssup::common::SubsysFacade::Init | ( | rad::SMAdapter & | sm, |
| rad::ThreadActivity * | activity ) |
Init all subsystems managed by the Supervisor.
| [in] | sm | Reference to the SM sigleton. |
| [in] | activity | Pointer to the current activity. |
This methods triggers the move to the Initialisation transient substate in the state machine which is executed in a dedicated thread.
| void ifw::sup::syssup::common::SubsysFacade::Recover | ( | rad::SMAdapter & | sm, |
| rad::ThreadActivity * | activity ) |
Recover all subsystems managed by the Supervisor.
| [in] | sm | Reference to the SM sigleton. |
| [in] | activity | Pointer to the current activity. |
This methods triggers the move to the Disabling transient substate in the state machine which is executed in a dedicated thread.
|
virtual |
Reset subsystems.
| void ifw::sup::syssup::common::SubsysFacade::SetAccess | ( | std::string | subsys, |
| bool | access ) |
| void ifw::sup::syssup::common::SubsysFacade::SetSubsystemConnectionState | ( | std::string | name, |
| SubsysData::ConnectionEnum | connection ) |
Get subsystem connection state.
| name | subsystem name |
| connection | new connection status |
| void ifw::sup::syssup::common::SubsysFacade::SetSubsystemState | ( | std::string | name, |
| std::string | state ) |
Set the subsystem state.
| name | subsystem name |
| state | new state |
| void ifw::sup::syssup::common::SubsysFacade::SetSubsystemStates | ( | std::string | name, |
| std::string | state, | ||
| std::string | substate ) |
Set the subsystem states: state and substate.
| name | |
| state | |
| substate |
| void ifw::sup::syssup::common::SubsysFacade::SetSubsystemSubstate | ( | std::string | name, |
| std::string | substate ) |
Set the subsystem substate.
| name | subsystem name |
| substate | new subtate |
| void ifw::sup::syssup::common::SubsysFacade::Setup | ( | const std::any & | payload | ) |
Executes a setup message.
| [in] | payload | message containing the setup payload |
This method takes care of forwarding the setup message to all subsyss registered in the facade.
The subsys facade class handles subsyss sequentialy. In case of an error, the setup will finish immediately. The subsys facade does not know the internals of each subsys, it just forward the message blindly to all subsystems. Each subsystem class is responsible of handling the parameters defined in the setup message.
This is a blocking operation since settings of parameters is expected to be fast.
| void ifw::sup::syssup::common::SubsysFacade::StartDaq | ( | std::string | daqid | ) |
Start Data Acquisition.
This method collect data from subsystems 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
| void ifw::sup::syssup::common::SubsysFacade::StartMonitoring | ( | ) |
StartMonitoring.
This method triggers the subscription of the status per each subsystem. The subscription is done following the pub/sub endpoints registerd for each subsystem in the configuration.
|
virtual |
Abort all subsystems managed by the devmgr.
| DaqInfo ifw::sup::syssup::common::SubsysFacade::StopDaq | ( | std::string | daqid | ) |
Stop Data Acquisition.
This method collect data from subsystems 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.
| void ifw::sup::syssup::common::SubsysFacade::SubsysCommand | ( | scxml4cpp::Context * | c, |
| OBJECT & | obj ) |
Forward request to an specific subsystem.
| [in] | c | SM contex |
| [in] | obj | specific object managing the replies of the futures. |
This method is used to generalize the asynchronous sending of requests to individual subsystems. It supports the following event types:
Events::SubInit Events::SubEnable Events::SubDisable Events::SubReset
If the event type is not known it will through an exception. The method forward the requests only to the system with access flag enabled and with internal scope. If a subsystem is not available, at the time the request is received, then this subsystem is ignored.
This method defines a lambda function that will be executed with the future continuation.
Each request object is stored in a map associated with an UUID. Once the reply is received from the subsystem. The request is obtained from the map using the UUID and the reply is sent to the originator. Then, the entry in map is removed.
| void ifw::sup::syssup::common::SubsysFacade::UpdateConfiguration | ( | ) |
Triggers the update of the subsystem configuration.
| void ifw::sup::syssup::common::SubsysFacade::UpdateHandler | ( | ) |
Triggers the update of the estimated state/substate.
This callback is called whenever a new subscription is received by any of the subsystems.
| SingleReplier<Events::SubDisable> ifw::sup::syssup::common::SubsysFacade::m_disable_replier |
| SingleReplier<Events::SubEnable> ifw::sup::syssup::common::SubsysFacade::m_enable_replier |
| SingleReplier<Events::SubInit> ifw::sup::syssup::common::SubsysFacade::m_init_replier |
| SingleReplier<Events::SubReset> ifw::sup::syssup::common::SubsysFacade::m_reset_replier |