ifw-sup 5.1.0
 
Loading...
Searching...
No Matches
ifw::sup::syssup::common::Generic Class Reference

#include <generic.hpp>

Inheritance diagram for ifw::sup::syssup::common::Generic:

Public Member Functions

 Generic (const std::string name, Config &config, DataContext &data_ctx)
 Subsys abstract class constructor.
 
virtual ~Generic ()
 Default destructor.
 
virtual bool IsNotReady () const override
 Check if subsys is Standby/NotReady.
 
virtual bool IsReady () const override
 Check if subsys is Standby/Ready.
 
virtual bool IsOperational () const override
 Check if subsys is Operational.
 
virtual void CheckSubsysFailure () const override
 Check if subsys is in failure state.
 
virtual bool IsDisabling () const override
 Check if subsys is disablig.
 
virtual std::optional< elt::mal::future< void > > Connect () override
 
virtual void Close () override
 
virtual elt::mal::future< std::string > Init () override
 Executes a Init command.
 
virtual elt::mal::future< std::string > Enable () override
 Executes a Enable command.
 
virtual elt::mal::future< std::string > Disable () override
 Executes a Disable command.
 
virtual elt::mal::future< std::string > Stop () override
 Executes a Stop command.
 
virtual elt::mal::future< std::string > GetState () override
 
virtual elt::mal::future< std::string > GetStatus () override
 
virtual elt::mal::future< std::string > GetVersion () override
 
virtual elt::mal::future< std::string > Reset () override
 Executes a Reset command.
 
virtual void Ignore (rad::AnyEvent const &last_event) override
 Executes a Ignore.
 
virtual void StopIgn (rad::AnyEvent const &last_event) override
 Executes a StopIgn.
 
virtual void SubsysReset (rad::AnyEvent const &last_event) override
 Executes a hardware reset command.
 
virtual void SubsysInit (rad::AnyEvent const &last_event) override
 Executes a hardware init command.
 
virtual void SubsysEnable (rad::AnyEvent const &last_event) override
 Executes a hardware enable command.
 
virtual void SubsysDisable (rad::AnyEvent const &last_event) override
 Executes a hardware disable command.
 
virtual void Setup (const std::any &payload) override
 Executes a run time configuration.
 
virtual void Status (const std::string &payload, std::string &buffer) override
 Get subsystem status.
 
virtual std::string GetName () const override
 Get subsystem name.
 
std::string GetPrefixName () const
 Get subsystem name for logging purposes.
 
std::string GetScopeStr () const
 Get subsystem scope as string.
 
bool GetAccess () const
 Get subsystem access flag.
 
void SetAccess (const bool &access)
 

Public Attributes

std::atomic< bool > m_initiated_connection {false}
 

Protected Member Functions

bool IsMsgForMe (const std::string &id) const
 Check if received message id is addressed to me.
 
void UpdateDb (std::vector< std::string > attr_vector)
 Update subsys database.
 
void UpdateConfig () override
 Update subsystem configuration.
 
void SetIgnore (bool flag)
 SetIgnore.
 
void GetPrefix (const std::vector< std::string > prefix_list, std::string &prefix)
 Get prefix for writing attributes to the DB.
 
bool CheckNameParam (const std::any &payload)
 Determine whether paramater is included (subsys name).
 
void StartSubscription () override
 Start subscription of subsystem status.
 
void StopSubscription ()
 Start subscription of subsystem status.
 

Protected Attributes

std::string m_name
 name of the subsystem
 
Config & m_config
 reference to the config object.
 
DataContext & m_data_ctx
 reference to the data context object.
 
Dispatcher< stdif::StdCmdsAsync > m_dispatcher
 
elt::mal::rr::ListenerRegistration m_connection_listener
 
std::unique_ptr< rad::cii::Subscriber< stdif::Status > > m_subscriber
 

Detailed Description

Subsys abstract class. This class represents the basic implementation of a subsys class. Most of the subsys share common properties and behavioural aspects. This class is implementing the common behaviour and defining the basic properties of all subsys classes.

Constructor & Destructor Documentation

