mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
door, logic: propagate new logfile to Door class
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
7e522e59af
commit
c058e1e4d0
@ -28,6 +28,7 @@
|
||||
#define DEFAULT_SERIAL_BAUDRATE 9600UL
|
||||
|
||||
#define LOG_FILENAME "doorlockd.log"
|
||||
#define LOG_SCRIPTS_FILENAME "doorlockd-scripts.log"
|
||||
|
||||
#define SHARED_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/"
|
||||
|
||||
|
@ -166,6 +166,7 @@ int main(int argc, char** argv)
|
||||
std::string lockPagePrefix;
|
||||
fs::path logdir;
|
||||
std::string logfile;
|
||||
std::string logfile_scripts;
|
||||
unsigned int tokenLength;
|
||||
std::string serDev;
|
||||
unsigned int baudrate;
|
||||
@ -219,6 +220,7 @@ int main(int argc, char** argv)
|
||||
tokenTimeout = std::chrono::seconds(timeout);
|
||||
|
||||
logfile = (logdir / LOG_FILENAME).string();
|
||||
logfile_scripts = (logdir / LOG_SCRIPTS_FILENAME).string();
|
||||
|
||||
l.setLogFile(logfile);
|
||||
l.logFile(true);
|
||||
@ -250,6 +252,7 @@ int main(int argc, char** argv)
|
||||
tokenLength,
|
||||
serDev,
|
||||
baudrate,
|
||||
logfile_scripts,
|
||||
onClientMessage));
|
||||
server(port);
|
||||
}
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include "../../doorcmds.h"
|
||||
|
||||
Door::Door(const std::string &serDev,
|
||||
unsigned int baudrate) :
|
||||
unsigned int baudrate,
|
||||
const std::string &logfile_scripts) :
|
||||
_baudrate(baudrate),
|
||||
_port(_ioService, serDev),
|
||||
_logfile_scripts(logfile_scripts),
|
||||
_logger(Logger::get())
|
||||
{
|
||||
// Configure serial port
|
||||
|
@ -20,10 +20,9 @@ public:
|
||||
using DoorCallback = std::function<void(Doormessage)>;
|
||||
enum class State {Unlocked, Locked};
|
||||
|
||||
|
||||
|
||||
Door(const std::string &serDev,
|
||||
unsigned int baudrate);
|
||||
unsigned int baudrate,
|
||||
const std::string &logfile_scripts);
|
||||
~Door();
|
||||
|
||||
State state() const;
|
||||
@ -44,6 +43,8 @@ private:
|
||||
boost::asio::io_service _ioService = { };
|
||||
boost::asio::serial_port _port;
|
||||
|
||||
const std::string _logfile_scripts;
|
||||
|
||||
std::mutex _stateMutex = { };
|
||||
volatile State _state = { State::Locked };
|
||||
|
||||
|
@ -12,9 +12,10 @@ Logic::Logic(const std::chrono::seconds tokenTimeout,
|
||||
const unsigned int tokenLength,
|
||||
const std::string &serDev,
|
||||
const unsigned int baudrate,
|
||||
const std::string &logfile_scripts,
|
||||
std::condition_variable &onClientUpdate) :
|
||||
_logger(Logger::get()),
|
||||
_door(serDev, baudrate),
|
||||
_door(serDev, baudrate, logfile_scripts),
|
||||
_tokenTimeout(tokenTimeout),
|
||||
_onClientUpdate(onClientUpdate),
|
||||
_ldapUri(ldapUri),
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
const unsigned int tokenLength,
|
||||
const std::string &serDev,
|
||||
const unsigned int baudrate,
|
||||
const std::string &logfile_scripts,
|
||||
std::condition_variable &onClientUpdate);
|
||||
~Logic();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user