Ulrich Mohr
4d154b7cee
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
- /mission is a library now, in preparation of unittests (which bring their own main) - eive-simple is now only available in bsp=arm/q7s (but is still not compiling) - watchdog and simple are their own executables, not configurations any more - moved some q7s specific code into /bsp-q7s to flatten if-hierarchy in main CMakeLists.txt - compiler and linker options are not globally applied to all targets - linux is the default fsfw osal now, as current code does not compile on hosted
51 lines
976 B
C++
51 lines
976 B
C++
#ifndef WATCHDOG_WATCHDOG_H_
|
|
#define WATCHDOG_WATCHDOG_H_
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
class WatchdogTask {
|
|
public:
|
|
enum class States {
|
|
NOT_STARTED,
|
|
RUNNING,
|
|
SUSPENDED,
|
|
FAULTY
|
|
};
|
|
|
|
enum class LoopResult {
|
|
OK,
|
|
SUSPEND_RQ,
|
|
CANCEL_RQ,
|
|
RESTART_RQ,
|
|
TIMEOUT,
|
|
HUNG_UP,
|
|
FAULT
|
|
};
|
|
|
|
WatchdogTask();
|
|
|
|
virtual ~WatchdogTask();
|
|
|
|
int performOperation();
|
|
private:
|
|
int fd = 0;
|
|
|
|
bool obswRunning = false;
|
|
bool watchdogRunning = false;
|
|
bool printNotRunningLatch = false;
|
|
std::array<uint8_t, 64> buf;
|
|
States state = States::NOT_STARTED;
|
|
|
|
LoopResult watchdogLoop();
|
|
LoopResult pollEvent(struct pollfd& waiter);
|
|
LoopResult parseCommandByte(ssize_t readLen);
|
|
|
|
int performRunningOperation();
|
|
int performNotRunningOperation(LoopResult type);
|
|
int performSuspendOperation();
|
|
};
|
|
|
|
#endif /* WATCHDOG_WATCHDOG_H_ */
|