◆ Generic()

ifw::sup::syssup::common::Generic::Generic ( const std::string name,
Config & config,
DataContext & data_ctx )

Subsys abstract class constructor.

Parameters
[in]nameSubsystem name.
[in]configReference to server configuration.
[in,out]data_ctxReference to the data context object.

◆ ~Generic()

ifw::sup::syssup::common::Generic::~Generic ( )
virtual

Default destructor.

Member Function Documentation

◆ CheckNameParam()

bool ifw::sup::syssup::common::Generic::CheckNameParam ( const std::any & payload)
protected

Determine whether paramater is included (subsys name).

Parameters
payloadPayload of the command, a vector of strings.

If the vector is empty, it will return true. If the vector contains the the id of the subsys it will also return true otherwise it will return false.

◆ CheckSubsysFailure()

void ifw::sup::syssup::common::Generic::CheckSubsysFailure ( ) const
overridevirtual

Check if subsys is in failure state.

Exceptions
anexception if an error ocurrs.

◆ Close()

void ifw::sup::syssup::common::Generic::Close ( )
overridevirtual

◆ Connect()

std::optional< elt::mal::future< void > > ifw::sup::syssup::common::Generic::Connect ( )
overridevirtual

◆ Disable()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::Disable ( )
overridevirtual

Executes a Disable command.

Exceptions
anexception if an error ocurrs.

◆ Enable()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::Enable ( )
overridevirtual

Executes a Enable command.

Exceptions
anexception if an error ocurrs.

◆ GetAccess()

bool ifw::sup::syssup::common::Generic::GetAccess ( ) const

Get subsystem access flag.

Returns

◆ GetName()

std::string ifw::sup::syssup::common::Generic::GetName ( ) const
overridevirtual

Get subsystem name.

◆ GetPrefix()

void ifw::sup::syssup::common::Generic::GetPrefix ( const std::vector< std::string > prefix_list,
std::string & prefix )
protected

Get prefix for writing attributes to the DB.

Parameters
prefix_listList of intermediate prefix values.
prefixString containing the formatted prefix.

◆ GetPrefixName()

std::string ifw::sup::syssup::common::Generic::GetPrefixName ( ) const

Get subsystem name for logging purposes.

Returns

◆ GetScopeStr()

std::string ifw::sup::syssup::common::Generic::GetScopeStr ( ) const

Get subsystem scope as string.

Returns

◆ GetState()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::GetState ( )
overridevirtual

◆ GetStatus()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::GetStatus ( )
overridevirtual

◆ GetVersion()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::GetVersion ( )
overridevirtual

◆ Ignore()

void ifw::sup::syssup::common::Generic::Ignore ( rad::AnyEvent const & last_event)
overridevirtual

Executes a Ignore.

Parameters
[in]last_eventcontains the payload of the Ignore message.
Exceptions
anexception if an error ocurrs.

◆ Init()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::Init ( )
overridevirtual

Executes a Init command.

Returns
true if command is successfully executed, false otherwise.
Exceptions
anexception if an error ocurrs.

◆ IsDisabling()

bool ifw::sup::syssup::common::Generic::IsDisabling ( ) const
overridevirtual

Check if subsys is disablig.

Returns
true if subsys is disabling, false otherwise

◆ IsMsgForMe()

bool ifw::sup::syssup::common::Generic::IsMsgForMe ( const std::string & id) const
protected

Check if received message id is addressed to me.

Parameters
[in]idmessage id
Returns
true is message id matches own subsys id, false otherwise.

◆ IsNotReady()

bool ifw::sup::syssup::common::Generic::IsNotReady ( ) const
overridevirtual

Check if subsys is Standby/NotReady.

Returns
true is subsys is Standby/NotReady, false otherwise

◆ IsOperational()

bool ifw::sup::syssup::common::Generic::IsOperational ( ) const
overridevirtual

Check if subsys is Operational.

Returns
true is subsys is Operational, false otherwise

◆ IsReady()

bool ifw::sup::syssup::common::Generic::IsReady ( ) const
overridevirtual

Check if subsys is Standby/Ready.

