fsfw/devicehandlers/DeviceHandlerFailureIsolation.h
Ulrich Mohr 575f70ba03 updating code from Flying Laptop
This is the framework of Flying Laptop OBSW version A.13.0.
2018-07-12 16:29:32 +02:00

53 lines
1.9 KiB
C++

#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#include <framework/fdir/FaultCounter.h>
#include <framework/fdir/FailureIsolationBase.h>
namespace Factory{
void setStaticFrameworkObjectIds();
}
class DeviceHandlerFailureIsolation: public FailureIsolationBase {
friend void (Factory::setStaticFrameworkObjectIds)();
friend class Heater;
public:
DeviceHandlerFailureIsolation(object_id_t owner, object_id_t parent);
~DeviceHandlerFailureIsolation();
ReturnValue_t initialize();
void triggerEvent(Event event, uint32_t parameter1 = 0,
uint32_t parameter2 = 0);bool isFdirActionInProgress();
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex);
protected:
FaultCounter strangeReplyCount;
FaultCounter missedReplyCount;
FaultCounter recoveryCounter;
enum FDIRState {
NONE, RECOVERY_ONGOING, DEVICE_MIGHT_BE_OFF, AWAIT_SHUTDOWN
};
FDIRState fdirState;
MessageQueueId_t powerConfirmation;
static object_id_t powerConfirmationId;
static const uint32_t MAX_REBOOT = 1;
static const uint32_t REBOOT_TIME_MS = 180000;
static const uint32_t MAX_STRANGE_REPLIES = 10;
static const uint32_t STRANGE_REPLIES_TIME_MS = 10000;
static const uint32_t MAX_MISSED_REPLY_COUNT = 5;
static const uint32_t MISSED_REPLY_TIME_MS = 10000;
virtual ReturnValue_t eventReceived(EventMessage* event);
virtual void eventConfirmed(EventMessage* event);
void wasParentsFault(EventMessage* event);
void decrementFaultCounters();
void handleRecovery(Event reason);
virtual void clearFaultCounters();
void setFdirState(FDIRState state);
void startRecovery(Event reason);
void setFaulty(Event reason);
bool isFdirInActionOrAreWeFaulty(EventMessage* event);
};
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_ */