added eive-watchdog

This commit is contained in:
2021-07-29 11:35:20 +02:00
parent 190590e1b5
commit 59bcf6cec2
8 changed files with 283 additions and 28 deletions

37
watchdog/Watchdog.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef WATCHDOG_WATCHDOG_H_
#define WATCHDOG_WATCHDOG_H_
#include <array>
class WatchdogTask {
public:
enum class States {
NOT_STARTED,
RUNNING,
SUSPENDED,
FAULTY
};
enum class LoopResult {
OK,
CANCEL_RQ,
RESTART_RQ,
TIMEOUT
};
WatchdogTask();
virtual ~WatchdogTask();
int performOperation();
private:
int fd = 0;
std::array<uint8_t, 64> buf;
States state = States::NOT_STARTED;
LoopResult watchdogLoop();
};
#endif /* WATCHDOG_WATCHDOG_H_ */