2020-12-03 13:21:44 +01:00
|
|
|
#ifndef FSFW_INTERNALERROR_INTERNALERRORREPORTER_H_
|
|
|
|
#define FSFW_INTERNALERROR_INTERNALERRORREPORTER_H_
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
#include "InternalErrorReporterIF.h"
|
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
#include "../tasks/PeriodicTaskIF.h"
|
|
|
|
#include "../internalError/InternalErrorDataset.h"
|
|
|
|
#include "../datapoollocal/LocalDataPoolManager.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../tasks/ExecutableObjectIF.h"
|
|
|
|
#include "../objectmanager/SystemObject.h"
|
|
|
|
#include "../ipc/MutexIF.h"
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
/**
|
|
|
|
* @brief This class is used to track internal errors like lost telemetry,
|
|
|
|
* failed message sending or a full store.
|
|
|
|
* @details
|
|
|
|
* All functions were kept virtual so this class can be extended easily
|
|
|
|
* to store custom internal errors (e.g. communication interface errors).
|
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
class InternalErrorReporter: public SystemObject,
|
|
|
|
public ExecutableObjectIF,
|
2020-12-03 13:21:44 +01:00
|
|
|
public InternalErrorReporterIF,
|
|
|
|
public HasLocalDataPoolIF {
|
2018-07-12 16:29:32 +02:00
|
|
|
public:
|
2020-12-03 13:21:44 +01:00
|
|
|
|
|
|
|
InternalErrorReporter(object_id_t setObjectId,
|
|
|
|
uint32_t messageQueueDepth = 5);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable diagnostic printout. Please note that this feature will
|
|
|
|
* only work if DEBUG has been supplied to the build defines.
|
|
|
|
* @param enable
|
|
|
|
*/
|
|
|
|
void setDiagnosticPrintout(bool enable);
|
|
|
|
|
2021-01-06 21:14:23 +01:00
|
|
|
void setMutexTimeout(MutexIF::TimeoutType timeoutType,
|
|
|
|
uint32_t timeoutMs);
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
virtual ~InternalErrorReporter();
|
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
virtual object_id_t getObjectId() const override;
|
|
|
|
virtual MessageQueueId_t getCommandQueue() const override;
|
|
|
|
virtual ReturnValue_t initializeLocalDataPool(
|
|
|
|
LocalDataPool& localDataPoolMap,
|
|
|
|
LocalDataPoolManager& poolManager) override;
|
|
|
|
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
|
|
|
virtual dur_millis_t getPeriodicOperationFrequency() const override;
|
|
|
|
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
2021-01-11 21:31:03 +01:00
|
|
|
ProvidesDataPoolSubscriptionIF* getSubsciptionInterface() override;
|
2020-12-03 13:21:44 +01:00
|
|
|
|
|
|
|
virtual ReturnValue_t initialize() override;
|
|
|
|
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
|
|
|
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
virtual void queueMessageNotSent();
|
|
|
|
|
|
|
|
virtual void lostTm();
|
|
|
|
|
|
|
|
virtual void storeFull();
|
2020-12-03 13:21:44 +01:00
|
|
|
|
|
|
|
virtual void setTaskIF(PeriodicTaskIF* task) override;
|
2018-07-12 16:29:32 +02:00
|
|
|
protected:
|
2020-12-03 13:21:44 +01:00
|
|
|
MessageQueueIF* commandQueue;
|
|
|
|
LocalDataPoolManager poolManager;
|
|
|
|
|
|
|
|
PeriodicTaskIF* executingTask = nullptr;
|
2021-01-06 21:14:23 +01:00
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
MutexIF* mutex = nullptr;
|
2021-01-06 21:14:23 +01:00
|
|
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
|
|
|
uint32_t timeoutMs = 20;
|
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
sid_t internalErrorSid;
|
|
|
|
InternalErrorDataset internalErrorDataset;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
bool diagnosticPrintout = true;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
uint32_t queueHits = 0;
|
|
|
|
uint32_t tmHits = 0;
|
|
|
|
uint32_t storeHits = 0;
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
uint32_t getAndResetQueueHits();
|
|
|
|
uint32_t getQueueHits();
|
|
|
|
void incrementQueueHits();
|
|
|
|
|
|
|
|
uint32_t getAndResetTmHits();
|
|
|
|
uint32_t getTmHits();
|
|
|
|
void incrementTmHits();
|
|
|
|
|
|
|
|
uint32_t getAndResetStoreHits();
|
|
|
|
uint32_t getStoreHits();
|
|
|
|
void incrementStoreHits();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-12-03 13:21:44 +01:00
|
|
|
#endif /* FSFW_INTERNALERROR_INTERNALERRORREPORTER_H_ */
|