From 0f9690f6c22c1a59806ecf44c384e59489d6c1c9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Feb 2022 13:35:12 +0100 Subject: [PATCH 1/4] watchdog updates --- watchdog/CMakeLists.txt | 4 ++++ watchdog/definitions.h | 19 +++++++++++++++++++ watchdog/watchdogConf.h.in | 17 ++--------------- 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 watchdog/definitions.h diff --git a/watchdog/CMakeLists.txt b/watchdog/CMakeLists.txt index a01bf853..88908436 100644 --- a/watchdog/CMakeLists.txt +++ b/watchdog/CMakeLists.txt @@ -2,3 +2,7 @@ target_sources(${WATCHDOG_NAME} PRIVATE main.cpp Watchdog.cpp ) + +target_include_directories(${WATCHDOG_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/watchdog/definitions.h b/watchdog/definitions.h new file mode 100644 index 00000000..991de54d --- /dev/null +++ b/watchdog/definitions.h @@ -0,0 +1,19 @@ +#ifndef WATCHDOG_DEFINITIONS_H_ +#define WATCHDOG_DEFINITIONS_H_ + +namespace watchdog { + +// Suspend watchdog operations temporarily +static constexpr char SUSPEND_CHAR = 's'; +// Resume watchdog operations +static constexpr char RESTART_CHAR = 'b'; +// Causes the watchdog to close down +static constexpr char CANCEL_CHAR = 'c'; + +static constexpr int TIMEOUT_MS = 5 * 1000; +const std::string FIFO_NAME = "/tmp/watchdog-pipe"; +const std::string RUNNING_FILE_NAME = "/tmp/obsw-running"; + +} + +#endif /* WATCHDOG_DEFINITIONS_H_ */ diff --git a/watchdog/watchdogConf.h.in b/watchdog/watchdogConf.h.in index 02d84e70..df57c5ec 100644 --- a/watchdog/watchdogConf.h.in +++ b/watchdog/watchdogConf.h.in @@ -1,24 +1,11 @@ #include #include +#include "definitions.h" + #define WATCHDOG_VERBOSE_LEVEL 1 /** * This flag instructs the watchdog to create a special file in /tmp if the OBSW is running * or to delete it if it is not running */ #define WATCHDOG_CREATE_FILE_IF_RUNNING 1 - -namespace watchdog { - -static constexpr int TIMEOUT_MS = 5 * 1000; -const std::string FIFO_NAME = "/tmp/watchdog-pipe"; -const std::string RUNNING_FILE_NAME = "/tmp/obsw-running"; - -// Suspend watchdog operations temporarily -static constexpr char SUSPEND_CHAR = 's'; -// Resume watchdog operations -static constexpr char RESTART_CHAR = 'b'; -// Causes the watchdog to close down -static constexpr char CANCEL_CHAR = 'c'; - -} -- 2.43.0 From 56a57fadc8275443f4633581af523c1e258d288d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Feb 2022 13:37:26 +0100 Subject: [PATCH 2/4] update project file --- misc/eclipse/.cproject | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index e2984ed8..15b0195b 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -1177,7 +1177,7 @@