2018-07-12 16:29:32 +02:00
#ifndef FRAMEWORK_FDIR_FAILUREISOLATIONBASE_H_
#define FRAMEWORK_FDIR_FAILUREISOLATIONBASE_H_
2016-06-15 23:48:41 +02:00
2020-08-13 20:53:35 +02:00
#include "../events/EventMessage.h"
#include "ConfirmsFailuresIF.h"
#include "FaultCounter.h"
#include "../health/HealthMessage.h"
#include "../parameters/HasParametersIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MessageQueueIF.h"
2018-07-12 16:29:32 +02:00
class FailureIsolationBase : public HasReturnvaluesIF ,
public ConfirmsFailuresIF ,
public HasParametersIF {
2016-06-15 23:48:41 +02:00
public :
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID :: FDIR_1 ;
2020-12-08 14:43:44 +01:00
static const Event FDIR_CHANGED_STATE = MAKE_EVENT ( 1 , severity :: INFO ); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState).
static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT ( 2 , severity :: MEDIUM ); //!< FDIR tries to restart device. Par1: event that caused recovery.
static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT ( 3 , severity :: MEDIUM ); //!< FDIR turns off device. Par1: event that caused recovery.
2020-08-08 13:28:59 +02:00
FailureIsolationBase ( object_id_t owner ,
object_id_t parent = objects :: NO_OBJECT ,
2018-07-12 16:29:32 +02:00
uint8_t messageDepth = 10 , uint8_t parameterDomainBase = 0xF0 );
2020-08-08 13:28:59 +02:00
2018-07-12 16:29:32 +02:00
virtual ~ FailureIsolationBase ();
2016-06-15 23:48:41 +02:00
virtual ReturnValue_t initialize ();
2020-08-08 13:28:59 +02:00
/**
* This is called by the DHB in performOperation()
*/
2016-06-15 23:48:41 +02:00
void checkForFailures ();
2020-08-08 13:28:59 +02:00
MessageQueueId_t getEventReceptionQueue () override ;
2018-07-12 16:29:32 +02:00
virtual void triggerEvent ( Event event , uint32_t parameter1 = 0 ,
uint32_t parameter2 = 0 );
2016-06-15 23:48:41 +02:00
protected :
2020-08-08 13:28:59 +02:00
MessageQueueIF * eventQueue = nullptr ;
2016-06-15 23:48:41 +02:00
object_id_t ownerId ;
2020-08-08 13:28:59 +02:00
HasHealthIF * owner = nullptr ;
2016-06-15 23:48:41 +02:00
object_id_t faultTreeParent ;
uint8_t parameterDomainBase ;
void setOwnerHealth ( HasHealthIF :: HealthState health );
virtual ReturnValue_t eventReceived ( EventMessage * event ) = 0 ;
virtual void eventConfirmed ( EventMessage * event );
virtual void wasParentsFault ( EventMessage * event );
virtual ReturnValue_t confirmFault ( EventMessage * event );
virtual void decrementFaultCounters () = 0 ;
2018-07-12 16:29:32 +02:00
ReturnValue_t sendConfirmationRequest ( EventMessage * event ,
2020-08-08 13:28:59 +02:00
MessageQueueId_t destination = MessageQueueIF :: NO_QUEUE );
2018-07-12 16:29:32 +02:00
void throwFdirEvent ( Event event , uint32_t parameter1 = 0 ,
uint32_t parameter2 = 0 );
2016-06-15 23:48:41 +02:00
private :
2018-07-12 16:29:32 +02:00
void doConfirmFault ( EventMessage * event ); bool isFdirDisabledForSeverity (
EventSeverity_t severity );
2016-06-15 23:48:41 +02:00
};
2018-07-12 16:29:32 +02:00
#endif /* FRAMEWORK_FDIR_FAILUREISOLATIONBASE_H_ */