added eive-watchdog
This commit is contained in:
37
watchdog/Watchdog.h
Normal file
37
watchdog/Watchdog.h
Normal 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_ */
|
Reference in New Issue
Block a user