new defintions file

This commit is contained in:
Robin Müller 2022-02-22 00:22:15 +01:00
parent aaefe9e1ca
commit 292cf8f5e4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 25 additions and 15 deletions

View File

@ -2,3 +2,7 @@ target_sources(${WATCHDOG_NAME} PRIVATE
main.cpp main.cpp
Watchdog.cpp Watchdog.cpp
) )
target_include_directories(${WATCHDOG_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

19
watchdog/definitions.h Normal file
View File

@ -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_ */

View File

@ -1,24 +1,11 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include "definitions.h"
#define WATCHDOG_VERBOSE_LEVEL 1 #define WATCHDOG_VERBOSE_LEVEL 1
/** /**
* This flag instructs the watchdog to create a special file in /tmp if the OBSW is running * 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 * or to delete it if it is not running
*/ */
#define WATCHDOG_CREATE_FILE_IF_RUNNING 1 #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';
}