Returns
true is subsys is Standby/Ready, false otherwise

◆ Reset()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::Reset ( )
overridevirtual

Executes a Reset command.

Exceptions
anexception if an error ocurrs.

◆ SetAccess()

void ifw::sup::syssup::common::Generic::SetAccess ( const bool & access)

◆ SetIgnore()

void ifw::sup::syssup::common::Generic::SetIgnore ( bool flag)
protected

SetIgnore.

Parameters
flag

◆ Setup()

void ifw::sup::syssup::common::Generic::Setup ( const std::any & payload)
overridevirtual

Executes a run time configuration.

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

◆ StartSubscription()

void ifw::sup::syssup::common::Generic::StartSubscription ( )
overrideprotected

Start subscription of subsystem status.

◆ Status()

void ifw::sup::syssup::common::Generic::Status ( const std::string & payload,
std::string & buffer )
overridevirtual

Get subsystem status.

Parameters
[in,out]bufferReference to the buffer object.

◆ Stop()

elt::mal::future< std::string > ifw::sup::syssup::common::Generic::Stop ( )
overridevirtual

Executes a Stop command.

Exceptions
anexception if an error ocurrs.

◆ StopIgn()

void ifw::sup::syssup::common::Generic::StopIgn ( rad::AnyEvent const & last_event)
overridevirtual

Executes a StopIgn.

Parameters
[in]last_eventcontains the payload of the StopIgn message.
Exceptions
anexception if an error ocurrs.

◆ StopSubscription()

void ifw::sup::syssup::common::Generic::StopSubscription ( )
protected

Start subscription of subsystem status.

◆ SubsysDisable()

void ifw::sup::syssup::common::Generic::SubsysDisable ( rad::AnyEvent const & last_event)
overridevirtual

Executes a hardware disable command.

Parameters
[in]last_eventpayload of the hw disable message
Exceptions
anexception if an error ocurrs.

◆ SubsysEnable()

void ifw::sup::syssup::common::Generic::SubsysEnable ( rad::AnyEvent const & last_event)
overridevirtual

Executes a hardware enable command.

Parameters
[in]last_eventpayload of the hw enable message
Exceptions
anexception if an error ocurrs.

◆ SubsysInit()

void ifw::sup::syssup::common::Generic::SubsysInit ( rad::AnyEvent const & last_event)
overridevirtual

Executes a hardware init command.

Parameters
[in]last_eventpayload of the hw init message
Exceptions
anexception if an error ocurrs.

◆ SubsysReset()

void ifw::sup::syssup::common::Generic::SubsysReset ( rad::AnyEvent const & last_event)
overridevirtual

Executes a hardware reset command.

Parameters
[in]last_eventpayload of the hw reset message
Exceptions
anexception if an error ocurrs.

◆ UpdateConfig()

void ifw::sup::syssup::common::Generic::UpdateConfig ( )
overrideprotected

Update subsystem configuration.

◆ UpdateDb()

void ifw::sup::syssup::common::Generic::UpdateDb ( std::vector< std::string > attr_vector)
protected

Update subsys database.

Parameters
attr_vectorList of attributes with their values.

Member Data Documentation

◆ m_config

Config& ifw::sup::syssup::common::Generic::m_config
protected

reference to the config object.

◆ m_connection_listener

elt::mal::rr::ListenerRegistration ifw::sup::syssup::common::Generic::m_connection_listener
protected

◆ m_data_ctx

DataContext& ifw::sup::syssup::common::Generic::m_data_ctx
protected

reference to the data context object.

◆ m_dispatcher

Dispatcher<stdif::StdCmdsAsync> ifw::sup::syssup::common::Generic::m_dispatcher
protected

◆ m_initiated_connection

std::atomic<bool> ifw::sup::syssup::common::Generic::m_initiated_connection {false}

◆ m_name

std::string ifw::sup::syssup::common::Generic::m_name
protected

name of the subsystem

◆ m_subscriber

std::unique_ptr<rad::cii::Subscriber<stdif::Status> > ifw::sup::syssup::common::Generic::m_subscriber
protected

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